summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2004-08-12 03:28:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:20 -0500
commitd86f6ceeadd04dccf6b5d7a78e627f78bb424fc7 (patch)
tree6ccf11b615077e0724d74ef751a8e6e436d65f0d
parentead3776a74810cabe0fae61fa1407e8c113446a7 (diff)
downloadsamba-d86f6ceeadd04dccf6b5d7a78e627f78bb424fc7.tar.gz
samba-d86f6ceeadd04dccf6b5d7a78e627f78bb424fc7.tar.bz2
samba-d86f6ceeadd04dccf6b5d7a78e627f78bb424fc7.zip
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)
-rw-r--r--source3/utils/net_ads.c5
-rw-r--r--source3/utils/net_ads_cldap.c3
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),