r26443: Remove global_loadparm instances.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 13 Dec 2007 23:27:31 +0000 (00:27 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:50:11 +0000 (05:50 +0100)
(This used to be commit 8242c696235d1bfb402b5c276a57f36d93610545)

12 files changed:
source4/lib/registry/hive.c
source4/lib/registry/hive.h
source4/lib/registry/ldb.c
source4/lib/registry/regf.c
source4/lib/registry/samba.c
source4/lib/registry/tests/hive.c
source4/lib/registry/tests/registry.c
source4/lib/registry/tools/common.c
source4/lib/registry/tools/regshell.c
source4/lib/registry/tools/regtree.c
source4/ntvfs/posix/pvfs_resolve.c
source4/ntvfs/print/vfs_print.c

index 16534aac9c5718bea51b2283f92c782d2ed27171..64bee8251bfc19a3ec8db9be3d3c6ac0b4e35c95 100644 (file)
@@ -27,6 +27,7 @@
 _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
                              struct auth_session_info *session_info,
                              struct cli_credentials *credentials,
+                             struct loadparm_context *lp_ctx,
                              struct hive_key **root)
 {
        int fd, num;
@@ -51,11 +52,11 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
 
        if (!strncmp(peek, "regf", 4)) {
                close(fd);
-               return reg_open_regf_file(parent_ctx, location, root);
+               return reg_open_regf_file(parent_ctx, location, lp_ctx, root);
        } else if (!strncmp(peek, "TDB file", 8)) {
                close(fd);
                return reg_open_ldb_file(parent_ctx, location, session_info,
-                                        credentials, root);
+                                        credentials, lp_ctx, root);
        }
 
        return WERR_BADFILE;
index d8e20d4aa223cb19a70139c1a1a7989e0e2369b5..37e5493da8a7801b2138b93a4b6c03047d2ef502 100644 (file)
@@ -144,6 +144,7 @@ struct auth_session_info;
 WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
                     struct auth_session_info *session_info,
                     struct cli_credentials *credentials,
+                    struct loadparm_context *lp_ctx,
                     struct hive_key **root);
 WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key,
                         const char **classname, uint32_t *num_subkeys,
@@ -183,10 +184,12 @@ WERROR hive_key_flush(struct hive_key *key);
 WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
                          const char *location, struct hive_key **key);
 WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
-                         const char *location, struct hive_key **key);
+                         const char *location, struct loadparm_context *lp_ctx,
+                         struct hive_key **key);
 WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
                         struct auth_session_info *session_info,
                         struct cli_credentials *credentials,
+                        struct loadparm_context *lp_ctx,
                         struct hive_key **k);
 
 
index 11fa066a3502ebe1b8dc8257fbe456d12a25a6fc..873e291d5b1927032c854a242d4d7185266f4bab 100644 (file)
@@ -337,6 +337,7 @@ 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 loadparm_context *lp_ctx,
                         struct hive_key **k)
 {
        struct ldb_key_data *kd;
index 8eb5760f5676481a90e1d46d4bb71ba521fcb71c..210b4c9ada1aead7fc93f874a1a455f0ff5e5e5e 100644 (file)
@@ -1942,8 +1942,8 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
        return WERR_OK;
 }
 
-WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
-                         const char *location, struct hive_key **key)
+WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location, 
+                         struct loadparm_context *lp_ctx, struct hive_key **key)
 {
        struct regf_data *regf;
        struct regf_hdr *regf_hdr;
@@ -1952,7 +1952,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
 
        regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
 
-       regf->iconv_convenience = lp_iconv_convenience(global_loadparm);
+       regf->iconv_convenience = lp_iconv_convenience(lp_ctx);
 
        W_ERROR_HAVE_NO_MEMORY(regf);
 
index a5a60ba61087b7e4e9b071079417fb4b7d283e61..02f3363bab97366e806eaf393425c5e1854cb7bf 100644 (file)
@@ -40,11 +40,11 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
                                   lp_private_dir(lp_ctx),
                                   name);
 
-       error = reg_open_hive(ctx, location, auth_info, creds, &hive);
+       error = reg_open_hive(ctx, location, auth_info, creds, lp_ctx, &hive);
 
        if (W_ERROR_EQUAL(error, WERR_NOT_FOUND))
                error = reg_open_ldb_file(ctx, location, auth_info,
-                                         creds, &hive);
+                                         creds, lp_ctx, &hive);
 
        if (!W_ERROR_IS_OK(error))
                return error;
index 2a0f04eb54fe2629f1d68189d1181cc5e863dea7..04a91d42fae7eb7b69f053460faa3fc710e14a05 100644 (file)
@@ -323,7 +323,7 @@ static bool hive_setup_ldb(struct torture_context *tctx, void **data)
 
        rmdir(dirname);
 
-       error = reg_open_ldb_file(tctx, dirname, NULL, NULL, &key);
+       error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->lp_ctx, &key);
        if (!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Unable to initialize ldb hive\n");
                return false;
index f0035071f2fc09c2a52e1f6a037cc1602a16fb1a..8cb04330844e68c97683f3b36418f5d583223f3d 100644 (file)
@@ -547,7 +547,7 @@ static bool setup_local_registry(struct torture_context *tctx, void **data)
        torture_assert_ntstatus_ok(tctx, status, "Creating temp dir failed");
 
        filename = talloc_asprintf(tctx, "%s/classes_root.ldb", tempdir);
-       error = reg_open_ldb_file(tctx, filename, NULL, NULL, &hive_key);
+       error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &hive_key);
        torture_assert_werr_ok(tctx, error, "Opening classes_root file failed");
 
        error = reg_mount_hive(rctx, hive_key, HKEY_CLASSES_ROOT, NULL);
index c9293cd3102811f0202521763224401ca4d80b4d..29e96475e6cc9a9751a6fe55cd57ca7aa93a2bf0 100644 (file)
@@ -42,13 +42,14 @@ struct registry_context *reg_common_open_remote(const char *remote,
 }
 
 struct registry_key *reg_common_open_file(const char *path,
+                                         struct loadparm_context *lp_ctx,
                                          struct cli_credentials *creds)
 {
        struct hive_key *hive_root;
        struct registry_context *h;
        WERROR error;
 
-       error = reg_open_hive(NULL, path, NULL, creds, &hive_root);
+       error = reg_open_hive(NULL, path, NULL, creds, lp_ctx, &hive_root);
 
        if(!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Unable to open '%s': %s \n",
index 2c692952fb7040cbc3de0751820b84ab927900ac..1c5157e93797aa8086275d05f849b2a312e6b364 100644 (file)
@@ -500,7 +500,7 @@ int main(int argc, char **argv)
                ctx->registry = reg_common_open_remote(remote, cmdline_lp_ctx, 
                                                       cmdline_credentials);
        } else if (file != NULL) {
-               ctx->current = reg_common_open_file(file, cmdline_credentials);
+               ctx->current = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials);
                if (ctx->current == NULL)
                        return 1;
                ctx->registry = ctx->current->context;
index b267e11b43d3dc3f78324583be855f72b49f65ce..0f47d8f8ddb0969eec1592646fdcfd2b581ec6b4 100644 (file)
@@ -131,7 +131,7 @@ int main(int argc, char **argv)
        if (remote != NULL) {
                h = reg_common_open_remote(remote, cmdline_lp_ctx, cmdline_credentials);
        } else if (file != NULL) {
-               start_key = reg_common_open_file(file, cmdline_credentials);
+               start_key = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials);
        } else {
                h = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx);
        }
index d9a60e385728df7f180bc1b206c6d8fff81a21cc..949fa131a4a0d115bb740b036eade12bff457e9c 100644 (file)
@@ -257,7 +257,7 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name,
 
        while (*p) {
                size_t c_size;
-               codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &c_size);
+               codepoint_t c = next_codepoint(lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), p, &c_size);
                switch (c) {
                case '\\':
                        if (name->has_wildcard) {
index 267f325dd4a595fe612eef7206104e179ed4dcb3..aa9b11a9737ebae0ba395441cf66a8792f4843e7 100644 (file)
@@ -83,8 +83,8 @@ static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
 
                p = (char *)io->ioctl.out.blob.data;
                SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */);
-               push_string(lp_iconv_convenience(global_loadparm), p+2, lp_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
-               push_string(lp_iconv_convenience(global_loadparm), p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
+               push_string(lp_iconv_convenience(ntvfs->ctx->lp_ctx), p+2, lp_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
+               push_string(lp_iconv_convenience(ntvfs->ctx->lp_ctx), p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
                return NT_STATUS_OK;
        }