summaryrefslogtreecommitdiff
path: root/source3/libads/ads_struct.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-13 11:29:49 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-13 11:29:49 +0000
commit75a6ac48a0a2fb5285fd7d92fed770cacc0d400f (patch)
tree46c8caa10cb2408659dd2e0f770c8af86795f4e5 /source3/libads/ads_struct.c
parent0ae491629917116b2ad587762a258a5649408649 (diff)
downloadsamba-75a6ac48a0a2fb5285fd7d92fed770cacc0d400f.tar.gz
samba-75a6ac48a0a2fb5285fd7d92fed770cacc0d400f.tar.bz2
samba-75a6ac48a0a2fb5285fd7d92fed770cacc0d400f.zip
try the PDC for our workgroup if we can't find the ldap server
(This used to be commit fc9fd2ca19899e757a6d3ccbba3d4a10f27d7a3f)
Diffstat (limited to 'source3/libads/ads_struct.c')
-rw-r--r--source3/libads/ads_struct.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index 72f2a32e64..4b2ab5b40f 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/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;
}