diff options
author | Michael Adam <obnox@samba.org> | 2008-04-09 22:21:15 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-04-10 01:29:01 +0200 |
commit | 87ca44723181900799985d7c3c1d02863fb8da71 (patch) | |
tree | 1f00c23167114a04277b2ad192e177c408bb40a4 /source3/lib | |
parent | 1321dda51bf3fd208d77cebafc14fec2800cc10d (diff) | |
download | samba-87ca44723181900799985d7c3c1d02863fb8da71.tar.gz samba-87ca44723181900799985d7c3c1d02863fb8da71.tar.bz2 samba-87ca44723181900799985d7c3c1d02863fb8da71.zip |
libsmbconf: add delete_includes mehtod to the api (and backend implementations)
Michael
(This used to be commit daef50e54d58a6684b6a890ebf523ca6245f0290)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/smbconf/smbconf.c | 22 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf.h | 2 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_private.h | 2 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.c | 25 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_txt_simple.c | 8 |
5 files changed, 59 insertions, 0 deletions
diff --git a/source3/lib/smbconf/smbconf.c b/source3/lib/smbconf/smbconf.c index 7c24c55781..541b163bfb 100644 --- a/source3/lib/smbconf/smbconf.c +++ b/source3/lib/smbconf/smbconf.c @@ -389,3 +389,25 @@ WERROR smbconf_set_global_includes(struct smbconf_ctx *ctx, return werr; } + + +WERROR smbconf_delete_includes(struct smbconf_ctx *ctx, const char *service) +{ + if (!smbconf_share_exists(ctx, service)) { + return WERR_NO_SUCH_SERVICE; + } + + return ctx->ops->delete_includes(ctx, service); +} + +WERROR smbconf_delete_global_includes(struct smbconf_ctx *ctx) +{ + WERROR werr; + + werr = smbconf_global_check(ctx); + if (W_ERROR_IS_OK(werr)) { + werr = smbconf_delete_includes(ctx, GLOBAL_NAME); + } + + return werr; +} diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h index a18b88f4e5..ee7549ac74 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/source3/lib/smbconf/smbconf.h @@ -99,5 +99,7 @@ WERROR smbconf_set_includes(struct smbconf_ctx *ctx, WERROR smbconf_set_global_includes(struct smbconf_ctx *ctx, uint32_t num_includes, const char **includes); +WERROR smbconf_delete_includes(struct smbconf_ctx *ctx, const char *service); +WERROR smbconf_delete_global_includes(struct smbconf_ctx *ctx); #endif /* _LIBSMBCONF_H_ */ diff --git a/source3/lib/smbconf/smbconf_private.h b/source3/lib/smbconf/smbconf_private.h index bed8f8e5ed..5acba5a40a 100644 --- a/source3/lib/smbconf/smbconf_private.h +++ b/source3/lib/smbconf/smbconf_private.h @@ -58,6 +58,8 @@ struct smbconf_ops { WERROR (*set_includes)(struct smbconf_ctx *ctx, const char *service, uint32_t num_includes, const char **includes); + WERROR (*delete_includes)(struct smbconf_ctx *ctx, + const char *service); }; struct smbconf_ctx { diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index d43c6a15f1..b262959afc 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -999,6 +999,30 @@ done: return werr; } +static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx, + const char *service) +{ + WERROR werr = WERR_OK; + struct registry_key *key = NULL; + TALLOC_CTX *tmp_ctx = talloc_stackframe(); + + werr = smbconf_reg_open_service_key(tmp_ctx, ctx, service, + REG_KEY_ALL, &key); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + if (!smbconf_value_exists(key, INCLUDES_VALNAME)) { + goto done; + } + + werr = reg_deletevalue(key, INCLUDES_VALNAME); + + +done: + TALLOC_FREE(tmp_ctx); + return werr; +} struct smbconf_ops smbconf_ops_reg = { .init = smbconf_reg_init, @@ -1017,6 +1041,7 @@ struct smbconf_ops smbconf_ops_reg = { .delete_parameter = smbconf_reg_delete_parameter, .get_includes = smbconf_reg_get_includes, .set_includes = smbconf_reg_set_includes, + .delete_includes = smbconf_reg_delete_includes, }; diff --git a/source3/lib/smbconf/smbconf_txt_simple.c b/source3/lib/smbconf/smbconf_txt_simple.c index 9164d1690a..1bea6cb8b9 100644 --- a/source3/lib/smbconf/smbconf_txt_simple.c +++ b/source3/lib/smbconf/smbconf_txt_simple.c @@ -568,6 +568,13 @@ static WERROR smbconf_txt_set_includes(struct smbconf_ctx *ctx, return WERR_NOT_SUPPORTED; } +static WERROR smbconf_txt_delete_includes(struct smbconf_ctx *ctx, + const char *service) +{ + return WERR_NOT_SUPPORTED; +} + + static struct smbconf_ops smbconf_ops_txt = { .init = smbconf_txt_init, .shutdown = smbconf_txt_shutdown, @@ -585,6 +592,7 @@ static struct smbconf_ops smbconf_ops_txt = { .delete_parameter = smbconf_txt_delete_parameter, .get_includes = smbconf_txt_get_includes, .set_includes = smbconf_txt_set_includes, + .delete_includes = smbconf_txt_delete_includes, }; |