summaryrefslogtreecommitdiff
path: root/source3/lib/smbconf
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-04-07 17:19:03 +0200
committerMichael Adam <obnox@samba.org>2011-05-10 19:13:20 +0200
commit29eea4b09ad2e99504f42a3c29195fb4757792dd (patch)
tree97bff20a1b7977b07e0576960cb1b3b4830dbec0 /source3/lib/smbconf
parentb34e1768b762ae46e4fe761d9691ed09d285c9a9 (diff)
downloadsamba-29eea4b09ad2e99504f42a3c29195fb4757792dd.tar.gz
samba-29eea4b09ad2e99504f42a3c29195fb4757792dd.tar.bz2
samba-29eea4b09ad2e99504f42a3c29195fb4757792dd.zip
libsmbconf: Convert smbconf_init() to sbcErr.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib/smbconf')
-rw-r--r--source3/lib/smbconf/smbconf_init.c20
-rw-r--r--source3/lib/smbconf/smbconf_init.h2
-rw-r--r--source3/lib/smbconf/smbconf_reg.c2
-rw-r--r--source3/lib/smbconf/smbconf_reg.h2
-rw-r--r--source3/lib/smbconf/testsuite.c14
5 files changed, 21 insertions, 19 deletions
diff --git a/source3/lib/smbconf/smbconf_init.c b/source3/lib/smbconf/smbconf_init.c
index 36c51de5f0..2587a4fc53 100644
--- a/source3/lib/smbconf/smbconf_init.c
+++ b/source3/lib/smbconf/smbconf_init.c
@@ -34,28 +34,28 @@
* - "registry" or "reg"
* - "txt" or "file"
*/
-WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
+sbcErr smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
const char *source)
{
- WERROR werr;
+ sbcErr err;
char *backend = NULL;
char *path = NULL;
char *sep;
TALLOC_CTX *tmp_ctx = talloc_stackframe();
if (conf_ctx == NULL) {
- werr = WERR_INVALID_PARAM;
+ err = SBC_ERR_INVALID_PARAM;
goto done;
}
if ((source == NULL) || (*source == '\0')) {
- werr = WERR_INVALID_PARAM;
+ err = SBC_ERR_INVALID_PARAM;
goto done;
}
backend = talloc_strdup(tmp_ctx, source);
if (backend == NULL) {
- werr = WERR_NOMEM;
+ err = SBC_ERR_NOMEM;
goto done;
}
@@ -69,16 +69,16 @@ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
}
if (strequal(backend, "registry") || strequal(backend, "reg")) {
- werr = smbconf_init_reg(mem_ctx, conf_ctx, path);
+ err = smbconf_init_reg(mem_ctx, conf_ctx, path);
} else if (strequal(backend, "file") || strequal(backend, "txt")) {
- werr = smbconf_init_txt(mem_ctx, conf_ctx, path);
+ err = smbconf_init_txt(mem_ctx, conf_ctx, path);
} else if (sep == NULL) {
/*
* If no separator was given in the source, and the string is
* not a known backend, assume file backend and use the source
* string as a path argument.
*/
- werr = smbconf_init_txt(mem_ctx, conf_ctx, backend);
+ err = smbconf_init_txt(mem_ctx, conf_ctx, backend);
} else {
/*
* Separator was specified but this is not a known backend.
@@ -87,10 +87,10 @@ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
* This may occur with an include directive like this:
* 'include = /path/to/file.%T'
*/
- werr = smbconf_init_txt(mem_ctx, conf_ctx, source);
+ err = smbconf_init_txt(mem_ctx, conf_ctx, source);
}
done:
talloc_free(tmp_ctx);
- return werr;
+ return err;
}
diff --git a/source3/lib/smbconf/smbconf_init.h b/source3/lib/smbconf/smbconf_init.h
index abd62df204..45ea809624 100644
--- a/source3/lib/smbconf/smbconf_init.h
+++ b/source3/lib/smbconf/smbconf_init.h
@@ -26,7 +26,7 @@ struct smbconf_ctx;
* intialization dispatcher function.
* takes source string in the form of "backend:path"
*/
-WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
+sbcErr smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
const char *source);
#endif /* _LIBSMBCONF_INIT_H_ */
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index 67df03cbd2..09b4682de0 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -1156,7 +1156,7 @@ struct smbconf_ops smbconf_ops_reg = {
* initialize the smbconf registry backend
* the only function that is exported from this module
*/
-WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
+sbcErr smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
const char *path)
{
return smbconf_init_internal(mem_ctx, conf_ctx, path, &smbconf_ops_reg);
diff --git a/source3/lib/smbconf/smbconf_reg.h b/source3/lib/smbconf/smbconf_reg.h
index 7f54b6e32d..2c49057a94 100644
--- a/source3/lib/smbconf/smbconf_reg.h
+++ b/source3/lib/smbconf/smbconf_reg.h
@@ -26,7 +26,7 @@ struct smbconf_ctx;
* initialization functions for the registry backend modules
*/
-WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
+sbcErr smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
const char *path);
diff --git a/source3/lib/smbconf/testsuite.c b/source3/lib/smbconf/testsuite.c
index 80754dd20c..5bde5e1621 100644
--- a/source3/lib/smbconf/testsuite.c
+++ b/source3/lib/smbconf/testsuite.c
@@ -204,6 +204,7 @@ static bool create_conf_file(const char *filename)
static bool torture_smbconf_txt(void)
{
WERROR werr;
+ sbcErr err;
bool ret = true;
const char *filename = "/tmp/smb.conf.smbconf_testsuite";
struct smbconf_ctx *conf_ctx = NULL;
@@ -217,9 +218,9 @@ static bool torture_smbconf_txt(void)
}
printf("TEST: init\n");
- werr = smbconf_init_txt(mem_ctx, &conf_ctx, filename);
- if (!W_ERROR_IS_OK(werr)) {
- printf("FAIL: text backend failed: %s\n", win_errstr(werr));
+ err = smbconf_init_txt(mem_ctx, &conf_ctx, filename);
+ if (!SBC_ERROR_IS_OK(err)) {
+ printf("FAIL: text backend failed: %s\n", sbcErrorString(err));
ret = false;
goto done;
}
@@ -246,6 +247,7 @@ done:
static bool torture_smbconf_reg(void)
{
WERROR werr;
+ sbcErr err;
bool ret = true;
struct smbconf_ctx *conf_ctx = NULL;
TALLOC_CTX *mem_ctx = talloc_stackframe();
@@ -253,9 +255,9 @@ static bool torture_smbconf_reg(void)
printf("test: registry backend\n");
printf("TEST: init\n");
- werr = smbconf_init_reg(mem_ctx, &conf_ctx, NULL);
- if (!W_ERROR_IS_OK(werr)) {
- printf("FAIL: init failed: %s\n", win_errstr(werr));
+ err = smbconf_init_reg(mem_ctx, &conf_ctx, NULL);
+ if (!SBC_ERROR_IS_OK(err)) {
+ printf("FAIL: init failed: %s\n", sbcErrorString(err));
ret = false;
goto done;
}