summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-04-08 15:48:01 +0200
committerMichael Adam <obnox@samba.org>2011-05-10 19:13:20 +0200
commit7af2876e4526d348a1e601f2d14776e08d4668cb (patch)
tree26fe48b14825073cc6e84e893e006fbf4b47f2f7 /source3
parent823cd472b42c276a48bd368655f28dfa9ae7d430 (diff)
downloadsamba-7af2876e4526d348a1e601f2d14776e08d4668cb.tar.gz
samba-7af2876e4526d348a1e601f2d14776e08d4668cb.tar.bz2
samba-7af2876e4526d348a1e601f2d14776e08d4668cb.zip
libsmbconf: Convert smbconf_create_share() to smbErr.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/smbconf/smbconf_reg.c22
-rw-r--r--source3/utils/net_conf.c20
2 files changed, 24 insertions, 18 deletions
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index f6b6d8d46b..78a3145db5 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -127,12 +127,13 @@ static bool smbconf_value_exists(struct registry_key *key, const char *param)
/**
* create a subkey of the base key (i.e. a service...)
*/
-static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
+static sbcErr smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
struct smbconf_ctx *ctx,
const char * subkeyname,
struct registry_key **newkey)
{
- WERROR werr = WERR_OK;
+ WERROR werr;
+ sbcErr err = SBC_ERR_OK;
TALLOC_CTX *create_ctx;
enum winreg_CreateAction action = REG_ACTION_NONE;
@@ -145,15 +146,16 @@ static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
REG_KEY_WRITE, newkey, &action);
if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {
DEBUG(10, ("Key '%s' already exists.\n", subkeyname));
- werr = WERR_FILE_EXISTS;
+ err = SBC_ERR_FILE_EXISTS;
}
if (!W_ERROR_IS_OK(werr)) {
DEBUG(5, ("Error creating key %s: %s\n",
subkeyname, win_errstr(werr)));
+ err = SBC_ERR_UNKNOWN_FAILURE;
}
talloc_free(create_ctx);
- return werr;
+ return err;
}
/**
@@ -864,21 +866,21 @@ static bool smbconf_reg_share_exists(struct smbconf_ctx *ctx,
/**
* Add a service if it does not already exist - registry version
*/
-static WERROR smbconf_reg_create_share(struct smbconf_ctx *ctx,
+static sbcErr smbconf_reg_create_share(struct smbconf_ctx *ctx,
const char *servicename)
{
- WERROR werr;
+ sbcErr err;
struct registry_key *key = NULL;
if (servicename == NULL) {
- return WERR_OK;
+ return SBC_ERR_OK;
}
- werr = smbconf_reg_create_service_key(talloc_tos(), ctx,
- servicename, &key);
+ err = smbconf_reg_create_service_key(talloc_tos(), ctx,
+ servicename, &key);
talloc_free(key);
- return werr;
+ return err;
}
/**
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 192088c6ba..3b6005a2b9 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -180,6 +180,7 @@ static WERROR import_process_service(struct net_context *c,
{
uint32_t idx;
WERROR werr = WERR_OK;
+ sbcErr err;
uint32_t num_includes = 0;
char **includes = NULL;
TALLOC_CTX *mem_ctx = talloc_stackframe();
@@ -205,8 +206,9 @@ static WERROR import_process_service(struct net_context *c,
goto done;
}
}
- werr = smbconf_create_share(conf_ctx, service->name);
- if (!W_ERROR_IS_OK(werr)) {
+ err = smbconf_create_share(conf_ctx, service->name);
+ if (!SBC_ERROR_IS_OK(err)) {
+ werr = WERR_GENERAL_FAILURE;
goto done;
}
@@ -578,6 +580,7 @@ static int net_conf_addshare(struct net_context *c,
{
int ret = -1;
WERROR werr = WERR_OK;
+ sbcErr err;
char *sharename = NULL;
const char *path = NULL;
const char *comment = NULL;
@@ -714,10 +717,10 @@ static int net_conf_addshare(struct net_context *c,
* create the share
*/
- werr = smbconf_create_share(conf_ctx, sharename);
- if (!W_ERROR_IS_OK(werr)) {
+ err = smbconf_create_share(conf_ctx, sharename);
+ if (!SBC_ERROR_IS_OK(err)) {
d_fprintf(stderr, _("Error creating share %s: %s\n"),
- sharename, win_errstr(werr));
+ sharename, sbcErrorString(err));
goto cancel;
}
@@ -820,6 +823,7 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
{
int ret = -1;
WERROR werr = WERR_OK;
+ sbcErr err;
char *service = NULL;
char *param = NULL;
const char *value_str = NULL;
@@ -855,10 +859,10 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
}
if (!smbconf_share_exists(conf_ctx, service)) {
- werr = smbconf_create_share(conf_ctx, service);
- if (!W_ERROR_IS_OK(werr)) {
+ err = smbconf_create_share(conf_ctx, service);
+ if (!SBC_ERROR_IS_OK(err)) {
d_fprintf(stderr, _("Error creating share '%s': %s\n"),
- service, win_errstr(werr));
+ service, sbcErrorString(err));
goto cancel;
}
}