From: msweet Date: Tue, 15 Jul 2014 19:57:59 +0000 (+0000) Subject: Get builds working on Windows again. X-Git-Tag: v2.2b1~565 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33c9220c0a1c7fa4f26cfc8a123794fff5e49f00;p=thirdparty%2Fcups.git Get builds working on Windows again. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12031 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/cups/array.c b/cups/array.c index 0f04eab0aa..855706994e 100644 --- a/cups/array.c +++ b/cups/array.c @@ -19,6 +19,7 @@ * Include necessary headers... */ +#include #include "string-private.h" #include "debug-private.h" #include "array-private.h" diff --git a/cups/http.c b/cups/http.c index 54a51b123c..5539815226 100644 --- a/cups/http.c +++ b/cups/http.c @@ -2859,7 +2859,11 @@ httpShutdown(http_t *http) /* I - HTTP connection */ if (http->tls) _httpTLSStop(http); +#ifdef WIN32 + shutdown(http->fd, SD_RECEIVE); /* Microsoft-ism... */ +#else shutdown(http->fd, SHUT_RD); +#endif /* WIN32 */ } diff --git a/cups/libcups2.def b/cups/libcups2.def index d74e8d933e..eeea5ff528 100644 --- a/cups/libcups2.def +++ b/cups/libcups2.def @@ -1,5 +1,5 @@ LIBRARY libcups2 -VERSION 2.10 +VERSION 2.11 EXPORTS _cupsBufferGet _cupsBufferRelease @@ -88,8 +88,17 @@ cupsArrayRemove cupsArrayRestore cupsArraySave cupsArrayUserData +cupsCancelDestJob cupsCancelJob cupsCharsetToUTF8 +cupsCheckDestSupported +cupsCloseDestJob +cupsConnectDest +cupsCopyDest +cupsCopyDestConflicts +cupsCopyDestInfo +cupsCreateDestJob +cupsCreateJob cupsDirClose cupsDirOpen cupsDirRead @@ -101,6 +110,7 @@ cupsDoRequest cupsEncodeOptions cupsEncodeOptions2 cupsEncryption +cupsEnumDests cupsFileClose cupsFileCompression cupsFileEOF @@ -130,6 +140,9 @@ cupsFileWrite cupsFindDestDefault cupsFindDestReady cupsFindDestSupported +cupsFinishDestDocument +cupsFinishDocument +cupsFreeDestInfo cupsFreeDests cupsFreeJobs cupsFreeOptions @@ -138,8 +151,11 @@ cupsGetDefault cupsGetDefault2 cupsGetDest cupsGetDestMediaByIndex +cupsGetDestMediaByName +cupsGetDestMediaBySize cupsGetDestMediaCount cupsGetDestMediaDefault +cupsGetDestWithURI cupsGetDests cupsGetDests2 cupsGetFd @@ -159,6 +175,10 @@ cupsLangFree cupsLangGet cupsLastError cupsLastErrorString +cupsLocalizeDestMedia +cupsLocalizeDestOption +cupsLocalizeDestValue +cupsMakeServerCredentials cupsMarkOptions cupsNotifySubject cupsNotifyText @@ -181,8 +201,11 @@ cupsSetEncryption cupsSetPasswordCB cupsSetServer cupsSetServerCertCB +cupsSetServerCredentials cupsSetUser cupsSetUserAgent +cupsStartDestDocument +cupsStartDocument cupsTempFd cupsTempFile cupsTempFile2 @@ -221,7 +244,9 @@ httpConnect httpConnect2 httpConnectEncrypt httpCopyCredentials -httpCreateCredentials +httpCredentialsAreValidForName +httpCredentialsGetExpiration +httpCredentialsGetTrust httpCredentialsString httpDecode64 httpDecode64_2 @@ -237,6 +262,7 @@ httpFreeCredentials httpGet httpGetActivity httpGetAddress +httpGetAuthString httpGetBlocking httpGetContentEncoding httpGetCookie @@ -276,6 +302,7 @@ httpRead httpRead2 httpReadRequest httpReconnect +httpReconnect2 httpResolveHostname httpSaveCredentials httpSeparate @@ -294,6 +321,7 @@ httpStateString httpStatus httpTrace httpUpdate +httpURIStatusString httpWait httpWrite httpWrite2 diff --git a/cups/sspi-private.h b/cups/sspi-private.h deleted file mode 100644 index e8f36c2d14..0000000000 --- a/cups/sspi-private.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 -# include -# include -# include -# include -# include -# define SECURITY_WIN32 -# include -# include - -/* - * 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_ */ diff --git a/cups/tls-sspi.c b/cups/tls-sspi.c index 0f08c5a862..9540fbc450 100644 --- a/cups/tls-sspi.c +++ b/cups/tls-sspi.c @@ -548,7 +548,7 @@ _httpTLSRead(http_t *http, /* I - HTTP connection */ 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 */ @@ -587,7 +587,7 @@ _httpTLSRead(http_t *http, /* I - HTTP connection */ } else { - DEBUG_puts("_httpTLSRead: Unable to find data buffer.")); + DEBUG_puts("_httpTLSRead: Unable to find data buffer."); WSASetLastError(WSASYSCALLFAILURE); return (-1); } @@ -816,7 +816,7 @@ _httpTLSWrite(http_t *http, /* I - HTTP connection */ bufferLen = conn->streamSizes.cbMaximumMessage + conn->streamSizes.cbHeader + conn->streamSizes.cbTrailer; - if (bufferLen > conn->writeBufferLen) + if (bufferLen > conn->writeBufferLength) { BYTE *temp; /* New buffer pointer */ @@ -827,8 +827,8 @@ _httpTLSWrite(http_t *http, /* I - HTTP connection */ return (-1); } - conn->writeBuffer = temp; - conn->writeBufferLen = bufferLen; + conn->writeBuffer = temp; + conn->writeBufferLength = bufferLen; } bytesLeft = len; @@ -836,7 +836,7 @@ _httpTLSWrite(http_t *http, /* I - HTTP connection */ 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 */ @@ -900,7 +900,7 @@ _httpTLSWrite(http_t *http, /* I - HTTP connection */ } -#ifdef HAVE_SSL +#if 0 /* * 'http_setup_ssl()' - Set up SSL/TLS support on a connection. */ @@ -938,7 +938,7 @@ http_setup_ssl(http_t *http) /* I - Connection to server */ *hostptr = '\0'; } - http->tls = _sspiAlloc(); + http->tls = http_sspi_alloc(); if (!http->tls) { @@ -946,7 +946,6 @@ http_setup_ssl(http_t *http) /* I - Connection to server */ return (-1); } - http->tls->sock = http->fd; dwSize = sizeof(username) / sizeof(TCHAR); GetUserName(username, &dwSize); _sntprintf_s(commonName, sizeof(commonName) / sizeof(TCHAR), @@ -986,6 +985,7 @@ http_setup_ssl(http_t *http) /* I - Connection to server */ return (0); } +#endif // 0 /* @@ -1009,22 +1009,21 @@ static int /* O - 0 on success, -1 on failure */ 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 | @@ -1356,10 +1355,10 @@ http_sspi_free(_http_sspi_t *conn) /* I - Client connection */ 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); @@ -1669,7 +1668,7 @@ http_sspi_server(http_t *http, /* I - HTTP connection */ { 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; diff --git a/cups/util.c b/cups/util.c index 27103c8a34..e93601190c 100644 --- a/cups/util.c +++ b/cups/util.c @@ -1023,7 +1023,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL 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... diff --git a/test/ipptool.c b/test/ipptool.c index 458c7dab88..848321b642 100644 --- a/test/ipptool.c +++ b/test/ipptool.c @@ -25,7 +25,9 @@ #include #ifdef WIN32 # include -# define R_OK 0 +# ifndef R_OK +# define R_OK 0 +# endif /* !R_OK */ #else # include # include diff --git a/vcnet/config.h b/vcnet/config.h index 5e4d75a601..a951f5485c 100644 --- a/vcnet/config.h +++ b/vcnet/config.h @@ -57,6 +57,7 @@ * 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) diff --git a/vcnet/libcups2.vcproj b/vcnet/libcups2.vcproj index 2580eb21a2..d2f0e4fac7 100644 --- a/vcnet/libcups2.vcproj +++ b/vcnet/libcups2.vcproj @@ -1040,6 +1040,10 @@ /> + + @@ -1316,10 +1320,6 @@ /> - - @@ -1396,6 +1396,10 @@ RelativePath="..\cups\thread.c" > + + @@ -1598,10 +1602,6 @@ RelativePath="..\cups\pwg-private.h" > - -