diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libnet/libnet_conf.c | 21 | ||||
-rw-r--r-- | source3/utils/net_conf.c | 12 |
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: |