]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror changes from trunk.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 22 May 2014 13:59:21 +0000 (13:59 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 22 May 2014 13:59:21 +0000 (13:59 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.7@11890 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES.txt
backend/ipp.c
cgi-bin/ipp-var.c
conf/mime.types
cups/libcups2.def
cups/string-private.h
cups/string.c
cups/testipp.c
scheduler/testsub.c
systemv/lpstat.c

index 83add7dcfa43dbdd808034b50e49aa27ce419129..47617717543a387675efbbade01c00bf15fd5125 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES.txt - 1.7.3 - 2014-05-13
+CHANGES.txt - 1.7.3 - 2014-05-22
 --------------------------------
 
 CHANGES IN CUPS V1.7.3
@@ -13,8 +13,20 @@ CHANGES IN CUPS V1.7.3
        - The IPP backend did not abort a job when the printer did not validate
          the supplied options (<rdar://problem/16836752>)
        - Fixed an authentication race condition in cupsSendRequest (STR #4403)
+       - The scheduler did not add the "job-hold-until-specified" reason when
+         holding a job using the lp command (STR #4405)
+       - The CUPS headers incorrectly needed libdispatch for blocks support
+         (STR #4397)
+       - The configure script incorrectly added libgcrypt as a GNU TLS
+         dependency (STR #4399)
+       - CUPS did not compile when Avahi or mDNSResponder was not present
+         (STR #4402)
        - cupsGetDestMediaCount did not work for CUPS_MEDIA_FLAGS DEFAULT
          (STR #4414)
+       - Auto-typing of PWG Raster files did not work (STR #4417)
+       - IPP queues using hardcoded credentials would ask for credentials
+         (STR #4371)
+       - Dates in non-UTF-8 locales did not display correctly (STR #4388)
 
 
 CHANGES IN CUPS V1.7.2
index 432857deb192583ebecf3aad6d46c14adab99e39..f36e3720f7a01ba1cc9c2a5869711e15a23b095b 100644 (file)
@@ -91,8 +91,10 @@ static const char * const jattrs[] = /* Job attributes we want */
   "job-state",
   "job-state-reasons"
 };
-static int             job_canceled = 0;
+static int             job_canceled = 0,
                                        /* Job cancelled? */
+                       uri_credentials = 0;
+                                       /* Credentials supplied in URI? */
 static char            username[256] = "",
                                        /* Username for device URI */
                        *password = NULL;
@@ -630,6 +632,7 @@ main(int  argc,                             /* I - Number of command-line args */
       *password++ = '\0';
 
     cupsSetUser(username);
+    uri_credentials = 1;
   }
   else
   {
@@ -2986,20 +2989,23 @@ password_cb(const char *prompt,         /* I - Prompt (not used) */
   (void)method;
   (void)resource;
 
- /*
-  * Remember that we need to authenticate...
-  */
+  if (!uri_credentials)
+  {
+   /*
+    * Remember that we need to authenticate...
+    */
 
-  auth_info_required = "username,password";
+    auth_info_required = "username,password";
 
-  if (httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "username",
-                      def_username))
-  {
-    char       quoted[HTTP_MAX_VALUE * 2 + 4];
-                                       /* Quoted string */
+    if (httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "username",
+                       def_username))
+    {
+      char     quoted[HTTP_MAX_VALUE * 2 + 4];
+                                         /* Quoted string */
 
-    fprintf(stderr, "ATTR: auth-info-default=%s,\n",
-            quote_string(def_username, quoted, sizeof(quoted)));
+      fprintf(stderr, "ATTR: auth-info-default=%s,\n",
+             quote_string(def_username, quoted, sizeof(quoted)));
+    }
   }
 
   if (password && *password && *password_tries < 3)
index 38120da080168c98d85fb4cdf0200ad6f218fd3d..ddc560e1573f1c254dd3b48e0846bb1ee7e318ac 100644 (file)
@@ -1,31 +1,16 @@
 /*
  * "$Id$"
  *
- *   CGI <-> IPP variable routines for CUPS.
+ * CGI <-> IPP variable routines for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products.
  *
- *   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:
- *
- *   cgiGetAttributes()    - Get the list of attributes that are needed by the
- *                           template file.
- *   cgiGetIPPObjects()    - Get the objects in an IPP response.
- *   cgiMoveJobs()         - Move one or more jobs.
- *   cgiPrintCommand()     - Print a CUPS command job.
- *   cgiPrintTestPage()    - Print a test page.
- *   cgiRewriteURL()       - Rewrite a printer URI into a web browser URL...
- *   cgiSetIPPObjectVars() - Set CGI variables from an IPP object.
- *   cgiSetIPPVars()       - Set CGI variables from an IPP response.
- *   cgiShowIPPError()     - Show the last IPP error message.
- *   cgiShowJobs()         - Show print jobs.
- *   cgiText()             - Return localized text.
+ * 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/".
  */
 
 /*
@@ -958,7 +943,6 @@ cgiSetIPPObjectVars(
                        *nameptr,       /* Pointer into name */
                        value[16384],   /* Value(s) */
                        *valptr;        /* Pointer into value */
-  struct tm            *date;          /* Date information */
 
 
   fprintf(stderr, "DEBUG2: cgiSetIPPObjectVars(obj=%p, prefix=\"%s\", "
@@ -1186,17 +1170,9 @@ cgiSetIPPObjectVars(
        case IPP_TAG_INTEGER :
        case IPP_TAG_ENUM :
            if (strncmp(name, "time_at_", 8) == 0)
-           {
-             time_t    t;              /* Temporary time value */
-
-              t    = (time_t)attr->values[i].integer;
-             date = localtime(&t);
-
-             strftime(valptr, sizeof(value) - (valptr - value), "%c", date);
-           }
+             _cupsStrDate(valptr, sizeof(value) - (size_t)(valptr - value), (time_t)ippGetInteger(attr, i));
            else
-             snprintf(valptr, sizeof(value) - (valptr - value),
-                      "%d", attr->values[i].integer);
+             snprintf(valptr, sizeof(value) - (size_t)(valptr - value), "%d", ippGetInteger(attr, i));
            break;
 
        case IPP_TAG_BOOLEAN :
index 217d75bee95af42a3b4ca45fa2c86d2bb0994653..31001100f25555e641a60aab01656a78335b2bda 100644 (file)
@@ -1,20 +1,20 @@
 #
 # "$Id: mime.types 7670 2008-06-17 22:42:08Z mike $"
 #
-#   Base MIME types file for CUPS.
+# Base MIME types file for CUPS.
 #
-#   DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW
-#   VERSIONS OF CUPS.  Instead, create a "local.types" file that
-#   reflects your local configuration changes.
+# DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW
+# VERSIONS OF CUPS.  Instead, create a "local.types" file that
+# reflects your local configuration changes.
 #
-#   Copyright 2007-2011 by Apple Inc.
-#   Copyright 1997-2007 by Easy Software Products.
+# Copyright 2007-2014 by Apple Inc.
+# Copyright 1997-2007 by Easy Software Products.
 #
-#   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/".
+# 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/".
 #
 
 ########################################################################
@@ -92,7 +92,7 @@ image/jpeg                    jpeg jpg jpe string(0,<FFD8FF>) +\
                                 char(3,0xe4) char(3,0xe5) char(3,0xe6) char(3,0xe7)\
                                 char(3,0xe8) char(3,0xe9) char(3,0xea) char(3,0xeb)\
                                 char(3,0xec) char(3,0xed) char(3,0xee) char(3,0xef))
-image/pwg-raster               string(0,"RaS2") + string(4,PwgRaster<00>) priority(100)
+image/pwg-raster               string(0,"RaS2") + string(4,PwgRaster<00>) priority(150)
 image/tiff                     tiff tif string(0,MM<002A>) string(0,II<2A00>)
 image/x-photocd                        pcd string(2048,PCD_IPI)
 image/x-portable-anymap                pnm
@@ -152,7 +152,7 @@ application/vnd.cups-pdf
 application/vnd.cups-postscript
 application/vnd.cups-ppd       ppd string(0,"*PPD-Adobe:")
 application/vnd.cups-raster    string(0,"RaSt") string(0,"tSaR") \
-                               string(0,"RaS2") string(0,"2SaR") \
+                               (string(0,"RaS2") + !string(4,PwgRaster<00>)) string(0,"2SaR") \
                                string(0,"RaS3") string(0,"3SaR")
 application/vnd.cups-raw       (string(0,<1B>E) + !string(2,<1B>%0B)) \
                                string(0,<1B>@) \
index ea525c1509271d796695b5ec799e667cacaef734..f3ea9ff6c841d1b4020bb68781bd21ef6b5897ea 100644 (file)
@@ -23,6 +23,7 @@ _cupsNextDelay
 _cupsSetError\r
 _cupsSetLocale\r
 _cupsStrAlloc\r
+_cupsStrDate\r
 _cupsStrFlush\r
 _cupsStrFormatd\r
 _cupsStrFree\r
index 8255bfdfb1a62b1dd5277963cecaf2c7990cde7e..1a02be1cf64511262c6e93c326686cd25d9e48fa 100644 (file)
@@ -1,18 +1,18 @@
 /*
  * "$Id$"
  *
- *   Private string definitions for CUPS.
+ * Private string definitions for CUPS.
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 1997-2006 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
  *
- *   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/".
+ * 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/".
  *
- *   This file is subject to the Apple OS-Developed Software exception.
+ * This file is subject to the Apple OS-Developed Software exception.
  */
 
 #ifndef _CUPS_STRING_PRIVATE_H_
@@ -28,6 +28,7 @@
 #  include <ctype.h>
 #  include <errno.h>
 #  include <locale.h>
+#  include <time.h>
 
 #  include "config.h"
 
@@ -199,6 +200,13 @@ extern double      _cupsStrScand(const char *buf, char **bufptr,
                              struct lconv *loc);
 
 
+/*
+ * Date function...
+ */
+
+extern char    *_cupsStrDate(char *buf, size_t bufsize, time_t timeval);
+
+
 /*
  * C++ magic...
  */
index 7a862f6617882d7147aefc9d41eef61432e2bbdf..cfba1004852b4f58c1eed473e8f9cb997e4a51d7 100644 (file)
  */
 
 #define _CUPS_STRING_C_
-#include "string-private.h"
-#include "debug-private.h"
-#include "thread-private.h"
-#include "array.h"
+#include "cups-private.h"
 #include <stddef.h>
 #include <limits.h>
 
@@ -161,6 +158,39 @@ _cupsStrAlloc(const char *s)               /* I - String */
 }
 
 
+/*
+ * '_cupsStrDate()' - Return a localized date for a given time value.
+ *
+ * This function works around the locale encoding issues of strftime...
+ */
+
+char *                                 /* O - Buffer */
+_cupsStrDate(char   *buf,              /* I - Buffer */
+             size_t bufsize,           /* I - Size of buffer */
+            time_t timeval)            /* I - Time value */
+{
+  struct tm    *dateval;               /* Local date/time */
+  char         temp[1024];             /* Temporary buffer */
+  _cups_globals_t *cg = _cupsGlobals();        /* Per-thread globals */
+
+
+  if (!cg->lang_default)
+    cg->lang_default = cupsLangDefault();
+
+  dateval = localtime(&timeval);
+
+  if (cg->lang_default->encoding != CUPS_UTF8)
+  {
+    strftime(temp, sizeof(temp), "%c", dateval);
+    cupsCharsetToUTF8((cups_utf8_t *)buf, temp, (int)bufsize, cg->lang_default->encoding);
+  }
+  else
+    strftime(buf, bufsize, "%c", dateval);
+
+  return (buf);
+}
+
+
 /*
  * '_cupsStrFlush()' - Flush the string pool.
  */
index c96a4b05ba09a7ff44a7d8daae6d4f59fc753e5e..d931e4fef485dc0fc6d92c0aefd5ebe2a1144e54 100644 (file)
@@ -901,17 +901,10 @@ print_attributes(ipp_t *ipp,              /* I - IPP request */
 
       case IPP_TAG_DATE :
           {
-           time_t      vtime;          /* Date/Time value */
-           struct tm   *vdate;         /* Date info */
            char        vstring[256];   /* Formatted time */
 
            for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
-           {
-             vtime = ippDateToTime(val->date);
-             vdate = localtime(&vtime);
-             strftime(vstring, sizeof(vstring), "%c", vdate);
-             printf(" (%s)", vstring);
-           }
+             printf(" (%s)", _cupsStrDate(vstring, sizeof(vstring), ippDateToTime(val->date)));
           }
           putchar('\n');
           break;
index 4635c653667dee42e8b3ea093d6187bb70e37f73..ffab4a37ed5262af91f77d08f0563adac7adfadc 100644 (file)
@@ -435,17 +435,10 @@ print_attributes(ipp_t *ipp,              /* I - IPP request */
 
       case IPP_TAG_DATE :
           {
-           time_t      vtime;          /* Date/Time value */
-           struct tm   *vdate;         /* Date info */
            char        vstring[256];   /* Formatted time */
 
            for (i = 0, val = attr->values; i < attr->num_values; i ++, val ++)
-           {
-             vtime = ippDateToTime(val->date);
-             vdate = localtime(&vtime);
-             strftime(vstring, sizeof(vstring), "%c", vdate);
-             printf(" (%s)", vstring);
-           }
+             printf(" (%s)", _cupsStrDate(vstring, sizeof(vstring), ippDateToTime(val->date)));
           }
           putchar('\n');
           break;
index 3bdca13a73c8df33a4f86d8af25ef468aac74b14..6449c99aacf8c15409c437754ef26da766156a40 100644 (file)
@@ -3,7 +3,7 @@
  *
  * "lpstat" command for CUPS.
  *
- * Copyright 2007-2013 by Apple Inc.
+ * Copyright 2007-2014 by Apple Inc.
  * Copyright 1997-2006 by Easy Software Products.
  *
  * These coded instructions, statements, and computer programs are the
@@ -649,7 +649,6 @@ show_accepting(const char  *printers,       /* I - Destinations */
                *message;               /* Printer device URI */
   int          accepting;              /* Accepting requests? */
   time_t       ptime;                  /* Printer state time */
-  struct tm    *pdate;                 /* Printer state date & time */
   char         printer_state_time[255];/* Printer state time */
   static const char *pattrs[] =                /* Attributes we need for printers... */
                {
@@ -772,8 +771,7 @@ show_accepting(const char  *printers,       /* I - Destinations */
 
       if (match_list(printers, printer))
       {
-        pdate = localtime(&ptime);
-        strftime(printer_state_time, sizeof(printer_state_time), "%c", pdate);
+        _cupsStrDate(printer_state_time, sizeof(printer_state_time), ptime);
 
         if (accepting)
          _cupsLangPrintf(stdout, _("%s accepting requests since %s"),
@@ -1323,7 +1321,6 @@ show_jobs(const char *dests,              /* I - Destinations */
                jobid,                  /* job-id */
                size;                   /* job-k-octets */
   time_t       jobtime;                /* time-at-creation */
-  struct tm    *jobdate;               /* Date & time */
   char         temp[255],              /* Temporary buffer */
                date[255];              /* Date buffer */
   static const char *jattrs[] =                /* Attributes we need for jobs... */
@@ -1481,62 +1478,44 @@ show_jobs(const char *dests,            /* I - Destinations */
 
       if (match_list(dests, dest) && match_list(users, username))
       {
-        jobdate = localtime(&jobtime);
         snprintf(temp, sizeof(temp), "%s-%d", dest, jobid);
 
-        if (long_status == 3)
-       {
-        /*
-         * Show the consolidated output format for the SGI tools...
-         */
+       _cupsStrDate(date, sizeof(date), jobtime);
 
-         if (!strftime(date, sizeof(date), "%b %d %H:%M", jobdate))
-           strlcpy(date, "Unknown", sizeof(date));
-
-         _cupsLangPrintf(stdout, "%s;%s;%d;%s;%s",
-                         temp, username ? username : "unknown",
-                         size, title ? title : "unknown", date);
-       }
+       if (ranking)
+         _cupsLangPrintf(stdout, "%3d %-21s %-13s %8.0f %s",
+                         rank, temp, username ? username : "unknown",
+                         1024.0 * size, date);
        else
+         _cupsLangPrintf(stdout, "%-23s %-13s %8.0f   %s",
+                         temp, username ? username : "unknown",
+                         1024.0 * size, date);
+       if (long_status)
        {
-         if (!strftime(date, sizeof(date), "%c", jobdate))
-           strlcpy(date, "Unknown", sizeof(date));
-
-          if (ranking)
-           _cupsLangPrintf(stdout, "%3d %-21s %-13s %8.0f %s",
-                           rank, temp, username ? username : "unknown",
-                           1024.0 * size, date);
-          else
-           _cupsLangPrintf(stdout, "%-23s %-13s %8.0f   %s",
-                           temp, username ? username : "unknown",
-                           1024.0 * size, date);
-          if (long_status)
-          {
-           if (message)
-             _cupsLangPrintf(stdout, _("\tStatus: %s"), message);
-
-           if (reasons)
-           {
-             char      alerts[1024],   /* Alerts string */
-                       *aptr;          /* Pointer into alerts string */
+         if (message)
+           _cupsLangPrintf(stdout, _("\tStatus: %s"), message);
 
-             for (i = 0, aptr = alerts; i < reasons->num_values; i ++)
-             {
-               if (i)
-                 snprintf(aptr, sizeof(alerts) - (aptr - alerts), " %s",
-                          reasons->values[i].string.text);
-                else
-                 strlcpy(alerts, reasons->values[i].string.text,
-                         sizeof(alerts));
-
-               aptr += strlen(aptr);
-             }
+         if (reasons)
+         {
+           char        alerts[1024],   /* Alerts string */
+                     *aptr;            /* Pointer into alerts string */
 
-             _cupsLangPrintf(stdout, _("\tAlerts: %s"), alerts);
+           for (i = 0, aptr = alerts; i < reasons->num_values; i ++)
+           {
+             if (i)
+               snprintf(aptr, sizeof(alerts) - (aptr - alerts), " %s",
+                        reasons->values[i].string.text);
+             else
+               strlcpy(alerts, reasons->values[i].string.text,
+                       sizeof(alerts));
+
+             aptr += strlen(aptr);
            }
 
-           _cupsLangPrintf(stdout, _("\tqueued for %s"), dest);
+           _cupsLangPrintf(stdout, _("\tAlerts: %s"), alerts);
          }
+
+         _cupsLangPrintf(stdout, _("\tqueued for %s"), dest);
        }
       }
 
@@ -1579,7 +1558,6 @@ show_printers(const char  *printers,      /* I - Destinations */
   ipp_pstate_t pstate;                 /* Printer state */
   cups_ptype_t ptype;                  /* Printer type */
   time_t       ptime;                  /* Printer state time */
-  struct tm    *pdate;                 /* Printer state date & time */
   int          jobid;                  /* Job ID of current job */
   char         printer_uri[HTTP_MAX_URI],
                                        /* Printer URI */
@@ -1823,8 +1801,7 @@ show_printers(const char  *printers,      /* I - Destinations */
         * Display it...
        */
 
-        pdate = localtime(&ptime);
-        strftime(printer_state_time, sizeof(printer_state_time), "%c", pdate);
+        _cupsStrDate(printer_state_time, sizeof(printer_state_time), ptime);
 
         switch (pstate)
        {