diff options
author | Michael Adam <obnox@samba.org> | 2007-12-31 01:14:44 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2007-12-31 01:14:44 +0100 |
commit | e8a680cdf391255fcbdacd1dcebc0f5a947408f1 (patch) | |
tree | fdebdf3a38ca52c0b41c07c5154069a392e01efe /source3/libnet | |
parent | a74de0c7eb575e5b983773a1b8daa724c7074e7e (diff) | |
download | samba-e8a680cdf391255fcbdacd1dcebc0f5a947408f1.tar.gz samba-e8a680cdf391255fcbdacd1dcebc0f5a947408f1.tar.bz2 samba-e8a680cdf391255fcbdacd1dcebc0f5a947408f1.zip |
Rename libnet_smbconf_key_exists() to libnet_smbconf_share_exists()
and move it to the api section of libnet_conf.c
Michael
(This used to be commit 9b5d8f4d95ebfd47831906019e11227aecc83aa1)
Diffstat (limited to 'source3/libnet')
-rw-r--r-- | source3/libnet/libnet_conf.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 8fe2c76ea3..1b13b5bdc9 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -100,26 +100,6 @@ static WERROR libnet_smbconf_reg_open_basepath(TALLOC_CTX *ctx, return libnet_smbconf_reg_open_path(ctx, NULL, desired_access, key); } -/* - * check if a subkey of KEY_SMBCONF of a given name exists - */ -bool libnet_smbconf_key_exists(const char *subkeyname) -{ - bool ret = false; - WERROR werr = WERR_OK; - TALLOC_CTX *mem_ctx = talloc_stackframe(); - struct registry_key *key = NULL; - - werr = libnet_smbconf_reg_open_path(mem_ctx, subkeyname, REG_KEY_READ, - &key); - if (W_ERROR_IS_OK(werr)) { - ret = true; - } - - TALLOC_FREE(mem_ctx); - return ret; -} - static bool libnet_smbconf_value_exists(struct registry_key *key, const char *param) { @@ -530,7 +510,7 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, } /* make sure "global" is always listed first */ - if (libnet_smbconf_key_exists(GLOBAL_NAME)) { + if (libnet_smbconf_share_exists(GLOBAL_NAME)) { werr = libnet_smbconf_add_string_to_array(tmp_ctx, &tmp_share_names, 0, GLOBAL_NAME); @@ -583,6 +563,26 @@ done: } /** + * check if a share/service of a given name exists + */ +bool libnet_smbconf_share_exists(const char *subkeyname) +{ + bool ret = false; + WERROR werr = WERR_OK; + TALLOC_CTX *mem_ctx = talloc_stackframe(); + struct registry_key *key = NULL; + + werr = libnet_smbconf_reg_open_path(mem_ctx, subkeyname, REG_KEY_READ, + &key); + if (W_ERROR_IS_OK(werr)) { + ret = true; + } + + TALLOC_FREE(mem_ctx); + return ret; +} + +/** * get a definition of a share (service) from configuration. */ WERROR libnet_smbconf_getshare(TALLOC_CTX *mem_ctx, const char *servicename, @@ -638,7 +638,7 @@ WERROR libnet_smbconf_setparm(const char *service, struct registry_key *key = NULL; TALLOC_CTX *mem_ctx = talloc_stackframe(); - if (!libnet_smbconf_key_exists(service)) { + if (!libnet_smbconf_share_exists(service)) { werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service, &key); } else { @@ -673,7 +673,7 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - if (!libnet_smbconf_key_exists(service)) { + if (!libnet_smbconf_share_exists(service)) { werr = WERR_NO_SUCH_SERVICE; goto done; } @@ -716,7 +716,7 @@ WERROR libnet_smbconf_delparm(const char *service, WERROR werr = WERR_OK; TALLOC_CTX *mem_ctx = talloc_stackframe(); - if (!libnet_smbconf_key_exists(service)) { + if (!libnet_smbconf_share_exists(service)) { return WERR_NO_SUCH_SERVICE; } |