summaryrefslogtreecommitdiffstats
path: root/source3/lib
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-04-08 10:40:02 +0200
committerMichael Adam <obnox@samba.org>2011-05-10 19:13:20 +0200
commit720ba8e7e7463669bb4fc9d5a91387bafc9aec0f (patch)
tree1dc38c8eac90a803b0618d78cd11d84c3eb54270 /source3/lib
parent9082c7cee8805281d18bd9f2f0afed4260ee95a8 (diff)
downloadsamba-720ba8e7e7463669bb4fc9d5a91387bafc9aec0f.tar.gz
samba-720ba8e7e7463669bb4fc9d5a91387bafc9aec0f.tar.xz
samba-720ba8e7e7463669bb4fc9d5a91387bafc9aec0f.zip
libsmbconf: Convert smbconf_drop() to sbcErr.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/smbconf/smbconf_reg.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index 71b60c86bc1..844a9b6b483 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -698,10 +698,11 @@ static void smbconf_reg_get_csn(struct smbconf_ctx *ctx,
/**
* Drop the whole configuration (restarting empty) - registry version
*/
-static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx)
+static sbcErr smbconf_reg_drop(struct smbconf_ctx *ctx)
{
char *path, *p;
WERROR werr = WERR_OK;
+ sbcErr err = SBC_ERR_OK;
struct registry_key *parent_key = NULL;
struct registry_key *new_key = NULL;
TALLOC_CTX* mem_ctx = talloc_stackframe();
@@ -711,39 +712,44 @@ static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx)
werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
if (!W_ERROR_IS_OK(werr)) {
DEBUG(1, ("Error creating admin token\n"));
+ err = SBC_ERR_UNKNOWN_FAILURE;
goto done;
}
path = talloc_strdup(mem_ctx, ctx->path);
if (path == NULL) {
- werr = WERR_NOMEM;
+ err = SBC_ERR_NOMEM;
goto done;
}
p = strrchr(path, '\\');
if (p == NULL) {
- werr = WERR_INVALID_PARAM;
+ err = SBC_ERR_INVALID_PARAM;
goto done;
}
*p = '\0';
werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token,
&parent_key);
-
if (!W_ERROR_IS_OK(werr)) {
+ err = SBC_ERR_IO_FAILURE;
goto done;
}
werr = reg_deletekey_recursive(parent_key, p+1);
-
if (!W_ERROR_IS_OK(werr)) {
+ err = SBC_ERR_IO_FAILURE;
goto done;
}
werr = reg_createkey(mem_ctx, parent_key, p+1, REG_KEY_WRITE,
&new_key, &action);
+ if (!W_ERROR_IS_OK(werr)) {
+ err = SBC_ERR_IO_FAILURE;
+ goto done;
+ }
done:
talloc_free(mem_ctx);
- return werr;
+ return err;
}
/**