r26205: Pass loadparm_context to secrets_db_connect() rather than using global context.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 29 Nov 2007 15:01:16 +0000 (16:01 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:46:51 +0000 (05:46 +0100)
source/auth/credentials/credentials.c
source/auth/credentials/credentials_files.c
source/lib/ldb/ldb_ildap/config.mk
source/libnet/libnet_join.c
source/param/secrets.c
source/param/secrets.h
source/rpc_server/lsa/dcesrv_lsa.c

index d6c0bbc0ba27d8b8941c4ec356cdc4535fee6477..8510a1f711003f128543f1605c51b62dd961afa1 100644 (file)
@@ -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 *))
 {
index db69fc1cb4f3ac2c4deca1665a9cc67bb3ef8dbf..2d850956e2ced0ed5cd69cafb71b424283e7bce7 100644 (file)
@@ -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);
index f7ed3469f35f8c4d39225b49e18db9cf02cdaf81..83c43b6c3501c7624d8e66b74f68799557b097a3 100644 (file)
@@ -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
index d80ff34d0fd4c51035ae32033b573fd09126f7db..25ad0ca440244f6027ab13f4cacd01aad57da709 100644 (file)
@@ -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, 
index 308c5a607beecb5e0fb47b2f2c559638d2c86202..eeced9ddbe85fd0af22c45f968e0a4f6f06f8f87 100644 (file)
@@ -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;
index 5aabb849c5c1482549387671fb7f587ec804c2db..9d98db0d084c3ca721a45bf69dc8e98724ce1a1a 100644 (file)
@@ -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 */
index 93c1ee9e4d34fc8e979ff5a34c14e22532b4c095..9d1f43a21473c16fd430afb2ca4c0649ba514c3d 100644 (file)
@@ -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;