1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-11 04:58:19 +03:00

resolve: initialize 'current' when SD_RESOLVED_NO_STALE is set

Otherwise, the check below is always fail.
```
if (FLAGS_SET(query_flags, SD_RESOLVED_NO_STALE) && j->until_valid < current)
```

Follow-up for 5ed91481abea382dc486507556e5cdf0f36b796f.

(cherry picked from commit 6756b61626afc343f8b6824f41bef67bb442f1d7)
This commit is contained in:
Yu Watanabe 2023-07-31 22:11:51 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent 507c4c7968
commit 257c6f91b8

View File

@ -1030,9 +1030,10 @@ int dns_cache_lookup(
goto miss;
}
if (FLAGS_SET(query_flags, SD_RESOLVED_CLAMP_TTL)) {
if ((query_flags & (SD_RESOLVED_CLAMP_TTL | SD_RESOLVED_NO_STALE)) != 0) {
/* 'current' is always passed to answer_add_clamp_ttl(), but is only used conditionally.
* We'll do the same assert there to make sure that it was initialized properly. */
* We'll do the same assert there to make sure that it was initialized properly.
* 'current' is also used below when SD_RESOLVED_NO_STALE is set. */
current = now(CLOCK_BOOTTIME);
assert(current > 0);
}