diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/netapi/serverinfo.c | 2 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf.c | 4 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf.h | 3 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_private.h | 5 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.c | 28 | ||||
-rw-r--r-- | source3/libnet/libnet_join.c | 4 | ||||
-rw-r--r-- | source3/param/loadparm.c | 4 | ||||
-rw-r--r-- | source3/utils/net_conf.c | 2 |
8 files changed, 32 insertions, 20 deletions
diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 913338fd49..a9749a12f9 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -191,7 +191,7 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, return WERR_NOT_SUPPORTED; } - werr = smbconf_init_reg(ctx, &conf_ctx); + werr = smbconf_init_reg(ctx, &conf_ctx, NULL); if (!W_ERROR_IS_OK(werr)) { goto done; } diff --git a/source3/lib/smbconf/smbconf.c b/source3/lib/smbconf/smbconf.c index 0eee5a6c4a..756b9ec3ca 100644 --- a/source3/lib/smbconf/smbconf.c +++ b/source3/lib/smbconf/smbconf.c @@ -92,7 +92,7 @@ static WERROR smbconf_global_check(struct smbconf_ctx *ctx) * should be called. */ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, - struct smbconf_ops *ops) + const char *path, struct smbconf_ops *ops) { WERROR werr = WERR_OK; struct smbconf_ctx *ctx; @@ -108,7 +108,7 @@ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, ctx->ops = ops; - werr = ctx->ops->init(ctx); + werr = ctx->ops->init(ctx, path); if (!W_ERROR_IS_OK(werr)) { goto fail; } diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 35da36795e..23b9504971 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -35,7 +35,8 @@ struct smbconf_csn { * initialization functions for the available modules * (a dispatcher might be added in the future) */ -WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); +WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, + const char *path); /* * the smbconf API functions diff --git a/source3/lib/smbconf/smbconf_private.h b/source3/lib/smbconf/smbconf_private.h index 008ae97601..6250dc7339 100644 --- a/source3/lib/smbconf/smbconf_private.h +++ b/source3/lib/smbconf/smbconf_private.h @@ -21,7 +21,7 @@ #define __LIBSMBCONF_PRIVATE_H__ struct smbconf_ops { - WERROR (*init)(struct smbconf_ctx *ctx); + WERROR (*init)(struct smbconf_ctx *ctx, const char *path); int (*shutdown)(struct smbconf_ctx *ctx); WERROR (*open_conf)(struct smbconf_ctx *ctx); int (*close_conf)(struct smbconf_ctx *ctx); @@ -55,6 +55,7 @@ struct smbconf_ops { struct smbconf_ctx { NT_USER_TOKEN *token; + const char *path; struct smbconf_ops *ops; }; @@ -64,6 +65,6 @@ WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, const char *string); WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, - struct smbconf_ops *ops); + const char *path, struct smbconf_ops *ops); #endif diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index f0a1f17f8e..beb1c20de6 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -69,7 +69,7 @@ done: } /** - * Open a subkey of KEY_SMBCONF (i.e a service) + * Open a subkey of the base key (i.e a service) */ static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx, struct smbconf_ctx *ctx, @@ -86,7 +86,7 @@ static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx, goto done; } - path = talloc_asprintf(mem_ctx, "%s\\%s", KEY_SMBCONF, servicename); + path = talloc_asprintf(mem_ctx, "%s\\%s", ctx->path, servicename); if (path == NULL) { werr = WERR_NOMEM; goto done; @@ -100,14 +100,14 @@ done: } /** - * open the base key KEY_SMBCONF + * open the base key */ static WERROR smbconf_reg_open_base_key(TALLOC_CTX *mem_ctx, struct smbconf_ctx *ctx, uint32 desired_access, struct registry_key **key) { - return smbconf_reg_open_path(mem_ctx, ctx, KEY_SMBCONF, desired_access, + return smbconf_reg_open_path(mem_ctx, ctx, ctx->path, desired_access, key); } @@ -131,7 +131,7 @@ static bool smbconf_value_exists(struct registry_key *key, const char *param) } /** - * create a subkey of KEY_SMBCONF + * create a subkey of the base key (i.e. a service...) */ static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx, struct smbconf_ctx *ctx, @@ -372,10 +372,19 @@ done: /** * initialize the registry smbconf backend */ -static WERROR smbconf_reg_init(struct smbconf_ctx *ctx) +static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path) { WERROR werr = WERR_OK; + if (path == NULL) { + path = KEY_SMBCONF; + } + ctx->path = talloc_strdup(ctx, path); + if (ctx->path == NULL) { + werr = WERR_NOMEM; + goto done; + } + if (!registry_init_smbconf()) { werr = WERR_REG_IO_FAILURE; goto done; @@ -433,7 +442,7 @@ static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx) TALLOC_CTX* mem_ctx = talloc_stackframe(); enum winreg_CreateAction action; - path = talloc_strdup(mem_ctx, KEY_SMBCONF); + path = talloc_strdup(mem_ctx, ctx->path); if (path == NULL) { werr = WERR_NOMEM; goto done; @@ -742,7 +751,8 @@ struct smbconf_ops smbconf_ops_reg = { * initialize the smbconf registry backend * the only function that is exported from this module */ -WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx) +WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, + const char *path) { - return smbconf_init(mem_ctx, conf_ctx, &smbconf_ops_reg); + return smbconf_init(mem_ctx, conf_ctx, path, &smbconf_ops_reg); } diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 52376ac821..6d5449ff57 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1198,7 +1198,7 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) WERROR werr; struct smbconf_ctx *ctx; - werr = smbconf_init_reg(r, &ctx); + werr = smbconf_init_reg(r, &ctx, NULL); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -1242,7 +1242,7 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) WERROR werr = WERR_OK; struct smbconf_ctx *ctx; - werr = smbconf_init_reg(r, &ctx); + werr = smbconf_init_reg(r, &ctx, NULL); if (!W_ERROR_IS_OK(werr)) { goto done; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 7212969344..f61d0d8fdc 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -6497,7 +6497,7 @@ static bool process_registry_globals(bool (*pfunc)(const char *, const char *)) if (conf_ctx == NULL) { /* first time */ - werr = smbconf_init_reg(NULL, &conf_ctx); + werr = smbconf_init_reg(NULL, &conf_ctx, NULL); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -6607,7 +6607,7 @@ bool lp_file_list_changed(void) if (lp_config_backend_is_registry()) { if (conf_ctx == NULL) { WERROR werr; - werr = smbconf_init_reg(NULL, &conf_ctx); + werr = smbconf_init_reg(NULL, &conf_ctx, NULL); if (!W_ERROR_IS_OK(werr)) { DEBUG(0, ("error opening configuration: %s\n", dos_errstr(werr))); diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index cde3ab0a92..d108fe14d2 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -889,7 +889,7 @@ static int net_conf_wrap_function(int (*fn)(struct smbconf_ctx *, struct smbconf_ctx *conf_ctx; int ret = -1; - werr = smbconf_init_reg(mem_ctx, &conf_ctx); + werr = smbconf_init_reg(mem_ctx, &conf_ctx, NULL); if (!W_ERROR_IS_OK(werr)) { return -1; |