summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-04-11 17:43:10 +0200
committerMichael Adam <obnox@samba.org>2011-05-10 19:13:22 +0200
commit4d391d29f87cfe88e1d3aa96f193c486beb5a1f1 (patch)
tree07c6362725b61ac2b7bd991c8a9382ae05902d12
parente1f0b91c5fd6b11e258464994868be8020c89e89 (diff)
downloadsamba-4d391d29f87cfe88e1d3aa96f193c486beb5a1f1.tar.gz
samba-4d391d29f87cfe88e1d3aa96f193c486beb5a1f1.tar.xz
samba-4d391d29f87cfe88e1d3aa96f193c486beb5a1f1.zip
libsmbconf: Convert smbconf_get_config() to sbcErr.
Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r--lib/smbconf/smbconf.c14
-rw-r--r--lib/smbconf/smbconf.h2
-rw-r--r--source3/param/loadparm.c6
-rw-r--r--source3/utils/net_conf.c43
4 files changed, 27 insertions, 38 deletions
diff --git a/lib/smbconf/smbconf.c b/lib/smbconf/smbconf.c
index c81af36cdb..e0441ed985 100644
--- a/lib/smbconf/smbconf.c
+++ b/lib/smbconf/smbconf.c
@@ -141,12 +141,11 @@ sbcErr smbconf_drop(struct smbconf_ctx *ctx)
* param_names : list of lists of parameter names for each share
* param_values : list of lists of parameter values for each share
*/
-WERROR smbconf_get_config(struct smbconf_ctx *ctx,
+sbcErr smbconf_get_config(struct smbconf_ctx *ctx,
TALLOC_CTX *mem_ctx,
uint32_t *num_shares,
struct smbconf_service ***services)
{
- WERROR werr = WERR_OK;
sbcErr err;
TALLOC_CTX *tmp_ctx = NULL;
uint32_t tmp_num_shares;
@@ -155,7 +154,7 @@ WERROR smbconf_get_config(struct smbconf_ctx *ctx,
uint32_t count;
if ((num_shares == NULL) || (services == NULL)) {
- werr = WERR_INVALID_PARAM;
+ err = SBC_ERR_INVALID_PARAM;
goto done;
}
@@ -164,15 +163,13 @@ WERROR smbconf_get_config(struct smbconf_ctx *ctx,
err = smbconf_get_share_names(ctx, tmp_ctx, &tmp_num_shares,
&tmp_share_names);
if (!SBC_ERROR_IS_OK(err)) {
- werr = WERR_GENERAL_FAILURE;
goto done;
}
tmp_services = talloc_array(tmp_ctx, struct smbconf_service *,
tmp_num_shares);
-
if (tmp_services == NULL) {
- werr = WERR_NOMEM;
+ err = SBC_ERR_NOMEM;
goto done;
}
@@ -181,12 +178,11 @@ WERROR smbconf_get_config(struct smbconf_ctx *ctx,
tmp_share_names[count],
&tmp_services[count]);
if (!SBC_ERROR_IS_OK(err)) {
- werr = WERR_GENERAL_FAILURE;
goto done;
}
}
- werr = WERR_OK;
+ err = SBC_ERR_OK;
*num_shares = tmp_num_shares;
if (tmp_num_shares > 0) {
@@ -197,7 +193,7 @@ WERROR smbconf_get_config(struct smbconf_ctx *ctx,
done:
talloc_free(tmp_ctx);
- return werr;
+ return err;
}
/**
diff --git a/lib/smbconf/smbconf.h b/lib/smbconf/smbconf.h
index f5dd922ed1..467b5caa79 100644
--- a/lib/smbconf/smbconf.h
+++ b/lib/smbconf/smbconf.h
@@ -76,7 +76,7 @@ void smbconf_shutdown(struct smbconf_ctx *ctx);
bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
const char *service, const char *param);
sbcErr smbconf_drop(struct smbconf_ctx *ctx);
-WERROR smbconf_get_config(struct smbconf_ctx *ctx,
+sbcErr smbconf_get_config(struct smbconf_ctx *ctx,
TALLOC_CTX *mem_ctx,
uint32_t *num_shares,
struct smbconf_service ***services);
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;
}