summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-04-11 15:14:52 +0200
committerMichael Adam <obnox@samba.org>2011-05-10 19:13:22 +0200
commitd911bafea695dc36d7952bd265dfe15a3e04ac7b (patch)
treecd30e1c56152f40de4340ab4e893970859d07ad4 /source3/lib
parent9f9711490ae743493722c997e316a31600ef02d6 (diff)
downloadsamba-d911bafea695dc36d7952bd265dfe15a3e04ac7b.tar.gz
samba-d911bafea695dc36d7952bd265dfe15a3e04ac7b.tar.bz2
samba-d911bafea695dc36d7952bd265dfe15a3e04ac7b.zip
libsmbconf: Convert smbconf_set_includes() to sbcErr.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/smbconf/smbconf_reg.c28
-rw-r--r--source3/lib/smbconf/testsuite.c13
2 files changed, 23 insertions, 18 deletions
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index deca6ec68a..124140b178 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -236,31 +236,32 @@ done:
return err;
}
-static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key,
+static sbcErr smbconf_reg_set_multi_sz_value(struct registry_key *key,
const char *valname,
const uint32_t num_strings,
const char **strings)
{
WERROR werr;
+ sbcErr err = SBC_ERR_OK;
struct registry_value *value;
uint32_t count;
TALLOC_CTX *tmp_ctx = talloc_stackframe();
const char **array;
if (strings == NULL) {
- werr = WERR_INVALID_PARAM;
+ err = SBC_ERR_INVALID_PARAM;
goto done;
}
array = talloc_zero_array(tmp_ctx, const char *, num_strings + 1);
if (array == NULL) {
- werr = WERR_NOMEM;
+ err = SBC_ERR_NOMEM;
goto done;
}
value = TALLOC_ZERO_P(tmp_ctx, struct registry_value);
if (value == NULL) {
- werr = WERR_NOMEM;
+ err = SBC_ERR_NOMEM;
goto done;
}
@@ -269,13 +270,13 @@ static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key,
for (count = 0; count < num_strings; count++) {
array[count] = talloc_strdup(value, strings[count]);
if (array[count] == NULL) {
- werr = WERR_NOMEM;
+ err = SBC_ERR_NOMEM;
goto done;
}
}
if (!push_reg_multi_sz(value, &value->data, array)) {
- werr = WERR_NOMEM;
+ err = SBC_ERR_NOMEM;
goto done;
}
@@ -283,11 +284,12 @@ static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key,
if (!W_ERROR_IS_OK(werr)) {
DEBUG(5, ("Error adding value '%s' to key '%s': %s\n",
valname, key->key->name, win_errstr(werr)));
+ err = SBC_ERR_ACCESS_DENIED;
}
done:
talloc_free(tmp_ctx);
- return werr;
+ return err;
}
/**
@@ -1098,7 +1100,7 @@ done:
return err;
}
-static WERROR smbconf_reg_set_includes(struct smbconf_ctx *ctx,
+static sbcErr smbconf_reg_set_includes(struct smbconf_ctx *ctx,
const char *service,
uint32_t num_includes,
const char **includes)
@@ -1111,23 +1113,27 @@ static WERROR smbconf_reg_set_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 (num_includes == 0) {
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;
+ }
} else {
- werr = smbconf_reg_set_multi_sz_value(key, INCLUDES_VALNAME,
+ err = smbconf_reg_set_multi_sz_value(key, INCLUDES_VALNAME,
num_includes, includes);
}
done:
talloc_free(tmp_ctx);
- return werr;
+ return err;
}
static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx,
diff --git a/source3/lib/smbconf/testsuite.c b/source3/lib/smbconf/testsuite.c
index 8a7e2d4c25..593839d88f 100644
--- a/source3/lib/smbconf/testsuite.c
+++ b/source3/lib/smbconf/testsuite.c
@@ -68,7 +68,6 @@ done:
static bool test_set_get_includes(struct smbconf_ctx *ctx)
{
- WERROR werr;
sbcErr err;
uint32_t count;
bool ret = false;
@@ -83,10 +82,10 @@ static bool test_set_get_includes(struct smbconf_ctx *ctx)
printf("TEST: set_get_includes\n");
- werr = smbconf_set_global_includes(ctx, set_num_includes, set_includes);
- if (!W_ERROR_IS_OK(werr)) {
+ err = smbconf_set_global_includes(ctx, set_num_includes, set_includes);
+ if (!SBC_ERROR_IS_OK(err)) {
printf("FAIL: get_set_includes (setting includes) - %s\n",
- win_errstr(werr));
+ sbcErrorString(err));
goto done;
}
@@ -139,10 +138,10 @@ static bool test_delete_includes(struct smbconf_ctx *ctx)
printf("TEST: delete_includes\n");
- werr = smbconf_set_global_includes(ctx, set_num_includes, set_includes);
- if (!W_ERROR_IS_OK(werr)) {
+ err = smbconf_set_global_includes(ctx, set_num_includes, set_includes);
+ if (!SBC_ERROR_IS_OK(err)) {
printf("FAIL: delete_includes (setting includes) - %s\n",
- win_errstr(werr));
+ sbcErrorString(err));
goto done;
}