mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
r26353: Remove use of global_loadparm.
(This used to be commit 17637e4490e42db6cdef619286c4d5a0982e9d1a)
This commit is contained in:
parent
dd7e5ed88c
commit
a72c5053c5
@ -32,7 +32,7 @@ struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_
|
||||
{
|
||||
if (lp_parm_bool(lp_ctx, NULL, "ctdb", "enable", false) &&
|
||||
lp_parm_bool(lp_ctx, NULL, "ctdb", name, true)) {
|
||||
return db_tmp_open_ctdb(mem_ctx, name, tdb_flags);
|
||||
return db_tmp_open_ctdb(mem_ctx, lp_ctx, name, tdb_flags);
|
||||
}
|
||||
|
||||
return db_tmp_open_tdb(mem_ctx, lp_ctx, name, tdb_flags);
|
||||
|
@ -51,4 +51,4 @@ struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_
|
||||
|
||||
/* backends */
|
||||
struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *name, int tdb_flags);
|
||||
struct db_context *db_tmp_open_ctdb(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags);
|
||||
struct db_context *db_tmp_open_ctdb(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *name, int tdb_flags);
|
||||
|
@ -159,7 +159,8 @@ static int db_ctdb_get_seqnum(struct db_context *db)
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct db_context *db_tmp_open_ctdb(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags)
|
||||
struct db_context *db_tmp_open_ctdb(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
const char *name, int tdb_flags)
|
||||
{
|
||||
struct db_context *db;
|
||||
struct ctdb_context *ctdb = talloc_get_type(cluster_backend_handle(),
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "libcli/ldap/ldap_client.h"
|
||||
#include "auth/auth.h"
|
||||
#include "auth/credentials/credentials.h"
|
||||
#include "param/param.h"
|
||||
|
||||
struct ildb_private {
|
||||
struct ldap_connection *ldap;
|
||||
@ -792,7 +793,7 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
|
||||
goto failed;
|
||||
}
|
||||
} else {
|
||||
status = ldap_bind_sasl(ildb->ldap, creds);
|
||||
status = ldap_bind_sasl(ildb->ldap, creds, global_loadparm);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
ldb_debug(ldb, LDB_DEBUG_ERROR, "Failed to bind - %s\n",
|
||||
ldap_errstr(ildb->ldap, module, status));
|
||||
|
@ -43,7 +43,8 @@ NTSTATUS ldap_rebind(struct ldap_connection *conn)
|
||||
|
||||
switch (conn->bind.type) {
|
||||
case LDAP_BIND_SASL:
|
||||
status = ldap_bind_sasl(conn, (struct cli_credentials *)conn->bind.creds);
|
||||
status = ldap_bind_sasl(conn, (struct cli_credentials *)conn->bind.creds,
|
||||
global_loadparm);
|
||||
break;
|
||||
|
||||
case LDAP_BIND_SIMPLE:
|
||||
@ -200,7 +201,8 @@ static struct ldap_message *new_ldap_sasl_bind_msg(struct ldap_connection *conn,
|
||||
perform a sasl bind using the given credentials
|
||||
*/
|
||||
NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
|
||||
struct cli_credentials *creds)
|
||||
struct cli_credentials *creds,
|
||||
struct loadparm_context *lp_ctx)
|
||||
{
|
||||
NTSTATUS status;
|
||||
TALLOC_CTX *tmp_ctx = NULL;
|
||||
@ -219,7 +221,7 @@ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
|
||||
NULL
|
||||
};
|
||||
|
||||
status = gensec_client_start(conn, &conn->gensec, NULL, global_loadparm);
|
||||
status = gensec_client_start(conn, &conn->gensec, NULL, lp_ctx);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(0, ("Failed to start GENSEC engine (%s)\n", nt_errstr(status)));
|
||||
goto failed;
|
||||
|
@ -220,6 +220,7 @@ struct ntptr_ops {
|
||||
struct ntptr_context {
|
||||
const struct ntptr_ops *ops;
|
||||
void *private_data;
|
||||
struct loadparm_context *lp_ctx;
|
||||
};
|
||||
|
||||
/* this structure is used by backends to determine the size of some critical types */
|
||||
|
@ -119,7 +119,8 @@ const struct ntptr_critical_sizes *ntptr_interface_version(void)
|
||||
/*
|
||||
create a ntptr_context with a specified NTPTR backend
|
||||
*/
|
||||
NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, const char *providor, struct ntptr_context **_ntptr)
|
||||
NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
const char *providor, struct ntptr_context **_ntptr)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct ntptr_context *ntptr;
|
||||
@ -132,6 +133,7 @@ NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, const char *providor, struct nt
|
||||
NT_STATUS_HAVE_NO_MEMORY(ntptr);
|
||||
ntptr->private_data = NULL;
|
||||
ntptr->ops = ntptr_backend_byname(providor);
|
||||
ntptr->lp_ctx = lp_ctx;
|
||||
|
||||
if (!ntptr->ops) {
|
||||
DEBUG(1,("ntptr_init_context: failed to find NTPTR providor='%s'\n",
|
||||
|
@ -87,7 +87,7 @@ static int sptr_db_search(struct ldb_context *ldb,
|
||||
|
||||
static NTSTATUS sptr_init_context(struct ntptr_context *ntptr)
|
||||
{
|
||||
struct ldb_context *sptr_db = sptr_db_connect(ntptr, global_loadparm);
|
||||
struct ldb_context *sptr_db = sptr_db_connect(ntptr, ntptr->lp_ctx);
|
||||
NT_STATUS_HAVE_NO_MEMORY(sptr_db);
|
||||
|
||||
ntptr->private_data = sptr_db;
|
||||
@ -170,9 +170,9 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC
|
||||
enum ndr_err_code ndr_err;
|
||||
struct spoolss_OSVersion os;
|
||||
|
||||
os.major = dcesrv_common_get_version_major(mem_ctx, global_loadparm);
|
||||
os.minor = dcesrv_common_get_version_minor(mem_ctx, global_loadparm);
|
||||
os.build = dcesrv_common_get_version_build(mem_ctx, global_loadparm);
|
||||
os.major = dcesrv_common_get_version_major(mem_ctx, server->ntptr->lp_ctx);
|
||||
os.minor = dcesrv_common_get_version_minor(mem_ctx, server->ntptr->lp_ctx);
|
||||
os.build = dcesrv_common_get_version_build(mem_ctx, server->ntptr->lp_ctx);
|
||||
os.extra_string = "";
|
||||
|
||||
ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &os, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersion);
|
||||
@ -188,9 +188,9 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC
|
||||
enum ndr_err_code ndr_err;
|
||||
struct spoolss_OSVersionEx os_ex;
|
||||
|
||||
os_ex.major = dcesrv_common_get_version_major(mem_ctx, global_loadparm);
|
||||
os_ex.minor = dcesrv_common_get_version_minor(mem_ctx, global_loadparm);
|
||||
os_ex.build = dcesrv_common_get_version_build(mem_ctx, global_loadparm);
|
||||
os_ex.major = dcesrv_common_get_version_major(mem_ctx, server->ntptr->lp_ctx);
|
||||
os_ex.minor = dcesrv_common_get_version_minor(mem_ctx, server->ntptr->lp_ctx);
|
||||
os_ex.build = dcesrv_common_get_version_build(mem_ctx, server->ntptr->lp_ctx);
|
||||
os_ex.extra_string = "";
|
||||
os_ex.unknown2 = 0;
|
||||
os_ex.unknown3 = 0;
|
||||
@ -204,12 +204,12 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC
|
||||
r->out.data.binary = blob;
|
||||
return WERR_OK;
|
||||
} else if (strcmp("DNSMachineName", r->in.value_name) == 0) {
|
||||
if (!lp_realm(global_loadparm)) return WERR_INVALID_PARAM;
|
||||
if (!lp_realm(server->ntptr->lp_ctx)) return WERR_INVALID_PARAM;
|
||||
|
||||
r->out.type = SPOOLSS_PRINTER_DATA_TYPE_STRING;
|
||||
r->out.data.string = talloc_asprintf(mem_ctx, "%s.%s",
|
||||
lp_netbios_name(global_loadparm),
|
||||
lp_realm(global_loadparm));
|
||||
lp_netbios_name(server->ntptr->lp_ctx),
|
||||
lp_realm(server->ntptr->lp_ctx));
|
||||
W_ERROR_HAVE_NO_MEMORY(r->out.data.string);
|
||||
return WERR_OK;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx);
|
||||
cli_credentials_set_conf(credentials, global_loadparm);
|
||||
cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
|
||||
cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
|
||||
if (domain) {
|
||||
cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
|
||||
@ -176,7 +176,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
|
||||
DEBUG(5, ("CIFS backend: Using machine account\n"));
|
||||
credentials = cli_credentials_init(private);
|
||||
cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx);
|
||||
cli_credentials_set_conf(credentials, global_loadparm);
|
||||
cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
|
||||
if (domain) {
|
||||
cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
|
||||
}
|
||||
@ -198,7 +198,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
|
||||
io.in.called_name = host;
|
||||
io.in.credentials = credentials;
|
||||
io.in.fallback_to_anonymous = false;
|
||||
io.in.workgroup = lp_workgroup(global_loadparm);
|
||||
io.in.workgroup = lp_workgroup(ntvfs->ctx->lp_ctx);
|
||||
io.in.service = remote_share;
|
||||
io.in.service_type = "?????";
|
||||
|
||||
|
@ -88,7 +88,7 @@ static struct odb_context *odb_tdb_init(TALLOC_CTX *mem_ctx,
|
||||
odb->ntvfs_ctx = ntvfs_ctx;
|
||||
|
||||
/* leave oplocks disabled by default until the code is working */
|
||||
odb->oplocks = lp_parm_bool(global_loadparm, NULL, "opendb", "oplocks", false);
|
||||
odb->oplocks = lp_parm_bool(ntvfs_ctx->lp_ctx, NULL, "opendb", "oplocks", false);
|
||||
|
||||
return odb;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ static NTSTATUS ipc_connect(struct ntvfs_module_context *ntvfs,
|
||||
private->pipe_list = NULL;
|
||||
|
||||
/* setup the DCERPC server subsystem */
|
||||
status = dcesrv_init_ipc_context(private, global_loadparm, &private->dcesrv);
|
||||
status = dcesrv_init_ipc_context(private, ntvfs->ctx->lp_ctx, &private->dcesrv);
|
||||
NT_STATUS_NOT_OK_RETURN(status);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
|
@ -187,6 +187,7 @@ struct ntvfs_context {
|
||||
struct share_config *config;
|
||||
|
||||
struct server_id server_id;
|
||||
struct loadparm_context *lp_ctx;
|
||||
struct event_context *event_ctx;
|
||||
struct messaging_context *msg_ctx;
|
||||
|
||||
|
@ -154,6 +154,7 @@ _PUBLIC_ bool ntvfs_interface_differs(const struct ntvfs_critical_sizes *const i
|
||||
NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, enum ntvfs_type type,
|
||||
enum protocol_types protocol,
|
||||
struct event_context *ev, struct messaging_context *msg,
|
||||
struct loadparm_context *lp_ctx,
|
||||
struct server_id server_id, struct ntvfs_context **_ctx)
|
||||
{
|
||||
const char **handlers = share_string_list_option(mem_ctx, scfg, SHARE_NTVFS_HANDLER);
|
||||
@ -172,6 +173,7 @@ NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, e
|
||||
ctx->event_ctx = ev;
|
||||
ctx->msg_ctx = msg;
|
||||
ctx->server_id = server_id;
|
||||
ctx->lp_ctx = lp_ctx;
|
||||
|
||||
for (i=0; handlers[i]; i++) {
|
||||
struct ntvfs_module_context *ntvfs;
|
||||
|
@ -614,7 +614,7 @@ NTSTATUS pvfs_mangle_init(struct pvfs_state *pvfs)
|
||||
}
|
||||
|
||||
/* by default have a max of 512 entries in the cache. */
|
||||
ctx->cache_size = lp_parm_int(global_loadparm, NULL, "mangle", "cachesize", 512);
|
||||
ctx->cache_size = lp_parm_int(pvfs->ntvfs->ctx->lp_ctx, NULL, "mangle", "cachesize", 512);
|
||||
|
||||
ctx->prefix_cache = talloc_array(ctx, char *, ctx->cache_size);
|
||||
if (ctx->prefix_cache == NULL) {
|
||||
@ -628,7 +628,7 @@ NTSTATUS pvfs_mangle_init(struct pvfs_state *pvfs)
|
||||
memset(ctx->prefix_cache, 0, sizeof(char *) * ctx->cache_size);
|
||||
memset(ctx->prefix_cache_hashes, 0, sizeof(uint32_t) * ctx->cache_size);
|
||||
|
||||
ctx->mangle_prefix = lp_parm_int(global_loadparm, NULL, "mangle", "prefix", -1);
|
||||
ctx->mangle_prefix = lp_parm_int(pvfs->ntvfs->ctx->lp_ctx, NULL, "mangle", "prefix", -1);
|
||||
if (ctx->mangle_prefix < 0 || ctx->mangle_prefix > 6) {
|
||||
ctx->mangle_prefix = DEFAULT_MANGLE_PREFIX;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
|
||||
event_context_find(pvfs),
|
||||
pvfs->ntvfs->ctx->config);
|
||||
|
||||
pvfs->sidmap = sidmap_open(pvfs, global_loadparm);
|
||||
pvfs->sidmap = sidmap_open(pvfs, pvfs->ntvfs->ctx->lp_ctx);
|
||||
if (pvfs->sidmap == NULL) {
|
||||
return NT_STATUS_INTERNAL_DB_CORRUPTION;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
|
||||
|
||||
p = (char *)io->ioctl.out.blob.data;
|
||||
SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */);
|
||||
push_string(global_smb_iconv_convenience, p+2, lp_netbios_name(global_loadparm), 15, STR_TERMINATE|STR_ASCII);
|
||||
push_string(global_smb_iconv_convenience, p+2, lp_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
|
||||
push_string(global_smb_iconv_convenience, p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ static NTSTATUS unixuid_connect(struct ntvfs_module_context *ntvfs,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
private->sidmap = sidmap_open(private, global_loadparm);
|
||||
private->sidmap = sidmap_open(private, ntvfs->ctx->lp_ctx);
|
||||
if (private->sidmap == NULL) {
|
||||
return NT_STATUS_INTERNAL_DB_CORRUPTION;
|
||||
}
|
||||
|
@ -216,7 +216,8 @@ static NTSTATUS dcerpc_spoolss_bind(struct dcesrv_call_state *dce_call, const st
|
||||
NTSTATUS status;
|
||||
struct ntptr_context *ntptr;
|
||||
|
||||
status = ntptr_init_context(dce_call->context, lp_ntptr_providor(dce_call->conn->dce_ctx->lp_ctx), &ntptr);
|
||||
status = ntptr_init_context(dce_call->context, dce_call->conn->dce_ctx->lp_ctx,
|
||||
lp_ntptr_providor(dce_call->conn->dce_ctx->lp_ctx), &ntptr);
|
||||
NT_STATUS_NOT_OK_RETURN(status);
|
||||
|
||||
dce_call->context->private = ntptr;
|
||||
|
@ -99,6 +99,7 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call,
|
||||
PROTOCOL_NT1,
|
||||
dce_call->event_ctx,
|
||||
dce_call->conn->msg_ctx,
|
||||
dce_call->conn->dce_ctx->lp_ctx,
|
||||
dce_call->conn->server_id,
|
||||
&c->ntvfs);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
|
@ -49,6 +49,7 @@ static NTSTATUS make_connection_scfg(struct smbsrv_request *req,
|
||||
req->smb_conn->negotiate.protocol,
|
||||
req->smb_conn->connection->event.ctx,
|
||||
req->smb_conn->connection->msg_ctx,
|
||||
global_loadparm,
|
||||
req->smb_conn->connection->server_id,
|
||||
&tcon->ntvfs);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "librpc/gen_ndr/security.h"
|
||||
#include "smbd/service_stream.h"
|
||||
#include "ntvfs/ntvfs.h"
|
||||
#include "param/param.h"
|
||||
|
||||
/*
|
||||
send an oplock break request to a client
|
||||
@ -293,6 +294,7 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
|
||||
req->smb_conn->negotiate.protocol,
|
||||
req->smb_conn->connection->event.ctx,
|
||||
req->smb_conn->connection->msg_ctx,
|
||||
global_loadparm,
|
||||
req->smb_conn->connection->server_id,
|
||||
&tcon->ntvfs);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "torture/torture.h"
|
||||
#include "torture/ldap/proto.h"
|
||||
|
||||
#include "param/param.h"
|
||||
|
||||
static bool test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password)
|
||||
{
|
||||
NTSTATUS status;
|
||||
@ -47,7 +49,7 @@ static bool test_bind_sasl(struct ldap_connection *conn, struct cli_credentials
|
||||
|
||||
printf("Testing sasl bind as user\n");
|
||||
|
||||
status = torture_ldap_bind_sasl(conn, creds);
|
||||
status = torture_ldap_bind_sasl(conn, creds, global_loadparm);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
ret = false;
|
||||
}
|
||||
|
@ -39,11 +39,12 @@ NTSTATUS torture_ldap_bind(struct ldap_connection *conn, const char *userdn, con
|
||||
}
|
||||
|
||||
_PUBLIC_ NTSTATUS torture_ldap_bind_sasl(struct ldap_connection *conn,
|
||||
struct cli_credentials *creds)
|
||||
struct cli_credentials *creds,
|
||||
struct loadparm_context *lp_ctx)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
status = ldap_bind_sasl(conn, creds);
|
||||
status = ldap_bind_sasl(conn, creds, lp_ctx);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("Failed sasl bind with provided credentials - %s\n",
|
||||
nt_errstr(status));
|
||||
|
@ -236,7 +236,7 @@ static bool test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *creden
|
||||
|
||||
printf("connected to LDAP: %s\n", ctx->ldap_url);
|
||||
|
||||
status = torture_ldap_bind_sasl(l->conn, credentials);
|
||||
status = torture_ldap_bind_sasl(l->conn, credentials, global_loadparm);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("failed to bind to LDAP:\n");
|
||||
return false;
|
||||
|
@ -429,7 +429,8 @@ static void init_domain_recv_ldapconn(struct composite_context *ctx)
|
||||
state->domain->dc_name);
|
||||
state->ctx->status =
|
||||
ldap_bind_sasl(state->domain->ldap_conn,
|
||||
state->domain->libnet_ctx->cred);
|
||||
state->domain->libnet_ctx->cred,
|
||||
state->domain->libnet_ctx->lp_ctx);
|
||||
DEBUG(0, ("ldap_bind returned %s\n",
|
||||
nt_errstr(state->ctx->status)));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user