libsmbconf: add backend specific init function.
authorMichael Adam <obnox@samba.org>
Fri, 21 Mar 2008 01:20:16 +0000 (02:20 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 21 Mar 2008 01:25:56 +0000 (02:25 +0100)
Hide generic init function taking smbconf_ops argument
from public api.

Michael

source/lib/netapi/serverinfo.c
source/lib/smbconf/smbconf.c
source/lib/smbconf/smbconf.h
source/lib/smbconf/smbconf_private.h
source/libnet/libnet_join.c
source/param/loadparm.c
source/utils/net_conf.c

index ffc5f6fd3ee24700f51a4eda08eeb57030e83d2b..913338fd4951c34657c97f824d09fe6b948ac0a8 100644 (file)
@@ -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;
        }
index 82683caa69635e1ad3215fc218792ef3bf9b4735..ceed349a092c0d3372d7789f592689ac21801972 100644 (file)
@@ -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)) {
index 33fa82e8981c10c803de0614fa6c346600e966e1..207d5797bda2567ac4ee2564be13646b055ccbf0 100644 (file)
@@ -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);
index b64da6ca73d3661f4e7128693458bb9480c0f175..72f13c74021f039b1e9cabe789d3f1f739dd0e16 100644 (file)
@@ -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
index 12081c3a10ca199d4ea71084e4da042992bbae88..d3fba167d95c2a500e7f91cd9e47171b3d7e6db6 100644 (file)
@@ -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;
        }
index bb3b6141f0e0795f1f5bc0741b646360731dc76c..72129693445c2f7f5a2513ea17ca1261e59bab06 100644 (file)
@@ -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)));
index 118196976dbf154ddf9ced0e7973c6631c605174..cde3ab0a923b67994354b0739fd851b1f3b9ad17 100644 (file)
@@ -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;