X-Git-Url: http://git.samba.org/?p=samba.git;a=blobdiff_plain;f=source3%2Flib%2Fsmbconf%2Fsmbconf_reg.c;h=01de193b3c499d32bd65c6b0eef9afea3eb2b6b1;hp=1aa345da3c668dcdb6da5d8b9d735172802faa26;hb=26f238466caa1d40edf74d4678c2e981ec9018bd;hpb=f9fb9436ae7a6556d3636f732889bae136a81390 diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index 1aa345da3c6..01de193b3c4 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -18,7 +18,7 @@ */ #include "includes.h" -#include "smbconf_private.h" +#include "lib/smbconf/smbconf_private.h" #define INCLUDES_VALNAME "includes" @@ -112,7 +112,7 @@ static WERROR smbconf_reg_open_path(TALLOC_CTX *mem_ctx, if (!W_ERROR_IS_OK(werr)) { DEBUG(5, ("Error opening registry path '%s': %s\n", - path, dos_errstr(werr))); + path, win_errstr(werr))); } done: @@ -145,7 +145,7 @@ static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx, werr = smbconf_reg_open_path(mem_ctx, ctx, path, desired_access, key); done: - TALLOC_FREE(path); + talloc_free(path); return werr; } @@ -176,7 +176,7 @@ static bool smbconf_value_exists(struct registry_key *key, const char *param) ret = true; } - TALLOC_FREE(ctx); + talloc_free(ctx); return ret; } @@ -212,11 +212,11 @@ static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx, } if (!W_ERROR_IS_OK(werr)) { DEBUG(5, ("Error creating key %s: %s\n", - subkeyname, dos_errstr(werr))); + subkeyname, win_errstr(werr))); } done: - TALLOC_FREE(create_ctx); + talloc_free(create_ctx); return werr; } @@ -283,7 +283,7 @@ static WERROR smbconf_reg_set_value(struct registry_key *key, if (!W_ERROR_IS_OK(werr)) { DEBUG(5, ("Error adding value '%s' to " "key '%s': %s\n", - canon_valname, key->key->name, dos_errstr(werr))); + canon_valname, key->key->name, win_errstr(werr))); } done: @@ -327,11 +327,11 @@ static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key, werr = reg_setvalue(key, valname, value); if (!W_ERROR_IS_OK(werr)) { DEBUG(5, ("Error adding value '%s' to key '%s': %s\n", - valname, key->key->name, dos_errstr(werr))); + valname, key->key->name, win_errstr(werr))); } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -436,7 +436,7 @@ static WERROR smbconf_reg_get_includes_internal(TALLOC_CTX *mem_ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -533,7 +533,7 @@ static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -585,14 +585,14 @@ static WERROR smbconf_reg_delete_values(struct registry_key *key) DEBUG(1, ("smbconf_reg_delete_values: " "Error enumerating values of %s: %s\n", key->key->name, - dos_errstr(werr))); + win_errstr(werr))); goto done; } werr = WERR_OK; done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -642,6 +642,27 @@ static int smbconf_reg_shutdown(struct smbconf_ctx *ctx) return ctx->ops->close_conf(ctx); } +static bool smbconf_reg_requires_messaging(struct smbconf_ctx *ctx) +{ +#ifdef CLUSTER_SUPPORT + if (lp_clustering() && lp_parm_bool(-1, "ctdb", "registry.tdb", true)) { + return true; + } +#endif + return false; +} + +static bool smbconf_reg_is_writeable(struct smbconf_ctx *ctx) +{ + /* + * The backend has write support. + * + * TODO: add access checks whether the concrete + * config source is really writeable by the calling user. + */ + return true; +} + static WERROR smbconf_reg_open(struct smbconf_ctx *ctx) { WERROR werr; @@ -727,7 +748,7 @@ static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx) &new_key, &action); done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -812,7 +833,7 @@ static WERROR smbconf_reg_get_share_names(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -833,7 +854,7 @@ static bool smbconf_reg_share_exists(struct smbconf_ctx *ctx, ret = true; } - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return ret; } @@ -855,7 +876,7 @@ static WERROR smbconf_reg_create_share(struct smbconf_ctx *ctx, servicename, &key); } - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -875,6 +896,9 @@ static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx, werr = smbconf_reg_open_service_key(tmp_ctx, ctx, servicename, REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { + if (W_ERROR_EQUAL(werr, WERR_BADFILE)) { + werr = WERR_NO_SUCH_SERVICE; + } goto done; } @@ -902,7 +926,7 @@ static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -928,7 +952,7 @@ static WERROR smbconf_reg_delete_share(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -953,7 +977,7 @@ static WERROR smbconf_reg_set_parameter(struct smbconf_ctx *ctx, werr = smbconf_reg_set_value(key, param, valstr); done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -998,8 +1022,8 @@ static WERROR smbconf_reg_get_parameter(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(key); - TALLOC_FREE(value); + talloc_free(key); + talloc_free(value); return werr; } @@ -1033,7 +1057,7 @@ static WERROR smbconf_reg_delete_parameter(struct smbconf_ctx *ctx, werr = reg_deletevalue(key, param); done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -1057,7 +1081,7 @@ static WERROR smbconf_reg_get_includes(struct smbconf_ctx *ctx, includes); done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -1087,7 +1111,7 @@ static WERROR smbconf_reg_set_includes(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -1112,13 +1136,15 @@ static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx, done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } struct smbconf_ops smbconf_ops_reg = { .init = smbconf_reg_init, .shutdown = smbconf_reg_shutdown, + .requires_messaging = smbconf_reg_requires_messaging, + .is_writeable = smbconf_reg_is_writeable, .open_conf = smbconf_reg_open, .close_conf = smbconf_reg_close, .get_csn = smbconf_reg_get_csn,