summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/smbconf/smbconf.c22
-rw-r--r--source3/lib/smbconf/smbconf.h2
-rw-r--r--source3/lib/smbconf/smbconf_private.h2
-rw-r--r--source3/lib/smbconf/smbconf_reg.c25
-rw-r--r--source3/lib/smbconf/smbconf_txt_simple.c8
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,
};