summaryrefslogtreecommitdiff
path: root/source3/libnet/libnet_conf.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-12-19 16:07:40 +0100
committerGünther Deschner <gd@samba.org>2007-12-21 15:29:11 +0100
commit991112eda710c97dff607dd615c777023395da65 (patch)
treeb67f165f9cae04735b45c55cf469225f0e03ee5e /source3/libnet/libnet_conf.c
parent721d36df8372dd45430a93c99180bb94ec7d9773 (diff)
downloadsamba-991112eda710c97dff607dd615c777023395da65.tar.gz
samba-991112eda710c97dff607dd615c777023395da65.tar.bz2
samba-991112eda710c97dff607dd615c777023395da65.zip
Implement NetServerSetInfo level 1005 in local mode with smbconf registry.
Guenther (This used to be commit 15c2bc15f20a677c3c94895150e396275de6ac9b)
Diffstat (limited to 'source3/libnet/libnet_conf.c')
-rw-r--r--source3/libnet/libnet_conf.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c
index f394e02e20..8bc5161268 100644
--- a/source3/libnet/libnet_conf.c
+++ b/source3/libnet/libnet_conf.c
@@ -147,3 +147,49 @@ done:
return werr;
}
+static WERROR do_modify_val_config(struct registry_key *key,
+ const char *val_name,
+ const char *val_data)
+{
+ struct registry_value val;
+
+ ZERO_STRUCT(val);
+
+ val.type = REG_SZ;
+ val.v.sz.str = CONST_DISCARD(char *, val_data);
+ val.v.sz.len = strlen(val_data) + 1;
+
+ return reg_setvalue(key, val_name, &val);
+}
+
+WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx,
+ const char *param,
+ const char *val)
+{
+ WERROR werr;
+ struct registry_key *key = NULL;
+
+ if (!lp_include_registry_globals()) {
+ return WERR_NOT_SUPPORTED;
+ }
+
+ if (!registry_init_regdb()) {
+ return WERR_REG_IO_FAILURE;
+ }
+
+ if (!libnet_smbconf_key_exists(mem_ctx, GLOBAL_NAME)) {
+ werr = libnet_reg_createkey_internal(mem_ctx,
+ GLOBAL_NAME, &key);
+ } else {
+ werr = libnet_smbconf_open_path(mem_ctx,
+ GLOBAL_NAME,
+ REG_KEY_WRITE, &key);
+ }
+
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
+ }
+
+ return do_modify_val_config(key, param, val);
+}
+