another patches for net_ads.c

Michael Adam ma at sernet.de
Fri Aug 4 13:59:17 GMT 2006


Hi, 

here is a reworked version of the patch.
It is much smaller due to all the rehabilitated 
DEBUG(>0, ) statements ;-)

Cheers - Michael

On Thu, Aug 03, 2006 at 11:59:27PM +0200, Michael Adam wrote:
> Hi Jerry,
> 
> On Thu, Aug 03, 2006 at 11:56:51AM -0500, Gerald (Jerry) Carter wrote:
> > 
> > Some of the DEBUG level 0 messages probably should
> > be moved to d_printf()'s.  Others might need to be
> > d_fpritnf(stderr,"..") instead.  I think anything
> > about 0 should stay with the DEBUG macro.
> > 
> > Do you want to rework the patches some?  or should
> > I cherry pick?
> 
> I will rework, trying to find a suitable choice of 
> d_printf / d_fprintf(stderr,) and restoring the DEBUG
> calls for higher debug levels.
> 
> Regards, Michael


-------------- next part --------------
Index: libads/ldap.c
===================================================================
--- libads/ldap.c	(revision 17383)
+++ libads/ldap.c	(working copy)
@@ -282,7 +282,7 @@
 		goto got_connection;
 	}
 
-	return ADS_ERROR_SYSTEM(errno?errno:ENOENT);
+	return ADS_ERROR_NT(NT_STATUS_NO_LOGON_SERVERS);
 
 got_connection:
 	DEBUG(3,("Connected to LDAP server %s\n", inet_ntoa(ads->ldap_ip)));
Index: utils/net_ads.c
===================================================================
--- utils/net_ads.c	(revision 17383)
+++ utils/net_ads.c	(working copy)
@@ -278,7 +278,7 @@
 			second_time = True;
 			goto retry;
 		} else {
-			DEBUG(0,("ads_connect: %s\n", ads_errstr(status)));
+			d_printf("%s.\n", ads_errstr(status));
 			ads_destroy(&ads);
 			return NULL;
 		}
@@ -542,7 +542,7 @@
 
 	rc = ads_find_user_acct(ads, &res, argv[0]);
 	if (!ADS_ERR_OK(rc)) {
-		DEBUG(0, ("User %s does not exist\n", argv[0]));
+		d_printf("User %s does not exist.\n", argv[0]);
 		ads_destroy(&ads);
 		return -1;
 	}
@@ -668,7 +668,7 @@
 
 	rc = ads_find_user_acct(ads, &res, argv[0]);
 	if (!ADS_ERR_OK(rc)) {
-		DEBUG(0, ("Group %s does not exist\n", argv[0]));
+		d_printf("Group %s does not exist.\n", argv[0]);
 		ads_destroy(&ads);
 		return -1;
 	}
@@ -769,7 +769,7 @@
 	}
 
 	if (!(ctx = talloc_init("net_ads_leave"))) {
-		DEBUG(0, ("Could not initialise talloc context\n"));
+		d_fprintf(stderr, "Could not initialise talloc context.\n");
 		return -1;
 	}
 
@@ -1100,7 +1100,7 @@
 	/* go ahead and setup the default salt */
 
 	if ( (std_salt = kerberos_standard_des_salt()) == NULL ) {
-		DEBUG(0,("net_derive_salting_principal: failed to obtain stanard DES salt\n"));
+		d_fprintf(stderr, "net_derive_salting_principal: failed to obtain stanard DES salt\n");
 		return False;
 	}
 
@@ -1199,7 +1199,7 @@
 	}
 
 	if (!(ctx = talloc_init("net_ads_join"))) {
-		DEBUG(0, ("Could not initialise talloc context\n"));
+		d_fprintf(stderr, "Could not initialise talloc context.\n");
 		goto fail;
 	}
 
@@ -1240,7 +1240,8 @@
 	password = talloc_strdup(ctx, tmp_password);
 	
 	if ( net_join_domain( ctx, ads->config.ldap_server_name, &ads->ldap_ip, &domain_sid, password ) != 0 ) {
-		d_fprintf(stderr, "Failed to join domain!\n");
+		/* There should be more detailed output here... */
+		d_fprintf(stderr, "call of net_join_domain failed\n");
 		goto fail;
 	}
 	
@@ -1341,6 +1342,8 @@
 	return 0;
 
 fail:
+	/* issue an overall failure message at the end. */
+	d_printf("Failed to join domain!\n");
 	ads_destroy(&ads);
 	return -1;
 }


More information about the samba-technical mailing list