[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Tue Jan 31 10:38:02 MST 2012


The branch, master has been updated
       via  8972c92 s3:net ads join: remove a useless empty comment block
       via  976672b s3:net ads join: add a comment for the call to _net_ads_join_dns_update()
       via  be312e7 s3:net ads join: reduce indentation in _net_ads_join_dns_updates()
       via  7e5c5bd s3:net ads join: move dns update code out to new function _net_ads_join_dns_updates()
       via  1768d36 s3:net ads join: improve comment for dns update block
       via  8f9b432 s3:net ads join: improve status evaluation for call to net_update_dns()
       via  9cd7b8f s3:net ads join: interpret return code of ads_kinit_password() in dns update block
       via  4831b6e s3:net ads join: check for malloc success and react accordingly in dns update block
       via  ca913c9 s3:net ads join: check for success of fetching machine password in dns update block
       via  04fa9a3 s3:net ads join: untangle assignment from check, fix return code and improve error logging
       via  63d9b5d s3:net ads join: reduce indentation and improve logging in the dns update code block
       via  1d83f21 s3:net ads join: untangle assignment from check.
       via  dc4cf82 s3:net registry: fix a copy and paste error in a help text
      from  2343703 tevent: Fix python documentation strings

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8972c92342211fefb3d76bc306f7fbc467089010
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 31 16:16:47 2012 +0100

    s3:net ads join: remove a useless empty comment block
    
    Autobuild-User: Michael Adam <obnox at samba.org>
    Autobuild-Date: Tue Jan 31 18:37:45 CET 2012 on sn-devel-104

commit 976672bf805e3ec44c10e07baeaa4a4ebc0da5cc
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 31 16:15:54 2012 +0100

    s3:net ads join: add a comment for the call to _net_ads_join_dns_update()

commit be312e76d2b27674c5e38b760ca6521052caa460
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 31 01:05:14 2012 +0100

    s3:net ads join: reduce indentation in _net_ads_join_dns_updates()

commit 7e5c5bdcc46b55c5890d755601fe5278557d0948
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 31 00:59:21 2012 +0100

    s3:net ads join: move dns update code out to new function _net_ads_join_dns_updates()

commit 1768d3621a077eb8b0457cbcabc1f7e2a4545948
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 30 18:04:41 2012 +0100

    s3:net ads join: improve comment for dns update block

commit 8f9b43281d7ad425a4e6681503eb6e872d9040d7
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 30 14:15:14 2012 +0100

    s3:net ads join: improve status evaluation for call to net_update_dns()
    
    untangle assignment from check and log error code in message if failed.

commit 9cd7b8f04d6e51a0be4e18e8842ff1062134afae
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 30 14:12:15 2012 +0100

    s3:net ads join: interpret return code of ads_kinit_password() in dns update block
    
    If failed, print according error message and skip the attempt to do dns update.

commit 4831b6e6bb422a9186cf42980894b5e46c147ed4
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 30 14:07:52 2012 +0100

    s3:net ads join: check for malloc success and react accordingly in dns update block

commit ca913c98a6948f1b4acf38dd548fb6fa0191367c
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 30 14:05:59 2012 +0100

    s3:net ads join: check for success of fetching machine password in dns update block
    
    log and cleanup accordingly if failed

commit 04fa9a389c6d027dc4defb2527550fda650c4a6b
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 30 14:00:12 2012 +0100

    s3:net ads join: untangle assignment from check, fix return code and improve error logging
    
    only the dns update failed, not the join.
    Also do proper memory cleanup

commit 63d9b5d75a435bbbc06aa8d00371a1c61b69acfb
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 30 13:56:45 2012 +0100

    s3:net ads join: reduce indentation and improve logging in the dns update code block
    
    by doing an early goto done upon error condition

commit 1d83f2118e0e9e1de02909247114ac18ce55a6be
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 30 13:03:59 2012 +0100

    s3:net ads join: untangle assignment from check.

commit dc4cf82fb573074b4bb063321c86cb306902a4bc
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 27 14:02:07 2012 +0100

    s3:net registry: fix a copy and paste error in a help text

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

Summary of changes:
 source3/utils/net_ads.c      |  135 +++++++++++++++++++++++++++--------------
 source3/utils/net_registry.c |    4 +-
 2 files changed, 91 insertions(+), 48 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 0893a1d..381393e 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1304,8 +1304,91 @@ static int net_ads_join_usage(struct net_context *c, int argc, const char **argv
 	return -1;
 }
 
-/*******************************************************************
- ********************************************************************/
+
+static void _net_ads_join_dns_updates(TALLOC_CTX *ctx, struct libnet_JoinCtx *r)
+{
+#if defined(WITH_DNS_UPDATES)
+	ADS_STRUCT *ads_dns = NULL;
+	int ret;
+	NTSTATUS status;
+
+	/*
+	 * In a clustered environment, don't do dynamic dns updates:
+	 * Registering the set of ip addresses that are assigned to
+	 * the interfaces of the node that performs the join does usually
+	 * not have the desired effect, since the local interfaces do not
+	 * carry the complete set of the cluster's public IP addresses.
+	 * And it can also contain internal addresses that should not
+	 * be visible to the outside at all.
+	 * In order to do dns updates in a clustererd setup, use
+	 * net ads dns register.
+	 */
+	if (lp_clustering()) {
+		d_fprintf(stderr, _("Not doing automatic DNS update in a "
+				    "clustered setup.\n"));
+		return;
+	}
+
+	if (!r->out.domain_is_ad) {
+		return;
+	}
+
+	/*
+	 * We enter this block with user creds.
+	 * kinit with the machine password to do dns update.
+	 */
+
+	ads_dns = ads_init(lp_realm(), NULL, r->in.dc_name);
+
+	if (ads_dns == NULL) {
+		d_fprintf(stderr, _("DNS update failed: out of memory!\n"));
+		goto done;
+	}
+
+	use_in_memory_ccache();
+
+	ret = asprintf(&ads_dns->auth.user_name, "%s$", lp_netbios_name());
+	if (ret == -1) {
+		d_fprintf(stderr, _("DNS update failed: out of memory\n"));
+		goto done;
+	}
+
+	ads_dns->auth.password = secrets_fetch_machine_password(
+		r->out.netbios_domain_name, NULL, NULL);
+	if (ads_dns->auth.password == NULL) {
+		d_fprintf(stderr, _("DNS update failed: out of memory\n"));
+		goto done;
+	}
+
+	ads_dns->auth.realm = SMB_STRDUP(r->out.dns_domain_name);
+	if (ads_dns->auth.realm == NULL) {
+		d_fprintf(stderr, _("DNS update failed: out of memory\n"));
+		goto done;
+	}
+
+	strupper_m(ads_dns->auth.realm);
+
+	ret = ads_kinit_password(ads_dns);
+	if (ret != 0) {
+		d_fprintf(stderr,
+			  _("DNS update failed: kinit failed: %s\n"),
+			  error_message(ret));
+		goto done;
+	}
+
+	status = net_update_dns(ctx, ads_dns, NULL);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_fprintf( stderr, _("DNS update failed: %s\n"),
+			  nt_errstr(status));
+	}
+
+done:
+	ads_destroy(&ads_dns);
+#endif
+
+	return;
+}
+
 
 int net_ads_join(struct net_context *c, int argc, const char **argv)
 {
@@ -1444,52 +1527,12 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
 			r->out.netbios_domain_name);
 	}
 
-#if defined(WITH_DNS_UPDATES)
 	/*
-	 * In a clustered environment, don't do dynamic dns updates:
-	 * Registering the set of ip addresses that are assigned to
-	 * the interfaces of the node that performs the join does usually
-	 * not have the desired effect, since the local interfaces do not
-	 * carry the complete set of the cluster's public IP addresses.
-	 * And it can also contain internal addresses that should not
-	 * be visible to the outside at all.
-	 * In order to do dns updates in a clustererd setup, use
-	 * net ads dns register.
+	 * We try doing the dns update (if it was compiled in).
+	 * If the dns update fails, we still consider the join
+	 * operation as succeeded if we came this far.
 	 */
-	if (lp_clustering()) {
-		d_fprintf(stderr, _("Not doing automatic DNS update in a "
-				    "clustered setup.\n"));
-		goto done;
-	}
-
-	if (r->out.domain_is_ad) {
-		/* We enter this block with user creds */
-		ADS_STRUCT *ads_dns = NULL;
-
-		if ( (ads_dns = ads_init( lp_realm(), NULL, r->in.dc_name )) != NULL ) {
-			/* kinit with the machine password */
-
-			use_in_memory_ccache();
-			if (asprintf( &ads_dns->auth.user_name, "%s$", lp_netbios_name()) == -1) {
-				goto fail;
-			}
-			ads_dns->auth.password = secrets_fetch_machine_password(
-				r->out.netbios_domain_name, NULL, NULL );
-			ads_dns->auth.realm = SMB_STRDUP( r->out.dns_domain_name );
-			strupper_m(ads_dns->auth.realm );
-			ads_kinit_password( ads_dns );
-		}
-
-		if ( !ads_dns || !NT_STATUS_IS_OK(net_update_dns( ctx, ads_dns, NULL)) ) {
-			d_fprintf( stderr, _("DNS update failed!\n") );
-		}
-
-		/* exit from this block using machine creds */
-		ads_destroy(&ads_dns);
-	}
-
-done:
-#endif
+	_net_ads_join_dns_updates(ctx, r);
 
 	TALLOC_FREE(r);
 	TALLOC_FREE( ctx );
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index 90b0d19..eb7d19a 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -1439,9 +1439,9 @@ int net_registry(struct net_context *c, int argc, const char **argv)
 			"check",
 			net_registry_check,
 			NET_TRANSPORT_LOCAL,
-			N_("Check .reg file"),
+			N_("Check a registry database"),
 			N_("net registry check\n"
-			   "    Check .reg file")
+			   "    Check a registry database")
 		},
 	{ NULL, NULL, 0, NULL, NULL }
 	};


-- 
Samba Shared Repository


More information about the samba-cvs mailing list