From: msweet Date: Thu, 22 May 2014 13:59:21 +0000 (+0000) Subject: Mirror changes from trunk. X-Git-Tag: release-2.1.4~16^2~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a16dd94b986c82ec2e601a7553c7c1b51c7b9bc;p=thirdparty%2Fcups.git Mirror changes from trunk. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.7@11890 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES.txt b/CHANGES.txt index 83add7dcfa..4761771754 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 () - 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 diff --git a/backend/ipp.c b/backend/ipp.c index 432857deb1..f36e3720f7 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -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) diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c index 38120da080..ddc560e157 100644 --- a/cgi-bin/ipp-var.c +++ b/cgi-bin/ipp-var.c @@ -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 : diff --git a/conf/mime.types b/conf/mime.types index 217d75bee9..31001100f2 100644 --- a/conf/mime.types +++ b/conf/mime.types @@ -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,) +\ 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>@) \ diff --git a/cups/libcups2.def b/cups/libcups2.def index ea525c1509..f3ea9ff6c8 100644 --- a/cups/libcups2.def +++ b/cups/libcups2.def @@ -23,6 +23,7 @@ _cupsNextDelay _cupsSetError _cupsSetLocale _cupsStrAlloc +_cupsStrDate _cupsStrFlush _cupsStrFormatd _cupsStrFree diff --git a/cups/string-private.h b/cups/string-private.h index 8255bfdfb1..1a02be1cf6 100644 --- a/cups/string-private.h +++ b/cups/string-private.h @@ -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 # include # include +# include # 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... */ diff --git a/cups/string.c b/cups/string.c index 7a862f6617..cfba100485 100644 --- a/cups/string.c +++ b/cups/string.c @@ -37,10 +37,7 @@ */ #define _CUPS_STRING_C_ -#include "string-private.h" -#include "debug-private.h" -#include "thread-private.h" -#include "array.h" +#include "cups-private.h" #include #include @@ -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. */ diff --git a/cups/testipp.c b/cups/testipp.c index c96a4b05ba..d931e4fef4 100644 --- a/cups/testipp.c +++ b/cups/testipp.c @@ -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; diff --git a/scheduler/testsub.c b/scheduler/testsub.c index 4635c65366..ffab4a37ed 100644 --- a/scheduler/testsub.c +++ b/scheduler/testsub.c @@ -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; diff --git a/systemv/lpstat.c b/systemv/lpstat.c index 3bdca13a73..6449c99aac 100644 --- a/systemv/lpstat.c +++ b/systemv/lpstat.c @@ -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) {