From ea24bb2da8f643e043dc3af3ed3f16388878b57b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 6 Nov 2002 01:29:07 +0000 Subject: 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) --- source3/auth/auth_domain.c | 19 ++++++++++++-- source3/libads/ldap.c | 19 +++++--------- source3/libsmb/namequery.c | 59 ++++++++++++++++++++++++++++++++---------- source3/nsswitch/winbindd_cm.c | 20 +++++++++++--- source3/rpcclient/samsync.c | 9 +++---- source3/smbd/change_trust_pw.c | 15 +++-------- source3/utils/net.c | 25 +++++------------- source3/utils/net_lookup.c | 16 ++++++------ 8 files changed, 108 insertions(+), 74 deletions(-) (limited to 'source3') diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c index 129c486562..e18d809efb 100644 --- a/source3/auth/auth_domain.c +++ b/source3/auth/auth_domain.c @@ -288,8 +288,23 @@ static NTSTATUS find_connect_pdc(struct cli_state **cli, if (time_now - last_change_time < 3600) use_pdc_only = True; - if (!get_dc_list(use_pdc_only, domain, &ip_list, &count)) - return NT_STATUS_NO_LOGON_SERVERS; + if (use_pdc_only) { + struct in_addr pdc_ip; + + if (!get_pdc_ip(domain, &pdc_ip)) + return NT_STATUS_NO_LOGON_SERVERS; + + if ((ip_list = (struct in_addr *) + malloc(sizeof(struct in_addr))) == NULL) + return NT_STATUS_NO_MEMORY; + + ip_list[0] = pdc_ip; + count = 1; + + } else { + if (!get_dc_list(domain, &ip_list, &count)) + return NT_STATUS_NO_LOGON_SERVERS; + } /* * Firstly try and contact a PDC/BDC who has the same 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 0) @@ -96,10 +96,10 @@ static int net_lookup_ldap(int argc, const char **argv) } DEBUG(9, ("Looking up DC for domain %s\n", domain)); - if (!get_dc_list(True, domain, &addr, &count)) + if (!get_pdc_ip(domain, &addr)) return -1; - hostent = gethostbyaddr((char *) &addr->s_addr, sizeof(addr->s_addr), + hostent = gethostbyaddr((char *) &addr.s_addr, sizeof(addr.s_addr), AF_INET); if (!hostent) return -1; @@ -124,7 +124,7 @@ static int net_lookup_ldap(int argc, const char **argv) static int net_lookup_dc(int argc, const char **argv) { - struct in_addr *ip_list; + struct in_addr *ip_list, addr; char *pdc_str = NULL; const char *domain=opt_target_workgroup; int count, i; @@ -133,13 +133,13 @@ static int net_lookup_dc(int argc, const char **argv) domain=argv[0]; /* first get PDC */ - if (!get_dc_list(True, domain, &ip_list, &count)) + if (!get_pdc_ip(domain, &addr)) return -1; - asprintf(&pdc_str, "%s", inet_ntoa(*ip_list)); + asprintf(&pdc_str, "%s", inet_ntoa(addr)); d_printf("%s\n", pdc_str); - if (!get_dc_list(False, domain, &ip_list, &count)) { + if (!get_dc_list(domain, &ip_list, &count)) { SAFE_FREE(pdc_str); return 0; } -- cgit