summaryrefslogtreecommitdiff
path: root/source3/libads/ldap.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-11-06 05:14:15 +0000
committerTim Potter <tpot@samba.org>2002-11-06 05:14:15 +0000
commitab1cf8d1cf447e85063b43b65fa05c8b4bfde2a9 (patch)
treede41e9906d94ea9b2a1d2c12920d23b9640d3e83 /source3/libads/ldap.c
parentd21a06bbb44a0044657de38c1eb544be8c335918 (diff)
downloadsamba-ab1cf8d1cf447e85063b43b65fa05c8b4bfde2a9.tar.gz
samba-ab1cf8d1cf447e85063b43b65fa05c8b4bfde2a9.tar.bz2
samba-ab1cf8d1cf447e85063b43b65fa05c8b4bfde2a9.zip
Merge of get_dc_list() api change from HEAD.
(This used to be commit 6ba7847ce2756fde94e530fd0bf2a055f3e27373)
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])));