From: Jeremy Allison Date: Thu, 23 Jul 2020 20:10:12 +0000 (-0700) Subject: s3: Parameters. Add 'async dns timeout' parameter. Default to 10. Minimum value 1. X-Git-Tag: talloc-2.3.2~896 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a140391d6d2bba65275bdc7a85a33cc502dbfb7;p=thirdparty%2Fsamba.git s3: Parameters. Add 'async dns timeout' parameter. Default to 10. Minimum value 1. Signed-off-by: Jeremy Allison Reviewed-by: Andreas Schneider --- diff --git a/docs-xml/smbdotconf/tuning/asyncdnstimeout.xml b/docs-xml/smbdotconf/tuning/asyncdnstimeout.xml new file mode 100644 index 00000000000..6c7ead2b2fd --- /dev/null +++ b/docs-xml/smbdotconf/tuning/asyncdnstimeout.xml @@ -0,0 +1,21 @@ + + + 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. + + The minimum value of this parameter is clamped + at 1 second. + zero. + + +10 +20 + diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index dc22f646b3e..7e9767590f9 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -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; diff --git a/source3/include/proto.h b/source3/include/proto.h index d349e22aa6b..51bac188919 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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 */ diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index cf5da0aca21..ebe120433ee 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -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; +}