* Include necessary headers...
*/
+#include <cups/cups.h>
#include "string-private.h"
#include "debug-private.h"
#include "array-private.h"
if (http->tls)
_httpTLSStop(http);
+#ifdef WIN32
+ shutdown(http->fd, SD_RECEIVE); /* Microsoft-ism... */
+#else
shutdown(http->fd, SHUT_RD);
+#endif /* WIN32 */
}
LIBRARY libcups2\r
-VERSION 2.10\r
+VERSION 2.11\r
EXPORTS\r
_cupsBufferGet\r
_cupsBufferRelease\r
cupsArrayRestore\r
cupsArraySave\r
cupsArrayUserData\r
+cupsCancelDestJob\r
cupsCancelJob\r
cupsCharsetToUTF8\r
+cupsCheckDestSupported\r
+cupsCloseDestJob\r
+cupsConnectDest\r
+cupsCopyDest\r
+cupsCopyDestConflicts\r
+cupsCopyDestInfo\r
+cupsCreateDestJob\r
+cupsCreateJob\r
cupsDirClose\r
cupsDirOpen\r
cupsDirRead\r
cupsEncodeOptions\r
cupsEncodeOptions2\r
cupsEncryption\r
+cupsEnumDests\r
cupsFileClose\r
cupsFileCompression\r
cupsFileEOF\r
cupsFindDestDefault\r
cupsFindDestReady\r
cupsFindDestSupported\r
+cupsFinishDestDocument\r
+cupsFinishDocument\r
+cupsFreeDestInfo\r
cupsFreeDests\r
cupsFreeJobs\r
cupsFreeOptions\r
cupsGetDefault2\r
cupsGetDest\r
cupsGetDestMediaByIndex\r
+cupsGetDestMediaByName\r
+cupsGetDestMediaBySize\r
cupsGetDestMediaCount\r
cupsGetDestMediaDefault\r
+cupsGetDestWithURI\r
cupsGetDests\r
cupsGetDests2\r
cupsGetFd\r
cupsLangGet\r
cupsLastError\r
cupsLastErrorString\r
+cupsLocalizeDestMedia\r
+cupsLocalizeDestOption\r
+cupsLocalizeDestValue\r
+cupsMakeServerCredentials\r
cupsMarkOptions\r
cupsNotifySubject\r
cupsNotifyText\r
cupsSetPasswordCB\r
cupsSetServer\r
cupsSetServerCertCB\r
+cupsSetServerCredentials\r
cupsSetUser\r
cupsSetUserAgent\r
+cupsStartDestDocument\r
+cupsStartDocument\r
cupsTempFd\r
cupsTempFile\r
cupsTempFile2\r
httpConnect2\r
httpConnectEncrypt\r
httpCopyCredentials\r
-httpCreateCredentials\r
+httpCredentialsAreValidForName\r
+httpCredentialsGetExpiration\r
+httpCredentialsGetTrust\r
httpCredentialsString\r
httpDecode64\r
httpDecode64_2\r
httpGet\r
httpGetActivity\r
httpGetAddress\r
+httpGetAuthString\r
httpGetBlocking\r
httpGetContentEncoding\r
httpGetCookie\r
httpRead2\r
httpReadRequest\r
httpReconnect\r
+httpReconnect2\r
httpResolveHostname\r
httpSaveCredentials\r
httpSeparate\r
httpStatus\r
httpTrace\r
httpUpdate\r
+httpURIStatusString\r
httpWait\r
httpWrite\r
httpWrite2\r
+++ /dev/null
-/*
- * Private SSPI definitions for CUPS.
- *
- * Copyright 2010 by Apple Inc.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
- */
-
-#ifndef _CUPS_SSPI_PRIVATE_H_
-# define _CUPS_SSPI_PRIVATE_H_
-
-/*
- * Include necessary headers...
- */
-
-# include <config.h>
-# include <winsock2.h>
-# include <ws2tcpip.h>
-# include <wincrypt.h>
-# include <wintrust.h>
-# include <schannel.h>
-# define SECURITY_WIN32
-# include <security.h>
-# include <sspi.h>
-
-/*
- * C++ magic...
- */
-
-# ifdef __cplusplus
-extern "C" {
-# endif /* __cplusplus */
-
-
-typedef struct /**** SSPI/SSL data structure ****/
-{
- SOCKET sock; /* TCP/IP socket */
- CredHandle creds; /* Credentials */
- CtxtHandle context; /* SSL context */
- BOOL contextInitialized; /* Is context init'd? */
- SecPkgContext_StreamSizes streamSizes; /* SSL data stream sizes */
- BYTE *decryptBuffer; /* Data pre-decryption*/
- size_t decryptBufferLength; /* Length of decrypt buffer */
- size_t decryptBufferUsed; /* Bytes used in buffer */
- BYTE *readBuffer; /* Data post-decryption */
- size_t readBufferLength; /* Length of read buffer */
- size_t readBufferUsed; /* Bytes used in buffer */
- DWORD certFlags; /* Cert verification flags */
-} _sspi_struct_t;
-
-
-/*
- * Prototypes...
- */
-_sspi_struct_t *_sspiAlloc(void);
-BOOL _sspiAccept(_sspi_struct_t *conn);
-BOOL _sspiConnect(_sspi_struct_t *conn,
- const CHAR *hostname);
-void _sspiFree(_sspi_struct_t *conn);
-BOOL _sspiGetCredentials(_sspi_struct_t *conn,
- const LPWSTR containerName,
- const TCHAR *commonName,
- BOOL server);
-int _sspiPending(_sspi_struct_t *conn);
-int _sspiRead(_sspi_struct_t *conn,
- void *buf, size_t len);
-void _sspiSetAllowsAnyRoot(_sspi_struct_t *conn,
- BOOL allow);
-void _sspiSetAllowsExpiredCerts(_sspi_struct_t *conn,
- BOOL allow);
-int _sspiWrite(_sspi_struct_t *conn,
- void *buf, size_t len);
-
-
-# ifdef __cplusplus
-}
-# endif /* __cplusplus */
-#endif /* !_CUPS_SSPI_PRIVATE_H_ */
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;
DEBUG_printf(("2cupsGetPPD3: Printer hostname=\"%s\", port=%d", hostname,
port));
- if (cupsServer()[0] == '/' && !strcasecmp(hostname, "localhost") && port == ippPort())
+ if (cupsServer()[0] == '/' && !_cups_strcasecmp(hostname, "localhost") && port == ippPort())
{
/*
* Redirect localhost to domain socket...
#include <sys/stat.h>
#ifdef WIN32
# include <windows.h>
-# define R_OK 0
+# ifndef R_OK
+# define R_OK 0
+# endif /* !R_OK */
#else
# include <signal.h>
# include <termios.h>
* Map the POSIX sleep() and usleep() functions to the Win32 Sleep() function...
*/
+typedef unsigned long useconds_t;
#define sleep(X) Sleep(1000 * (X))
#define usleep(X) Sleep((X)/1000)
/>\r
</FileConfiguration>\r
</File>\r
+ <File\r
+ RelativePath="..\cups\libcups2.def"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\cups\localize.c"\r
>\r
/>\r
</FileConfiguration>\r
</File>\r
- <File\r
- RelativePath="..\cups\sspi.c"\r
- >\r
- </File>\r
<File\r
RelativePath="..\cups\string.c"\r
>\r
RelativePath="..\cups\thread.c"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\cups\tls.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\cups\transcode.c"\r
>\r
RelativePath="..\cups\pwg-private.h"\r
>\r
</File>\r
- <File\r
- RelativePath="..\cups\sspi-private.h"\r
- >\r
- </File>\r
<File\r
RelativePath="..\cups\string-private.h"\r
>\r