svn commit: samba r14757 - branches/SAMBA_3_0/source/utils trunk/source/utils

gd at samba.org gd at samba.org
Wed Mar 29 15:30:27 GMT 2006


Author: gd
Date: 2006-03-29 15:30:26 +0000 (Wed, 29 Mar 2006)
New Revision: 14757

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14757

Log:
Make sure we only send out a CLDAP request to an connected AD server.

Guenther

Modified:
   branches/SAMBA_3_0/source/utils/net_ads.c
   trunk/source/utils/net_ads.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_ads.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_ads.c	2006-03-29 14:52:03 UTC (rev 14756)
+++ branches/SAMBA_3_0/source/utils/net_ads.c	2006-03-29 15:30:26 UTC (rev 14757)
@@ -69,18 +69,20 @@
 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;
 	}

Modified: trunk/source/utils/net_ads.c
===================================================================
--- trunk/source/utils/net_ads.c	2006-03-29 14:52:03 UTC (rev 14756)
+++ trunk/source/utils/net_ads.c	2006-03-29 15:30:26 UTC (rev 14757)
@@ -69,18 +69,20 @@
 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;
 	}



More information about the samba-cvs mailing list