1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

libsmbconf: add get_includes() and set_includes() to the API.

Includes have to get a special treatment, at least for registry.
Includes are not like other smbconf parameters: they are some kind
of metainformation. "include" has two effects when stated twice so
it can not be stored boldly into registry, since there can only be
one value named "include" in registry per key.

I will provide special handling for includes for the registry backend.

This patch provides the necessary methods in the smbconf API.

Michael
(This used to be commit e86eb375d9f83f73aeea0a16c8b43e2ef21a6e20)
This commit is contained in:
Michael Adam 2008-04-08 01:56:32 +02:00
parent df6b68b073
commit 8e97662899
5 changed files with 73 additions and 2 deletions

View File

@ -335,3 +335,25 @@ WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx,
return werr;
}
WERROR smbconf_get_includes(struct smbconf_ctx *ctx,
const char *service,
uint32_t *num_includes, char ***includes)
{
if (!smbconf_share_exists(ctx, service)) {
return WERR_NO_SUCH_SERVICE;
}
return ctx->ops->get_includes(ctx, service, num_includes, includes);
}
WERROR smbconf_set_includes(struct smbconf_ctx *ctx,
const char *service,
uint32_t num_includes, const char **includes)
{
if (!smbconf_share_exists(ctx, service)) {
return WERR_NO_SUCH_SERVICE;
}
return ctx->ops->set_includes(ctx, service, num_includes, includes);
}

View File

@ -86,5 +86,11 @@ WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx,
const char *service, const char *param);
WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx,
const char *param);
WERROR smbconf_get_includes(struct smbconf_ctx *ctx,
const char *service,
uint32_t *num_includes, char ***includes);
WERROR smbconf_set_includes(struct smbconf_ctx *ctx,
const char *service,
uint32_t num_includes, const char **includes);
#endif /* _LIBSMBCONF_H_ */

View File

@ -51,6 +51,12 @@ struct smbconf_ops {
char **valstr);
WERROR (*delete_parameter)(struct smbconf_ctx *ctx,
const char *service, const char *param);
WERROR (*get_includes)(struct smbconf_ctx *ctx,
const char *service,
uint32_t *num_includes, char ***includes);
WERROR (*set_includes)(struct smbconf_ctx *ctx,
const char *service,
uint32_t num_includes, const char **includes);
};
struct smbconf_ctx {

View File

@ -776,6 +776,23 @@ done:
return werr;
}
static WERROR smbconf_reg_get_includes(struct smbconf_ctx *ctx,
const char *service,
uint32_t *num_includes,
char ***includes)
{
return WERR_NOT_SUPPORTED;
}
static WERROR smbconf_reg_set_includes(struct smbconf_ctx *ctx,
const char *service,
uint32_t num_includes,
const char **includes)
{
return WERR_NOT_SUPPORTED;
}
struct smbconf_ops smbconf_ops_reg = {
.init = smbconf_reg_init,
.shutdown = smbconf_reg_shutdown,
@ -790,7 +807,9 @@ struct smbconf_ops smbconf_ops_reg = {
.delete_share = smbconf_reg_delete_share,
.set_parameter = smbconf_reg_set_parameter,
.get_parameter = smbconf_reg_get_parameter,
.delete_parameter = smbconf_reg_delete_parameter
.delete_parameter = smbconf_reg_delete_parameter,
.get_includes = smbconf_reg_get_includes,
.set_includes = smbconf_reg_set_includes,
};

View File

@ -494,6 +494,22 @@ static WERROR smbconf_txt_delete_parameter(struct smbconf_ctx *ctx,
return WERR_NOT_SUPPORTED;
}
static WERROR smbconf_txt_get_includes(struct smbconf_ctx *ctx,
const char *service,
uint32_t *num_includes,
char ***includes)
{
return WERR_NOT_SUPPORTED;
}
static WERROR smbconf_txt_set_includes(struct smbconf_ctx *ctx,
const char *service,
uint32_t num_includes,
const char **includes)
{
return WERR_NOT_SUPPORTED;
}
static struct smbconf_ops smbconf_ops_txt = {
.init = smbconf_txt_init,
.shutdown = smbconf_txt_shutdown,
@ -508,7 +524,9 @@ static struct smbconf_ops smbconf_ops_txt = {
.delete_share = smbconf_txt_delete_share,
.set_parameter = smbconf_txt_set_parameter,
.get_parameter = smbconf_txt_get_parameter,
.delete_parameter = smbconf_txt_delete_parameter
.delete_parameter = smbconf_txt_delete_parameter,
.get_includes = smbconf_txt_get_includes,
.set_includes = smbconf_txt_set_includes,
};