From 96a200511e884a88dcf48fa5b313b2cddb2df566 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 14 Dec 2007 00:27:31 +0100 Subject: r26443: Remove global_loadparm instances. (This used to be commit 8242c696235d1bfb402b5c276a57f36d93610545) --- source4/lib/registry/hive.c | 5 +++-- source4/lib/registry/hive.h | 5 ++++- source4/lib/registry/ldb.c | 1 + source4/lib/registry/regf.c | 6 +++--- source4/lib/registry/samba.c | 4 ++-- source4/lib/registry/tests/hive.c | 2 +- source4/lib/registry/tests/registry.c | 2 +- source4/lib/registry/tools/common.c | 3 ++- source4/lib/registry/tools/regshell.c | 2 +- source4/lib/registry/tools/regtree.c | 2 +- source4/ntvfs/posix/pvfs_resolve.c | 2 +- source4/ntvfs/print/vfs_print.c | 4 ++-- 12 files changed, 22 insertions(+), 16 deletions(-) diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c index 16534aac9c..64bee8251b 100644 --- a/source4/lib/registry/hive.c +++ b/source4/lib/registry/hive.c @@ -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; diff --git a/source4/lib/registry/hive.h b/source4/lib/registry/hive.h index d8e20d4aa2..37e5493da8 100644 --- a/source4/lib/registry/hive.h +++ b/source4/lib/registry/hive.h @@ -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); diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 11fa066a35..873e291d5b 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -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; diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 8eb5760f56..210b4c9ada 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -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); diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c index a5a60ba610..02f3363bab 100644 --- a/source4/lib/registry/samba.c +++ b/source4/lib/registry/samba.c @@ -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; diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 2a0f04eb54..04a91d42fa 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -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; diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index f0035071f2..8cb0433084 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -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); diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c index c9293cd310..29e96475e6 100644 --- a/source4/lib/registry/tools/common.c +++ b/source4/lib/registry/tools/common.c @@ -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", diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 2c692952fb..1c5157e937 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -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; diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index b267e11b43..0f47d8f8dd 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -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); } diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c index d9a60e3857..949fa131a4 100644 --- a/source4/ntvfs/posix/pvfs_resolve.c +++ b/source4/ntvfs/posix/pvfs_resolve.c @@ -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) { diff --git a/source4/ntvfs/print/vfs_print.c b/source4/ntvfs/print/vfs_print.c index 267f325dd4..aa9b11a973 100644 --- a/source4/ntvfs/print/vfs_print.c +++ b/source4/ntvfs/print/vfs_print.c @@ -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; } -- cgit