From fececde1815bf0469bb56e07cf23f54011c9b4ae Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 21 Mar 2008 02:20:16 +0100 Subject: libsmbconf: add backend specific init function. Hide generic init function taking smbconf_ops argument from public api. Michael (This used to be commit b3f6920ccb9a27fde26e889a7f1f3afaf56b784f) --- source3/lib/netapi/serverinfo.c | 2 +- source3/lib/smbconf/smbconf.c | 10 ++++++++-- source3/lib/smbconf/smbconf.h | 2 +- source3/lib/smbconf/smbconf_private.h | 3 +++ source3/libnet/libnet_join.c | 4 ++-- source3/param/loadparm.c | 4 ++-- source3/utils/net_conf.c | 2 +- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index ffc5f6fd3e..913338fd49 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(ctx, &conf_ctx); + werr = smbconf_init_reg(ctx, &conf_ctx); if (!W_ERROR_IS_OK(werr)) { goto done; } diff --git a/source3/lib/smbconf/smbconf.c b/source3/lib/smbconf/smbconf.c index 82683caa69..ceed349a09 100644 --- a/source3/lib/smbconf/smbconf.c +++ b/source3/lib/smbconf/smbconf.c @@ -781,6 +781,11 @@ struct smbconf_ops smbconf_ops_reg = { .delete_parameter = smbconf_reg_delete_parameter }; +WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx) +{ + return smbconf_init(mem_ctx, conf_ctx, &smbconf_ops_reg); +} + /********************************************************************** * @@ -801,7 +806,8 @@ struct smbconf_ops smbconf_ops_reg = { * After the work with the configuration is completed, smbconf_shutdown() * should be called. */ -WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx) +WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, + struct smbconf_ops *ops) { WERROR werr = WERR_OK; struct smbconf_ctx *ctx; @@ -815,7 +821,7 @@ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx) return WERR_NOMEM; } - ctx->ops = &smbconf_ops_reg; + ctx->ops = ops; werr = ctx->ops->init(ctx); if (!W_ERROR_IS_OK(werr)) { diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index 33fa82e898..207d5797bd 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -33,7 +33,7 @@ struct smbconf_csn { * (Backends and possibly remote support being added ...) */ -WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); +WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx); void smbconf_shutdown(struct smbconf_ctx *ctx); bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn, const char *service, const char *param); diff --git a/source3/lib/smbconf/smbconf_private.h b/source3/lib/smbconf/smbconf_private.h index b64da6ca73..72f13c7402 100644 --- a/source3/lib/smbconf/smbconf_private.h +++ b/source3/lib/smbconf/smbconf_private.h @@ -58,4 +58,7 @@ struct smbconf_ctx { struct smbconf_ops *ops; }; +WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, + struct smbconf_ops *ops); + #endif diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 12081c3a10..d3fba167d9 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1201,7 +1201,7 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) WERROR werr; struct smbconf_ctx *ctx; - werr = smbconf_init(r, &ctx); + werr = smbconf_init_reg(r, &ctx); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -1245,7 +1245,7 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) WERROR werr = WERR_OK; struct smbconf_ctx *ctx; - werr = smbconf_init(r, &ctx); + werr = smbconf_init_reg(r, &ctx); if (!W_ERROR_IS_OK(werr)) { goto done; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index bb3b6141f0..7212969344 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(NULL, &conf_ctx); + werr = smbconf_init_reg(NULL, &conf_ctx); 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(NULL, &conf_ctx); + werr = smbconf_init_reg(NULL, &conf_ctx); 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 118196976d..cde3ab0a92 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(mem_ctx, &conf_ctx); + werr = smbconf_init_reg(mem_ctx, &conf_ctx); if (!W_ERROR_IS_OK(werr)) { return -1; -- cgit