diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-12-13 11:29:49 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-12-13 11:29:49 +0000 |
commit | fc9fd2ca19899e757a6d3ccbba3d4a10f27d7a3f (patch) | |
tree | 76be3639fe2e4adabe80b8be2421bc32df073881 /source/libads | |
parent | 4405a87fb754cece3a5428246ea6ecb9abba1996 (diff) | |
download | samba-fc9fd2ca19899e757a6d3ccbba3d4a10f27d7a3f.tar.gz samba-fc9fd2ca19899e757a6d3ccbba3d4a10f27d7a3f.tar.xz samba-fc9fd2ca19899e757a6d3ccbba3d4a10f27d7a3f.zip |
try the PDC for our workgroup if we can't find the ldap server
Diffstat (limited to 'source/libads')
-rw-r--r-- | source/libads/ads_struct.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/libads/ads_struct.c b/source/libads/ads_struct.c index 72f2a32e64c..4b2ab5b40fa 100644 --- a/source/libads/ads_struct.c +++ b/source/libads/ads_struct.c @@ -62,16 +62,21 @@ char *ads_build_dn(const char *realm) static char *find_ldap_server(ADS_STRUCT *ads) { char *list = NULL; + struct in_addr ip; - if (!ads->realm) return NULL; - - if (ldap_domain2hostlist(ads->realm, &list) == LDAP_SUCCESS) { + if (ads->realm && + ldap_domain2hostlist(ads->realm, &list) == LDAP_SUCCESS) { char *p; p = strchr(list, ':'); if (p) *p = 0; return list; } + /* get desperate, find the domain controller IP */ + if (resolve_name(lp_workgroup(), &ip, 0x1B)) { + return strdup(inet_ntoa(ip)); + } + return NULL; } |