mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
s3: libsmb: Make get_pdc_ip() use internal_resolve_name_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
parent
55b589e9b0
commit
37eaee03e0
@ -3712,22 +3712,32 @@ bool find_master_ip(const char *group, struct sockaddr_storage *master_ss)
|
|||||||
bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss)
|
bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss)
|
||||||
{
|
{
|
||||||
struct ip_service *ip_list = NULL;
|
struct ip_service *ip_list = NULL;
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
|
NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
|
||||||
static const char *ads_order[] = { "ads", NULL };
|
static const char *ads_order[] = { "ads", NULL };
|
||||||
/* Look up #1B name */
|
/* Look up #1B name */
|
||||||
|
|
||||||
if (lp_security() == SEC_ADS) {
|
if (lp_security() == SEC_ADS) {
|
||||||
status = internal_resolve_name(domain, 0x1b, NULL, &ip_list,
|
status = internal_resolve_name_talloc(talloc_tos(),
|
||||||
&count, ads_order);
|
domain,
|
||||||
|
0x1b,
|
||||||
|
NULL,
|
||||||
|
&ip_list,
|
||||||
|
&count,
|
||||||
|
ads_order);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_STATUS_IS_OK(status) || count == 0) {
|
if (!NT_STATUS_IS_OK(status) || count == 0) {
|
||||||
status = internal_resolve_name(domain, 0x1b, NULL, &ip_list,
|
TALLOC_FREE(ip_list);
|
||||||
&count,
|
status = internal_resolve_name_talloc(talloc_tos(),
|
||||||
lp_name_resolve_order());
|
domain,
|
||||||
|
0x1b,
|
||||||
|
NULL,
|
||||||
|
&ip_list,
|
||||||
|
&count,
|
||||||
|
lp_name_resolve_order());
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
SAFE_FREE(ip_list);
|
TALLOC_FREE(ip_list);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3736,12 +3746,12 @@ bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss)
|
|||||||
multi-homed PDC and not a mess up */
|
multi-homed PDC and not a mess up */
|
||||||
|
|
||||||
if ( count > 1 ) {
|
if ( count > 1 ) {
|
||||||
DEBUG(6,("get_pdc_ip: PDC has %d IP addresses!\n", count));
|
DBG_INFO("PDC has %zu IP addresses!\n", count);
|
||||||
sort_service_list(ip_list, count);
|
sort_service_list(ip_list, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
*pss = ip_list[0].ss;
|
*pss = ip_list[0].ss;
|
||||||
SAFE_FREE(ip_list);
|
TALLOC_FREE(ip_list);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user