summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-12-23 03:41:55 +0100
committerMichael Adam <obnox@samba.org>2007-12-23 04:10:32 +0100
commit62f08d3dd9b1f1d53a8e9ecf352fbbfb4c12c484 (patch)
tree4f16e6c7eef27ddb2746ad49308d19a4d0fa32c2 /source3
parent31d436e54c2ec56ae59527feb9a31d13eca44f6d (diff)
downloadsamba-62f08d3dd9b1f1d53a8e9ecf352fbbfb4c12c484.tar.gz
samba-62f08d3dd9b1f1d53a8e9ecf352fbbfb4c12c484.tar.bz2
samba-62f08d3dd9b1f1d53a8e9ecf352fbbfb4c12c484.zip
Move net_conf_setparm() to libnet_conf.c
renaming it to libnet_smbconf_setparm() Michael (This used to be commit 60f49b22b5aa125ff6cb358a258a1be99c378d7a)
Diffstat (limited to 'source3')
-rw-r--r--source3/libnet/libnet_conf.c21
-rw-r--r--source3/utils/net_conf.c12
2 files changed, 22 insertions, 11 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c
index d42e5ad227..00dc1d473d 100644
--- a/source3/libnet/libnet_conf.c
+++ b/source3/libnet/libnet_conf.c
@@ -235,6 +235,27 @@ static WERROR do_modify_val_config(struct registry_key *key,
return reg_setvalue(key, val_name, &val);
}
+WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx,
+ const char *service,
+ const char *param,
+ const char *valstr)
+{
+ WERROR werr;
+ struct registry_key *key = NULL;
+
+ if (!libnet_smbconf_key_exists(mem_ctx, service)) {
+ werr = libnet_reg_createkey_internal(mem_ctx, service, &key);
+ } else {
+ werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_WRITE,
+ &key);
+ }
+ W_ERROR_NOT_OK_RETURN(werr);
+
+ werr = libnet_smbconf_reg_setvalue_internal(key, param, valstr);
+
+ return werr;
+}
+
WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx,
const char *param,
const char *val)
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 2648aa2e81..1ab1378910 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -834,7 +834,6 @@ static int net_conf_setparm(int argc, const char **argv)
{
int ret = -1;
WERROR werr = WERR_OK;
- struct registry_key *key = NULL;
char *service = NULL;
char *param = NULL;
const char *value_str = NULL;
@@ -850,23 +849,14 @@ static int net_conf_setparm(int argc, const char **argv)
param = strdup_lower(argv[1]);
value_str = argv[2];
- if (!libnet_smbconf_key_exists(ctx, service)) {
- werr = libnet_reg_createkey_internal(ctx, service, &key);
- } else {
- werr = libnet_smbconf_open_path(ctx, service, REG_KEY_WRITE, &key);
- }
- if (!W_ERROR_IS_OK(werr)) {
- goto done;
- }
+ werr = libnet_smbconf_setparm(ctx, service, param, value_str);
- werr = libnet_smbconf_reg_setvalue_internal(key, param, value_str);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error setting value '%s': %s\n",
param, dos_errstr(werr));
goto done;
}
-
ret = 0;
done: