1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

r24799: Prefer IP address to dns name when replying in winbindd dsgetdcname.

Guenther
This commit is contained in:
Günther Deschner 2007-08-30 09:52:21 +00:00 committed by Gerald (Jerry) Carter
parent aca2d78db1
commit e5cc09c72f

View File

@ -298,6 +298,7 @@ enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain,
{
NTSTATUS result;
struct DS_DOMAIN_CONTROLLER_INFO *info = NULL;
const char *dc = NULL;
state->request.domain_name
[sizeof(state->request.domain_name)-1] = '\0';
@ -312,7 +313,22 @@ enum winbindd_result winbindd_dual_dsgetdcname(struct winbindd_domain *domain,
return WINBINDD_ERROR;
}
fstrcpy(state->response.data.dc_name, info->domain_controller_name);
if (info->domain_controller_address) {
dc = info->domain_controller_address;
if ((dc[0] == '\\') && (dc[1] == '\\')) {
dc += 2;
}
}
if ((!dc || !is_ipaddress(dc)) && info->domain_controller_name) {
dc = info->domain_controller_name;
}
if (!dc || !*dc) {
return WINBINDD_ERROR;
}
fstrcpy(state->response.data.dc_name, dc);
return WINBINDD_OK;
}