summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-09-04 13:58:18 -0700
committerJeremy Allison <jra@samba.org>2013-09-05 09:17:27 -0700
commit32037e0533f720ebbd3f49c5951c4ef30aac9985 (patch)
treef9db5cdac1da5bd09fb0e2a6e373a96a9847c08b /source3/utils
parent6b915bfd0f4194453c1b01158f2c2772b2a2df2f (diff)
downloadsamba-32037e0533f720ebbd3f49c5951c4ef30aac9985.tar.gz
samba-32037e0533f720ebbd3f49c5951c4ef30aac9985.tar.bz2
samba-32037e0533f720ebbd3f49c5951c4ef30aac9985.zip
Add a talloc context to sitename_fetch().
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_lookup.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c
index 50226f0ba5..9d61be2aa3 100644
--- a/source3/utils/net_lookup.c
+++ b/source3/utils/net_lookup.c
@@ -113,15 +113,14 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
else
domain = c->opt_target_workgroup;
- sitename = sitename_fetch(domain);
-
if ( (ctx = talloc_init("net_lookup_ldap")) == NULL ) {
d_fprintf(stderr,"net_lookup_ldap: talloc_init() %s!\n",
_("failed"));
- SAFE_FREE(sitename);
return -1;
}
+ sitename = sitename_fetch(ctx, domain);
+
DEBUG(9, ("Lookup up ldap for domain %s\n", domain));
dns_hosts_file = lp_parm_const_string(-1, "resolv", "host file", NULL);
@@ -130,14 +129,12 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
if ( NT_STATUS_IS_OK(status) && numdcs ) {
print_ldap_srvlist(dcs, numdcs);
TALLOC_FREE( ctx );
- SAFE_FREE(sitename);
return 0;
}
DEBUG(9, ("Looking up PDC for domain %s\n", domain));
if (!get_pdc_ip(domain, &ss)) {
TALLOC_FREE( ctx );
- SAFE_FREE(sitename);
return -1;
}
@@ -149,7 +146,6 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
if (ret) {
TALLOC_FREE( ctx );
- SAFE_FREE(sitename);
return -1;
}
@@ -157,7 +153,6 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
domain = strchr(h_name, '.');
if (!domain) {
TALLOC_FREE( ctx );
- SAFE_FREE(sitename);
return -1;
}
domain++;
@@ -169,12 +164,10 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
if ( NT_STATUS_IS_OK(status) && numdcs ) {
print_ldap_srvlist(dcs, numdcs);
TALLOC_FREE( ctx );
- SAFE_FREE(sitename);
return 0;
}
TALLOC_FREE( ctx );
- SAFE_FREE(sitename);
return -1;
#endif
@@ -212,14 +205,14 @@ static int net_lookup_dc(struct net_context *c, int argc, const char **argv)
}
d_printf("%s\n", pdc_str);
- sitename = sitename_fetch(domain);
+ sitename = sitename_fetch(talloc_tos(), domain);
if (!NT_STATUS_IS_OK(get_sorted_dc_list(domain, sitename,
&ip_list, &count, sec_ads))) {
SAFE_FREE(pdc_str);
- SAFE_FREE(sitename);
+ TALLOC_FREE(sitename);
return 0;
}
- SAFE_FREE(sitename);
+ TALLOC_FREE(sitename);
for (i=0;i<count;i++) {
print_sockaddr(addr, sizeof(addr), &ip_list[i].ss);
if (!strequal(pdc_str, addr))