summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-08-30 09:52:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:22 -0500
commit7650d3bb18e1689c0d9c391ad6e5e172e0b54a62 (patch)
tree26871f8b0834d1e010ca0d867cfee40c7ca6ac3a /source3
parentb79f9b087054fd3b5c5cddfc89e4c56434309d34 (diff)
downloadsamba-7650d3bb18e1689c0d9c391ad6e5e172e0b54a62.tar.gz
samba-7650d3bb18e1689c0d9c391ad6e5e172e0b54a62.tar.bz2
samba-7650d3bb18e1689c0d9c391ad6e5e172e0b54a62.zip
r24799: Prefer IP address to dns name when replying in winbindd dsgetdcname.
Guenther (This used to be commit e5cc09c72f4acc851ed53ca02def5d692000d0da)
Diffstat (limited to 'source3')
-rw-r--r--source3/nsswitch/winbindd_misc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/nsswitch/winbindd_misc.c b/source3/nsswitch/winbindd_misc.c
index c32f052e3c..9c3f634534 100644
--- a/source3/nsswitch/winbindd_misc.c
+++ b/source3/nsswitch/winbindd_misc.c
@@ -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;
}