summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-01-03 11:30:14 +0100
committerMichael Adam <obnox@samba.org>2008-01-03 11:30:14 +0100
commitfd597c7e6d1b5d89c75dd24f2b62916ec81a67ae (patch)
tree9df3a6f4b4cc1b291f529aca6597d89ae908573f /source3/libnet
parent40079c4eb47b590a88ac8d568a5d5f039bc02af6 (diff)
downloadsamba-fd597c7e6d1b5d89c75dd24f2b62916ec81a67ae.tar.gz
samba-fd597c7e6d1b5d89c75dd24f2b62916ec81a67ae.tar.bz2
samba-fd597c7e6d1b5d89c75dd24f2b62916ec81a67ae.zip
Add libnet_conf API function libnet_smbconf_create_share().
And make libnet_smbconf_setparm() return error if the share does not already exist. Adapt net_conf_addshare to this new situation. Michael (This used to be commit de349bd26db3341815f6d8f6c18a5ca1fd664dca)
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_conf.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c
index ebdfd75744..2c67d4735e 100644
--- a/source3/libnet/libnet_conf.c
+++ b/source3/libnet/libnet_conf.c
@@ -612,6 +612,27 @@ bool libnet_smbconf_share_exists(const char *servicename)
}
/**
+ * Add a service if it does not already exist.
+ */
+WERROR libnet_smbconf_create_share(const char *servicename)
+{
+ WERROR werr;
+ TALLOC_CTX *mem_ctx = talloc_stackframe();
+ struct registry_key *key = NULL;
+
+ if (libnet_smbconf_share_exists(servicename)) {
+ werr = WERR_ALREADY_EXISTS;
+ goto done;
+ }
+
+ werr = libnet_smbconf_reg_createkey_internal(mem_ctx, servicename, &key);
+
+done:
+ TALLOC_FREE(mem_ctx);
+ return werr;
+}
+
+/**
* get a definition of a share (service) from configuration.
*/
WERROR libnet_smbconf_getshare(TALLOC_CTX *mem_ctx, const char *servicename,
@@ -668,12 +689,12 @@ WERROR libnet_smbconf_setparm(const char *service,
TALLOC_CTX *mem_ctx = talloc_stackframe();
if (!libnet_smbconf_share_exists(service)) {
- werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service,
- &key);
- } else {
- werr = libnet_smbconf_reg_open_service_key(mem_ctx, service,
- REG_KEY_WRITE, &key);
+ werr = WERR_NO_SUCH_SERVICE;
+ goto done;
}
+
+ werr = libnet_smbconf_reg_open_service_key(mem_ctx, service,
+ REG_KEY_WRITE, &key);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}