]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Save Windows+OpenSSL work.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 16 Sep 2022 13:33:17 +0000 (09:33 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 16 Sep 2022 13:33:17 +0000 (09:33 -0400)
cups/globals.c
cups/tls-openssl.c

index 73e660912ffd2271ce22cb0a54aa7d71333ba467..2b0462ceb3075d8ecddf7269a96c25f385d345dd 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include "cups-private.h"
+#include "debug-internal.h"
 #ifndef _WIN32
 #  include <pwd.h>
 #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 ++)
     {
index 2c2a9e86320e615ae54389dd0f663b088b369a93..0aa05f01a55388869ad34aed4a296b3bef417ee5 100644 (file)
@@ -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.");