s3: Parameters. Add 'async dns timeout' parameter. Default to 10. Minimum value 1.
authorJeremy Allison <jra@samba.org>
Thu, 23 Jul 2020 20:10:12 +0000 (13:10 -0700)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 7 Aug 2020 06:34:37 +0000 (06:34 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
docs-xml/smbdotconf/tuning/asyncdnstimeout.xml [new file with mode: 0644]
lib/param/loadparm.c
source3/include/proto.h
source3/param/loadparm.c

diff --git a/docs-xml/smbdotconf/tuning/asyncdnstimeout.xml b/docs-xml/smbdotconf/tuning/asyncdnstimeout.xml
new file mode 100644 (file)
index 0000000..6c7ead2
--- /dev/null
@@ -0,0 +1,21 @@
+<samba:parameter name="async dns timeout"
+                 context="G"
+                 type="integer"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+    <para>The number of seconds the asynchronous DNS
+    resolver code in Samba will wait for responses.
+    Some of the Samba client library code uses internal
+    asynchronous DNS resolution for A and AAAA records
+    when trying to find Active Directory Domain controllers.
+    This value prevents this name resolution code from
+    waiting for DNS server timeouts.
+    </para>
+    <para>The minimum value of this parameter is clamped
+    at 1 second.
+    zero.</para>
+</description>
+
+<value type="default">10</value>
+<value type="example">20</value>
+</samba:parameter>
index dc22f646b3e8bf769f7f55ace9cce0a9d34113c8..7e9767590f973d2334fb726018c791488a266222 100644 (file)
@@ -3066,6 +3066,9 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
        lpcfg_do_global_parameter(
                lp_ctx, "ldap max search request size", "256000");
 
+       /* Async DNS query timeout in seconds. */
+       lpcfg_do_global_parameter(lp_ctx, "async dns timeout", "10");
+
        for (i = 0; parm_table[i].label; i++) {
                if (!(lp_ctx->flags[i] & FLAG_CMDLINE)) {
                        lp_ctx->flags[i] |= FLAG_DEFAULT;
index d349e22aa6be357e67fa5483ac71b1bcaad17256..51bac188919b2bcede588f41e6efed2b2cfbabee 100644 (file)
@@ -886,6 +886,7 @@ int lp_min_receive_file_size(void);
 void widelinks_warning(int snum);
 const char *lp_ncalrpc_dir(void);
 void _lp_set_server_role(int server_role);
+uint32_t lp_get_async_dns_timeout(void);
 
 /* The following definitions come from param/loadparm_ctx.c  */
 
index cf5da0aca21c8170de3e059664abda02a14e446a..ebe120433ee09317e9d59a0b756b7534032cbc16 100644 (file)
@@ -961,6 +961,9 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
        Globals.ldap_max_authenticated_request_size = 16777216;
        Globals.ldap_max_search_request_size = 256000;
 
+       /* Async DNS query timeout (in seconds). */
+       Globals.async_dns_timeout = 10;
+
        /* Now put back the settings that were set with lp_set_cmdline() */
        apply_lp_set_cmdline();
 }
@@ -4755,3 +4758,16 @@ enum samba_weak_crypto lp_weak_crypto()
 
        return Globals.weak_crypto;
 }
+
+uint32_t lp_get_async_dns_timeout(void)
+{
+       uint32_t val = Globals.async_dns_timeout;
+       /*
+        * Clamp minimum async dns timeout to 1 second
+        * as per the man page.
+        */
+       if (val < 1) {
+               val = 1;
+       }
+       return val;
+}