summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/smbconf/smbconf.c11
-rw-r--r--lib/smbconf/smbconf.h4
-rw-r--r--lib/smbconf/smbconf_private.h2
-rw-r--r--lib/smbconf/smbconf_txt.c4
-rw-r--r--source3/lib/smbconf/smbconf_reg.c14
-rw-r--r--source3/libnet/libnet_join.c7
-rw-r--r--source3/utils/net_conf.c13
7 files changed, 29 insertions, 26 deletions
diff --git a/lib/smbconf/smbconf.c b/lib/smbconf/smbconf.c
index 02c49cc877..a6bb64fec8 100644
--- a/lib/smbconf/smbconf.c
+++ b/lib/smbconf/smbconf.c
@@ -330,7 +330,7 @@ sbcErr smbconf_get_global_parameter(struct smbconf_ctx *ctx,
/**
* delete a parameter from configuration
*/
-WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx,
+sbcErr smbconf_delete_parameter(struct smbconf_ctx *ctx,
const char *service, const char *param)
{
return ctx->ops->delete_parameter(ctx, service, param);
@@ -341,19 +341,18 @@ WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx,
*
* Create [global] if it does not exist.
*/
-WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx,
+sbcErr smbconf_delete_global_parameter(struct smbconf_ctx *ctx,
const char *param)
{
- WERROR werr;
sbcErr err;
err = smbconf_global_check(ctx);
if (!SBC_ERROR_IS_OK(err)) {
- return WERR_GENERAL_FAILURE;
+ return err;
}
- werr = smbconf_delete_parameter(ctx, GLOBAL_NAME, param);
+ err = smbconf_delete_parameter(ctx, GLOBAL_NAME, param);
- return werr;
+ return err;
}
WERROR smbconf_get_includes(struct smbconf_ctx *ctx,
diff --git a/lib/smbconf/smbconf.h b/lib/smbconf/smbconf.h
index 15476f1460..e0a3ed5054 100644
--- a/lib/smbconf/smbconf.h
+++ b/lib/smbconf/smbconf.h
@@ -107,9 +107,9 @@ sbcErr smbconf_get_global_parameter(struct smbconf_ctx *ctx,
TALLOC_CTX *mem_ctx,
const char *param,
char **valstr);
-WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx,
+sbcErr smbconf_delete_parameter(struct smbconf_ctx *ctx,
const char *service, const char *param);
-WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx,
+sbcErr smbconf_delete_global_parameter(struct smbconf_ctx *ctx,
const char *param);
WERROR smbconf_get_includes(struct smbconf_ctx *ctx,
TALLOC_CTX *mem_ctx,
diff --git a/lib/smbconf/smbconf_private.h b/lib/smbconf/smbconf_private.h
index 9bfcbe097a..c46d30279b 100644
--- a/lib/smbconf/smbconf_private.h
+++ b/lib/smbconf/smbconf_private.h
@@ -57,7 +57,7 @@ struct smbconf_ops {
const char *service,
const char *param,
char **valstr);
- WERROR (*delete_parameter)(struct smbconf_ctx *ctx,
+ sbcErr (*delete_parameter)(struct smbconf_ctx *ctx,
const char *service, const char *param);
WERROR (*get_includes)(struct smbconf_ctx *ctx,
TALLOC_CTX *mem_ctx,
diff --git a/lib/smbconf/smbconf_txt.c b/lib/smbconf/smbconf_txt.c
index e31009e7b2..17dee486d5 100644
--- a/lib/smbconf/smbconf_txt.c
+++ b/lib/smbconf/smbconf_txt.c
@@ -526,11 +526,11 @@ static sbcErr smbconf_txt_get_parameter(struct smbconf_ctx *ctx,
/**
* delete a parameter from configuration
*/
-static WERROR smbconf_txt_delete_parameter(struct smbconf_ctx *ctx,
+static sbcErr smbconf_txt_delete_parameter(struct smbconf_ctx *ctx,
const char *service,
const char *param)
{
- return WERR_NOT_SUPPORTED;
+ return SBC_ERR_NOT_SUPPORTED;
}
static WERROR smbconf_txt_get_includes(struct smbconf_ctx *ctx,
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index 42eb6d18b9..f78c3555ab 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -1036,37 +1036,39 @@ done:
/**
* delete a parameter from configuration
*/
-static WERROR smbconf_reg_delete_parameter(struct smbconf_ctx *ctx,
+static sbcErr smbconf_reg_delete_parameter(struct smbconf_ctx *ctx,
const char *service,
const char *param)
{
struct registry_key *key = NULL;
- WERROR werr = WERR_OK;
+ WERROR werr;
sbcErr err;
TALLOC_CTX *mem_ctx = talloc_stackframe();
err = smbconf_reg_open_service_key(mem_ctx, ctx, service,
REG_KEY_ALL, &key);
if (!SBC_ERROR_IS_OK(err)) {
- werr = WERR_NOMEM;
goto done;
}
if (!smbconf_reg_valname_valid(param)) {
- werr = WERR_INVALID_PARAM;
+ err = SBC_ERR_INVALID_PARAM;
goto done;
}
if (!smbconf_value_exists(key, param)) {
- werr = WERR_INVALID_PARAM;
+ err = SBC_ERR_CAN_NOT_COMPLETE;
goto done;
}
werr = reg_deletevalue(key, param);
+ if (!W_ERROR_IS_OK(werr)) {
+ err = SBC_ERR_ACCESS_DENIED;
+ }
done:
talloc_free(mem_ctx);
- return werr;
+ return err;
}
static WERROR smbconf_reg_get_includes(struct smbconf_ctx *ctx,
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index ef0d5d0850..2b06be5dc1 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -1540,8 +1540,11 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r)
goto done;
}
- werr = smbconf_delete_global_parameter(ctx, "workgroup");
- W_ERROR_NOT_OK_GOTO_DONE(werr);
+ err = smbconf_delete_global_parameter(ctx, "workgroup");
+ if (!SBC_ERROR_IS_OK(err)) {
+ werr = WERR_NO_SUCH_SERVICE;
+ goto done;
+ }
smbconf_delete_global_parameter(ctx, "realm");
}
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 187735027b..bee8dd2a19 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -960,7 +960,7 @@ static int net_conf_delparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
int argc, const char **argv)
{
int ret = -1;
- WERROR werr = WERR_OK;
+ sbcErr err;
char *service = NULL;
char *param = NULL;
TALLOC_CTX *mem_ctx = talloc_stackframe();
@@ -986,21 +986,20 @@ static int net_conf_delparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
goto done;
}
- werr = smbconf_delete_parameter(conf_ctx, service, param);
-
- if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) {
+ err = smbconf_delete_parameter(conf_ctx, service, param);
+ if (SBC_ERROR_EQUAL(err, SBC_ERR_NO_SUCH_SERVICE)) {
d_fprintf(stderr,
_("Error: given service '%s' does not exist.\n"),
service);
goto done;
- } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
+ } else if (SBC_ERROR_EQUAL(err, SBC_ERR_INVALID_PARAM)) {
d_fprintf(stderr,
_("Error: given parameter '%s' is not set.\n"),
param);
goto done;
- } else if (!W_ERROR_IS_OK(werr)) {
+ } else if (!SBC_ERROR_IS_OK(err)) {
d_fprintf(stderr, _("Error deleting value '%s': %s.\n"),
- param, win_errstr(werr));
+ param, sbcErrorString(err));
goto done;
}