]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Save work - testhttp now works to get HTTPS web page.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 17 Jul 2014 16:42:49 +0000 (16:42 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 17 Jul 2014 16:42:49 +0000 (16:42 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12041 a1ca3aef-8c08-0410-bb20-df032aa958be

cups/tls-sspi.c

index c6f79cedeb534134b75f29c372e399fb334083ae..bb736151ada28414bfec2a486197a130e7c5634c 100644 (file)
@@ -595,7 +595,7 @@ _httpTLSRead(http_t *http,          /* I - HTTP connection */
       conn->readBufferUsed += bytesToSave;
     }
 
-    return (bytesToCopy);
+    num = bytesToCopy;
   }
   else
   {
@@ -619,7 +619,7 @@ _httpTLSRead(http_t *http,          /* I - HTTP connection */
     conn->decryptBufferUsed = 0;
   }
 
-  return (0);
+  return (num);
 }
 
 
@@ -1797,6 +1797,35 @@ http_sspi_server(http_t     *http,       /* I - HTTP connection */
 }
 
 
+/*
+ * 'http_sspi_strerror()' - Return a string for the specified error code.
+ */
+
+static const char *                    /* O - String for error */
+http_sspi_strerror(_http_sspi_t *conn, /* I - SSPI data */
+                   DWORD        code)  /* I - Error code */
+{
+  if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, 0, conn->error, sizeof(conn->error), NULL))
+  {
+   /*
+    * Strip trailing CR + LF...
+    */
+
+    char       *ptr;                   /* Pointer into error message */
+
+    for (ptr = conn->error + strlen(conn->error) - 1; ptr >= conn->error; ptr --)
+      if (*ptr == '\n' || *ptr == '\r')
+        *ptr = '\0';
+      else
+        break;
+  }
+  else
+    snprintf(conn->error, sizeof(conn->error), "Unknown error %x", code);
+
+  return (conn->error);
+}
+
+
 #if 0
 /*
  * '_sspiSetAllowsAnyRoot()' - Set the client cert policy for untrusted root certs
@@ -1826,21 +1855,6 @@ _sspiSetAllowsExpiredCerts(_http_sspi_t *conn,
 }
 
 
-/*
- * 'http_sspi_strerror()' - Return a string for the specified error code.
- */
-
-static const char *                    /* O - String for error */
-http_sspi_strerror(_http_sspi_t *conn, /* I - SSPI data */
-                   DWORD        code)  /* I - Error code */
-{
-  if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, 0, conn->error, sizeof(conn->error), NULL))
-    snprintf(conn->error, sizeof(conn->error), "Unknown error %x", code);
-
-  return (conn->error);
-}
-
-
 /*
  * 'http_sspi_verify()' - Verify a certificate.
  */