From 35394561d2ce12de4ace15d162e6df667b10b677 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 3 Mar 2015 11:39:39 +0100 Subject: resolv: Use the same default timeout for SRV queries as previously MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we changed the resolver code to use the TTL values from the DNS queries instead of harcoded ones, we changed the default value by accident. Add a separate SRV TTL that is backwards-compatible with the old harcoded value. Reviewed-by: Pavel Březina (cherry picked from commit eafbc66c2ff6365478e62a8df3fd005bf80e5c7b) --- src/resolv/async_resolv.c | 4 +++- src/resolv/async_resolv.h | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c index c7f04d1b6..86ee64dd3 100644 --- a/src/resolv/async_resolv.c +++ b/src/resolv/async_resolv.c @@ -1590,8 +1590,10 @@ resolv_getsrv_done(void *arg, int status, int timeouts, unsigned char *abuf, int state->reply_list = reply_list; ok = resolv_get_ttl(abuf, alen, &state->ttl); if (ok == false) { - state->ttl = RESOLV_DEFAULT_TTL; + DEBUG(4, ("Could not read TTL, using the default..\n")); + state->ttl = RESOLV_DEFAULT_SRV_TTL; } + DEBUG(7, ("Using TTL [%lu]\n", (unsigned long) state->ttl)); tevent_req_done(req); return; diff --git a/src/resolv/async_resolv.h b/src/resolv/async_resolv.h index 94ac92bb7..feb6c03e3 100644 --- a/src/resolv/async_resolv.h +++ b/src/resolv/async_resolv.h @@ -41,6 +41,12 @@ #define RESOLV_DEFAULT_TTL 7200 #endif /* RESOLV_DEFAULT_TTL */ +#ifndef RESOLV_DEFAULT_SRV_TTL +#define RESOLV_DEFAULT_SRV_TTL 14400 +#endif /* RESOLV_DEFAULT_SRV_TTL */ + +#include "util/util.h" + /* * An opaque structure which holds context for a module using the async * resolver. Is should be used as a "local-global" variable - in sssd, -- cgit