net: add option --no-dns-updates for net ads join
authorMichael Adam <obnox@samba.org>
Wed, 9 Sep 2015 06:28:43 +0000 (08:28 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 9 Sep 2015 19:34:15 +0000 (21:34 +0200)
If called with this option, 'net ads join' will not attempt
to perform dns updates.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/utils/net.c
source3/utils/net.h
source3/utils/net_ads.c

index 8182323a10a9def461838317e9b53fdb77347692..6bf719b27c98e44e36ae53bd05630b41bc4bd73d 100644 (file)
@@ -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}
        };
index cded8e155cf45b645da325146148d6ecc11d7854..d6dfeb6208f86cb5c17632687108bcbe5db63819 100644 (file)
@@ -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;
index a0f59affc7e815a4ba10404666dfd3cf40445685..8a2985c9065f8f6a306383fccb471429a12c8177 100644 (file)
@@ -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@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 );