From: Michael R Sweet Date: Mon, 2 May 2022 16:12:47 +0000 (-0400) Subject: Invalidate PPD cache if cupsd.conf is newer (Issue #371) X-Git-Tag: v2.4.2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41fbc18c0fffd34d9a89a4616e0e5da7f1ba62dd;p=thirdparty%2Fcups.git Invalidate PPD cache if cupsd.conf is newer (Issue #371) --- diff --git a/CHANGES.md b/CHANGES.md index c96e393f53..6b88adb82b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,8 @@ Changes in CUPS v2.4.2 (TBA) IPP Everywhere queue (Issues #340, #343) - Re-added LibreSSL/OpenSSL support (Issue #362) - Updated the Solaris smf service file (Issue #368) +- The scheduler now regenerates the PPD cache information after changing the + "cupsd.conf" file (Issue #371) - Updated the scheduler to set "auth-info-required" to "username,password" if a backend reports it needs authentication info but doesn't set a method for authentication (Issue #373) diff --git a/scheduler/printers.c b/scheduler/printers.c index 7a5791ba1e..4efa613f3f 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -3874,6 +3874,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ int i, j; /* Looping vars */ char cache_name[1024]; /* Cache filename */ struct stat cache_info; /* Cache file info */ + struct stat conf_info; /* cupsd.conf file info */ ppd_file_t *ppd; /* PPD file */ char ppd_name[1024]; /* PPD filename */ struct stat ppd_info; /* PPD file info */ @@ -3935,6 +3936,9 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ * Check to see if the cache is up-to-date... */ + if (stat(ConfigurationFile, &conf_info)) + conf_info.st_mtime = 0; + snprintf(cache_name, sizeof(cache_name), "%s/%s.data", CacheDir, p->name); if (stat(cache_name, &cache_info)) cache_info.st_mtime = 0; @@ -3951,7 +3955,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ _ppdCacheDestroy(p->pc); p->pc = NULL; - if (cache_info.st_mtime >= ppd_info.st_mtime) + if (cache_info.st_mtime >= ppd_info.st_mtime && cache_info.st_mtime >= conf_info.st_mtime) { cupsdLogMessage(CUPSD_LOG_DEBUG, "load_ppd: Loading %s...", cache_name);