diff options
author | Andreas Schneider <asn@samba.org> | 2011-04-11 17:43:10 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-05-10 19:13:22 +0200 |
commit | 4d391d29f87cfe88e1d3aa96f193c486beb5a1f1 (patch) | |
tree | 07c6362725b61ac2b7bd991c8a9382ae05902d12 /source3 | |
parent | e1f0b91c5fd6b11e258464994868be8020c89e89 (diff) | |
download | samba-4d391d29f87cfe88e1d3aa96f193c486beb5a1f1.tar.gz samba-4d391d29f87cfe88e1d3aa96f193c486beb5a1f1.tar.bz2 samba-4d391d29f87cfe88e1d3aa96f193c486beb5a1f1.zip |
libsmbconf: Convert smbconf_get_config() to sbcErr.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/param/loadparm.c | 6 | ||||
-rw-r--r-- | source3/utils/net_conf.c | 43 |
2 files changed, 21 insertions, 28 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index d9608babc8..2f67c502d2 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -7313,7 +7313,7 @@ static bool process_registry_globals(void) bool process_registry_shares(void) { - WERROR werr; + sbcErr err; uint32_t count; struct smbconf_service **service = NULL; uint32_t num_shares = 0; @@ -7325,8 +7325,8 @@ bool process_registry_shares(void) goto done; } - werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service); - if (!W_ERROR_IS_OK(werr)) { + err = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service); + if (!SBC_ERROR_IS_OK(err)) { goto done; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 7ca58ee2d5..2c6ccda110 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -174,13 +174,12 @@ static int net_conf_delincludes_usage(struct net_context *c, int argc, /** * This functions process a service previously loaded with libsmbconf. */ -static WERROR import_process_service(struct net_context *c, +static sbcErr import_process_service(struct net_context *c, struct smbconf_ctx *conf_ctx, struct smbconf_service *service) { uint32_t idx; - WERROR werr = WERR_OK; - sbcErr err; + sbcErr err = SBC_ERR_OK; uint32_t num_includes = 0; char **includes = NULL; TALLOC_CTX *mem_ctx = talloc_stackframe(); @@ -203,13 +202,11 @@ static WERROR import_process_service(struct net_context *c, if (smbconf_share_exists(conf_ctx, service->name)) { err = smbconf_delete_share(conf_ctx, service->name); if (!SBC_ERROR_IS_OK(err)) { - werr = WERR_GENERAL_FAILURE; goto done; } } err = smbconf_create_share(conf_ctx, service->name); if (!SBC_ERROR_IS_OK(err)) { - werr = WERR_GENERAL_FAILURE; goto done; } @@ -220,13 +217,13 @@ static WERROR import_process_service(struct net_context *c, char *, num_includes+1); if (includes == NULL) { - werr = WERR_NOMEM; + err = SBC_ERR_NOMEM; goto done; } includes[num_includes] = talloc_strdup(includes, service->param_values[idx]); if (includes[num_includes] == NULL) { - werr = WERR_NOMEM; + err = SBC_ERR_NOMEM; goto done; } num_includes++; @@ -240,7 +237,6 @@ static WERROR import_process_service(struct net_context *c, _("Error in section [%s], parameter \"%s\": %s\n"), service->name, service->param_names[idx], sbcErrorString(err)); - werr = WERR_NOMEM; goto done; } } @@ -249,14 +245,13 @@ static WERROR import_process_service(struct net_context *c, err = smbconf_set_includes(conf_ctx, service->name, num_includes, (const char **)includes); if (!SBC_ERROR_IS_OK(err)) { - werr = WERR_NOMEM; goto done; } - werr = WERR_OK; + err = SBC_ERR_OK; done: TALLOC_FREE(mem_ctx); - return werr; + return err; } @@ -269,7 +264,7 @@ done: static int net_conf_list(struct net_context *c, struct smbconf_ctx *conf_ctx, int argc, const char **argv) { - WERROR werr = WERR_OK; + sbcErr err; int ret = -1; TALLOC_CTX *mem_ctx; uint32_t num_shares; @@ -283,10 +278,10 @@ static int net_conf_list(struct net_context *c, struct smbconf_ctx *conf_ctx, goto done; } - werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &shares); - if (!W_ERROR_IS_OK(werr)) { + err = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &shares); + if (!SBC_ERROR_IS_OK(err)) { d_fprintf(stderr, _("Error getting config: %s\n"), - win_errstr(werr)); + sbcErrorString(err)); goto done; } @@ -324,7 +319,6 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, char *conf_source = NULL; TALLOC_CTX *mem_ctx; struct smbconf_ctx *txt_ctx; - WERROR werr; sbcErr err; if (c->display_usage) @@ -361,7 +355,6 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, if (!SBC_ERROR_IS_OK(err)) { d_printf(_("error loading file '%s': %s\n"), filename, sbcErrorString(err)); - werr = WERR_NO_SUCH_SERVICE; goto done; } @@ -383,22 +376,22 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, err = smbconf_transaction_start(conf_ctx); if (!SBC_ERROR_IS_OK(err)) { d_printf(_("error starting transaction: %s\n"), - win_errstr(werr)); + sbcErrorString(err)); goto done; } - werr = import_process_service(c, conf_ctx, service); - if (!W_ERROR_IS_OK(werr)) { + err = import_process_service(c, conf_ctx, service); + if (!SBC_ERROR_IS_OK(err)) { goto cancel; } } else { struct smbconf_service **services = NULL; uint32_t num_shares, sidx; - werr = smbconf_get_config(txt_ctx, mem_ctx, + err = smbconf_get_config(txt_ctx, mem_ctx, &num_shares, &services); - if (!W_ERROR_IS_OK(werr)) { + if (!SBC_ERROR_IS_OK(err)) { goto cancel; } if (!c->opt_testmode) { @@ -423,9 +416,9 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, } for (sidx = 0; sidx < num_shares; sidx++) { - werr = import_process_service(c, conf_ctx, - services[sidx]); - if (!W_ERROR_IS_OK(werr)) { + err = import_process_service(c, conf_ctx, + services[sidx]); + if (!SBC_ERROR_IS_OK(err)) { goto cancel; } |