[PATCHES] add option --no-dns-updates to net ads join

Michael Adam obnox at samba.org
Wed Sep 9 09:39:45 UTC 2015


attachement ...

On 2015-09-09 at 11:34 +0200, Michael Adam wrote:
> Attached find two patches to add the named option
> to net ads join: sometimes one does not want these
> to happen. Maybe one just knows that they are going
> to fail anyways and wants to spare the message...
> 
> Review/Push appreciated.
> 
> Thanks - Michael


-------------- next part --------------
From f8fc28e6475191c8b11e0aa657d2ce7525ab6899 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 9 Sep 2015 08:28:43 +0200
Subject: [PATCH 1/2] net: add option --no-dns-updates for net ads join

If called with this option, 'net ads join' will not attempt
to perform dns updates.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/utils/net.c     | 2 ++
 source3/utils/net.h     | 1 +
 source3/utils/net_ads.c | 9 ++++++---
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/source3/utils/net.c b/source3/utils/net.c
index 8182323..6bf719b 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -839,6 +839,8 @@ static struct functable net_func[] = {
 		{"wipe", 0, POPT_ARG_NONE, &c->opt_wipe},
 		/* Options for 'net registry import' */
 		{"precheck", 0, POPT_ARG_STRING, &c->opt_precheck},
+		/* Options for 'net ads join' */
+		{"no-dns-updates", 0, POPT_ARG_NONE, &c->opt_no_dns_updates},
 		POPT_COMMON_SAMBA
 		{ 0, 0, 0, 0}
 	};
diff --git a/source3/utils/net.h b/source3/utils/net.h
index cded8e1..d6dfeb6 100644
--- a/source3/utils/net.h
+++ b/source3/utils/net.h
@@ -84,6 +84,7 @@ struct net_context {
 	const char *opt_output;
 	int opt_wipe;
 	const char *opt_precheck;
+	int opt_no_dns_updates;
 
 	int opt_have_ip;
 	struct sockaddr_storage opt_dest_ip;
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index a0f59af..8a2985c 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1318,7 +1318,7 @@ static NTSTATUS net_update_dns(struct net_context *c, TALLOC_CTX *mem_ctx, ADS_S
 
 static int net_ads_join_usage(struct net_context *c, int argc, const char **argv)
 {
-	d_printf(_("net ads join [options]\n"
+	d_printf(_("net ads join [--no-dns-updates] [options]\n"
 	           "Valid options:\n"));
 	d_printf(_("   createupn[=UPN]    Set the userPrincipalName attribute during the join.\n"
 		   "                      The deault UPN is in the form host/netbiosname at REALM.\n"));
@@ -1594,11 +1594,14 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
 	}
 
 	/*
-	 * We try doing the dns update (if it was compiled in).
+	 * We try doing the dns update (if it was compiled in
+	 * and if it was not disabled on the command line).
 	 * If the dns update fails, we still consider the join
 	 * operation as succeeded if we came this far.
 	 */
-	_net_ads_join_dns_updates(c, ctx, r);
+	if (!c->opt_no_dns_updates) {
+		_net_ads_join_dns_updates(c, ctx, r);
+	}
 
 	TALLOC_FREE(r);
 	TALLOC_FREE( ctx );
-- 
2.4.3


From 7759011223bf859744eb42fae2dc666f5a611eb3 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 9 Sep 2015 08:40:31 +0200
Subject: [PATCH 2/2] docs: mention new --no-dns-updates parameter in manpage
 of net.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 docs-xml/manpages/net.8.xml | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/docs-xml/manpages/net.8.xml b/docs-xml/manpages/net.8.xml
index a2bca95..f459bf4 100644
--- a/docs-xml/manpages/net.8.xml
+++ b/docs-xml/manpages/net.8.xml
@@ -371,6 +371,13 @@
 		</para></listitem>
 		</varlistentry>
 
+		<varlistentry>
+		<term>--no-dns-updates</term>
+		<listitem><para>Do not perform DNS updates as part of
+		"net ads join".
+		</para></listitem>
+		</varlistentry>
+
 		&stdarg.encrypt;
 		&popt.common.samba.client;
 
@@ -439,8 +446,9 @@ The remote server must be specified with the -S option.
 </refsect2>
 
 <refsect2>
-<title>[RPC|ADS] JOIN [TYPE] [-U username[%password]] [createupn=UPN]
-[createcomputer=OU] [machinepass=PASS] [osName=string osVer=string] [options]</title>
+<title>[RPC|ADS] JOIN [TYPE] [--no-dns-updates] [-U username[%password]]
+[createupn=UPN] [createcomputer=OU] [machinepass=PASS]
+[osName=string osVer=string] [options]</title>
 
 <para>
 Join a domain.  If the account already exists on the server, and 
-- 
2.4.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150909/94e2e424/attachment.sig>


More information about the samba-technical mailing list