diff options
author | Andreas Schneider <asn@samba.org> | 2011-04-08 10:28:17 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-05-10 19:13:20 +0200 |
commit | 9082c7cee8805281d18bd9f2f0afed4260ee95a8 (patch) | |
tree | a743afdae98e50ae97ef73e1f3bf33639782b4ea /source3/lib/smbconf | |
parent | 29eea4b09ad2e99504f42a3c29195fb4757792dd (diff) | |
download | samba-9082c7cee8805281d18bd9f2f0afed4260ee95a8.tar.gz samba-9082c7cee8805281d18bd9f2f0afed4260ee95a8.tar.bz2 samba-9082c7cee8805281d18bd9f2f0afed4260ee95a8.zip |
libsmbconf: Convert smbconf_open() to sbcErr.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib/smbconf')
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.c | 26 | ||||
-rw-r--r-- | source3/lib/smbconf/testsuite.c | 2 |
2 files changed, 16 insertions, 12 deletions
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index 09b4682de0..71b60c86bc 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -569,9 +569,10 @@ done: /** * initialize the registry smbconf backend */ -static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path) +static sbcErr smbconf_reg_init(struct smbconf_ctx *ctx, const char *path) { WERROR werr = WERR_OK; + sbcErr err; struct security_token *token; if (path == NULL) { @@ -588,17 +589,19 @@ static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path) werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token)); if (!W_ERROR_IS_OK(werr)) { DEBUG(1, ("Error creating admin token\n")); + err = SBC_ERR_UNKNOWN_FAILURE; goto done; } rpd(ctx)->open = false; werr = registry_init_smbconf(path); if (!W_ERROR_IS_OK(werr)) { + err = SBC_ERR_BADFILE; goto done; } - werr = ctx->ops->open_conf(ctx); - if (!W_ERROR_IS_OK(werr)) { + err = ctx->ops->open_conf(ctx); + if (!SBC_ERROR_IS_OK(err)) { DEBUG(1, ("Error opening the registry.\n")); goto done; } @@ -607,11 +610,12 @@ static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path) KEY_ENUMERATE_SUB_KEYS | REG_KEY_WRITE, token, &rpd(ctx)->base_key); if (!W_ERROR_IS_OK(werr)) { + err = SBC_ERR_UNKNOWN_FAILURE; goto done; } done: - return werr; + return err; } static int smbconf_reg_shutdown(struct smbconf_ctx *ctx) @@ -640,19 +644,21 @@ static bool smbconf_reg_is_writeable(struct smbconf_ctx *ctx) return true; } -static WERROR smbconf_reg_open(struct smbconf_ctx *ctx) +static sbcErr smbconf_reg_open(struct smbconf_ctx *ctx) { WERROR werr; if (rpd(ctx)->open) { - return WERR_OK; + return SBC_ERR_OK; } werr = regdb_open(); - if (W_ERROR_IS_OK(werr)) { - rpd(ctx)->open = true; + if (!W_ERROR_IS_OK(werr)) { + return SBC_ERR_BADFILE; } - return werr; + + rpd(ctx)->open = true; + return SBC_ERR_OK; } static int smbconf_reg_close(struct smbconf_ctx *ctx) @@ -682,7 +688,7 @@ static void smbconf_reg_get_csn(struct smbconf_ctx *ctx, return; } - if (!W_ERROR_IS_OK(ctx->ops->open_conf(ctx))) { + if (!SBC_ERROR_IS_OK(ctx->ops->open_conf(ctx))) { return; } diff --git a/source3/lib/smbconf/testsuite.c b/source3/lib/smbconf/testsuite.c index 5bde5e1621..b52d173768 100644 --- a/source3/lib/smbconf/testsuite.c +++ b/source3/lib/smbconf/testsuite.c @@ -203,7 +203,6 @@ 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"; @@ -246,7 +245,6 @@ done: static bool torture_smbconf_reg(void) { - WERROR werr; sbcErr err; bool ret = true; struct smbconf_ctx *conf_ctx = NULL; |