[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2611-g5d30e9f

Günther Deschner gd at samba.org
Thu Feb 28 12:06:29 GMT 2008


The branch, v3-2-test has been updated
       via  5d30e9f9fef98de7764ae53d3cbe659b78ae9fce (commit)
      from  a69b918784b037aa17d2dd88a33bd99930631c9b (commit)

http://gitweb.samba.org/?samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 5d30e9f9fef98de7764ae53d3cbe659b78ae9fce
Author: Günther Deschner <gd at samba.org>
Date:   Thu Feb 28 13:04:30 2008 +0100

    Re-arrange dns update block during "net ads join" a little.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/utils/net_ads.c |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/utils/net_ads.c b/source/utils/net_ads.c
index 8cf76ec..daddbfa 100644
--- a/source/utils/net_ads.c
+++ b/source/utils/net_ads.c
@@ -1645,34 +1645,36 @@ int net_ads_join(int argc, const char **argv)
 		DEBUG(1,("Error creating host keytab!\n"));
 	}
 
-#if defined(WITH_DNS_UPDATES)
-	/* We enter this block with user creds */
+	d_printf("Joined '%s' to realm '%s'\n", global_myname(), ads->server.realm);
+
 	ads_kdestroy( NULL );
 	ads_destroy(&ads);
-	ads = NULL;
 
-	if ( (ads = ads_init( lp_realm(), NULL, NULL )) != NULL ) {
-		/* kinit with the machine password */
+#if defined(WITH_DNS_UPDATES)
+	{
+		/* We enter this block with user creds */
+		ADS_STRUCT *ads_dns = NULL;
+
+		if ( (ads_dns = ads_init( lp_realm(), NULL, NULL )) != NULL ) {
+			/* kinit with the machine password */
+
+			use_in_memory_ccache();
+			asprintf( &ads_dns->auth.user_name, "%s$", global_myname() );
+			ads_dns->auth.password = secrets_fetch_machine_password(
+				lp_workgroup(), NULL, NULL );
+			ads_dns->auth.realm = SMB_STRDUP( lp_realm() );
+			ads_kinit_password( ads_dns );
+		}
 
-		use_in_memory_ccache();
-		asprintf( &ads->auth.user_name, "%s$", global_myname() );
-		ads->auth.password = secrets_fetch_machine_password(
-			lp_workgroup(), NULL, NULL );
-		ads->auth.realm = SMB_STRDUP( lp_realm() );
-		ads_kinit_password( ads );
-	}
+		if ( !ads_dns || !NT_STATUS_IS_OK(net_update_dns( ctx, ads_dns )) ) {
+			d_fprintf( stderr, "DNS update failed!\n" );
+		}
 
-	if ( !ads || !NT_STATUS_IS_OK(net_update_dns( ctx, ads )) ) {
-		d_fprintf( stderr, "DNS update failed!\n" );
+		/* exit from this block using machine creds */
+		ads_destroy(&ads_dns);
 	}
-
-	/* exit from this block using machine creds */
 #endif
-
-	d_printf("Joined '%s' to realm '%s'\n", global_myname(), ads->server.realm);
-
 	TALLOC_FREE( ctx );
-	ads_destroy(&ads);
 
 	return 0;
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list