summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-03-29 15:30:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:46 -0500
commit895fc239a489d82f0d5ccd82eec410f391bcc296 (patch)
treed58e96291454d0c995798650215825bcb1e9711f /source3/utils
parent2ab46a7a93c0979eae1e94b74ed80447ea3ff46e (diff)
downloadsamba-895fc239a489d82f0d5ccd82eec410f391bcc296.tar.gz
samba-895fc239a489d82f0d5ccd82eec410f391bcc296.tar.bz2
samba-895fc239a489d82f0d5ccd82eec410f391bcc296.zip
r14757: Make sure we only send out a CLDAP request to an connected AD server.
Guenther (This used to be commit d17712f9761589115e976e2240498396f36838ee)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_ads.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index a55bc4fe56..5f5e1aa5ea 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -69,18 +69,20 @@ int net_ads_usage(int argc, const char **argv)
static int net_ads_lookup(int argc, const char **argv)
{
ADS_STRUCT *ads;
+ ADS_STATUS status;
ads = ads_init(NULL, opt_target_workgroup, opt_host);
if (ads) {
ads->auth.flags |= ADS_AUTH_NO_BIND;
}
- ads_connect(ads);
-
- if (!ads) {
+ status = ads_connect(ads);
+ if (!ADS_ERR_OK(status) || !ads) {
d_fprintf(stderr, "Didn't find the cldap server!\n");
return -1;
- } if (!ads->config.realm) {
+ }
+
+ if (!ads->config.realm) {
ads->config.realm = CONST_DISCARD(char *, opt_target_workgroup);
ads->ldap_port = 389;
}