summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/auth/auth_sam.c4
-rw-r--r--source4/auth/sam.c2
-rw-r--r--source4/cldap_server/cldap_server.c4
-rw-r--r--source4/dsdb/common/sidmap.c3
-rw-r--r--source4/dsdb/repl/drepl_service.c2
-rw-r--r--source4/dsdb/samdb/cracknames.c3
-rw-r--r--source4/dsdb/samdb/samdb.c5
-rw-r--r--source4/dsdb/samdb/samdb.h1
-rw-r--r--source4/dsdb/samdb/samdb_privilege.c3
-rw-r--r--source4/kdc/hdb-ldb.c2
-rw-r--r--source4/kdc/kpasswdd.c4
-rw-r--r--source4/ldap_server/ldap_server.c13
-rw-r--r--source4/nbt_server/dgram/netlogon.c4
-rw-r--r--source4/nbt_server/nbt_server.c2
-rw-r--r--source4/param/loadparm.c2
-rw-r--r--source4/rpc_server/common/server_info.c2
-rw-r--r--source4/rpc_server/drsuapi/dcesrv_drsuapi.c3
-rw-r--r--source4/rpc_server/lsa/lsa_init.c2
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c12
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c4
-rw-r--r--source4/rpc_server/samr/samr_password.c7
-rw-r--r--source4/smb_server/smb_server.c2
-rw-r--r--source4/smbd/service_task.c3
-rw-r--r--source4/smbd/service_task.h1
-rw-r--r--source4/utils/testparm.c183
-rw-r--r--source4/web_server/web_server.c6
-rw-r--r--source4/wrepl_server/wrepl_server.c2
27 files changed, 152 insertions, 129 deletions
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c
index c1fcaa6f72..42e5ae9e7e 100644
--- a/source4/auth/auth_sam.c
+++ b/source4/auth/auth_sam.c
@@ -22,8 +22,8 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_netlogon.h"
#include "system/time.h"
-#include "util/util_ldb.h"
#include "lib/ldb/include/ldb.h"
+#include "util/util_ldb.h"
#include "auth/auth.h"
#include "auth/auth_sam.h"
#include "dsdb/samdb/samdb.h"
@@ -283,7 +283,7 @@ static NTSTATUS authsam_check_password_internals(struct auth_method_context *ctx
return NT_STATUS_NO_MEMORY;
}
- sam_ctx = samdb_connect(tmp_ctx, system_session(mem_ctx));
+ sam_ctx = samdb_connect(tmp_ctx, global_loadparm, system_session(mem_ctx));
if (sam_ctx == NULL) {
talloc_free(tmp_ctx);
return NT_STATUS_INVALID_SYSTEM_SERVICE;
diff --git a/source4/auth/sam.c b/source4/auth/sam.c
index 6a212b8cfe..ce02821e83 100644
--- a/source4/auth/sam.c
+++ b/source4/auth/sam.c
@@ -439,7 +439,7 @@ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, const char *principa
return NT_STATUS_NO_MEMORY;
}
- sam_ctx = samdb_connect(tmp_ctx, system_session(tmp_ctx));
+ sam_ctx = samdb_connect(tmp_ctx, global_loadparm, system_session(tmp_ctx));
if (sam_ctx == NULL) {
talloc_free(tmp_ctx);
return NT_STATUS_INVALID_SYSTEM_SERVICE;
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index ed78f45ca7..d43669a9e1 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -159,7 +159,7 @@ static void cldapd_task_init(struct task_server *task)
return;
}
- switch (lp_server_role(global_loadparm)) {
+ switch (lp_server_role(task->lp_ctx)) {
case ROLE_STANDALONE:
task_server_terminate(task, "cldap_server: no CLDAP server required in standalone configuration");
return;
@@ -180,7 +180,7 @@ static void cldapd_task_init(struct task_server *task)
}
cldapd->task = task;
- cldapd->samctx = samdb_connect(cldapd, anonymous_session(cldapd));
+ cldapd->samctx = samdb_connect(cldapd, task->lp_ctx, anonymous_session(cldapd));
if (cldapd->samctx == NULL) {
task_server_terminate(task, "cldapd failed to open samdb");
return;
diff --git a/source4/dsdb/common/sidmap.c b/source4/dsdb/common/sidmap.c
index 46052ac2a0..8383d2b36b 100644
--- a/source4/dsdb/common/sidmap.c
+++ b/source4/dsdb/common/sidmap.c
@@ -27,6 +27,7 @@
#include "libcli/ldap/ldap.h"
#include "util/util_ldb.h"
#include "libcli/security/security.h"
+#include "param/param.h"
/*
these are used for the fallback local uid/gid to sid mapping
@@ -54,7 +55,7 @@ _PUBLIC_ struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx)
if (sidmap == NULL) {
return NULL;
}
- sidmap->samctx = samdb_connect(sidmap, system_session(sidmap));
+ sidmap->samctx = samdb_connect(sidmap, global_loadparm, system_session(sidmap));
if (sidmap->samctx == NULL) {
talloc_free(sidmap);
return NULL;
diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c
index e56e2e179c..5c74dbfb72 100644
--- a/source4/dsdb/repl/drepl_service.c
+++ b/source4/dsdb/repl/drepl_service.c
@@ -50,7 +50,7 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service)
const struct GUID *ntds_guid;
struct drsuapi_DsBindInfo28 *bind_info28;
- service->samdb = samdb_connect(service, service->system_session_info);
+ service->samdb = samdb_connect(service, global_loadparm, service->system_session_info);
if (!service->samdb) {
return WERR_DS_SERVICE_UNAVAILABLE;
}
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index c0c44c8602..c5f1bdaffb 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -33,6 +33,7 @@
#include "auth/auth.h"
#include "util/util_ldb.h"
#include "dsdb/samdb/samdb.h"
+#include "param/param.h"
static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
struct smb_krb5_context *smb_krb5_context,
@@ -1210,7 +1211,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
- ldb = samdb_connect(mem_ctx, system_session(mem_ctx));
+ ldb = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx));
if (ldb == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 310ef17c24..dd20937ab7 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -71,11 +71,12 @@ char *samdb_relative_path(struct ldb_context *ldb,
return an opaque context pointer on success, or NULL on failure
*/
struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct auth_session_info *session_info)
{
struct ldb_context *ldb;
- ldb = ldb_wrap_connect(mem_ctx, global_loadparm,
- lp_sam_url(global_loadparm), session_info,
+ ldb = ldb_wrap_connect(mem_ctx, lp_ctx,
+ lp_sam_url(lp_ctx), session_info,
NULL, 0, NULL);
if (!ldb) {
return NULL;
diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h
index 5d39b2cfb0..54d1ce2e75 100644
--- a/source4/dsdb/samdb/samdb.h
+++ b/source4/dsdb/samdb/samdb.h
@@ -26,6 +26,7 @@ struct auth_session_info;
struct dsdb_control_current_partition;
struct dsdb_extended_replicated_object;
struct dsdb_extended_replicated_objects;
+struct loadparm_context;
#include "librpc/gen_ndr/security.h"
#include "lib/ldb/include/ldb.h"
diff --git a/source4/dsdb/samdb/samdb_privilege.c b/source4/dsdb/samdb/samdb_privilege.c
index 7fe840fca9..468a26bf98 100644
--- a/source4/dsdb/samdb/samdb_privilege.c
+++ b/source4/dsdb/samdb/samdb_privilege.c
@@ -25,6 +25,7 @@
#include "auth/auth.h"
#include "libcli/security/security.h"
#include "util/util_ldb.h"
+#include "param/param.h"
/*
add privilege bits for one sid to a security_token
@@ -96,7 +97,7 @@ _PUBLIC_ NTSTATUS samdb_privilege_setup(struct security_token *token)
}
mem_ctx = talloc_new(token);
- samctx = samdb_connect(mem_ctx, system_session(mem_ctx));
+ samctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx));
if (samctx == NULL) {
talloc_free(mem_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c
index 125852cfa1..a7c5e4b3fb 100644
--- a/source4/kdc/hdb-ldb.c
+++ b/source4/kdc/hdb-ldb.c
@@ -1133,7 +1133,7 @@ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
CRED_DONT_USE_KERBEROS);
/* Setup the link to LDB */
- (*db)->hdb_db = samdb_connect(*db, session_info);
+ (*db)->hdb_db = samdb_connect(*db, global_loadparm, session_info);
if ((*db)->hdb_db == NULL) {
DEBUG(1, ("hdb_ldb_create: Cannot open samdb for KDC backend!"));
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c
index 5bda85c96e..35697bef4e 100644
--- a/source4/kdc/kpasswdd.c
+++ b/source4/kdc/kpasswdd.c
@@ -180,7 +180,7 @@ static bool kpasswdd_change_password(struct kdc_server *kdc,
struct samr_DomInfo1 *dominfo;
struct ldb_context *samdb;
- samdb = samdb_connect(mem_ctx, system_session(mem_ctx));
+ samdb = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx));
if (!samdb) {
return kpasswdd_make_error_reply(kdc, mem_ctx,
KRB5_KPASSWD_HARDERROR,
@@ -310,7 +310,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc,
krb5_free_principal(context, principal);
- samdb = samdb_connect(mem_ctx, session_info);
+ samdb = samdb_connect(mem_ctx, global_loadparm, session_info);
if (!samdb) {
return kpasswdd_make_error_reply(kdc, mem_ctx,
KRB5_KPASSWD_HARDERROR,
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index c165eb698a..1ee37dceff 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -441,6 +441,7 @@ static const struct stream_server_ops ldap_stream_ops = {
add a socket address to the list of events, one event per port
*/
static NTSTATUS add_socket(struct event_context *event_context,
+ struct loadparm_context *lp_ctx,
const struct model_ops *model_ops,
const char *address, struct ldapsrv_service *ldap_service)
{
@@ -471,7 +472,7 @@ static NTSTATUS add_socket(struct event_context *event_context,
}
/* Load LDAP database */
- ldb = samdb_connect(ldap_service, system_session(ldap_service));
+ ldb = samdb_connect(ldap_service, lp_ctx, system_session(ldap_service));
if (!ldb) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@@ -538,7 +539,7 @@ static void ldapsrv_task_init(struct task_server *task)
ldap_service->tls_params = tls_initialise(ldap_service);
if (ldap_service->tls_params == NULL) goto failed;
- if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) {
+ if (lp_interfaces(task->lp_ctx) && lp_bind_interfaces_only(task->lp_ctx)) {
int num_interfaces = iface_count();
int i;
@@ -548,16 +549,16 @@ static void ldapsrv_task_init(struct task_server *task)
*/
for(i = 0; i < num_interfaces; i++) {
const char *address = iface_n_ip(i);
- status = add_socket(task->event_ctx, model_ops, address, ldap_service);
+ status = add_socket(task->event_ctx, task->lp_ctx, model_ops, address, ldap_service);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
} else {
- status = add_socket(task->event_ctx, model_ops,
- lp_socket_address(global_loadparm), ldap_service);
+ status = add_socket(task->event_ctx, task->lp_ctx, model_ops,
+ lp_socket_address(task->lp_ctx), ldap_service);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
- ldapi_path = private_path(ldap_service, global_loadparm, "ldapi");
+ ldapi_path = private_path(ldap_service, task->lp_ctx, "ldapi");
if (!ldapi_path) {
goto failed;
}
diff --git a/source4/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c
index 8672028348..ab6588348f 100644
--- a/source4/nbt_server/dgram/netlogon.c
+++ b/source4/nbt_server/dgram/netlogon.c
@@ -53,7 +53,7 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot,
return;
}
- samctx = samdb_connect(packet, anonymous_session(packet));
+ samctx = samdb_connect(packet, global_loadparm, anonymous_session(packet));
if (samctx == NULL) {
DEBUG(2,("Unable to open sam in getdc reply\n"));
return;
@@ -123,7 +123,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot,
return;
}
- samctx = samdb_connect(packet, anonymous_session(packet));
+ samctx = samdb_connect(packet, global_loadparm, anonymous_session(packet));
if (samctx == NULL) {
DEBUG(2,("Unable to open sam in getdc reply\n"));
return;
diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c
index abb4593b2c..173cea91d0 100644
--- a/source4/nbt_server/nbt_server.c
+++ b/source4/nbt_server/nbt_server.c
@@ -62,7 +62,7 @@ static void nbtd_task_init(struct task_server *task)
return;
}
- nbtsrv->sam_ctx = samdb_connect(nbtsrv, anonymous_session(nbtsrv));
+ nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->lp_ctx, anonymous_session(nbtsrv));
if (nbtsrv->sam_ctx == NULL) {
task_server_terminate(task, "nbtd failed to open samdb");
return;
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 8e2b8b555c..2d15f9c019 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -2127,7 +2127,7 @@ static void dump_a_service(struct loadparm_service * pService, FILE * f)
}
}
-bool lp_dump_a_parameter(struct loadparm_context *lp_ctx, int snum, char *parm_name, FILE * f,
+bool lp_dump_a_parameter(struct loadparm_context *lp_ctx, int snum, const char *parm_name, FILE * f,
bool isGlobal)
{
struct loadparm_service * pService = lp_ctx->ServicePtrs[snum];
diff --git a/source4/rpc_server/common/server_info.c b/source4/rpc_server/common/server_info.c
index c6f93f076a..6896c9fada 100644
--- a/source4/rpc_server/common/server_info.c
+++ b/source4/rpc_server/common/server_info.c
@@ -118,7 +118,7 @@ _PUBLIC_ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dces
break;
}
/* open main ldb */
- samctx = samdb_connect(tmp_ctx, anonymous_session(tmp_ctx));
+ samctx = samdb_connect(tmp_ctx, global_loadparm, anonymous_session(tmp_ctx));
if (samctx == NULL) {
DEBUG(2,("Unable to open samdb in determining server announce flags\n"));
} else {
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
index a0663a588d..cf2d259907 100644
--- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
+++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
@@ -27,6 +27,7 @@
#include "rpc_server/drsuapi/dcesrv_drsuapi.h"
#include "dsdb/samdb/samdb.h"
#include "lib/ldb/include/ldb_errors.h"
+#include "param/param.h"
/*
drsuapi_DsBind
@@ -57,7 +58,7 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C
/*
* connect to the samdb
*/
- b_state->sam_ctx = samdb_connect(b_state, dce_call->conn->auth_state.session_info);
+ b_state->sam_ctx = samdb_connect(b_state, global_loadparm, dce_call->conn->auth_state.session_info);
if (!b_state->sam_ctx) {
return WERR_FOOBAR;
}
diff --git a/source4/rpc_server/lsa/lsa_init.c b/source4/rpc_server/lsa/lsa_init.c
index 6cf062a22a..83607cc446 100644
--- a/source4/rpc_server/lsa/lsa_init.c
+++ b/source4/rpc_server/lsa/lsa_init.c
@@ -50,7 +50,7 @@ NTSTATUS dcesrv_lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
}
/* make sure the sam database is accessible */
- state->sam_ldb = samdb_connect(state, dce_call->conn->auth_state.session_info);
+ state->sam_ldb = samdb_connect(state, global_loadparm, dce_call->conn->auth_state.session_info);
if (state->sam_ldb == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index d441be807a..d5e385f70d 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -92,7 +92,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
return NT_STATUS_ACCESS_DENIED;
}
- sam_ctx = samdb_connect(mem_ctx, system_session(mem_ctx));
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -301,7 +301,7 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet(struct dcesrv_call_state *dce_call
&creds);
NT_STATUS_NOT_OK_RETURN(nt_status);
- sam_ctx = samdb_connect(mem_ctx, system_session(mem_ctx));
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -339,7 +339,7 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
&creds);
NT_STATUS_NOT_OK_RETURN(nt_status);
- sam_ctx = samdb_connect(mem_ctx, system_session(mem_ctx));
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -885,7 +885,7 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
NULL);
NT_STATUS_NOT_OK_RETURN(status);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->auth_state.session_info);
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, dce_call->conn->auth_state.session_info);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -989,7 +989,7 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA
ZERO_STRUCT(r->out);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->auth_state.session_info);
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, dce_call->conn->auth_state.session_info);
if (sam_ctx == NULL) {
return WERR_DS_SERVICE_UNAVAILABLE;
}
@@ -1147,7 +1147,7 @@ static WERROR dcesrv_netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce
ZERO_STRUCT(r->out);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->auth_state.session_info);
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, dce_call->conn->auth_state.session_info);
if (sam_ctx == NULL) {
return WERR_GENERAL_FAILURE;
}
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 9d208f8444..5d83ba84a7 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -141,7 +141,7 @@ static NTSTATUS dcesrv_samr_Connect(struct dcesrv_call_state *dce_call, TALLOC_C
}
/* make sure the sam database is accessible */
- c_state->sam_ctx = samdb_connect(c_state, dce_call->conn->auth_state.session_info);
+ c_state->sam_ctx = samdb_connect(c_state, global_loadparm, dce_call->conn->auth_state.session_info);
if (c_state->sam_ctx == NULL) {
talloc_free(c_state);
return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -4086,7 +4086,7 @@ static NTSTATUS dcesrv_samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TAL
ZERO_STRUCT(r->out.info);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->auth_state.session_info);
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, dce_call->conn->auth_state.session_info);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index a38f9840b6..736b85d7ee 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -33,6 +33,7 @@
#include "rpc_server/samr/proto.h"
#include "libcli/auth/libcli_auth.h"
#include "util/util_ldb.h"
+#include "param/param.h"
/*
samr_ChangePasswordUser
@@ -64,7 +65,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser(struct dcesrv_call_state *dce_call, TALL
}
/* To change a password we need to open as system */
- sam_ctx = samdb_connect(mem_ctx, system_session(mem_ctx));
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -203,7 +204,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call,
}
/* To change a password we need to open as system */
- sam_ctx = samdb_connect(mem_ctx, system_session(mem_ctx));
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -341,7 +342,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
}
/* To change a password we need to open as system */
- sam_ctx = samdb_connect(mem_ctx, system_session(mem_ctx));
+ sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index 691934f71c..9242fb1a12 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -203,7 +203,7 @@ static void smbsrv_preopen_ldb(struct task_server *task)
/* yes, this looks strange. It is a hack to preload the
schema. I'd like to share most of the ldb context with the
child too. That will come later */
- talloc_free(samdb_connect(task, NULL));
+ talloc_free(samdb_connect(task, global_loadparm, NULL));
}
/*
diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c
index c77cae4185..dceda5a922 100644
--- a/source4/smbd/service_task.c
+++ b/source4/smbd/service_task.c
@@ -64,9 +64,10 @@ static void task_server_callback(struct event_context *event_ctx,
task->event_ctx = event_ctx;
task->model_ops = state->model_ops;
task->server_id = server_id;
+ task->lp_ctx = global_loadparm;
task->msg_ctx = messaging_init(task,
- lp_messaging_path(task, global_loadparm),
+ lp_messaging_path(task, task->lp_ctx),
task->server_id, task->event_ctx);
if (!task->msg_ctx) {
task_server_terminate(task, "messaging_init() failed");
diff --git a/source4/smbd/service_task.h b/source4/smbd/service_task.h
index e5bf9ea414..207e2cbbca 100644
--- a/source4/smbd/service_task.h
+++ b/source4/smbd/service_task.h
@@ -28,6 +28,7 @@ struct task_server {
struct event_context *event_ctx;
const struct model_ops *model_ops;
struct messaging_context *msg_ctx;
+ struct loadparm_context *lp_ctx;
struct server_id server_id;
void *private;
};
diff --git a/source4/utils/testparm.c b/source4/utils/testparm.c
index 71ff937a51..17e6a72746 100644
--- a/source4/utils/testparm.c
+++ b/source4/utils/testparm.c
@@ -72,88 +72,17 @@ static int do_global_checks(struct loadparm_context *lp_ctx)
return ret;
}
- int main(int argc, const char *argv[])
+
+static int do_share_checks(struct loadparm_context *lp_ctx, const char *cname, const char *caddr, bool silent_mode,
+ bool show_defaults, const char *section_name, const char *parameter_name)
{
- int s;
- static int silent_mode = 0;
int ret = 0;
- poptContext pc;
-/*
- static int show_all_parameters = 0;
- static char *new_local_machine = NULL;
-*/
- static const char *section_name = NULL;
- static char *parameter_name = NULL;
- static const char *cname;
- static const char *caddr;
- static int show_defaults;
-
- struct poptOption long_options[] = {
- POPT_AUTOHELP
- {"suppress-prompt", 0, POPT_ARG_NONE, &silent_mode, 1, "Suppress prompt for enter"},
- {"verbose", 'v', POPT_ARG_NONE, &show_defaults, 1, "Show default options too"},
-/*
- We need support for smb.conf macros before this will work again
- {"server", 'L',POPT_ARG_STRING, &new_local_machine, 0, "Set %%L macro to servername\n"},
-*/
-/*
- These are harder to do with the new code structure
- {"show-all-parameters", '\0', POPT_ARG_NONE, &show_all_parameters, 1, "Show the parameters, type, possible values" },
-*/
- {"section-name", '\0', POPT_ARG_STRING, &section_name, 0, "Limit testparm to a named section" },
- {"parameter-name", '\0', POPT_ARG_STRING, &parameter_name, 0, "Limit testparm to a named parameter" },
- {"client-name", '\0', POPT_ARG_STRING, &cname, 0, "Client DNS name for 'hosts allow' checking (should match reverse lookup)"},
- {"client-ip", '\0', POPT_ARG_STRING, &caddr, 0, "Client IP address for 'hosts allow' checking"},
- POPT_COMMON_SAMBA
- POPT_COMMON_VERSION
- { NULL }
- };
-
- setup_logging(NULL, DEBUG_STDERR);
-
- pc = poptGetContext(NULL, argc, argv, long_options,
- POPT_CONTEXT_KEEP_FIRST);
- poptSetOtherOptionHelp(pc, "[OPTION...] [host-name] [host-ip]");
-
- while(poptGetNextOpt(pc) != -1);
-
-/*
- if (show_all_parameters) {
- show_parameter_list();
- exit(0);
- }
-*/
-
- if ( cname && ! caddr ) {
- printf ( "ERROR: For 'hosts allow' check you must specify both a DNS name and an IP address.\n" );
- return(1);
- }
-/*
- We need support for smb.conf macros before this will work again
-
- if (new_local_machine) {
- set_local_machine_name(new_local_machine, True);
- }
-*/
-
- /* We need this to force the output */
- lp_set_cmdline(global_loadparm, "log level", "2");
-
- fprintf(stderr, "Loaded smb config files from %s\n", lp_configfile(global_loadparm));
-
- if (!lp_load(lp_configfile(global_loadparm))) {
- fprintf(stderr,"Error loading services.\n");
- return(1);
- }
-
- fprintf(stderr,"Loaded services file OK.\n");
-
- ret = do_global_checks(global_loadparm);
+ int s;
- for (s=0;s<lp_numservices(global_loadparm);s++) {
- struct loadparm_service *service = lp_servicebynum(global_loadparm, s);
+ for (s=0;s<lp_numservices(lp_ctx);s++) {
+ struct loadparm_service *service = lp_servicebynum(lp_ctx, s);
if (service != NULL)
- if (strlen(lp_servicename(lp_servicebynum(global_loadparm, s))) > 12) {
+ if (strlen(lp_servicename(lp_servicebynum(lp_ctx, s))) > 12) {
fprintf(stderr, "WARNING: You have some share names that are longer than 12 characters.\n" );
fprintf(stderr, "These may not be accessible to some older clients.\n" );
fprintf(stderr, "(Eg. Windows9x, WindowsMe, and not listed in smbclient in Samba 3.0.)\n" );
@@ -161,8 +90,8 @@ static int do_global_checks(struct loadparm_context *lp_ctx)
}
}
- for (s=0;s<lp_numservices(global_loadparm);s++) {
- struct loadparm_service *service = lp_servicebynum(global_loadparm, s);
+ for (s=0;s<lp_numservices(lp_ctx);s++) {
+ struct loadparm_service *service = lp_servicebynum(lp_ctx, s);
if (service != NULL) {
const char **deny_list = lp_hostsdeny(service);
const char **allow_list = lp_hostsallow(service);
@@ -204,7 +133,7 @@ static int do_global_checks(struct loadparm_context *lp_ctx)
section_name = GLOBAL_NAME;
service = NULL;
} else if ((!strwicmp(section_name, GLOBAL_NAME)) == 0 &&
- (service=lp_service(global_loadparm, section_name)) == NULL) {
+ (service=lp_service(lp_ctx, section_name)) == NULL) {
fprintf(stderr,"Unknown section %s\n",
section_name);
return(1);
@@ -212,18 +141,18 @@ static int do_global_checks(struct loadparm_context *lp_ctx)
if (!parameter_name) {
lp_dump_one(stdout, show_defaults, service);
} else {
- ret = !lp_dump_a_parameter(global_loadparm, s, parameter_name, stdout, (service == NULL));
+ ret = !lp_dump_a_parameter(lp_ctx, s, parameter_name, stdout, (service == NULL));
}
} else {
- lp_dump(global_loadparm, stdout, show_defaults, lp_numservices(global_loadparm));
+ lp_dump(lp_ctx, stdout, show_defaults, lp_numservices(lp_ctx));
}
return(ret);
}
if(cname && caddr){
/* this is totally ugly, a real `quick' hack */
- for (s=0;s<lp_numservices(global_loadparm);s++) {
- struct loadparm_service *service = lp_servicebynum(global_loadparm, s);
+ for (s=0;s<lp_numservices(lp_ctx);s++) {
+ struct loadparm_service *service = lp_servicebynum(lp_ctx, s);
if (service != NULL) {
if (allow_access(NULL, lp_hostsdeny(NULL), lp_hostsallow(NULL), cname, caddr)
&& allow_access(NULL, lp_hostsdeny(service), lp_hostsallow(service), cname, caddr)) {
@@ -236,6 +165,90 @@ static int do_global_checks(struct loadparm_context *lp_ctx)
}
}
}
+
+ return ret;
+}
+
+
+ int main(int argc, const char *argv[])
+{
+ static bool silent_mode = false;
+ int ret = 0;
+ poptContext pc;
+/*
+ static int show_all_parameters = 0;
+ static char *new_local_machine = NULL;
+*/
+ static const char *section_name = NULL;
+ static char *parameter_name = NULL;
+ static const char *cname;
+ static const char *caddr;
+ static bool show_defaults = false;
+
+ struct poptOption long_options[] = {
+ POPT_AUTOHELP
+ {"suppress-prompt", 0, POPT_ARG_NONE, &silent_mode, true, "Suppress prompt for enter"},
+ {"verbose", 'v', POPT_ARG_NONE, &show_defaults, true, "Show default options too"},
+/*
+ We need support for smb.conf macros before this will work again
+ {"server", 'L',POPT_ARG_STRING, &new_local_machine, 0, "Set %%L macro to servername\n"},
+*/
+/*
+ These are harder to do with the new code structure
+ {"show-all-parameters", '\0', POPT_ARG_NONE, &show_all_parameters, 1, "Show the parameters, type, possible values" },
+*/
+ {"section-name", '\0', POPT_ARG_STRING, &section_name, 0, "Limit testparm to a named section" },
+ {"parameter-name", '\0', POPT_ARG_STRING, &parameter_name, 0, "Limit testparm to a named parameter" },
+ {"client-name", '\0', POPT_ARG_STRING, &cname, 0, "Client DNS name for 'hosts allow' checking (should match reverse lookup)"},
+ {"client-ip", '\0', POPT_ARG_STRING, &caddr, 0, "Client IP address for 'hosts allow' checking"},
+ POPT_COMMON_SAMBA
+ POPT_COMMON_VERSION
+ { NULL }
+ };
+
+ setup_logging(NULL, DEBUG_STDERR);
+
+ pc = poptGetContext(NULL, argc, argv, long_options,
+ POPT_CONTEXT_KEEP_FIRST);
+ poptSetOtherOptionHelp(pc, "[OPTION...] [host-name] [host-ip]");
+
+ while(poptGetNextOpt(pc) != -1);
+
+/*
+ if (show_all_parameters) {
+ show_parameter_list();
+ exit(0);
+ }
+*/
+
+ if ( cname && ! caddr ) {
+ printf ( "ERROR: For 'hosts allow' check you must specify both a DNS name and an IP address.\n" );
+ return(1);
+ }
+/*
+ We need support for smb.conf macros before this will work again
+
+ if (new_local_machine) {
+ set_local_machine_name(new_local_machine, True);
+ }
+*/
+
+ /* We need this to force the output */
+ lp_set_cmdline(global_loadparm, "log level", "2");
+
+ fprintf(stderr, "Loaded smb config files from %s\n", lp_configfile(global_loadparm));
+
+ if (!lp_load(lp_configfile(global_loadparm))) {
+ fprintf(stderr,"Error loading services.\n");
+ return(1);
+ }
+
+ fprintf(stderr,"Loaded services file OK.\n");
+
+ ret = do_global_checks(global_loadparm);
+
+ ret |= do_share_checks(global_loadparm, cname, caddr, silent_mode, show_defaults, section_name, parameter_name);
+
return(ret);
}
diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c
index 2e80339871..3926993334 100644
--- a/source4/web_server/web_server.c
+++ b/source4/web_server/web_server.c
@@ -241,7 +241,7 @@ static const struct stream_server_ops web_stream_ops = {
static void websrv_task_init(struct task_server *task)
{
NTSTATUS status;
- uint16_t port = lp_web_port(global_loadparm);
+ uint16_t port = lp_web_port(task->lp_ctx);
const struct model_ops *model_ops;
task_server_set_title(task, "task[websrv]");
@@ -250,7 +250,7 @@ static void websrv_task_init(struct task_server *task)
model_ops = process_model_byname("single");
if (!model_ops) goto failed;
- if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) {
+ if (lp_interfaces(task->lp_ctx) && lp_bind_interfaces_only(task->lp_ctx)) {
int num_interfaces = iface_count();
int i;
for(i = 0; i < num_interfaces; i++) {
@@ -264,7 +264,7 @@ static void websrv_task_init(struct task_server *task)
} else {
status = stream_setup_socket(task->event_ctx, model_ops,
&web_stream_ops,
- "ipv4", lp_socket_address(global_loadparm),
+ "ipv4", lp_socket_address(task->lp_ctx),
&port, task);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c
index cec2e6e65e..91f0a4fb05 100644
--- a/source4/wrepl_server/wrepl_server.c
+++ b/source4/wrepl_server/wrepl_server.c
@@ -458,7 +458,7 @@ static void wreplsrv_task_init(struct task_server *task)
/*
* setup up all partners, and open the winsdb
*/
- status = wreplsrv_open_winsdb(service, global_loadparm);
+ status = wreplsrv_open_winsdb(service, task->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "wreplsrv_task_init: wreplsrv_open_winsdb() failed");
return;