summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-04-11 16:01:22 +0200
committerMichael Adam <obnox@samba.org>2011-05-10 19:13:22 +0200
commit72d15f0c03cd67d32feb51f41238401b38344907 (patch)
treedbaa7bc99be2cfb3199dbbf9e1e0d8d17d6572b3 /source3
parentd911bafea695dc36d7952bd265dfe15a3e04ac7b (diff)
downloadsamba-72d15f0c03cd67d32feb51f41238401b38344907.tar.gz
samba-72d15f0c03cd67d32feb51f41238401b38344907.tar.bz2
samba-72d15f0c03cd67d32feb51f41238401b38344907.zip
libsmbconf: Convert smbconf_delete_includes() to sbcErr.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/smbconf/smbconf_reg.c16
-rw-r--r--source3/lib/smbconf/testsuite.c13
-rw-r--r--source3/utils/net_conf.c8
3 files changed, 20 insertions, 17 deletions
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index 124140b178..eb6db29f5c 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -1059,7 +1059,7 @@ static sbcErr smbconf_reg_delete_parameter(struct smbconf_ctx *ctx,
}
if (!smbconf_value_exists(key, param)) {
- err = SBC_ERR_CAN_NOT_COMPLETE;
+ err = SBC_ERR_OK;
goto done;
}
@@ -1136,10 +1136,10 @@ done:
return err;
}
-static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx,
+static sbcErr smbconf_reg_delete_includes(struct smbconf_ctx *ctx,
const char *service)
{
- WERROR werr = WERR_OK;
+ WERROR werr;
sbcErr err;
struct registry_key *key = NULL;
TALLOC_CTX *tmp_ctx = talloc_stackframe();
@@ -1147,20 +1147,24 @@ static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx,
err = smbconf_reg_open_service_key(tmp_ctx, ctx, service,
REG_KEY_ALL, &key);
if (!SBC_ERROR_IS_OK(err)) {
- werr = WERR_NOMEM;
goto done;
}
if (!smbconf_value_exists(key, INCLUDES_VALNAME)) {
+ err = SBC_ERR_OK;
goto done;
}
werr = reg_deletevalue(key, INCLUDES_VALNAME);
+ if (!W_ERROR_IS_OK(werr)) {
+ err = SBC_ERR_ACCESS_DENIED;
+ goto done;
+ }
-
+ err = SBC_ERR_OK;
done:
talloc_free(tmp_ctx);
- return werr;
+ return err;
}
static WERROR smbconf_reg_transaction_start(struct smbconf_ctx *ctx)
diff --git a/source3/lib/smbconf/testsuite.c b/source3/lib/smbconf/testsuite.c
index 593839d88f..c2a9a59cbe 100644
--- a/source3/lib/smbconf/testsuite.c
+++ b/source3/lib/smbconf/testsuite.c
@@ -125,7 +125,6 @@ done:
static bool test_delete_includes(struct smbconf_ctx *ctx)
{
- WERROR werr;
sbcErr err;
bool ret = false;
const char *set_includes[] = {
@@ -145,10 +144,10 @@ static bool test_delete_includes(struct smbconf_ctx *ctx)
goto done;
}
- werr = smbconf_delete_global_includes(ctx);
- if (!W_ERROR_IS_OK(werr)) {
+ err = smbconf_delete_global_includes(ctx);
+ if (!SBC_ERROR_IS_OK(err)) {
printf("FAIL: delete_includes (deleting includes) - %s\n",
- win_errstr(werr));
+ sbcErrorString(err));
goto done;
}
@@ -165,10 +164,10 @@ static bool test_delete_includes(struct smbconf_ctx *ctx)
goto done;
}
- werr = smbconf_delete_global_includes(ctx);
- if (!W_ERROR_IS_OK(werr)) {
+ err = smbconf_delete_global_includes(ctx);
+ if (!SBC_ERROR_IS_OK(err)) {
printf("FAIL: delete_includes (delete empty includes) - "
- "%s\n", win_errstr(werr));
+ "%s\n", sbcErrorString(err));
goto done;
}
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 255f14c920..2d7fb7bbb4 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -1102,7 +1102,7 @@ static int net_conf_delincludes(struct net_context *c,
struct smbconf_ctx *conf_ctx,
int argc, const char **argv)
{
- WERROR werr;
+ sbcErr err;
char *service;
int ret = -1;
TALLOC_CTX *mem_ctx = talloc_stackframe();
@@ -1118,9 +1118,9 @@ static int net_conf_delincludes(struct net_context *c,
goto done;
}
- werr = smbconf_delete_includes(conf_ctx, service);
- if (!W_ERROR_IS_OK(werr)) {
- d_printf(_("error deleting includes: %s\n"), win_errstr(werr));
+ err = smbconf_delete_includes(conf_ctx, service);
+ if (!SBC_ERROR_IS_OK(err)) {
+ d_printf(_("error deleting includes: %s\n"), sbcErrorString(err));
goto done;
}