diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-10-01 18:52:55 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:07:34 -0500 |
commit | 2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad (patch) | |
tree | 2d02f6e998c150cca5323e574ffb8094fffc288f /source4/lib | |
parent | 4d7273715f109db82a4ee4852855927a32bb4073 (diff) | |
download | samba-2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad.tar.gz samba-2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad.tar.bz2 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)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/cmdline/popt_credentials.c | 2 | ||||
-rw-r--r-- | source4/lib/db_wrap.c | 9 | ||||
-rw-r--r-- | source4/lib/db_wrap.h | 1 | ||||
-rw-r--r-- | source4/lib/dbwrap/dbwrap_tdb.c | 2 | ||||
-rw-r--r-- | source4/lib/events/events.c | 2 | ||||
-rw-r--r-- | source4/lib/gencache/gencache.c | 2 | ||||
-rw-r--r-- | source4/lib/messaging/irpc.h | 7 | ||||
-rw-r--r-- | source4/lib/messaging/messaging.c | 9 | ||||
-rw-r--r-- | source4/lib/registry/ldb.c | 10 | ||||
-rw-r--r-- | source4/lib/registry/samba.c | 10 | ||||
-rw-r--r-- | source4/lib/tls/tls.c | 12 |
11 files changed, 35 insertions, 31 deletions
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; } |