Codebase list krb5 / 9efb481
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
1 changed file(s) with 6 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
9292 static gss_mech_info g_mechList = NULL;
9393 static gss_mech_info g_mechListTail = NULL;
9494 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;
9696 static time_t g_confLastCall = (time_t)0;
9797
9898 static gss_OID_set_desc g_mechSet = { 0, NULL };
468468 mtime = check_link_mtime(pathname, &mtime);
469469 if (mtime == (time_t)-1)
470470 return;
471 if (mtime > *highest)
471 if (mtime > *highest || *highest == (time_t)-1)
472472 *highest = mtime;
473 if (mtime > last)
473 if (mtime > last || last == (time_t)-1)
474474 loadConfigFile(pathname);
475475 }
476476
481481 loadConfigFiles()
482482 {
483483 glob_t globbuf;
484 time_t highest = 0, now;
484 time_t highest = (time_t)-1, now;
485485 char **path;
486486 const char *val;
487487
521521
522522 #if defined(_WIN32)
523523 time_t lastConfModTime = getRegConfigModTime(MECH_KEY);
524 if (g_confFileModTime >= lastConfModTime)
524 if (g_confFileModTime >= lastConfModTime &&
525 g_confFileModTime != (time_t)-1)
525526 return;
526527 g_confFileModTime = lastConfModTime;
527528 loadConfigFromRegistry(HKEY_CURRENT_USER, MECH_KEY);