if (pDataBuffer)
{
- int bytesToCopy = min(pDataBuffer->cbBuffer, len);
+ int bytesToCopy = min((int)pDataBuffer->cbBuffer, len);
/* Number of bytes to copy into buf */
int bytesToSave = pDataBuffer->cbBuffer - bytesToCopy;
/* Number of bytes to save in our read buffer */
}
else
{
- DEBUG_puts("_httpTLSRead: Unable to find data buffer."));
+ DEBUG_puts("_httpTLSRead: Unable to find data buffer.");
WSASetLastError(WSASYSCALLFAILURE);
return (-1);
}
bufferLen = conn->streamSizes.cbMaximumMessage + conn->streamSizes.cbHeader + conn->streamSizes.cbTrailer;
- if (bufferLen > conn->writeBufferLen)
+ if (bufferLen > conn->writeBufferLength)
{
BYTE *temp; /* New buffer pointer */
return (-1);
}
- conn->writeBuffer = temp;
- conn->writeBufferLen = bufferLen;
+ conn->writeBuffer = temp;
+ conn->writeBufferLength = bufferLen;
}
bytesLeft = len;
while (bytesLeft)
{
- int chunk = min(conn->streamSizes.cbMaximumMessage, bytesLeft);
+ int chunk = min((int)conn->streamSizes.cbMaximumMessage, bytesLeft);
/* Size of data to write */
SECURITY_STATUS scRet; /* SSPI status */
}
-#ifdef HAVE_SSL
+#if 0
/*
* 'http_setup_ssl()' - Set up SSL/TLS support on a connection.
*/
*hostptr = '\0';
}
- http->tls = _sspiAlloc();
+ http->tls = http_sspi_alloc();
if (!http->tls)
{
return (-1);
}
- http->tls->sock = http->fd;
dwSize = sizeof(username) / sizeof(TCHAR);
GetUserName(username, &dwSize);
_sntprintf_s(commonName, sizeof(commonName) / sizeof(TCHAR),
return (0);
}
+#endif // 0
/*
http_sspi_client(http_t *http, /* I - Client connection */
const char *hostname) /* I - Server hostname */
{
- _http_sspi_t *conn; /* SSPI data */
- DWORD dwSSPIFlags; /* SSL connection attributes we want */
- DWORD dwSSPIOutFlags; /* SSL connection attributes we got */
- TimeStamp tsExpiry; /* Time stamp */
- SECURITY_STATUS scRet; /* Status */
- int cbData; /* Data count */
- SecBufferDesc inBuffer; /* Array of SecBuffer structs */
- SecBuffer inBuffers[2]; /* Security package buffer */
- SecBufferDesc outBuffer; /* Array of SecBuffer structs */
- SecBuffer outBuffers[1]; /* Security package buffer */
- int ret = 0; /* Return value */
+ _http_sspi_t *conn = http->tls; /* SSPI data */
+ DWORD dwSSPIFlags; /* SSL connection attributes we want */
+ DWORD dwSSPIOutFlags; /* SSL connection attributes we got */
+ TimeStamp tsExpiry; /* Time stamp */
+ SECURITY_STATUS scRet; /* Status */
+ int cbData; /* Data count */
+ SecBufferDesc inBuffer; /* Array of SecBuffer structs */
+ SecBuffer inBuffers[2]; /* Security package buffer */
+ SecBufferDesc outBuffer; /* Array of SecBuffer structs */
+ SecBuffer outBuffers[1]; /* Security package buffer */
+ int ret = 0; /* Return value */
DEBUG_printf(("http_sspi_client(http=%p, hostname=\"%s\")", http, hostname));
- serverCert = NULL;
dwSSPIFlags = ISC_REQ_SEQUENCE_DETECT |
ISC_REQ_REPLAY_DETECT |
ISC_REQ_CONFIDENTIALITY |
if (conn->writeBuffer)
free(conn->writeBuffer);
- if (conn->localCert.pbCertEncoded)
+ if (conn->localCert)
CertFreeCertificateContext(conn->localCert);
- if (conn->remoteCert.pbCertEncoded)
+ if (conn->remoteCert)
CertFreeCertificateContext(conn->remoteCert);
free(conn);
{
num = recv(http->fd, conn->decryptBuffer + conn->decryptBufferUsed, (int)(conn->decryptBufferLength - conn->decryptBufferUsed), 0);
- if (num == -1 WSAGetLastError() == WSAEWOULDBLOCK)
+ if (num == -1 && WSAGetLastError() == WSAEWOULDBLOCK)
Sleep(1);
else
break;