summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-11-29 16:01:16 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:46:51 +0100
commit991ee1aff092187bcfdd0ee1d9eb15361f73d5f7 (patch)
tree791d32dde17b8d4612b8526d5d81ef81a681928b
parent0e191fa26ab6f0f4119eccca0170e5ebd7f46382 (diff)
downloadsamba-991ee1aff092187bcfdd0ee1d9eb15361f73d5f7.tar.gz
samba-991ee1aff092187bcfdd0ee1d9eb15361f73d5f7.tar.bz2
samba-991ee1aff092187bcfdd0ee1d9eb15361f73d5f7.zip
r26205: Pass loadparm_context to secrets_db_connect() rather than using global context.
(This used to be commit 5718b6cfee86ddfc9cf405c98c68ba848df4d9d7)
-rw-r--r--source4/auth/credentials/credentials.c1
-rw-r--r--source4/auth/credentials/credentials_files.c2
-rw-r--r--source4/lib/ldb/ldb_ildap/config.mk2
-rw-r--r--source4/libnet/libnet_join.c2
-rw-r--r--source4/param/secrets.c11
-rw-r--r--source4/param/secrets.h6
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c6
7 files changed, 17 insertions, 13 deletions
diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c
index d6c0bbc0ba..8510a1f711 100644
--- a/source4/auth/credentials/credentials.c
+++ b/source4/auth/credentials/credentials.c
@@ -229,7 +229,6 @@ bool cli_credentials_set_principal(struct cli_credentials *cred,
/* Set a callback to get the principal. This could be a popup dialog,
* a terminal prompt or similar. */
-
bool cli_credentials_set_principal_callback(struct cli_credentials *cred,
const char *(*principal_cb) (struct cli_credentials *))
{
diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c
index db69fc1cb4..2d850956e2 100644
--- a/source4/auth/credentials/credentials_files.c
+++ b/source4/auth/credentials/credentials_files.c
@@ -212,7 +212,7 @@ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
if (!ldb) {
/* Local secrets are stored in secrets.ldb */
- ldb = secrets_db_connect(mem_ctx);
+ ldb = secrets_db_connect(mem_ctx, global_loadparm);
if (!ldb) {
/* set anonymous as the fallback, if the machine account won't work */
cli_credentials_set_anonymous(cred);
diff --git a/source4/lib/ldb/ldb_ildap/config.mk b/source4/lib/ldb/ldb_ildap/config.mk
index f7ed3469f3..83c43b6c35 100644
--- a/source4/lib/ldb/ldb_ildap/config.mk
+++ b/source4/lib/ldb/ldb_ildap/config.mk
@@ -3,7 +3,7 @@
[MODULE::ldb_ildap]
SUBSYSTEM = LIBLDB
CFLAGS = -Ilib/ldb/include
-OUTPUT_TYPE = SHARED_LIBRARY
+#OUTPUT_TYPE = SHARED_LIBRARY
PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP
INIT_FUNCTION = ldb_ildap_init
ALIASES = ldapi ldaps ldap
diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c
index d80ff34d0f..25ad0ca440 100644
--- a/source4/libnet/libnet_join.c
+++ b/source4/libnet/libnet_join.c
@@ -909,7 +909,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
* Local secrets are stored in secrets.ldb
* open it to make sure we can write the info into it after the join
*/
- ldb = secrets_db_connect(tmp_mem);
+ ldb = secrets_db_connect(tmp_mem, global_loadparm);
if (!ldb) {
r->out.error_string
= talloc_asprintf(mem_ctx,
diff --git a/source4/param/secrets.c b/source4/param/secrets.c
index 308c5a607b..eeced9ddbe 100644
--- a/source4/param/secrets.c
+++ b/source4/param/secrets.c
@@ -99,18 +99,18 @@ bool secrets_init(void)
/**
connect to the secrets ldb
*/
-struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx)
+struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
{
char *path;
const char *url;
struct ldb_context *ldb;
- url = lp_secrets_url(global_loadparm);
+ url = lp_secrets_url(lp_ctx);
if (!url || !url[0]) {
return NULL;
}
- path = private_path(mem_ctx, global_loadparm, url);
+ path = private_path(mem_ctx, lp_ctx, url);
if (!path) {
return NULL;
}
@@ -123,6 +123,9 @@ struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx)
return NULL;
}
+ ldb_set_modules_dir(ldb,
+ talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx)));
+
if (ldb_connect(ldb, path, 0, NULL) != 0) {
talloc_free(path);
return NULL;
@@ -146,7 +149,7 @@ struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
const char *attrs[] = { "objectSid", NULL };
struct dom_sid *result = NULL;
- ldb = secrets_db_connect(mem_ctx);
+ ldb = secrets_db_connect(mem_ctx, global_loadparm);
if (ldb == NULL) {
DEBUG(5, ("secrets_db_connect failed\n"));
return NULL;
diff --git a/source4/param/secrets.h b/source4/param/secrets.h
index 5aabb849c5..9d98db0d08 100644
--- a/source4/param/secrets.h
+++ b/source4/param/secrets.h
@@ -44,9 +44,9 @@ struct machine_acct_pass {
*/
void secrets_shutdown(void);
bool secrets_init(void);
-struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx);
-struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
- const char *domain);
+struct loadparm_context;
+struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
+struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx, const char *domain);
#endif /* _SECRETS_H */
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index 93c1ee9e4d..9d1f43a214 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -1713,7 +1713,8 @@ static NTSTATUS dcesrv_lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALL
return NT_STATUS_INVALID_PARAMETER;
}
- secret_state->sam_ldb = talloc_reference(secret_state, secrets_db_connect(mem_ctx));
+ secret_state->sam_ldb = talloc_reference(secret_state, secrets_db_connect(mem_ctx,
+ global_loadparm));
/* search for the secret record */
ret = gendb_search(secret_state->sam_ldb, mem_ctx,
ldb_dn_new(mem_ctx, secret_state->sam_ldb, "cn=LSA Secrets"),
@@ -1831,7 +1832,8 @@ static NTSTATUS dcesrv_lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC
}
} else {
- secret_state->sam_ldb = talloc_reference(secret_state, secrets_db_connect(mem_ctx));
+ secret_state->sam_ldb = talloc_reference(secret_state,
+ secrets_db_connect(mem_ctx, global_loadparm));
secret_state->global = false;
name = r->in.name.string;