From 42fdf36a116c5275df2b6d4b27818a765e689d6c Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 28 Jul 2026 13:21:45 -0400 Subject: [PATCH] Do some cleanup of TLS cert expiration changes (Issue #1590) --- CHANGES.md | 1 + cups/tls-gnutls.c | 8 +++++++- cups/tls-openssl.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8436359a9b..c71cb2d086 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -181,6 +181,7 @@ v2.5b1 - YYYY-MM-DD - Fixed A4 support in the `ippevepcl` program (Issue #1544) - Fixed issues with the environment variable support of CGI programs (Issue #1547) +- Fixed renewal of expired self-signed certificates (Issue #1590) - Fixed potential crash bug in `cupsCheckDestSupported` function. - Removed hash support for SHA2-512-224 and SHA2-512-256. - Removed `mantohtml` script for generating html pages (use diff --git a/cups/tls-gnutls.c b/cups/tls-gnutls.c index ed8fb1fb40..ceb46ddfce 100644 --- a/cups/tls-gnutls.c +++ b/cups/tls-gnutls.c @@ -1847,7 +1847,7 @@ _httpTLSStart(http_t *http) // I - Connection to server char *creds = cupsCopyCredentials(tls_keypath, cn); // PEM-encoded certificate - have_creds = creds && cupsGetCredentialsExpiration(creds) > time(NULL); + have_creds = cupsGetCredentialsExpiration(creds) > time(NULL); free(creds); } } @@ -2226,6 +2226,12 @@ gnutls_import_certs( DEBUG_printf("3gnutls_import_certs(credentials=\"%s\", num_certs=%p, certs=%p)", credentials, (void *)num_certs, (void *)certs); + if (!credentials) + { + *num_certs = 0; + return (NULL); + } + // Import all certificates from the string... datum.data = (void *)credentials; datum.size = strlen(credentials); diff --git a/cups/tls-openssl.c b/cups/tls-openssl.c index 1dd92028de..c8fe57cf15 100644 --- a/cups/tls-openssl.c +++ b/cups/tls-openssl.c @@ -1929,7 +1929,7 @@ _httpTLSStart(http_t *http) // I - Connection to server char *creds = cupsCopyCredentials(tls_keypath, cn); // PEM-encoded certificate - have_creds = creds && cupsGetCredentialsExpiration(creds) > time(NULL); + have_creds = cupsGetCredentialsExpiration(creds) > time(NULL); free(creds); } } -- 2.47.3