From d86f6ceeadd04dccf6b5d7a78e627f78bb424fc7 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Thu, 12 Aug 2004 03:28:57 +0000 Subject: r1750: This patch allows net ads lookup to rely on command line arguments if contacting an ADS server fails. This allows net ads lookup to work with clapd (very useful for testing). from aliguori@us.ibm.com (This used to be commit edb4e940b45cbb06a93004b15fc45a7a45a42498) --- source3/utils/net_ads.c | 5 ++++- source3/utils/net_ads_cldap.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 7b8ace85b6..2efd470bbe 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -77,9 +77,12 @@ static int net_ads_lookup(int argc, const char **argv) ads_connect(ads); - if (!ads || !ads->config.realm) { + if (!ads) { d_printf("Didn't find the cldap server!\n"); return -1; + } if (!ads->config.realm) { + ads->config.realm = opt_target_workgroup; + ads->ldap_port = 389; } return ads_cldap_netlogon(ads); diff --git a/source3/utils/net_ads_cldap.c b/source3/utils/net_ads_cldap.c index 1903172cf7..f3c6c5ff4d 100644 --- a/source3/utils/net_ads_cldap.c +++ b/source3/utils/net_ads_cldap.c @@ -280,8 +280,9 @@ int ads_cldap_netlogon(ADS_STRUCT *ads) int sock; int ret; struct cldap_netlogon_reply reply; + const char *target = opt_host ? opt_host : inet_ntoa(ads->ldap_ip); - sock = open_udp_socket(inet_ntoa(ads->ldap_ip), ads->ldap_port); + sock = open_udp_socket(target, ads->ldap_port); if (sock == -1) { d_printf("Failed to open udp socket to %s:%u\n", inet_ntoa(ads->ldap_ip), -- cgit