1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

libsmbconf: add delete_includes mehtod to the api (and backend implementations)

Michael
This commit is contained in:
Michael Adam 2008-04-09 22:21:15 +02:00
parent 0dc1fd6859
commit daef50e54d
5 changed files with 59 additions and 0 deletions

View File

@ -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;
}

View File

@ -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_ */

View File

@ -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 {

View File

@ -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,
};

View File

@ -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,
};