]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Get builds working on Windows again.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 15 Jul 2014 19:57:59 +0000 (19:57 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 15 Jul 2014 19:57:59 +0000 (19:57 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12031 a1ca3aef-8c08-0410-bb20-df032aa958be

cups/array.c
cups/http.c
cups/libcups2.def
cups/sspi-private.h [deleted file]
cups/tls-sspi.c
cups/util.c
test/ipptool.c
vcnet/config.h
vcnet/libcups2.vcproj

index 0f04eab0aa12733c8a682a6c8cd88950c71627b6..855706994e601185401c33f8fb12b77f308121a2 100644 (file)
@@ -19,6 +19,7 @@
  * Include necessary headers...
  */
 
+#include <cups/cups.h>
 #include "string-private.h"
 #include "debug-private.h"
 #include "array-private.h"
index 54a51b123c74848f11e819c1adc4643b1a4ae052..55398152264a1af33000ba115e575a7fd03a2c20 100644 (file)
@@ -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 */
 }
 
 
index d74e8d933e5231cd4aebf0a988730bd0d2594996..eeea5ff528dc835ceaef15eafb0e2e85e3face3f 100644 (file)
@@ -1,5 +1,5 @@
 LIBRARY libcups2\r
-VERSION 2.10\r
+VERSION 2.11\r
 EXPORTS\r
 _cupsBufferGet\r
 _cupsBufferRelease\r
@@ -88,8 +88,17 @@ cupsArrayRemove
 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
@@ -101,6 +110,7 @@ cupsDoRequest
 cupsEncodeOptions\r
 cupsEncodeOptions2\r
 cupsEncryption\r
+cupsEnumDests\r
 cupsFileClose\r
 cupsFileCompression\r
 cupsFileEOF\r
@@ -130,6 +140,9 @@ cupsFileWrite
 cupsFindDestDefault\r
 cupsFindDestReady\r
 cupsFindDestSupported\r
+cupsFinishDestDocument\r
+cupsFinishDocument\r
+cupsFreeDestInfo\r
 cupsFreeDests\r
 cupsFreeJobs\r
 cupsFreeOptions\r
@@ -138,8 +151,11 @@ cupsGetDefault
 cupsGetDefault2\r
 cupsGetDest\r
 cupsGetDestMediaByIndex\r
+cupsGetDestMediaByName\r
+cupsGetDestMediaBySize\r
 cupsGetDestMediaCount\r
 cupsGetDestMediaDefault\r
+cupsGetDestWithURI\r
 cupsGetDests\r
 cupsGetDests2\r
 cupsGetFd\r
@@ -159,6 +175,10 @@ cupsLangFree
 cupsLangGet\r
 cupsLastError\r
 cupsLastErrorString\r
+cupsLocalizeDestMedia\r
+cupsLocalizeDestOption\r
+cupsLocalizeDestValue\r
+cupsMakeServerCredentials\r
 cupsMarkOptions\r
 cupsNotifySubject\r
 cupsNotifyText\r
@@ -181,8 +201,11 @@ cupsSetEncryption
 cupsSetPasswordCB\r
 cupsSetServer\r
 cupsSetServerCertCB\r
+cupsSetServerCredentials\r
 cupsSetUser\r
 cupsSetUserAgent\r
+cupsStartDestDocument\r
+cupsStartDocument\r
 cupsTempFd\r
 cupsTempFile\r
 cupsTempFile2\r
@@ -221,7 +244,9 @@ httpConnect
 httpConnect2\r
 httpConnectEncrypt\r
 httpCopyCredentials\r
-httpCreateCredentials\r
+httpCredentialsAreValidForName\r
+httpCredentialsGetExpiration\r
+httpCredentialsGetTrust\r
 httpCredentialsString\r
 httpDecode64\r
 httpDecode64_2\r
@@ -237,6 +262,7 @@ httpFreeCredentials
 httpGet\r
 httpGetActivity\r
 httpGetAddress\r
+httpGetAuthString\r
 httpGetBlocking\r
 httpGetContentEncoding\r
 httpGetCookie\r
@@ -276,6 +302,7 @@ httpRead
 httpRead2\r
 httpReadRequest\r
 httpReconnect\r
+httpReconnect2\r
 httpResolveHostname\r
 httpSaveCredentials\r
 httpSeparate\r
@@ -294,6 +321,7 @@ httpStateString
 httpStatus\r
 httpTrace\r
 httpUpdate\r
+httpURIStatusString\r
 httpWait\r
 httpWrite\r
 httpWrite2\r
diff --git a/cups/sspi-private.h b/cups/sspi-private.h
deleted file mode 100644 (file)
index e8f36c2..0000000
+++ /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 <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_ */
index 0f08c5a862e1b3ae3d406b3e2f357d27e396b699..9540fbc45000a0c549e5e59ee7817993a6815e49 100644 (file)
@@ -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;
index 27103c8a34070f37f1e34083139cd3394066b1d1..e93601190cc2a9fe14b187c71237ba85f73b5bbf 100644 (file)
@@ -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...
index 458c7dab88d3b41c238deeb1bb0c590605b95f7c..848321b6427d7a59cdc13561a92327d2abea651e 100644 (file)
@@ -25,7 +25,9 @@
 #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>
index 5e4d75a601413761119c4ac8ceb552b34ca8911a..a951f5485c970a684438192dcf716e5277e2f97c 100644 (file)
@@ -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)
 
index 2580eb21a2406b7bed4e40f52a3f3aec7db23dc2..d2f0e4fac708d89b486ed388b5e6495783c90b1a 100644 (file)
                                        />\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