From 72d15f0c03cd67d32feb51f41238401b38344907 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 11 Apr 2011 16:01:22 +0200 Subject: libsmbconf: Convert smbconf_delete_includes() to sbcErr. Signed-off-by: Michael Adam --- source3/lib/smbconf/smbconf_reg.c | 16 ++++++++++------ source3/lib/smbconf/testsuite.c | 13 ++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'source3/lib') 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; } -- cgit