1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3: net lookup: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
Jeremy Allison 2020-08-26 11:56:00 -07:00 committed by Noel Power
parent b4164093cf
commit 1d6c3c2dea

View File

@ -183,7 +183,7 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
static int net_lookup_dc(struct net_context *c, int argc, const char **argv)
{
struct ip_service *ip_list;
struct ip_service *ip_list = NULL;
struct sockaddr_storage ss;
char *pdc_str = NULL;
const char *domain = NULL;
@ -192,6 +192,7 @@ static int net_lookup_dc(struct net_context *c, int argc, const char **argv)
size_t i;
char addr[INET6_ADDRSTRLEN];
bool sec_ads = (lp_security() == SEC_ADS);
NTSTATUS status;
if (sec_ads) {
domain = lp_realm();
@ -213,8 +214,13 @@ static int net_lookup_dc(struct net_context *c, int argc, const char **argv)
d_printf("%s\n", pdc_str);
sitename = sitename_fetch(talloc_tos(), domain);
if (!NT_STATUS_IS_OK(get_sorted_dc_list(domain, sitename,
&ip_list, &count, sec_ads))) {
status = get_sorted_dc_list_talloc(talloc_tos(),
domain,
sitename,
&ip_list,
&count,
sec_ads);
if (!NT_STATUS_IS_OK(status)) {
SAFE_FREE(pdc_str);
TALLOC_FREE(sitename);
return 0;
@ -225,6 +231,7 @@ static int net_lookup_dc(struct net_context *c, int argc, const char **argv)
if (!strequal(pdc_str, addr))
d_printf("%s\n", addr);
}
TALLOC_FREE(ip_list);
SAFE_FREE(pdc_str);
return 0;
}