summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-04-08 15:48:01 +0200
committerMichael Adam <obnox@samba.org>2011-05-10 19:13:20 +0200
commit7af2876e4526d348a1e601f2d14776e08d4668cb (patch)
tree26fe48b14825073cc6e84e893e006fbf4b47f2f7 /lib
parent823cd472b42c276a48bd368655f28dfa9ae7d430 (diff)
downloadsamba-7af2876e4526d348a1e601f2d14776e08d4668cb.tar.gz
samba-7af2876e4526d348a1e601f2d14776e08d4668cb.tar.bz2
samba-7af2876e4526d348a1e601f2d14776e08d4668cb.zip
libsmbconf: Convert smbconf_create_share() to smbErr.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/smbconf/smbconf.c66
-rw-r--r--lib/smbconf/smbconf.h2
-rw-r--r--lib/smbconf/smbconf_private.h2
-rw-r--r--lib/smbconf/smbconf_txt.c4
4 files changed, 44 insertions, 30 deletions
diff --git a/lib/smbconf/smbconf.c b/lib/smbconf/smbconf.c
index f429295568..68f7dfc902 100644
--- a/lib/smbconf/smbconf.c
+++ b/lib/smbconf/smbconf.c
@@ -27,12 +27,13 @@
*
**********************************************************************/
-static WERROR smbconf_global_check(struct smbconf_ctx *ctx)
+static sbcErr smbconf_global_check(struct smbconf_ctx *ctx)
{
if (!smbconf_share_exists(ctx, GLOBAL_NAME)) {
return smbconf_create_share(ctx, GLOBAL_NAME);
}
- return WERR_OK;
+
+ return SBC_ERR_OK;
}
@@ -222,11 +223,11 @@ bool smbconf_share_exists(struct smbconf_ctx *ctx,
/**
* Add a service if it does not already exist.
*/
-WERROR smbconf_create_share(struct smbconf_ctx *ctx,
+sbcErr smbconf_create_share(struct smbconf_ctx *ctx,
const char *servicename)
{
if ((servicename != NULL) && smbconf_share_exists(ctx, servicename)) {
- return WERR_FILE_EXISTS;
+ return SBC_ERR_FILE_EXISTS;
}
return ctx->ops->create_share(ctx, servicename);
@@ -275,12 +276,14 @@ WERROR smbconf_set_parameter(struct smbconf_ctx *ctx,
WERROR smbconf_set_global_parameter(struct smbconf_ctx *ctx,
const char *param, const char *val)
{
- WERROR werr;
+ WERROR werr = WERR_OK;
+ sbcErr err;
- werr = smbconf_global_check(ctx);
- if (W_ERROR_IS_OK(werr)) {
- werr = smbconf_set_parameter(ctx, GLOBAL_NAME, param, val);
+ err = smbconf_global_check(ctx);
+ if (!SBC_ERROR_IS_OK(err)) {
+ return WERR_GENERAL_FAILURE;
}
+ werr = smbconf_set_parameter(ctx, GLOBAL_NAME, param, val);
return werr;
}
@@ -312,13 +315,16 @@ WERROR smbconf_get_global_parameter(struct smbconf_ctx *ctx,
char **valstr)
{
WERROR werr;
+ sbcErr err;
- werr = smbconf_global_check(ctx);
- if (W_ERROR_IS_OK(werr)) {
- werr = smbconf_get_parameter(ctx, mem_ctx, GLOBAL_NAME, param,
- valstr);
+ err = smbconf_global_check(ctx);
+ if (!SBC_ERROR_IS_OK(err)) {
+ return WERR_GENERAL_FAILURE;
}
+ werr = smbconf_get_parameter(ctx, mem_ctx, GLOBAL_NAME, param,
+ valstr);
+
return werr;
}
@@ -340,11 +346,13 @@ WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx,
const char *param)
{
WERROR werr;
+ sbcErr err;
- werr = smbconf_global_check(ctx);
- if (W_ERROR_IS_OK(werr)) {
- werr = smbconf_delete_parameter(ctx, GLOBAL_NAME, param);
+ err = smbconf_global_check(ctx);
+ if (!SBC_ERROR_IS_OK(err)) {
+ return WERR_GENERAL_FAILURE;
}
+ werr = smbconf_delete_parameter(ctx, GLOBAL_NAME, param);
return werr;
}
@@ -363,12 +371,14 @@ WERROR smbconf_get_global_includes(struct smbconf_ctx *ctx,
uint32_t *num_includes, char ***includes)
{
WERROR werr;
+ sbcErr err;
- werr = smbconf_global_check(ctx);
- if (W_ERROR_IS_OK(werr)) {
- werr = smbconf_get_includes(ctx, mem_ctx, GLOBAL_NAME,
- num_includes, includes);
+ err = smbconf_global_check(ctx);
+ if (SBC_ERROR_IS_OK(err)) {
+ return WERR_GENERAL_FAILURE;
}
+ werr = smbconf_get_includes(ctx, mem_ctx, GLOBAL_NAME,
+ num_includes, includes);
return werr;
}
@@ -385,12 +395,14 @@ WERROR smbconf_set_global_includes(struct smbconf_ctx *ctx,
const char **includes)
{
WERROR werr;
+ sbcErr err;
- werr = smbconf_global_check(ctx);
- if (W_ERROR_IS_OK(werr)) {
- werr = smbconf_set_includes(ctx, GLOBAL_NAME,
- num_includes, includes);
+ err = smbconf_global_check(ctx);
+ if (!SBC_ERROR_IS_OK(err)) {
+ return WERR_GENERAL_FAILURE;
}
+ werr = smbconf_set_includes(ctx, GLOBAL_NAME,
+ num_includes, includes);
return werr;
}
@@ -404,11 +416,13 @@ WERROR smbconf_delete_includes(struct smbconf_ctx *ctx, const char *service)
WERROR smbconf_delete_global_includes(struct smbconf_ctx *ctx)
{
WERROR werr;
+ sbcErr err;
- werr = smbconf_global_check(ctx);
- if (W_ERROR_IS_OK(werr)) {
- werr = smbconf_delete_includes(ctx, GLOBAL_NAME);
+ err = smbconf_global_check(ctx);
+ if (!SBC_ERROR_IS_OK(err)) {
+ return WERR_GENERAL_FAILURE;
}
+ werr = smbconf_delete_includes(ctx, GLOBAL_NAME);
return werr;
}
diff --git a/lib/smbconf/smbconf.h b/lib/smbconf/smbconf.h
index af50dfb9a5..c1a82b5cf8 100644
--- a/lib/smbconf/smbconf.h
+++ b/lib/smbconf/smbconf.h
@@ -84,7 +84,7 @@ sbcErr smbconf_get_share_names(struct smbconf_ctx *ctx,
uint32_t *num_shares,
char ***share_names);
bool smbconf_share_exists(struct smbconf_ctx *ctx, const char *servicename);
-WERROR smbconf_create_share(struct smbconf_ctx *ctx, const char *servicename);
+sbcErr smbconf_create_share(struct smbconf_ctx *ctx, const char *servicename);
WERROR smbconf_get_share(struct smbconf_ctx *ctx,
TALLOC_CTX *mem_ctx,
const char *servicename,
diff --git a/lib/smbconf/smbconf_private.h b/lib/smbconf/smbconf_private.h
index 4058ade2e4..222497d031 100644
--- a/lib/smbconf/smbconf_private.h
+++ b/lib/smbconf/smbconf_private.h
@@ -41,7 +41,7 @@ struct smbconf_ops {
uint32_t *num_shares,
char ***share_names);
bool (*share_exists)(struct smbconf_ctx *ctx, const char *service);
- WERROR (*create_share)(struct smbconf_ctx *ctx, const char *service);
+ sbcErr (*create_share)(struct smbconf_ctx *ctx, const char *service);
WERROR (*get_share)(struct smbconf_ctx *ctx,
TALLOC_CTX *mem_ctx,
const char *servicename,
diff --git a/lib/smbconf/smbconf_txt.c b/lib/smbconf/smbconf_txt.c
index 444fa08663..1be27e6bbd 100644
--- a/lib/smbconf/smbconf_txt.c
+++ b/lib/smbconf/smbconf_txt.c
@@ -385,10 +385,10 @@ static bool smbconf_txt_share_exists(struct smbconf_ctx *ctx,
/**
* Add a service if it does not already exist
*/
-static WERROR smbconf_txt_create_share(struct smbconf_ctx *ctx,
+static sbcErr smbconf_txt_create_share(struct smbconf_ctx *ctx,
const char *servicename)
{
- return WERR_NOT_SUPPORTED;
+ return SBC_ERR_NOT_SUPPORTED;
}
/**