1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

s3: Parameters. Add 'async dns timeout' parameter. Default to 10. Minimum value 1.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Jeremy Allison 2020-07-23 13:10:12 -07:00 committed by Andreas Schneider
parent 156f1dfc39
commit 8a140391d6
4 changed files with 41 additions and 0 deletions

View File

@ -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>

View 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;

View 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 */

View 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;
}