Read GSS configuration files with mtime 0
There is at least one case (with flatpaks) where configuration files
in the special read-only /etc all have an mtime of 0. Using an
initial last modified time of 0 in g_initialize.c causes these files
to never be read.
Change the initial high value to the be the "invalid" value
(time_t)-1. Since the C and POSIX standards do not require time_t to
be signed, special-case the checks in load_if_changed() and
updateMechList() to treat all mod times as newer than -1.
[ghudson@mit.edu: edited commit message; slightly modified approach]
(cherry picked from commit 2b34a007461065e0cab4490dfe1ae5ddd10da67b)
ticket: 9060
version_fixed: 1.20
Simo Sorce authored 1 year, 11 months ago
Greg Hudson committed 1 year, 11 months ago
92 | 92 | static gss_mech_info g_mechList = NULL; |
93 | 93 | static gss_mech_info g_mechListTail = NULL; |
94 | 94 | static k5_mutex_t g_mechListLock = K5_MUTEX_PARTIAL_INITIALIZER; |
95 | static time_t g_confFileModTime = (time_t)0; | |
95 | static time_t g_confFileModTime = (time_t)-1; | |
96 | 96 | static time_t g_confLastCall = (time_t)0; |
97 | 97 | |
98 | 98 | static gss_OID_set_desc g_mechSet = { 0, NULL }; |
468 | 468 | mtime = check_link_mtime(pathname, &mtime); |
469 | 469 | if (mtime == (time_t)-1) |
470 | 470 | return; |
471 | if (mtime > *highest) | |
471 | if (mtime > *highest || *highest == (time_t)-1) | |
472 | 472 | *highest = mtime; |
473 | if (mtime > last) | |
473 | if (mtime > last || last == (time_t)-1) | |
474 | 474 | loadConfigFile(pathname); |
475 | 475 | } |
476 | 476 | |
481 | 481 | loadConfigFiles() |
482 | 482 | { |
483 | 483 | glob_t globbuf; |
484 | time_t highest = 0, now; | |
484 | time_t highest = (time_t)-1, now; | |
485 | 485 | char **path; |
486 | 486 | const char *val; |
487 | 487 | |
521 | 521 | |
522 | 522 | #if defined(_WIN32) |
523 | 523 | time_t lastConfModTime = getRegConfigModTime(MECH_KEY); |
524 | if (g_confFileModTime >= lastConfModTime) | |
524 | if (g_confFileModTime >= lastConfModTime && | |
525 | g_confFileModTime != (time_t)-1) | |
525 | 526 | return; |
526 | 527 | g_confFileModTime = lastConfModTime; |
527 | 528 | loadConfigFromRegistry(HKEY_CURRENT_USER, MECH_KEY); |