From: Michael R Sweet Date: Fri, 16 Sep 2022 13:33:17 +0000 (-0400) Subject: Save Windows+OpenSSL work. X-Git-Tag: v2.4.3~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89e47f9fddbc979380aee32d3270ffad39cba7ac;p=thirdparty%2Fcups.git Save Windows+OpenSSL work. --- diff --git a/cups/globals.c b/cups/globals.c index 73e660912f..2b0462ceb3 100644 --- a/cups/globals.c +++ b/cups/globals.c @@ -14,6 +14,7 @@ */ #include "cups-private.h" +#include "debug-internal.h" #ifndef _WIN32 # include #endif /* !_WIN32 */ @@ -283,6 +284,9 @@ cups_globals_alloc(void) DEBUG_printf(("cups_globals_alloc: USERPROFILE=\"%s\"", userprofile)); + if (!strncmp(userprofile, "C:\\", 3)) + userprofile += 2; + strlcpy(homedir, userprofile, sizeof(homedir)); for (homeptr = homedir; *homeptr; homeptr ++) { diff --git a/cups/tls-openssl.c b/cups/tls-openssl.c index 2c2a9e8632..0aa05f01a5 100644 --- a/cups/tls-openssl.c +++ b/cups/tls-openssl.c @@ -988,6 +988,7 @@ _httpTLSStart(http_t *http) // I - Connection to server const char *cn, // Common name to lookup *cnptr; // Pointer into common name int have_creds = 0; // Have credentials? + int key_status, crt_status; // Key and certificate load status context = SSL_CTX_new(TLS_server_method()); @@ -1091,7 +1092,10 @@ _httpTLSStart(http_t *http) // I - Connection to server DEBUG_printf(("4_httpTLSStart: Using private key file '%s'.", keyfile)); DEBUG_printf(("4_httpTLSStart: Using certificate file '%s'.", crtfile)); - if (!SSL_CTX_use_PrivateKey_file(context, keyfile, SSL_FILETYPE_PEM) || !SSL_CTX_use_certificate_chain_file(context, crtfile)) + crt_status = SSL_CTX_use_certificate_chain_file(context, crtfile); + key_status = SSL_CTX_use_PrivateKey_file(context, keyfile, SSL_FILETYPE_PEM); + + if (!key_status || !crt_status) { // Unable to load private key or certificate... DEBUG_puts("4_httpTLSStart: Unable to use private key or certificate chain file.");