summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libnet/libnet_conf.c11
-rw-r--r--source3/libnet/libnet_join.c17
-rw-r--r--source3/utils/net_conf.c6
3 files changed, 13 insertions, 21 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c
index be9edad4e9..6ea97a82eb 100644
--- a/source3/libnet/libnet_conf.c
+++ b/source3/libnet/libnet_conf.c
@@ -310,13 +310,13 @@ done:
return werr;
}
-WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx,
- const char *service,
+WERROR libnet_smbconf_setparm(const char *service,
const char *param,
const char *valstr)
{
WERROR werr;
struct registry_key *key = NULL;
+ TALLOC_CTX *mem_ctx = talloc_stackframe();
if (!libnet_smbconf_key_exists(service)) {
werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service,
@@ -332,7 +332,7 @@ WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx,
werr = libnet_smbconf_reg_setvalue_internal(key, param, valstr);
done:
- TALLOC_FREE(key);
+ TALLOC_FREE(mem_ctx);
return werr;
}
@@ -401,10 +401,9 @@ done:
*
**********************************************************************/
-WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx,
- const char *param,
+WERROR libnet_smbconf_set_global_param(const char *param,
const char *val)
{
- return libnet_smbconf_setparm(mem_ctx, GLOBAL_NAME, param, val);
+ return libnet_smbconf_setparm(GLOBAL_NAME, param, val);
}
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 68244e5156..4f5c09cf47 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -339,11 +339,10 @@ static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx,
if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) {
- werr = libnet_smbconf_set_global_param(mem_ctx, "security",
- "user");
+ werr = libnet_smbconf_set_global_param("security", "user");
W_ERROR_NOT_OK_RETURN(werr);
- werr = libnet_smbconf_set_global_param(mem_ctx, "workgroup",
+ werr = libnet_smbconf_set_global_param("workgroup",
r->in.domain_name);
return werr;
}
@@ -352,19 +351,18 @@ static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx,
is_ad = true;
}
- werr = libnet_smbconf_set_global_param(mem_ctx, "security", "domain");
+ werr = libnet_smbconf_set_global_param("security", "domain");
W_ERROR_NOT_OK_RETURN(werr);
- werr = libnet_smbconf_set_global_param(mem_ctx, "workgroup",
+ werr = libnet_smbconf_set_global_param("workgroup",
r->out.netbios_domain_name);
W_ERROR_NOT_OK_RETURN(werr);
if (is_ad) {
- werr = libnet_smbconf_set_global_param(mem_ctx, "security",
- "ads");
+ werr = libnet_smbconf_set_global_param("security", "ads");
W_ERROR_NOT_OK_RETURN(werr);
- werr = libnet_smbconf_set_global_param(mem_ctx, "realm",
+ werr = libnet_smbconf_set_global_param("realm",
r->out.dns_domain_name);
W_ERROR_NOT_OK_RETURN(werr);
}
@@ -379,8 +377,7 @@ static WERROR do_unjoin_modify_vals_config(TALLOC_CTX *mem_ctx,
if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
- werr = libnet_smbconf_set_global_param(mem_ctx, "security",
- "user");
+ werr = libnet_smbconf_set_global_param("security", "user");
W_ERROR_NOT_OK_RETURN(werr);
}
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 9a6f5400e1..eb6398f5b9 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -769,9 +769,6 @@ static int net_conf_setparm(int argc, const char **argv)
char *service = NULL;
char *param = NULL;
const char *value_str = NULL;
- TALLOC_CTX *ctx;
-
- ctx = talloc_init("setparm");
if (argc != 3) {
net_conf_setparm_usage(argc, argv);
@@ -781,7 +778,7 @@ static int net_conf_setparm(int argc, const char **argv)
param = strdup_lower(argv[1]);
value_str = argv[2];
- werr = libnet_smbconf_setparm(ctx, service, param, value_str);
+ werr = libnet_smbconf_setparm(service, param, value_str);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error setting value '%s': %s\n",
@@ -793,7 +790,6 @@ static int net_conf_setparm(int argc, const char **argv)
done:
SAFE_FREE(service);
- TALLOC_FREE(ctx);
return ret;
}