]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix Windows TLS bug.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 30 Sep 2021 23:06:41 +0000 (19:06 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 30 Sep 2021 23:06:41 +0000 (19:06 -0400)
cups/tls-sspi.c

index b4d8a94fbbdd75e4c2d401d75202f688610d8a29..77af3f3aea496a418c51c0058827c38d0948537b 100644 (file)
@@ -684,8 +684,8 @@ _httpTLSPending(http_t *http)               /* I - HTTP connection */
 {
   if (http->tls)
   {
-    DEBUG_printf(("4_httpTLSPending: Returning %d.", http->tls->readBufferUsed));
-    return (http->tls->readBufferUsed);
+    DEBUG_printf(("4_httpTLSPending: Returning %d.", http->tls->readBufferUsed + http->tls->decryptBufferUsed));
+    return (http->tls->readBufferUsed + http->tls->decryptBufferUsed);
   }
   else
   {
@@ -1329,7 +1329,6 @@ http_sspi_client(http_t     *http,        /* I - Client connection */
                  const char *hostname) /* I - Server hostname */
 {
   _http_sspi_t *sspi = http->tls;      /* SSPI data */
-  DWORD                dwSize;                 /* Size for buffer */
   DWORD                dwSSPIFlags;            /* SSL connection attributes we want */
   DWORD                dwSSPIOutFlags;         /* SSL connection attributes we got */
   TimeStamp    tsExpiry;               /* Time stamp */
@@ -1660,7 +1659,7 @@ http_sspi_create_credential(
     http_credential_t *cred)           /* I - Credential */
 {
   if (cred)
-    return (CertCreateCertificateContext(X509_ASN_ENCODING, cred->data, cred->datalen));
+    return (CertCreateCertificateContext(X509_ASN_ENCODING, cred->data, (DWORD)cred->datalen));
   else
     return (NULL);
 }
@@ -2315,7 +2314,7 @@ http_sspi_strerror(char   *buffer,        /* I - Error message buffer */
                    size_t bufsize,     /* I - Size of buffer */
                    DWORD  code)                /* I - Error code */
 {
-  if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, 0, buffer, bufsize, NULL))
+  if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, 0, buffer, (DWORD)bufsize, NULL))
   {
    /*
     * Strip trailing CR + LF...