summaryrefslogtreecommitdiff
path: root/source3/libads/ldap.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-11-06 01:29:07 +0000
committerTim Potter <tpot@samba.org>2002-11-06 01:29:07 +0000
commitea24bb2da8f643e043dc3af3ed3f16388878b57b (patch)
treedcffacff686f4867441fc7b177a865bcc43ea212 /source3/libads/ldap.c
parent62d4ea1bc50bcd9f89fa054f60ca475f87b4a9de (diff)
downloadsamba-ea24bb2da8f643e043dc3af3ed3f16388878b57b.tar.gz
samba-ea24bb2da8f643e043dc3af3ed3f16388878b57b.tar.bz2
samba-ea24bb2da8f643e043dc3af3ed3f16388878b57b.zip
Merge of get_dc_list() api change. This was slightly more intrusive
than the version in APPLIANCE so watch out for boogs. (This used to be commit 1e054e3db654801fbb5580211529cdfdea9ed686)
Diffstat (limited to 'source3/libads/ldap.c')
-rw-r--r--source3/libads/ldap.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 2359dbd7ed..a59b78bf13 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -180,7 +180,7 @@ static BOOL ads_try_dns(ADS_STRUCT *ads)
/* try connecting to a ldap server via netbios */
static BOOL ads_try_netbios(ADS_STRUCT *ads)
{
- struct in_addr *ip_list;
+ struct in_addr *ip_list, pdc_ip;
int count;
int i;
char *workgroup = ads->server.workgroup;
@@ -192,20 +192,15 @@ static BOOL ads_try_netbios(ADS_STRUCT *ads)
DEBUG(6,("ads_try_netbios: looking for workgroup '%s'\n", workgroup));
/* try the PDC first */
- if (get_dc_list(True, workgroup, &ip_list, &count)) {
- for (i=0;i<count;i++) {
- DEBUG(6,("ads_try_netbios: trying server '%s'\n",
- inet_ntoa(ip_list[i])));
- if (ads_try_connect(ads, inet_ntoa(ip_list[i]), LDAP_PORT)) {
- free(ip_list);
- return True;
- }
- }
- free(ip_list);
+ if (get_pdc_ip(workgroup, &pdc_ip)) {
+ DEBUG(6,("ads_try_netbios: trying server '%s'\n",
+ inet_ntoa(pdc_ip)));
+ if (ads_try_connect(ads, inet_ntoa(pdc_ip), LDAP_PORT))
+ return True;
}
/* now any DC, including backups */
- if (get_dc_list(False, workgroup, &ip_list, &count)) {
+ if (get_dc_list(workgroup, &ip_list, &count)) {
for (i=0;i<count;i++) {
DEBUG(6,("ads_try_netbios: trying server '%s'\n",
inet_ntoa(ip_list[i])));