]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
<rdar://problem/15386424> cups.org: gunzip bug prevents use of some gzip'd PPD files...
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 4 Nov 2013 23:47:03 +0000 (23:47 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 4 Nov 2013 23:47:03 +0000 (23:47 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11373 a1ca3aef-8c08-0410-bb20-df032aa958be

cups/file.c
cups/http-addr.c
cups/http-addrlist.c
cups/md5.c
scheduler/conf.c

index ef8c77209cafebef416449b2923476e66a69b69f..9b1f592a9da4c966e75b25f0d17cfd6d24e3a0eb 100644 (file)
@@ -1,61 +1,21 @@
 /*
  * "$Id$"
  *
- *   File functions for CUPS.
+ * File functions for CUPS.
  *
- *   Since stdio files max out at 256 files on many systems, we have to
- *   write similar functions without this limit.  At the same time, using
- *   our own file functions allows us to provide transparent support of
- *   gzip'd print files, PPD files, etc.
+ * Since stdio files max out at 256 files on many systems, we have to
+ * write similar functions without this limit.  At the same time, using
+ * our own file functions allows us to provide transparent support of
+ * gzip'd print files, PPD files, etc.
  *
- *   Copyright 2007-2012 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   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/".
- *
- * Contents:
- *
- *   _cupsFileCheck()       - Check the permissions of the given filename.
- *   _cupsFileCheckFilter() - Report file check results as CUPS filter messages.
- *   cupsFileClose()        - Close a CUPS file.
- *   cupsFileCompression()  - Return whether a file is compressed.
- *   cupsFileEOF()          - Return the end-of-file status.
- *   cupsFileFind()         - Find a file using the specified path.
- *   cupsFileFlush()        - Flush pending output.
- *   cupsFileGetChar()      - Get a single character from a file.
- *   cupsFileGetConf()      - Get a line from a configuration file.
- *   cupsFileGetLine()      - Get a CR and/or LF-terminated line that may
- *                            contain binary data.
- *   cupsFileGets()         - Get a CR and/or LF-terminated line.
- *   cupsFileLock()         - Temporarily lock access to a file.
- *   cupsFileNumber()       - Return the file descriptor associated with a CUPS
- *                            file.
- *   cupsFileOpen()         - Open a CUPS file.
- *   cupsFileOpenFd()       - Open a CUPS file using a file descriptor.
- *   cupsFilePeekChar()     - Peek at the next character from a file.
- *   cupsFilePrintf()       - Write a formatted string.
- *   cupsFilePutChar()      - Write a character.
- *   cupsFilePutConf()      - Write a configuration line.
- *   cupsFilePuts()         - Write a string.
- *   cupsFileRead()         - Read from a file.
- *   cupsFileRewind()       - Set the current file position to the beginning of
- *                            the file.
- *   cupsFileSeek()         - Seek in a file.
- *   cupsFileStderr()       - Return a CUPS file associated with stderr.
- *   cupsFileStdin()        - Return a CUPS file associated with stdin.
- *   cupsFileStdout()       - Return a CUPS file associated with stdout.
- *   cupsFileTell()         - Return the current file position.
- *   cupsFileUnlock()       - Unlock access to a file.
- *   cupsFileWrite()        - Write to a file.
- *   cups_compress()        - Compress a buffer of data.
- *   cups_fill()            - Fill the input buffer.
- *   cups_open()            - Safely open a file for writing.
- *   cups_read()            - Read from a file descriptor.
- *   cups_write()           - Write to a file descriptor.
+ * 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/".
  */
 
 /*
@@ -2429,8 +2389,8 @@ cups_fill(cups_file_t *fp)                /* I - CUPS file */
        }
        else
        {
-         tcrc = (((((trailer[3] << 8) | trailer[2]) << 8) | trailer[1]) << 8) |
-                trailer[0];
+         tcrc = ((((((uLong)trailer[3] << 8) | (uLong)trailer[2]) << 8) |
+                 (uLong)trailer[1]) << 8) | (uLong)trailer[0];
 
          if (tcrc != fp->crc)
          {
@@ -2438,7 +2398,7 @@ cups_fill(cups_file_t *fp)                /* I - CUPS file */
             * Bad CRC, mark end-of-file...
            */
 
-            DEBUG_printf(("9cups_fill: tcrc=%08x, fp->crc=%08x",
+            DEBUG_printf(("9cups_fill: tcrc=%08x != fp->crc=%08x",
                          (unsigned int)tcrc, (unsigned int)fp->crc));
 
            fp->eof = 1;
index 01eb74db50ce1802386f3e4eb3b683e713239029..130d0a748ea8ac78273fe202ca4074ab82593007 100644 (file)
@@ -746,8 +746,9 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
     if (ip[0] > 255 || ip[1] > 255 || ip[2] > 255 || ip[3] > 255)
       return (NULL);                   /* Invalid byte ranges! */
 
-    cg->ip_addr = htonl(((((((ip[0] << 8) | ip[1]) << 8) | ip[2]) << 8) |
-                         ip[3]));
+    cg->ip_addr = htonl((((((((unsigned)ip[0] << 8) | (unsigned)ip[1]) << 8) |
+                           (unsigned)ip[2]) << 8) |
+                         (unsigned)ip[3]));
 
    /*
     * Fill in the host entry and return it...
@@ -818,7 +819,7 @@ httpGetHostname(http_t *http,               /* I - HTTP connection or NULL */
 
     if (!s || slen <= 1)
       return (NULL);
-    
+
     if (gethostname(s, slen) < 0)
       strlcpy(s, "localhost", slen);
 
index b6cbc1f3fb43665d69d55846b239428d8431b63d..287692ff3d6434fd57aab764a8d235f04407eac5 100644 (file)
@@ -1,25 +1,16 @@
 /*
  * "$Id$"
  *
- *   HTTP address list routines for CUPS.
+ * HTTP address list routines for CUPS.
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   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/".
- *
- * Contents:
- *
- *   httpAddrConnect() - Connect to any of the addresses in the list.
- *   httpAddrConnect2() - Connect to any of the addresses in the list with a
- *                       timeout and optional cancel.
- *   httpAddrCopyList() - Copy an address list.
- *   httpAddrFreeList() - Free an address list.
- *   httpAddrGetList() - Get a list of addresses for a hostname.
+ * 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/".
  */
 
 /*
@@ -639,9 +630,10 @@ httpAddrGetList(const char *hostname,      /* I - Hostname, IP address, or NULL for p
            return (NULL);
 
           first->addr.ipv4.sin_family = AF_INET;
-          first->addr.ipv4.sin_addr.s_addr = htonl(((((((ip[0] << 8) |
-                                                      ip[1]) << 8) |
-                                                    ip[2]) << 8) | ip[3]));
+          first->addr.ipv4.sin_addr.s_addr = htonl((((((((unsigned)ip[0] << 8) |
+                                                      (unsigned)ip[1]) << 8) |
+                                                    (unsigned)ip[2]) << 8) |
+                                                  (unsigned)ip[3]));
           first->addr.ipv4.sin_port = htons(portnum);
        }
       }
index 1f46a957cd0d7eddcef3aa31b4ea6a8f50015671..843890d4d2ed75cf8a914056621a8935d59bd3a0 100644 (file)
@@ -1,31 +1,30 @@
 /*
  * "$Id$"
  *
- *   Private MD5 implementation for CUPS.
+ * Private MD5 implementation for CUPS.
  *
- *   Copyright 2007-2010 by Apple Inc.
- *   Copyright 2005 by Easy Software Products
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 2005 by Easy Software Products
+ * Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
  *
- *   Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the authors be held liable for any damages
+ * arising from the use of this software.
  *
- *   This software is provided 'as-is', without any express or implied
- *   warranty.  In no event will the authors be held liable for any damages
- *   arising from the use of this software.
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
  *
- *   Permission is granted to anyone to use this software for any purpose,
- *   including commercial applications, and to alter it and redistribute it
- *   freely, subject to the following restrictions:
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software. If you use this software
+ *    in a product, an acknowledgment in the product documentation would be
+ *    appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
  *
- *   1. The origin of this software must not be misrepresented; you must not
- *      claim that you wrote the original software. If you use this software
- *      in a product, an acknowledgment in the product documentation would be
- *      appreciated but is not required.
- *   2. Altered source versions must be plainly marked as such, and must not be
- *      misrepresented as being the original software.
- *   3. This notice may not be removed or altered from any source distribution.
- *
- *   L. Peter Deutsch
- *   ghost@aladdin.com
+ * L. Peter Deutsch
+ * ghost@aladdin.com
  */
 /*
   Independent implementation of MD5 (RFC 1321).
@@ -133,7 +132,8 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
     int i;
 
     for (i = 0; i < 16; ++i, xp += 4)
-       X[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
+       X[i] = (unsigned)xp[0] + ((unsigned)xp[1] << 8) +
+              ((unsigned)xp[2] << 16) + ((unsigned)xp[3] << 24);
 
 #else  /* !ARCH_IS_BIG_ENDIAN */
 
index a12793f7d1f4f90daa51f5d32504066b5d78fe20..eb26aff8edeb825ab11b3197ca662eff1aa7b3a1 100644 (file)
@@ -1,39 +1,16 @@
 /*
  * "$Id$"
  *
- *   Configuration routines for the CUPS scheduler.
+ * Configuration routines for the CUPS scheduler.
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   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/".
- *
- * Contents:
- *
- *   cupsdAddAlias()         - Add a host alias.
- *   cupsdCheckPermissions()  - Fix the mode and ownership of a file or
- *                             directory.
- *   cupsdDefaultAuthType()   - Get the default AuthType.
- *   cupsdFreeAliases()       - Free all of the alias entries.
- *   cupsdReadConfiguration() - Read the cupsd.conf file.
- *   get_address()           - Get an address + port number from a line.
- *   get_addr_and_mask()      - Get an IP address and netmask.
- *   mime_error_cb()         - Log a MIME error.
- *   parse_aaa()             - Parse authentication, authorization, and access
- *                             control lines.
- *   parse_fatal_errors()     - Parse FatalErrors values in a string.
- *   parse_groups()          - Parse system group names in a string.
- *   parse_protocols()       - Parse browse protocols in a string.
- *   parse_variable()        - Parse a variable line.
- *   read_cupsd_conf()       - Read the cupsd.conf configuration file.
- *   read_cups_files_conf()   - Read the cups-files.conf configuration file.
- *   read_location()         - Read a <Location path> definition.
- *   read_policy()           - Read a <Policy name> definition.
- *   set_policy_defaults()    - Set default policy values as needed.
+ * 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/".
  */
 
 /*
@@ -1815,7 +1792,8 @@ get_addr_and_mask(const char *value,      /* I - String from config file */
        * Merge everything into a 32-bit IPv4 address in ip[3]...
        */
 
-       ip[3] = (((((val[0] << 8) | val[1]) << 8) | val[2]) << 8) | val[3];
+       ip[3] = ((((((unsigned)val[0] << 8) | (unsigned)val[1]) << 8) |
+                (unsigned)val[2]) << 8) | (unsigned)val[3];
 
        if (ipcount < 4)
          mask[3] = (0xffffffff << (32 - 8 * ipcount)) & 0xffffffff;
@@ -1883,7 +1861,8 @@ get_addr_and_mask(const char *value,      /* I - String from config file */
     * Merge everything into a 32-bit IPv4 address in ip[3]...
     */
 
-    ip[3] = (((((val[0] << 8) | val[1]) << 8) | val[2]) << 8) | val[3];
+    ip[3] = ((((((unsigned)val[0] << 8) | (unsigned)val[1]) << 8) |
+             (unsigned)val[2]) << 8) | (unsigned)val[3];
 
     if (ipcount < 4)
       mask[3] = (0xffffffff << (32 - 8 * ipcount)) & 0xffffffff;
@@ -1910,7 +1889,8 @@ get_addr_and_mask(const char *value,      /* I - String from config file */
                  mask + 3) != 4)
         return (0);
 
-      mask[3] |= ((((mask[0] << 8) | mask[1]) << 8) | mask[2]) << 8;
+      mask[3] |= (((((unsigned)mask[0] << 8) | (unsigned)mask[1]) << 8) |
+                  (unsigned)mask[2]) << 8;
       mask[0] = mask[1] = mask[2] = 0;
     }
     else