summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-10-01 18:52:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:07:34 -0500
commit2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad (patch)
tree2d02f6e998c150cca5323e574ffb8094fffc288f
parent4d7273715f109db82a4ee4852855927a32bb4073 (diff)
downloadsamba-2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad.tar.gz
samba-2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad.tar.xz
samba-2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad.zip
r25446: Merge some changes I made on the way home from SFO:
2007-09-29 More higher-level passing around of lp_ctx. 2007-09-29 Fix warning. 2007-09-29 Pass loadparm contexts on a higher level. 2007-09-29 Avoid using global loadparm context. (This used to be commit 3468952e771ab31f90b6c374ade01c5550810f42)
-rw-r--r--source4/auth/auth.c2
-rw-r--r--source4/auth/auth_sam.c8
-rw-r--r--source4/auth/auth_server.c6
-rw-r--r--source4/auth/credentials/credentials_files.c2
-rw-r--r--source4/auth/gensec/gensec.c2
-rw-r--r--source4/auth/gensec/schannel_state.c5
-rw-r--r--source4/auth/kerberos/krb5_init_context.c2
-rw-r--r--source4/cluster/local.c2
-rw-r--r--source4/dsdb/samdb/samdb.c3
-rw-r--r--source4/ldap_server/ldap_backend.c4
-rw-r--r--source4/lib/cmdline/popt_credentials.c2
-rw-r--r--source4/lib/db_wrap.c9
-rw-r--r--source4/lib/db_wrap.h1
-rw-r--r--source4/lib/dbwrap/dbwrap_tdb.c2
-rw-r--r--source4/lib/events/events.c2
-rw-r--r--source4/lib/gencache/gencache.c2
-rw-r--r--source4/lib/messaging/irpc.h7
-rw-r--r--source4/lib/messaging/messaging.c9
-rw-r--r--source4/lib/registry/ldb.c10
-rw-r--r--source4/lib/registry/samba.c10
-rw-r--r--source4/lib/tls/tls.c12
-rw-r--r--source4/libcli/cliconnect.c3
-rw-r--r--source4/libcli/finddcs.c2
-rw-r--r--source4/libcli/smb2/connect.c3
-rw-r--r--source4/libcli/smb_composite/connect.c9
-rw-r--r--source4/libcli/smb_composite/sesssetup.c2
-rw-r--r--source4/libnet/libnet_become_dc.c2
-rw-r--r--source4/libnet/libnet_join.c3
-rw-r--r--source4/libnet/libnet_lookup.c5
-rw-r--r--source4/libnet/libnet_samsync_ldb.c8
-rw-r--r--source4/libnet/libnet_unbecome_dc.c3
-rw-r--r--source4/nbt_server/wins/winsdb.c4
-rw-r--r--source4/ntptr/ntptr_base.c2
-rw-r--r--source4/ntptr/simple_ldb/ntptr_simple_ldb.c2
-rw-r--r--source4/ntvfs/ntvfs_base.c2
-rw-r--r--source4/ntvfs/sysdep/sys_notify.c2
-rw-r--r--source4/param/secrets.c4
-rw-r--r--source4/param/share.c2
-rw-r--r--source4/param/share_ldb.c37
-rw-r--r--source4/param/util.c88
-rw-r--r--source4/rpc_server/service_rpc.c2
-rw-r--r--source4/scripting/ejs/smbcalls.c2
-rw-r--r--source4/scripting/ejs/smbcalls_auth.c10
-rw-r--r--source4/scripting/ejs/smbcalls_ldb.c2
-rw-r--r--source4/scripting/ejs/smbcalls_rpc.c4
-rw-r--r--source4/smb_server/smb/negprot.c2
-rw-r--r--source4/smbd/process_model.c2
-rw-r--r--source4/smbd/server.c4
-rw-r--r--source4/smbd/service_stream.c4
-rw-r--r--source4/smbd/service_task.c5
-rw-r--r--source4/torture/ldap/schema.c4
-rw-r--r--source4/torture/ldap/uptodatevector.c4
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c6
-rw-r--r--source4/torture/local/dbspeed.c3
-rw-r--r--source4/torture/local/irpc.c2
-rw-r--r--source4/torture/local/messaging.c11
-rw-r--r--source4/torture/rpc/spoolss.c2
-rw-r--r--source4/torture/torture.c2
-rw-r--r--source4/torture/winbind/struct_based.c3
-rw-r--r--source4/utils/ntlm_auth.c2
-rw-r--r--source4/winbind/wb_samba3_cmd.c2
-rw-r--r--source4/winbind/wb_server.c2
-rw-r--r--source4/wrepl_server/wrepl_server.c5
63 files changed, 198 insertions, 172 deletions
diff --git a/source4/auth/auth.c b/source4/auth/auth.c
index 7a3f9f82cb..20524b34a4 100644
--- a/source4/auth/auth.c
+++ b/source4/auth/auth.c
@@ -519,7 +519,7 @@ NTSTATUS auth_init(void)
if (initialized) return NT_STATUS_OK;
initialized = True;
- shared_init = load_samba_modules(NULL, "auth");
+ shared_init = load_samba_modules(NULL, global_loadparm, "auth");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c
index be8225f0dc..da1ffb5c85 100644
--- a/source4/auth/auth_sam.c
+++ b/source4/auth/auth_sam.c
@@ -342,14 +342,16 @@ static NTSTATUS authsam_want_check(struct auth_method_context *ctx,
TALLOC_CTX *mem_ctx,
const struct auth_usersupplied_info *user_info)
{
- BOOL is_local_name, is_my_domain;
+ bool is_local_name, is_my_domain;
if (!user_info->mapped.account_name || !*user_info->mapped.account_name) {
return NT_STATUS_NOT_IMPLEMENTED;
}
- is_local_name = is_myname(user_info->mapped.domain_name);
- is_my_domain = strequal(user_info->mapped.domain_name, lp_workgroup(global_loadparm));
+ is_local_name = lp_is_myname(global_loadparm,
+ user_info->mapped.domain_name);
+ is_my_domain = lp_is_mydomain(global_loadparm,
+ user_info->mapped.domain_name);
/* check whether or not we service this domain/workgroup name */
switch (lp_server_role(global_loadparm)) {
diff --git a/source4/auth/auth_server.c b/source4/auth/auth_server.c
index 5d4c33969f..1513228bd9 100644
--- a/source4/auth/auth_server.c
+++ b/source4/auth/auth_server.c
@@ -195,8 +195,8 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
struct smbcli_state *cli;
static uint8_t badpass[24];
static fstring baduser;
- static BOOL tested_password_server = False;
- static BOOL bad_password_server = False;
+ static bool tested_password_server = false;
+ static bool bad_password_server = false;
NTSTATUS nt_status = NT_STATUS_LOGON_FAILURE;
BOOL locally_made_cli = False;
@@ -206,7 +206,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
* password file.
*/
- if(is_myname(user_info->domain.str)) {
+ if (lp_is_myname(global_loadparm, user_info->domain.str)) {
DEBUG(3,("check_smbserver_security: Requested domain was for this machine.\n"));
return NT_STATUS_LOGON_FAILURE;
}
diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c
index 5770dbf057..2aefb7c52f 100644
--- a/source4/auth/credentials/credentials_files.c
+++ b/source4/auth/credentials/credentials_files.c
@@ -308,7 +308,7 @@ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
} else {
keytab = ldb_msg_find_attr_as_string(msgs[0], "privateKeytab", NULL);
if (keytab) {
- keytab = talloc_asprintf(mem_ctx, "FILE:%s", private_path(mem_ctx, keytab));
+ keytab = talloc_asprintf(mem_ctx, "FILE:%s", private_path(mem_ctx, global_loadparm, keytab));
if (keytab) {
cli_credentials_set_keytab_name(cred, keytab, CRED_SPECIFIED);
}
diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c
index 541c1ff181..9bbf31a7c7 100644
--- a/source4/auth/gensec/gensec.c
+++ b/source4/auth/gensec/gensec.c
@@ -1269,7 +1269,7 @@ NTSTATUS gensec_init(void)
if (initialized) return NT_STATUS_OK;
initialized = True;
- shared_init = load_samba_modules(NULL, "gensec");
+ shared_init = load_samba_modules(NULL, global_loadparm, "gensec");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/auth/gensec/schannel_state.c b/source4/auth/gensec/schannel_state.c
index afbbd618eb..46fb48ffd3 100644
--- a/source4/auth/gensec/schannel_state.c
+++ b/source4/auth/gensec/schannel_state.c
@@ -41,14 +41,15 @@ struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx)
"computerName: CASE_INSENSITIVE\n" \
"flatname: CASE_INSENSITIVE\n";
- path = smbd_tmp_path(mem_ctx, "schannel.ldb");
+ path = smbd_tmp_path(mem_ctx, global_loadparm, "schannel.ldb");
if (!path) {
return NULL;
}
existed = file_exist(path);
- ldb = ldb_wrap_connect(mem_ctx, path, system_session(mem_ctx),
+ ldb = ldb_wrap_connect(mem_ctx, global_loadparm, path,
+ system_session(mem_ctx),
NULL, LDB_FLG_NOSYNC, NULL);
talloc_free(path);
if (!ldb) {
diff --git a/source4/auth/kerberos/krb5_init_context.c b/source4/auth/kerberos/krb5_init_context.c
index d604c33233..68e60dcdc5 100644
--- a/source4/auth/kerberos/krb5_init_context.c
+++ b/source4/auth/kerberos/krb5_init_context.c
@@ -393,7 +393,7 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx,
talloc_set_destructor(*smb_krb5_context, smb_krb5_context_destroy_1);
- config_file = config_path(tmp_ctx, "krb5.conf");
+ config_file = config_path(tmp_ctx, global_loadparm, "krb5.conf");
if (!config_file) {
talloc_free(tmp_ctx);
return ENOMEM;
diff --git a/source4/cluster/local.c b/source4/cluster/local.c
index be6d857d7b..2abe422d5a 100644
--- a/source4/cluster/local.c
+++ b/source4/cluster/local.c
@@ -58,7 +58,7 @@ static struct tdb_wrap *local_tdb_tmp_open(struct cluster_ops *ops,
TALLOC_CTX *mem_ctx, const char *dbname,
int flags)
{
- char *path = smbd_tmp_path(mem_ctx, dbname);
+ char *path = smbd_tmp_path(mem_ctx, global_loadparm, dbname);
struct tdb_wrap *w;
w = tdb_wrap_open(mem_ctx, path, 0, flags,
O_RDWR|O_CREAT, 0600);
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 38be2825ea..2f755d6c79 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -45,7 +45,8 @@ struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx,
struct auth_session_info *session_info)
{
struct ldb_context *ldb;
- ldb = ldb_wrap_connect(mem_ctx, lp_sam_url(global_loadparm), session_info,
+ ldb = ldb_wrap_connect(mem_ctx, global_loadparm,
+ lp_sam_url(global_loadparm), session_info,
NULL, 0, NULL);
if (!ldb) {
return NULL;
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index ae0fd207b5..25d19a5a58 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -55,7 +55,9 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin
*/
NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn)
{
- conn->ldb = ldb_wrap_connect(conn, lp_sam_url(global_loadparm), conn->session_info,
+ conn->ldb = ldb_wrap_connect(conn,
+ global_loadparm,
+ lp_sam_url(global_loadparm), conn->session_info,
NULL, conn->global_catalog ? LDB_FLG_RDONLY : 0, NULL);
if (conn->ldb == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
diff --git a/source4/lib/cmdline/popt_credentials.c b/source4/lib/cmdline/popt_credentials.c
index b913e6a53a..49ef4f0aaf 100644
--- a/source4/lib/cmdline/popt_credentials.c
+++ b/source4/lib/cmdline/popt_credentials.c
@@ -37,7 +37,7 @@
*/
-static BOOL dont_ask;
+static bool dont_ask;
enum opt { OPT_SIMPLE_BIND_DN, OPT_PASSWORD, OPT_KERBEROS };
diff --git a/source4/lib/db_wrap.c b/source4/lib/db_wrap.c
index 4c0a06cf2c..c33786a1e4 100644
--- a/source4/lib/db_wrap.c
+++ b/source4/lib/db_wrap.c
@@ -103,6 +103,7 @@ static int ldb_wrap_destructor(struct ldb_context *ldb)
TODO: We need an error_string parameter
*/
struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
const char *url,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
@@ -121,7 +122,7 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
}
ldb_set_modules_dir(ldb,
- talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(global_loadparm)));
+ talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx)));
/* we want to use the existing event context if possible. This
relies on the fact that in smbd, everything is a child of
@@ -143,7 +144,7 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
return NULL;
}
- if (strcmp(lp_sam_url(global_loadparm), url) == 0) {
+ if (strcmp(lp_sam_url(lp_ctx), url) == 0) {
dsdb_set_global_schema(ldb);
}
@@ -157,14 +158,14 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
- real_url = private_path(ldb, url);
+ real_url = private_path(ldb, lp_ctx, url);
if (real_url == NULL) {
talloc_free(ldb);
return NULL;
}
/* allow admins to force non-sync ldb for all databases */
- if (lp_parm_bool(global_loadparm, NULL, "ldb", "nosync", false)) {
+ if (lp_parm_bool(lp_ctx, NULL, "ldb", "nosync", false)) {
flags |= LDB_FLG_NOSYNC;
}
diff --git a/source4/lib/db_wrap.h b/source4/lib/db_wrap.h
index 4ead9f3010..b45a05c24f 100644
--- a/source4/lib/db_wrap.h
+++ b/source4/lib/db_wrap.h
@@ -31,5 +31,6 @@ struct auth_session_info;
struct ldb_message;
struct ldb_dn;
struct cli_credentials;
+struct loadparm_context;
#include "lib/db_wrap_proto.h"
diff --git a/source4/lib/dbwrap/dbwrap_tdb.c b/source4/lib/dbwrap/dbwrap_tdb.c
index b6af8abadd..b256b6ccc4 100644
--- a/source4/lib/dbwrap/dbwrap_tdb.c
+++ b/source4/lib/dbwrap/dbwrap_tdb.c
@@ -241,7 +241,7 @@ struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, const char *name, int td
/* the name passed in should not be a full path, it should be
just be the db name */
- path = smbd_tmp_path(result, name);
+ path = smbd_tmp_path(result, global_loadparm, name);
db_tdb->wtdb = tdb_wrap_open(db_tdb, path, 0, tdb_flags,
O_CREAT|O_RDWR, 0666);
diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c
index c1e57a3d32..060f72f793 100644
--- a/source4/lib/events/events.c
+++ b/source4/lib/events/events.c
@@ -105,7 +105,7 @@ static void event_backend_init(void)
init_module_fn static_init[] = STATIC_LIBEVENTS_MODULES;
init_module_fn *shared_init;
if (event_backends) return;
- shared_init = load_samba_modules(NULL, "LIBEVENTS");
+ shared_init = load_samba_modules(NULL, global_loadparm, "LIBEVENTS");
run_init_functions(static_init);
run_init_functions(shared_init);
#else
diff --git a/source4/lib/gencache/gencache.c b/source4/lib/gencache/gencache.c
index 08ff55b211..30bb1d86ed 100644
--- a/source4/lib/gencache/gencache.c
+++ b/source4/lib/gencache/gencache.c
@@ -55,7 +55,7 @@ BOOL gencache_init(void)
/* skip file open if it's already opened */
if (cache) return True;
- cache_fname = lock_path(mem_ctx, "gencache.tdb");
+ cache_fname = lock_path(mem_ctx, global_loadparm, "gencache.tdb");
if (cache_fname != NULL) {
DEBUG(5, ("Opening cache file at %s\n", cache_fname));
} else {
diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h
index bcfc1f1ab4..989e5d4255 100644
--- a/source4/lib/messaging/irpc.h
+++ b/source4/lib/messaging/irpc.h
@@ -76,13 +76,12 @@ struct irpc_request {
} async;
};
+struct loadparm_context;
+
typedef void (*msg_callback_t)(struct messaging_context *msg, void *private,
uint32_t msg_type,
struct server_id server_id, DATA_BLOB *data);
-struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
- struct server_id server_id,
- struct event_context *ev);
NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server,
uint32_t msg_type, DATA_BLOB *data);
NTSTATUS messaging_register(struct messaging_context *msg, void *private,
@@ -91,9 +90,11 @@ NTSTATUS messaging_register(struct messaging_context *msg, void *private,
NTSTATUS messaging_register_tmp(struct messaging_context *msg, void *private,
msg_callback_t fn, uint32_t *msg_type);
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
+ const char *dir,
struct server_id server_id,
struct event_context *ev);
struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx,
+ const char *dir,
struct event_context *ev);
NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id server,
uint32_t msg_type, void *ptr);
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index e398b16d72..36cf9aa609 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -530,13 +530,13 @@ static int messaging_destructor(struct messaging_context *msg)
create the listening socket and setup the dispatcher
*/
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
+ const char *dir,
struct server_id server_id,
struct event_context *ev)
{
struct messaging_context *msg;
NTSTATUS status;
struct socket_address *path;
- char *dir;
msg = talloc_zero(mem_ctx, struct messaging_context);
if (msg == NULL) {
@@ -555,11 +555,9 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
}
/* create the messaging directory if needed */
- dir = smbd_tmp_path(msg, "messaging");
mkdir(dir, 0700);
- talloc_free(dir);
- msg->base_path = smbd_tmp_path(msg, "messaging");
+ msg->base_path = talloc_reference(msg, dir);
msg->path = messaging_path(msg, server_id);
msg->server_id = server_id;
msg->idr = idr_init(msg);
@@ -610,12 +608,13 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
A hack, for the short term until we get 'client only' messaging in place
*/
struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx,
+ const char *dir,
struct event_context *ev)
{
struct server_id id;
ZERO_STRUCT(id);
id.id = random() % 0x10000000;
- return messaging_init(mem_ctx, id, ev);
+ return messaging_init(mem_ctx, dir, id, ev);
}
/*
a list of registered irpc server functions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 5ecbfa0407..e9daf31f9b 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -23,6 +23,7 @@
#include "lib/ldb/include/ldb_errors.h"
#include "db_wrap.h"
#include "librpc/gen_ndr/winreg.h"
+#include "param/param.h"
static struct hive_operations reg_backend_ldb;
@@ -317,9 +318,9 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h,
}
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
- struct auth_session_info *session_info,
- struct cli_credentials *credentials,
- struct hive_key **k)
+ struct auth_session_info *session_info,
+ struct cli_credentials *credentials,
+ struct hive_key **k)
{
struct ldb_key_data *kd;
struct ldb_context *wrap;
@@ -327,7 +328,8 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
if (location == NULL)
return WERR_INVALID_PARAM;
- wrap = ldb_wrap_connect(parent_ctx, location, session_info, credentials, 0, NULL);
+ wrap = ldb_wrap_connect(parent_ctx, global_loadparm,
+ location, session_info, credentials, 0, NULL);
if (wrap == NULL) {
DEBUG(1, (__FILE__": unable to connect\n"));
diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c
index 48eb043306..18bbcb8299 100644
--- a/source4/lib/registry/samba.c
+++ b/source4/lib/registry/samba.c
@@ -25,11 +25,11 @@
* @brief Samba-specific registry functions
*/
-static WERROR mount_samba_hive(struct registry_context *ctx,
- struct auth_session_info *auth_info,
- struct cli_credentials *creds,
- const char *name,
- uint32_t hive_id)
+static WERROR mount_samba_hive(struct registry_context *ctx,
+ struct auth_session_info *auth_info,
+ struct cli_credentials *creds,
+ const char *name,
+ uint32_t hive_id)
{
WERROR error;
struct hive_key *hive;
diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c
index 8be818433d..d2f6d6f740 100644
--- a/source4/lib/tls/tls.c
+++ b/source4/lib/tls/tls.c
@@ -357,11 +357,11 @@ struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx)
struct tls_params *params;
int ret;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
- const char *keyfile = private_path(tmp_ctx, lp_tls_keyfile(global_loadparm));
- const char *certfile = private_path(tmp_ctx, lp_tls_certfile(global_loadparm));
- const char *cafile = private_path(tmp_ctx, lp_tls_cafile(global_loadparm));
- const char *crlfile = private_path(tmp_ctx, lp_tls_crlfile(global_loadparm));
- const char *dhpfile = private_path(tmp_ctx, lp_tls_dhpfile(global_loadparm));
+ const char *keyfile = private_path(tmp_ctx, global_loadparm, lp_tls_keyfile(global_loadparm));
+ const char *certfile = private_path(tmp_ctx, global_loadparm, lp_tls_certfile(global_loadparm));
+ const char *cafile = private_path(tmp_ctx, global_loadparm, lp_tls_cafile(global_loadparm));
+ const char *crlfile = private_path(tmp_ctx, global_loadparm, lp_tls_crlfile(global_loadparm));
+ const char *dhpfile = private_path(tmp_ctx, global_loadparm, lp_tls_dhpfile(global_loadparm));
void tls_cert_generate(TALLOC_CTX *, const char *, const char *, const char *);
params = talloc(mem_ctx, struct tls_params);
@@ -565,7 +565,7 @@ struct socket_context *tls_init_client(struct socket_context *socket,
}
new_sock->private_data = tls;
- cafile = private_path(tls, lp_tls_cafile(global_loadparm));
+ cafile = private_path(tls, global_loadparm, lp_tls_cafile(global_loadparm));
if (!cafile || !*cafile) {
goto failed;
}
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index 715eb875fe..96946da7fe 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -57,7 +57,8 @@ BOOL smbcli_transport_establish(struct smbcli_state *cli,
/* wrapper around smb_raw_negotiate() */
NTSTATUS smbcli_negprot(struct smbcli_state *cli)
{
- return smb_raw_negotiate(cli->transport, lp_cli_maxprotocol(global_loadparm));
+ return smb_raw_negotiate(cli->transport,
+ lp_cli_maxprotocol(global_loadparm));
}
/* wrapper around smb_raw_sesssetup() */
diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c
index 2ac1358197..e00697fe17 100644
--- a/source4/libcli/finddcs.c
+++ b/source4/libcli/finddcs.c
@@ -147,7 +147,7 @@ static void finddcs_name_resolved(struct composite_context *ctx)
state->r.in.ip_address = state->dcs[0].address;
state->r.in.my_computername = lp_netbios_name(global_loadparm);
state->r.in.my_accountname = talloc_asprintf(state, "%s$",
- lp_netbios_name(global_loadparm));
+ lp_netbios_name(global_loadparm));
if (composite_nomem(state->r.in.my_accountname, state->ctx)) return;
state->r.in.account_control = ACB_WSTRUST;
state->r.in.domain_sid = state->domain_sid;
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index 6a2e9d09e9..bb70311c56 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -187,7 +187,8 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(name);
name.name = host;
- creq = resolve_name_send(&name, c->event_ctx, lp_name_resolve_order(global_loadparm));
+ creq = resolve_name_send(&name, c->event_ctx,
+ lp_name_resolve_order(global_loadparm));
composite_continue(c, creq, continue_resolve, c);
return c;
}
diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c
index 22b2cdb0e2..23974619d6 100644
--- a/source4/libcli/smb_composite/connect.c
+++ b/source4/libcli/smb_composite/connect.c
@@ -63,7 +63,8 @@ static NTSTATUS connect_send_negprot(struct composite_context *c,
{
struct connect_state *state = talloc_get_type(c->private_data, struct connect_state);
- state->req = smb_raw_negotiate_send(state->transport, lp_cli_maxprotocol(global_loadparm));
+ state->req = smb_raw_negotiate_send(state->transport,
+ lp_cli_maxprotocol(global_loadparm));
NT_STATUS_HAVE_NO_MEMORY(state->req);
state->req->async.fn = request_handler;
@@ -172,7 +173,8 @@ static NTSTATUS connect_session_setup(struct composite_context *c,
state->io_setup->in.credentials = cli_credentials_init(state);
NT_STATUS_HAVE_NO_MEMORY(state->io_setup->in.credentials);
- cli_credentials_set_conf(state->io_setup->in.credentials, global_loadparm);
+ cli_credentials_set_conf(state->io_setup->in.credentials,
+ global_loadparm);
cli_credentials_set_anonymous(state->io_setup->in.credentials);
/* If the preceding attempt was with extended security, we
@@ -459,7 +461,8 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec
state->stage = CONNECT_RESOLVE;
make_nbt_name_server(&name, io->in.dest_host);
- state->creq = resolve_name_send(&name, c->event_ctx, lp_name_resolve_order(global_loadparm));
+ state->creq = resolve_name_send(&name, c->event_ctx,
+ lp_name_resolve_order(global_loadparm));
if (state->creq == NULL) goto failed;
state->creq->async.private_data = c;
diff --git a/source4/libcli/smb_composite/sesssetup.c b/source4/libcli/smb_composite/sesssetup.c
index 6f9e6b0de3..622367e746 100644
--- a/source4/libcli/smb_composite/sesssetup.c
+++ b/source4/libcli/smb_composite/sesssetup.c
@@ -418,7 +418,7 @@ static NTSTATUS session_setup_spnego(struct composite_context *c,
}
}
- if (chosen_oid == GENSEC_OID_SPNEGO) {
+ if ((const void *)chosen_oid == (const void *)GENSEC_OID_SPNEGO) {
status = gensec_update(session->gensec, state,
session->transport->negotiate.secblob,
&state->setup.spnego.in.secblob);
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index 76984bf5b1..cd782066db 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -790,7 +790,7 @@ static NTSTATUS becomeDC_ldap_connect(struct libnet_BecomeDC_state *s, struct be
url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name);
NT_STATUS_HAVE_NO_MEMORY(url);
- ldap->ldb = ldb_wrap_connect(s, url,
+ ldap->ldb = ldb_wrap_connect(s, global_loadparm, url,
NULL,
s->libnet->cred,
0, NULL);
diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c
index 553bde615b..1fd84146de 100644
--- a/source4/libnet/libnet_join.c
+++ b/source4/libnet/libnet_join.c
@@ -228,7 +228,8 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
return NT_STATUS_NO_MEMORY;
}
- remote_ldb = ldb_wrap_connect(tmp_ctx, remote_ldb_url,
+ remote_ldb = ldb_wrap_connect(tmp_ctx, global_loadparm,
+ remote_ldb_url,
NULL, ctx->cred, 0, NULL);
if (!remote_ldb) {
r->out.error_string = NULL;
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c
index 6856156734..cac7086a60 100644
--- a/source4/libnet/libnet_lookup.c
+++ b/source4/libnet/libnet_lookup.c
@@ -34,6 +34,8 @@
#include "librpc/gen_ndr/lsa.h"
#include "librpc/gen_ndr/ndr_lsa_c.h"
+#include "param/param.h"
+
struct lookup_state {
struct nbt_name hostname;
const char *address;
@@ -189,7 +191,8 @@ struct composite_context* libnet_LookupDCs_send(struct libnet_context *ctx,
struct libnet_LookupDCs *io)
{
struct composite_context *c;
- struct messaging_context *msg_ctx = messaging_client_init(mem_ctx, ctx->event_ctx);
+ struct messaging_context *msg_ctx =
+ messaging_client_init(mem_ctx, lp_messaging_path(mem_ctx, global_loadparm), ctx->event_ctx);
c = finddcs_send(mem_ctx, io->in.domain_name, io->in.name_type,
NULL, ctx->name_res_methods, ctx->event_ctx, msg_ctx);
diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c
index 9511989e8c..c49d800d40 100644
--- a/source4/libnet/libnet_samsync_ldb.c
+++ b/source4/libnet/libnet_samsync_ldb.c
@@ -1191,7 +1191,9 @@ static NTSTATUS libnet_samsync_ldb_init(TALLOC_CTX *mem_ctx,
}
ldap_url = talloc_asprintf(state, "ldap://%s", server);
- state->remote_ldb = ldb_wrap_connect(mem_ctx, ldap_url,
+ state->remote_ldb = ldb_wrap_connect(mem_ctx,
+ global_loadparm,
+ ldap_url,
NULL, state->samsync_state->machine_net_ctx->cred,
0, NULL);
if (!state->remote_ldb) {
@@ -1217,7 +1219,9 @@ NTSTATUS libnet_samsync_ldb(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, str
state->secrets = NULL;
state->trusted_domains = NULL;
- state->sam_ldb = ldb_wrap_connect(mem_ctx, lp_sam_url(global_loadparm),
+ state->sam_ldb = ldb_wrap_connect(mem_ctx,
+ global_loadparm,
+ lp_sam_url(global_loadparm),
r->in.session_info,
ctx->cred, 0, NULL);
diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c
index 643b97bc8b..40b1aab215 100644
--- a/source4/libnet/libnet_unbecome_dc.c
+++ b/source4/libnet/libnet_unbecome_dc.c
@@ -27,6 +27,7 @@
#include "dsdb/samdb/samdb.h"
#include "dsdb/common/flags.h"
#include "librpc/gen_ndr/ndr_drsuapi_c.h"
+#include "param/param.h"
/*****************************************************************************
* Windows 2003 (w2k3) does the following steps when changing the server role
@@ -307,7 +308,7 @@ static NTSTATUS unbecomeDC_ldap_connect(struct libnet_UnbecomeDC_state *s)
url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name);
NT_STATUS_HAVE_NO_MEMORY(url);
- s->ldap.ldb = ldb_wrap_connect(s, url,
+ s->ldap.ldb = ldb_wrap_connect(s, global_loadparm, url,
NULL,
s->libnet->cred,
0, NULL);
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c
index 299d5be894..2789873c59 100644
--- a/source4/nbt_server/wins/winsdb.c
+++ b/source4/nbt_server/wins/winsdb.c
@@ -992,7 +992,7 @@ static BOOL winsdb_check_or_add_module_list(struct winsdb_handle *h)
flags |= LDB_FLG_NOSYNC;
}
- h->ldb = ldb_wrap_connect(h, lock_path(h, lp_wins_url(global_loadparm)),
+ h->ldb = ldb_wrap_connect(h, global_loadparm, lock_path(h, global_loadparm, lp_wins_url(global_loadparm)),
NULL, NULL, flags, NULL);
if (!h->ldb) goto failed;
@@ -1025,7 +1025,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, enum winsdb_handle_cal
flags |= LDB_FLG_NOSYNC;
}
- h->ldb = ldb_wrap_connect(h, lock_path(h, lp_wins_url(global_loadparm)),
+ h->ldb = ldb_wrap_connect(h, global_loadparm, lock_path(h, global_loadparm, lp_wins_url(global_loadparm)),
NULL, NULL, flags, NULL);
if (!h->ldb) goto failed;
diff --git a/source4/ntptr/ntptr_base.c b/source4/ntptr/ntptr_base.c
index 5735dbe936..379c4e5413 100644
--- a/source4/ntptr/ntptr_base.c
+++ b/source4/ntptr/ntptr_base.c
@@ -72,7 +72,7 @@ NTSTATUS ntptr_register(const void *_ops)
NTSTATUS ntptr_init(void)
{
init_module_fn static_init[] = STATIC_ntptr_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, "ntptr");
+ init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "ntptr");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
index 02808bfbc8..4046c1bdbd 100644
--- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
+++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
@@ -43,7 +43,7 @@
*/
static struct ldb_context *sptr_db_connect(TALLOC_CTX *mem_ctx)
{
- return ldb_wrap_connect(mem_ctx, lp_spoolss_url(global_loadparm), system_session(mem_ctx),
+ return ldb_wrap_connect(mem_ctx, global_loadparm, lp_spoolss_url(global_loadparm), system_session(mem_ctx),
NULL, 0, NULL);
}
diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c
index 39e4ca73ea..c837e5898b 100644
--- a/source4/ntvfs/ntvfs_base.c
+++ b/source4/ntvfs/ntvfs_base.c
@@ -200,7 +200,7 @@ NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, e
NTSTATUS ntvfs_init(void)
{
init_module_fn static_init[] = STATIC_ntvfs_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, "ntvfs");
+ init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "ntvfs");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c
index 53ac7faa7e..a13d02c12e 100644
--- a/source4/ntvfs/sysdep/sys_notify.c
+++ b/source4/ntvfs/sysdep/sys_notify.c
@@ -131,7 +131,7 @@ _PUBLIC_ NTSTATUS sys_notify_init(void)
if (initialized) return NT_STATUS_OK;
initialized = True;
- shared_init = load_samba_modules(NULL, "sys_notify");
+ shared_init = load_samba_modules(NULL, global_loadparm, "sys_notify");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/param/secrets.c b/source4/param/secrets.c
index 4107526d75..829341a5f9 100644
--- a/source4/param/secrets.c
+++ b/source4/param/secrets.c
@@ -108,7 +108,7 @@ struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx)
return NULL;
}
- path = private_path(mem_ctx, url);
+ path = private_path(mem_ctx, global_loadparm, url);
if (!path) {
return NULL;
}
@@ -117,7 +117,7 @@ struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx)
/* Secrets.ldb *must* always be local. If we call for a
* system_session() we will recurse */
- ldb = ldb_wrap_connect(mem_ctx, path, NULL, NULL, 0, NULL);
+ ldb = ldb_wrap_connect(mem_ctx, global_loadparm, path, NULL, NULL, 0, NULL);
talloc_free(path);
if (!ldb) {
return NULL;
diff --git a/source4/param/share.c b/source4/param/share.c
index dabd4e8d26..d0a570eeca 100644
--- a/source4/param/share.c
+++ b/source4/param/share.c
@@ -152,7 +152,7 @@ NTSTATUS share_get_context(TALLOC_CTX *mem_ctx, struct share_context **ctx)
NTSTATUS share_init(void)
{
init_module_fn static_init[] = STATIC_share_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, "share");
+ init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "share");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c
index 586000f503..5ddf0e3511 100644
--- a/source4/param/share_ldb.c
+++ b/source4/param/share_ldb.c
@@ -37,10 +37,10 @@ static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, stru
return NT_STATUS_NO_MEMORY;
}
- sdb = ldb_wrap_connect( *ctx,
- private_path(*ctx, "share.ldb"),
- system_session(*ctx),
- NULL, 0, NULL);
+ sdb = ldb_wrap_connect(*ctx, global_loadparm,
+ private_path(*ctx, global_loadparm, "share.ldb"),
+ system_session(*ctx),
+ NULL, 0, NULL);
if (!sdb) {
talloc_free(*ctx);
@@ -569,22 +569,21 @@ done:
return ret;
}
+static const struct share_ops ops = {
+ .name = "ldb",
+ .init = sldb_init,
+ .string_option = sldb_string_option,
+ .int_option = sldb_int_option,
+ .bool_option = sldb_bool_option,
+ .string_list_option = sldb_string_list_option,
+ .list_all = sldb_list_all,
+ .get_config = sldb_get_config,
+ .create = sldb_create,
+ .set = sldb_set,
+ .remove = sldb_remove
+};
+
NTSTATUS share_ldb_init(void)
{
- static struct share_ops ops = {
- .name = "ldb",
- .init = sldb_init,
- .string_option = sldb_string_option,
- .int_option = sldb_int_option,
- .bool_option = sldb_bool_option,
- .string_list_option = sldb_string_list_option,
- .list_all = sldb_list_all,
- .get_config = sldb_get_config,
- .create = sldb_create,
- .set = sldb_set,
- .remove = sldb_remove
- };
-
return share_register(&ops);
}
-
diff --git a/source4/param/util.c b/source4/param/util.c
index 25959c4919..9c682a7791 100644
--- a/source4/param/util.c
+++ b/source4/param/util.c
@@ -35,20 +35,26 @@
*/
+_PUBLIC_ bool lp_is_mydomain(struct loadparm_context *lp_ctx,
+ const char *domain)
+{
+ return strequal(lp_workgroup(lp_ctx), domain);
+}
+
/**
see if a string matches either our primary or one of our secondary
netbios aliases. do a case insensitive match
*/
-_PUBLIC_ bool is_myname(const char *name)
+_PUBLIC_ bool lp_is_myname(struct loadparm_context *lp_ctx, const char *name)
{
const char **aliases;
int i;
- if (strcasecmp(name, lp_netbios_name(global_loadparm)) == 0) {
+ if (strcasecmp(name, lp_netbios_name(lp_ctx)) == 0) {
return True;
}
- aliases = lp_netbios_aliases(global_loadparm);
+ aliases = lp_netbios_aliases(lp_ctx);
for (i=0; aliases && aliases[i]; i++) {
if (strcasecmp(name, aliases[i]) == 0) {
return True;
@@ -62,7 +68,8 @@ _PUBLIC_ bool is_myname(const char *name)
/**
A useful function for returning a path in the Samba lock directory.
**/
-_PUBLIC_ char *lock_path(TALLOC_CTX* mem_ctx, const char *name)
+_PUBLIC_ char *lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
+ const char *name)
{
char *fname, *dname;
if (name == NULL) {
@@ -72,29 +79,7 @@ _PUBLIC_ char *lock_path(TALLOC_CTX* mem_ctx, const char *name)
return talloc_strdup(mem_ctx, name);
}
- dname = talloc_strdup(mem_ctx, lp_lockdir(global_loadparm));
- trim_string(dname,"","/");
-
- if (!directory_exist(dname)) {
- mkdir(dname,0755);
- }
-
- fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);
-
- talloc_free(dname);
-
- return fname;
-}
-
-
-/**
- A useful function for returning a path in the Samba piddir directory.
-**/
-static char *pid_path(TALLOC_CTX* mem_ctx, const char *name)
-{
- char *fname, *dname;
-
- dname = talloc_strdup(mem_ctx, lp_piddir(global_loadparm));
+ dname = talloc_strdup(mem_ctx, lp_lockdir(lp_ctx));
trim_string(dname,"","/");
if (!directory_exist(dname)) {
@@ -108,22 +93,6 @@ static char *pid_path(TALLOC_CTX* mem_ctx, const char *name)
return fname;
}
-
-/**
- * @brief Returns an absolute path to a file in the Samba lib directory.
- *
- * @param name File to find, relative to DATADIR.
- *
- * @retval Pointer to a talloc'ed string containing the full path.
- **/
-
-_PUBLIC_ char *data_path(TALLOC_CTX* mem_ctx, const char *name)
-{
- char *fname;
- fname = talloc_asprintf(mem_ctx, "%s/%s", dyn_DATADIR, name);
- return fname;
-}
-
/**
* @brief Returns an absolute path to a file in the directory containing the current config file
*
@@ -132,10 +101,11 @@ _PUBLIC_ char *data_path(TALLOC_CTX* mem_ctx, const char *name)
* @retval Pointer to a talloc'ed string containing the full path.
**/
-_PUBLIC_ char *config_path(TALLOC_CTX* mem_ctx, const char *name)
+_PUBLIC_ char *config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
+ const char *name)
{
char *fname, *config_dir, *p;
- config_dir = talloc_strdup(mem_ctx, lp_configfile(global_loadparm));
+ config_dir = talloc_strdup(mem_ctx, lp_configfile(lp_ctx));
p = strrchr(config_dir, '/');
if (!p) {
return NULL;
@@ -154,7 +124,9 @@ _PUBLIC_ char *config_path(TALLOC_CTX* mem_ctx, const char *name)
*
* @retval Pointer to a talloc'ed string containing the full path.
**/
-_PUBLIC_ char *private_path(TALLOC_CTX* mem_ctx, const char *name)
+_PUBLIC_ char *private_path(TALLOC_CTX* mem_ctx,
+ struct loadparm_context *lp_ctx,
+ const char *name)
{
char *fname;
if (name == NULL) {
@@ -163,7 +135,7 @@ _PUBLIC_ char *private_path(TALLOC_CTX* mem_ctx, const char *name)
if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
return talloc_strdup(mem_ctx, name);
}
- fname = talloc_asprintf(mem_ctx, "%s/%s", lp_private_dir(global_loadparm), name);
+ fname = talloc_asprintf(mem_ctx, "%s/%s", lp_private_dir(lp_ctx), name);
return fname;
}
@@ -172,11 +144,13 @@ _PUBLIC_ char *private_path(TALLOC_CTX* mem_ctx, const char *name)
for smbd go. If NULL is passed for name then return the directory
path itself
*/
-_PUBLIC_ char *smbd_tmp_path(TALLOC_CTX *mem_ctx, const char *name)
+_PUBLIC_ char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
+ const char *name)
{
char *fname, *dname;
- dname = pid_path(mem_ctx, "smbd.tmp");
+ dname = private_path(mem_ctx, lp_ctx, "smbd.tmp");
if (!directory_exist(dname)) {
mkdir(dname,0755);
}
@@ -276,12 +250,13 @@ _PUBLIC_ bool run_init_functions(init_module_fn *fns)
return ret;
}
-static char *modules_path(TALLOC_CTX* mem_ctx, const char *name)
+static char *modules_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
+ const char *name)
{
const char *env_moduledir = getenv("LD_SAMBA_MODULE_PATH");
return talloc_asprintf(mem_ctx, "%s/%s",
- env_moduledir?env_moduledir:lp_modulesdir(global_loadparm),
- name);
+ env_moduledir?env_moduledir:lp_modulesdir(lp_ctx),
+ name);
}
/**
@@ -290,9 +265,9 @@ static char *modules_path(TALLOC_CTX* mem_ctx, const char *name)
* Will return an array of function pointers to initialization functions
*/
-_PUBLIC_ init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, const char *subsystem)
+_PUBLIC_ init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *subsystem)
{
- char *path = modules_path(mem_ctx, subsystem);
+ char *path = modules_path(mem_ctx, lp_ctx, subsystem);
init_module_fn *ret;
ret = load_modules(mem_ctx, path);
@@ -302,4 +277,9 @@ _PUBLIC_ init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, const char *sub
return ret;
}
+_PUBLIC_ const char *lp_messaging_path(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx)
+{
+ return smbd_tmp_path(mem_ctx, lp_ctx, "messaging");
+}
diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c
index 62666b09ba..802c8b6df8 100644
--- a/source4/rpc_server/service_rpc.c
+++ b/source4/rpc_server/service_rpc.c
@@ -446,7 +446,7 @@ static NTSTATUS dcesrv_init(struct event_context *event_context,
NTSTATUS server_service_rpc_init(void)
{
init_module_fn static_init[] = STATIC_dcerpc_server_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, "dcerpc_server");
+ init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "dcerpc_server");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c
index 91e58873df..8a3ce245d2 100644
--- a/source4/scripting/ejs/smbcalls.c
+++ b/source4/scripting/ejs/smbcalls.c
@@ -184,7 +184,7 @@ void smb_setup_ejs_functions(void (*exception_handler)(const char *))
smb_setup_ejs_param();
smb_setup_ejs_literal();
- shared_init = load_samba_modules(NULL, "smbcalls");
+ shared_init = load_samba_modules(NULL, global_loadparm, "smbcalls");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/scripting/ejs/smbcalls_auth.c b/source4/scripting/ejs/smbcalls_auth.c
index dcb0f73909..e5b1aab3c2 100644
--- a/source4/scripting/ejs/smbcalls_auth.c
+++ b/source4/scripting/ejs/smbcalls_auth.c
@@ -30,9 +30,11 @@
#include "libcli/security/security.h"
static int ejs_doauth(MprVarHandle eid,
- TALLOC_CTX *tmp_ctx, struct MprVar *auth, const char *username,
- const char *password, const char *domain, const char *workstation,
- struct socket_address *remote_host, const char **auth_types)
+ TALLOC_CTX *tmp_ctx, struct MprVar *auth,
+ const char *username, const char *password,
+ const char *domain, const char *workstation,
+ struct socket_address *remote_host,
+ const char **auth_types)
{
struct auth_usersupplied_info *user_info = NULL;
struct auth_serversupplied_info *server_info = NULL;
@@ -54,7 +56,7 @@ static int ejs_doauth(MprVarHandle eid,
} else {
/* Hope we can find the event context somewhere up there... */
ev = event_context_find(tmp_ctx);
- msg = messaging_client_init(tmp_ctx, ev);
+ msg = messaging_client_init(tmp_ctx, global_loadparm, ev);
}
if (auth_types) {
diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c
index 1e55d1c563..42105e7965 100644
--- a/source4/scripting/ejs/smbcalls_ldb.c
+++ b/source4/scripting/ejs/smbcalls_ldb.c
@@ -452,7 +452,7 @@ static int ejs_ldbConnect(MprVarHandle eid, int argc, char **argv)
dbfile = argv[0];
- ldb = ldb_wrap_connect(mprMemCtx(), dbfile,
+ ldb = ldb_wrap_connect(mprMemCtx(), global_loadparm, dbfile,
session_info, creds,
0, (const char **)(argv+1));
if (ldb == NULL) {
diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c
index b95681d4ef..5d7c674208 100644
--- a/source4/scripting/ejs/smbcalls_rpc.c
+++ b/source4/scripting/ejs/smbcalls_rpc.c
@@ -78,7 +78,9 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv)
/* create a messaging context, looping as we have no way to
allocate temporary server ids automatically */
for (i=0;i<10000;i++) {
- p->msg_ctx = messaging_init(p, cluster_id(EJS_ID_BASE + i), ev);
+ p->msg_ctx = messaging_init(p,
+ lp_messaging_path(p, global_loadparm),
+ cluster_id(EJS_ID_BASE + i), ev);
if (p->msg_ctx) break;
}
if (p->msg_ctx == NULL) {
diff --git a/source4/smb_server/smb/negprot.c b/source4/smb_server/smb/negprot.c
index a35f86367b..835aa67302 100644
--- a/source4/smb_server/smb/negprot.c
+++ b/source4/smb_server/smb/negprot.c
@@ -281,7 +281,7 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice)
capabilities |= CAP_LARGE_READX | CAP_LARGE_WRITEX | CAP_W2K_SMBS;
}
- large_test_path = lock_path(req, "large_test.dat");
+ large_test_path = lock_path(req, global_loadparm, "large_test.dat");
if (large_file_support(large_test_path)) {
capabilities |= CAP_LARGE_FILES;
}
diff --git a/source4/smbd/process_model.c b/source4/smbd/process_model.c
index e11e6193fe..bb4d3a53bb 100644
--- a/source4/smbd/process_model.c
+++ b/source4/smbd/process_model.c
@@ -83,7 +83,7 @@ _PUBLIC_ NTSTATUS register_process_model(const void *_ops)
NTSTATUS process_model_init(void)
{
init_module_fn static_init[] = STATIC_process_model_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, "process_model");
+ init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "process_model");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 7d84ffe812..e86ddc910b 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -93,7 +93,7 @@ static void cleanup_tmp_files(void)
char *path;
TALLOC_CTX *mem_ctx = talloc_new(NULL);
- path = smbd_tmp_path(mem_ctx, NULL);
+ path = smbd_tmp_path(mem_ctx, global_loadparm, NULL);
recursive_delete(path);
talloc_free(mem_ctx);
@@ -296,7 +296,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
process_model_init();
- shared_init = load_samba_modules(NULL, "service");
+ shared_init = load_samba_modules(NULL, global_loadparm, "service");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c
index 1f1f92b495..31107df032 100644
--- a/source4/smbd/service_stream.c
+++ b/source4/smbd/service_stream.c
@@ -181,7 +181,9 @@ static void stream_new_connection(struct event_context *ev,
}
/* setup to receive internal messages on this connection */
- srv_conn->msg_ctx = messaging_init(srv_conn, srv_conn->server_id, ev);
+ srv_conn->msg_ctx = messaging_init(srv_conn,
+ lp_messaging_path(srv_conn, global_loadparm),
+ srv_conn->server_id, ev);
if (!srv_conn->msg_ctx) {
stream_terminate_connection(srv_conn, "messaging_init() failed");
return;
diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c
index cab5c7e112..c77cae4185 100644
--- a/source4/smbd/service_task.c
+++ b/source4/smbd/service_task.c
@@ -25,6 +25,7 @@
#include "smbd/service.h"
#include "smbd/service_task.h"
#include "lib/messaging/irpc.h"
+#include "param/param.h"
/*
terminate a task service
@@ -64,7 +65,9 @@ static void task_server_callback(struct event_context *event_ctx,
task->model_ops = state->model_ops;
task->server_id = server_id;
- task->msg_ctx = messaging_init(task, task->server_id, task->event_ctx);
+ task->msg_ctx = messaging_init(task,
+ lp_messaging_path(task, global_loadparm),
+ task->server_id, task->event_ctx);
if (!task->msg_ctx) {
task_server_terminate(task, "messaging_init() failed");
return;
diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c
index f754880d0b..4da758cac4 100644
--- a/source4/torture/ldap/schema.c
+++ b/source4/torture/ldap/schema.c
@@ -31,6 +31,8 @@
#include "torture/torture.h"
#include "torture/ldap/proto.h"
+#include "param/param.h"
+
struct test_rootDSE {
const char *defaultdn;
const char *rootdn;
@@ -374,7 +376,7 @@ BOOL torture_ldap_schema(struct torture_context *torture)
url = talloc_asprintf(torture, "ldap://%s/", host);
- ldb = ldb_wrap_connect(torture, url,
+ ldb = ldb_wrap_connect(torture, global_loadparm, url,
NULL,
cmdline_credentials,
0, NULL);
diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c
index 0ff9948cad..f8d00eaa4d 100644
--- a/source4/torture/ldap/uptodatevector.c
+++ b/source4/torture/ldap/uptodatevector.c
@@ -34,6 +34,8 @@
#include "librpc/ndr/libndr.h"
#include "librpc/gen_ndr/ndr_drsblobs.h"
+#include "param/param.h"
+
static bool test_check_uptodatevector(struct torture_context *torture,
struct ldb_context *ldb,
struct ldb_dn *partition_dn)
@@ -158,7 +160,7 @@ BOOL torture_ldap_uptodatevector(struct torture_context *torture)
url = talloc_asprintf(torture, "ldap://%s/", host);
if (!url) goto failed;
- ldb = ldb_wrap_connect(torture, url,
+ ldb = ldb_wrap_connect(torture, global_loadparm, url,
NULL,
cmdline_credentials,
0, NULL);
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index c5372eff08..5738e5c620 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -256,7 +256,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
DEBUG(0,("Open the SAM LDB with system credentials: %s\n", s->path.samdb_ldb));
- s->ldb = ldb_wrap_connect(s, s->path.samdb_ldb,
+ s->ldb = ldb_wrap_connect(s, global_loadparm, s->path.samdb_ldb,
system_session(s),
NULL, 0, NULL);
if (!s->ldb) {
@@ -484,7 +484,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
s->schema = NULL;
DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema: %s\n", s->path.samdb_ldb));
- s->ldb = ldb_wrap_connect(s, s->path.samdb_ldb,
+ s->ldb = ldb_wrap_connect(s, global_loadparm, s->path.samdb_ldb,
system_session(s),
NULL, 0, NULL);
if (!s->ldb) {
@@ -817,7 +817,7 @@ BOOL torture_net_become_dc(struct torture_context *torture)
s->schema = NULL;
DEBUG(0,("Reopen the SAM LDB with system credentials and all replicated data: %s\n", s->path.samdb_ldb));
- s->ldb = ldb_wrap_connect(s, s->path.samdb_ldb,
+ s->ldb = ldb_wrap_connect(s, global_loadparm, s->path.samdb_ldb,
system_session(s),
NULL, 0, NULL);
if (!s->ldb) {
diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index fb4e5c3c3a..b6c1a43d48 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -26,6 +26,7 @@
#include "lib/ldb/include/ldb_errors.h"
#include "lib/db_wrap.h"
#include "torture/torture.h"
+#include "param/param.h"
float tdb_speed;
@@ -174,7 +175,7 @@ static BOOL test_ldb_speed(struct torture_context *torture, const void *_data)
torture_comment(torture, "Testing ldb speed for sidmap\n");
- ldb = ldb_wrap_connect(tmp_ctx, "tdb://test.ldb",
+ ldb = ldb_wrap_connect(tmp_ctx, global_loadparm, "tdb://test.ldb",
NULL, NULL, LDB_FLG_NOSYNC, NULL);
if (!ldb) {
unlink("./test.ldb");
diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c
index ad1b22ca6f..70f9ac1e5f 100644
--- a/source4/torture/local/irpc.c
+++ b/source4/torture/local/irpc.c
@@ -220,11 +220,13 @@ static BOOL irpc_setup(struct torture_context *tctx, void **_data)
data->ev = tctx->ev;
torture_assert(tctx, data->msg_ctx1 =
messaging_init(tctx,
+ lp_messaging_path(tctx, global_loadparm),
cluster_id(MSG_ID1), data->ev),
"Failed to init first messaging context");
torture_assert(tctx, data->msg_ctx2 =
messaging_init(tctx,
+ lp_messaging_path(tctx, global_loadparm),
cluster_id(MSG_ID2), data->ev),
"Failed to init second messaging context");
diff --git a/source4/torture/local/messaging.c b/source4/torture/local/messaging.c
index 6834c82fae..bf2b83a0e4 100644
--- a/source4/torture/local/messaging.c
+++ b/source4/torture/local/messaging.c
@@ -72,16 +72,21 @@ static bool test_ping_speed(struct torture_context *tctx)
ev = tctx->ev;
- msg_server_ctx = messaging_init(mem_ctx, cluster_id(1), ev);
+ msg_server_ctx = messaging_init(mem_ctx,
+ lp_messaging_path(tctx, global_loadparm),
+ cluster_id(1), ev);
torture_assert(tctx, msg_server_ctx != NULL, "Failed to init ping messaging context");
messaging_register_tmp(msg_server_ctx, NULL, ping_message, &msg_ping);
messaging_register_tmp(msg_server_ctx, mem_ctx, exit_message, &msg_exit);
- msg_client_ctx = messaging_init(mem_ctx, cluster_id(2), ev);
+ msg_client_ctx = messaging_init(mem_ctx,
+ lp_messaging_path(mem_ctx, global_loadparm),
+ cluster_id(2), ev);
- torture_assert(tctx, msg_client_ctx != NULL, "msg_client_ctx messaging_init() failed");
+ torture_assert(tctx, msg_client_ctx != NULL,
+ "msg_client_ctx messaging_init() failed");
messaging_register_tmp(msg_client_ctx, &pong_count, pong_message, &msg_pong);
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 0a0abc5740..278228f731 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -68,7 +68,7 @@ struct test_spoolss_context {
#endif
#define COMPARE_UINT32(tctx, c, r, e) do {\
- _CHECK_FIELD_SIZE(c, r, e,uint32_t); \
+ _CHECK_FIELD_SIZE(c, r, e, uint32_t); \
torture_assert_int_equal(tctx, c.e, r.e, "invalid value"); \
} while(0)
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 2a1e731303..44a0d3b4c2 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -65,7 +65,7 @@ struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx,
int torture_init(void)
{
init_module_fn static_init[] = STATIC_torture_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, "torture");
+ init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "torture");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c
index a375158060..d7e7c164b6 100644
--- a/source4/torture/winbind/struct_based.c
+++ b/source4/torture/winbind/struct_based.c
@@ -141,7 +141,8 @@ static bool torture_winbind_struct_priv_pipe_dir(struct torture_context *torture
torture_assert(torture, got_dir, "NULL WINBINDD_PRIV_PIPE_DIR\n");
- default_dir = lock_path(torture, WINBINDD_PRIV_SOCKET_SUBDIR);
+ default_dir = lock_path(torture, global_loadparm,
+ WINBINDD_PRIV_SOCKET_SUBDIR);
expected_dir = torture_setting_string(torture,
"winbindd private pipe dir",
default_dir);
diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c
index 8d9ff4ff0c..2fa393a9d4 100644
--- a/source4/utils/ntlm_auth.c
+++ b/source4/utils/ntlm_auth.c
@@ -461,7 +461,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
if (!ev) {
exit(1);
}
- msg = messaging_client_init(state, ev);
+ msg = messaging_client_init(state, global_loadparm, ev);
if (!msg) {
exit(1);
}
diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c
index 3ca2b02f4a..4c8a9f9355 100644
--- a/source4/winbind/wb_samba3_cmd.c
+++ b/source4/winbind/wb_samba3_cmd.c
@@ -112,7 +112,7 @@ NTSTATUS wbsrv_samba3_priv_pipe_dir(struct wbsrv_samba3_call *s3call)
{
s3call->response.result = WINBINDD_OK;
s3call->response.extra_data.data =
- smbd_tmp_path(s3call, WINBINDD_SAMBA3_PRIVILEGED_SOCKET);
+ smbd_tmp_path(s3call, global_loadparm, WINBINDD_SAMBA3_PRIVILEGED_SOCKET);
NT_STATUS_HAVE_NO_MEMORY(s3call->response.extra_data.data);
return NT_STATUS_OK;
}
diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c
index 161168e049..3e27f31429 100644
--- a/source4/winbind/wb_server.c
+++ b/source4/winbind/wb_server.c
@@ -166,7 +166,7 @@ static void winbind_task_init(struct task_server *task)
listen_socket = talloc(service, struct wbsrv_listen_socket);
if (!listen_socket) goto nomem;
listen_socket->socket_path =
- smbd_tmp_path(listen_socket,
+ smbd_tmp_path(listen_socket, global_loadparm,
WINBINDD_SAMBA3_PRIVILEGED_SOCKET);
if (!listen_socket->socket_path) goto nomem;
listen_socket->service = service;
diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c
index 9e7e87887a..f4b48ae916 100644
--- a/source4/wrepl_server/wrepl_server.c
+++ b/source4/wrepl_server/wrepl_server.c
@@ -35,8 +35,9 @@
static struct ldb_context *wins_config_db_connect(TALLOC_CTX *mem_ctx)
{
- return ldb_wrap_connect(mem_ctx, private_path(mem_ctx,
- lp_wins_config_url(global_loadparm)),
+ return ldb_wrap_connect(mem_ctx, global_loadparm, private_path(mem_ctx,
+ global_loadparm,
+ lp_wins_config_url(global_loadparm)),
system_session(mem_ctx), NULL, 0, NULL);
}