From ba4f314f2becc177d5d2d887d9918bab96859c04 Mon Sep 17 00:00:00 2001 From: Michael Sweet Date: Tue, 15 Mar 2016 10:43:33 -0400 Subject: [PATCH] Import CUPS v2.1.3 --- CHANGES.txt | 21 +++++- INSTALL.txt | 2 +- README.txt | 2 +- backend/lpd.c | 6 +- config-scripts/cups-common.m4 | 2 +- configure | 20 +++--- configure.ac | 8 +-- cups/cups.h | 10 +-- cups/dest.c | 15 ++--- cups/encode.c | 12 ++-- cups/testoptions.c | 99 +++++++++++++++++++++++----- cups/usersys.c | 8 ++- filter/rastertolabel.c | 18 ++++- notifier/testnotify.c | 8 +-- packaging/cups.spec | 4 +- scheduler/client.c | 62 +++++++---------- scheduler/ipp.c | 18 ++++- scheduler/job.c | 9 ++- scheduler/main.c | 20 +----- scheduler/org.cups.cupsd.plist | 2 +- scheduler/subscriptions.c | 6 +- templates/de/jobs-header.tmpl | 2 +- test/ipptool.c | 58 +++++++++------- xcode/CUPS.xcodeproj/project.pbxproj | 1 + 24 files changed, 255 insertions(+), 158 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 566a4e3ede..6a1a1dbdf8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,25 @@ -CHANGES.txt - 2.1.2 - 2015-12-02 +CHANGES.txt - 2.1.3 - 2016-02-05 -------------------------------- +CHANGES IN CUPS V2.1.3 + + - The default password function did not work on some platforms + (STR #4750) + - The scheduler should not exit under memory pressure + () + - The EPL2 and ZPL sample drivers did not properly support the CutMedia + option. + - Pending subscriptions would prevent the scheduler from idle exiting + (STR #4754) + - Fixed some issues in ipptool for skipped tests + () + - The "lp -H resume" command did not reset the "job-state-reasons" + attribute value (STR #4752) + - The scheduler did not allow access to resource files (icons, etc.) + when the web interface was disabled (STR #4755) + - Localization fix (STR #4756) + + CHANGES IN CUPS V2.1.2 - Re-release of CUPS 2.1.1 as CUPS 2.1.2 due to error in tagging of the diff --git a/INSTALL.txt b/INSTALL.txt index 762b88897b..baa2388fb7 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,4 +1,4 @@ -INSTALL - CUPS v2.1.2 - 2015-12-02 +INSTALL - CUPS v2.1.3 - 2016-02-05 ---------------------------------- This file describes how to compile and install CUPS from source code. For more diff --git a/README.txt b/README.txt index 91a3c189bc..8f8459c9a7 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -README - CUPS v2.1.2 - 2015-12-02 +README - CUPS v2.1.3 - 2016-02-05 --------------------------------- Looking for compile instructions? Read the file "INSTALL.txt" instead... diff --git a/backend/lpd.c b/backend/lpd.c index 33e84086c3..7daa9a85d1 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -1,5 +1,5 @@ /* - * "$Id: lpd.c 12024 2014-07-15 12:58:39Z msweet $" + * "$Id: lpd.c 13040 2016-01-11 20:29:13Z msweet $" * * Line Printer Daemon backend for CUPS. * @@ -1251,7 +1251,7 @@ rresvport_af(int *port, /* IO - Port number to bind to */ */ memset(&addr, 0, sizeof(addr)); - addr.addr.sa_family = family; + addr.addr.sa_family = (sa_family_t)family; /* * Try to bind the socket to a reserved port... @@ -1320,5 +1320,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: lpd.c 12024 2014-07-15 12:58:39Z msweet $". + * End of "$Id: lpd.c 13040 2016-01-11 20:29:13Z msweet $". */ diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index 38a7af63a3..812229590b 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -17,7 +17,7 @@ dnl Set the name of the config header file... AC_CONFIG_HEADER(config.h) dnl Version number information... -CUPS_VERSION=2.1.2 +CUPS_VERSION=2.1.3 case "$CUPS_VERSION" in *svn) diff --git a/configure b/configure index 4170ff3adf..908794c761 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for CUPS 2.1.2. +# Generated by GNU Autoconf 2.68 for CUPS 2.1.3. # # Report bugs to . # @@ -560,8 +560,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='CUPS' PACKAGE_TARNAME='cups' -PACKAGE_VERSION='2.1.2' -PACKAGE_STRING='CUPS 2.1.2' +PACKAGE_VERSION='2.1.3' +PACKAGE_STRING='CUPS 2.1.3' PACKAGE_BUGREPORT='https://www.cups.org/str.php' PACKAGE_URL='https://www.cups.org/' @@ -1447,7 +1447,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures CUPS 2.1.2 to adapt to many kinds of systems. +\`configure' configures CUPS 2.1.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1508,7 +1508,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of CUPS 2.1.2:";; + short | recursive ) echo "Configuration of CUPS 2.1.3:";; esac cat <<\_ACEOF @@ -1687,7 +1687,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -CUPS configure 2.1.2 +CUPS configure 2.1.3 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2151,7 +2151,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by CUPS $as_me 2.1.2, which was +It was created by CUPS $as_me 2.1.3, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2526,7 +2526,7 @@ esac ac_config_headers="$ac_config_headers config.h" -CUPS_VERSION=2.1.2 +CUPS_VERSION=2.1.3 case "$CUPS_VERSION" in *svn) @@ -10765,7 +10765,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by CUPS $as_me 2.1.2, which was +This file was extended by CUPS $as_me 2.1.3, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -10828,7 +10828,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -CUPS config.status 2.1.2 +CUPS config.status 2.1.3 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index e6dc4fb1bb..11ca7bb394 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ dnl -dnl "$Id: configure.ac 12998 2015-12-02 15:09:04Z msweet $" +dnl "$Id: configure.ac 13031 2016-01-04 14:43:04Z msweet $" dnl dnl Configuration script for CUPS. dnl -dnl Copyright 2007-2015 by Apple Inc. +dnl Copyright 2007-2016 by Apple Inc. dnl Copyright 1997-2007 by Easy Software Products, all rights reserved. dnl dnl These coded instructions, statements, and computer programs are the @@ -17,7 +17,7 @@ dnl We need at least autoconf 2.60... AC_PREREQ(2.60) dnl Package name and version... -AC_INIT([CUPS], [2.1.2], [https://www.cups.org/str.php], [cups], [https://www.cups.org/]) +AC_INIT([CUPS], [2.1.3], [https://www.cups.org/str.php], [cups], [https://www.cups.org/]) sinclude(config-scripts/cups-opsys.m4) sinclude(config-scripts/cups-common.m4) @@ -95,5 +95,5 @@ AC_OUTPUT(Makedefs chmod +x cups-config dnl -dnl End of "$Id: configure.ac 12998 2015-12-02 15:09:04Z msweet $". +dnl End of "$Id: configure.ac 13031 2016-01-04 14:43:04Z msweet $". dnl diff --git a/cups/cups.h b/cups/cups.h index dc000ab812..5376838928 100644 --- a/cups/cups.h +++ b/cups/cups.h @@ -1,9 +1,9 @@ /* - * "$Id: cups.h 12998 2015-12-02 15:09:04Z msweet $" + * "$Id: cups.h 13031 2016-01-04 14:43:04Z msweet $" * * API definitions for CUPS. * - * Copyright 2007-2014 by Apple Inc. + * Copyright 2007-2016 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -58,10 +58,10 @@ extern "C" { * Constants... */ -# define CUPS_VERSION 2.0102 +# define CUPS_VERSION 2.0103 # define CUPS_VERSION_MAJOR 2 # define CUPS_VERSION_MINOR 1 -# define CUPS_VERSION_PATCH 2 +# define CUPS_VERSION_PATCH 3 # define CUPS_BC_FD 3 /* Back-channel file descriptor for @@ -636,5 +636,5 @@ extern int cupsSetServerCredentials(const char *path, const char *common_name, #endif /* !_CUPS_CUPS_H_ */ /* - * End of "$Id: cups.h 12998 2015-12-02 15:09:04Z msweet $". + * End of "$Id: cups.h 13031 2016-01-04 14:43:04Z msweet $". */ diff --git a/cups/dest.c b/cups/dest.c index 413fc271e1..578d352b11 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -1,9 +1,9 @@ /* - * "$Id: dest.c 12733 2015-06-12 01:21:05Z msweet $" + * "$Id: dest.c 13075 2016-01-29 21:14:05Z msweet $" * * User-defined destination (and option) support for CUPS. * - * Copyright 2007-2015 by Apple Inc. + * Copyright 2007-2016 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -122,7 +122,7 @@ typedef struct _cups_dnssd_resolve_s /* Data for resolving URI */ #ifdef __APPLE__ static CFArrayRef appleCopyLocations(void); static CFStringRef appleCopyNetwork(void); -static char *appleGetPaperSize(char *name, int namesize); +static char *appleGetPaperSize(char *name, size_t namesize); static CFStringRef appleGetPrinter(CFArrayRef locations, CFStringRef network, CFIndex *locindex); #endif /* __APPLE__ */ @@ -2491,8 +2491,8 @@ appleCopyNetwork(void) */ static char * /* O - Default paper size */ -appleGetPaperSize(char *name, /* I - Paper size name buffer */ - int namesize) /* I - Size of buffer */ +appleGetPaperSize(char *name, /* I - Paper size name buffer */ + size_t namesize) /* I - Size of buffer */ { CFStringRef defaultPaperID; /* Default paper ID */ pwg_media_t *pwgmedia; /* PWG media size */ @@ -2501,8 +2501,7 @@ appleGetPaperSize(char *name, /* I - Paper size name buffer */ defaultPaperID = _cupsAppleCopyDefaultPaperID(); if (!defaultPaperID || CFGetTypeID(defaultPaperID) != CFStringGetTypeID() || - !CFStringGetCString(defaultPaperID, name, namesize, - kCFStringEncodingUTF8)) + !CFStringGetCString(defaultPaperID, name, (CFIndex)namesize, kCFStringEncodingUTF8)) name[0] = '\0'; else if ((pwgmedia = pwgMediaForLegacy(name)) != NULL) strlcpy(name, pwgmedia->pwg, namesize); @@ -3943,5 +3942,5 @@ cups_make_string( /* - * End of "$Id: dest.c 12733 2015-06-12 01:21:05Z msweet $". + * End of "$Id: dest.c 13075 2016-01-29 21:14:05Z msweet $". */ diff --git a/cups/encode.c b/cups/encode.c index b43c4a3fc4..26c5efe3fe 100644 --- a/cups/encode.c +++ b/cups/encode.c @@ -1,9 +1,9 @@ /* - * "$Id: encode.c 12668 2015-05-27 19:30:32Z msweet $" + * "$Id: encode.c 13064 2016-01-27 16:05:09Z msweet $" * * Option encoding routines for CUPS. * - * Copyright 2007-2015 by Apple Inc. + * Copyright 2007-2016 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -542,14 +542,13 @@ cupsEncodeOptions2( else if (*sep == ',' && !quote) count ++; else if (*sep == '\\' && sep[1]) - sep ++; + sep += 2; } } else count = 1; - DEBUG_printf(("2cupsEncodeOptions2: option=\"%s\", count=%d", - option->name, count)); + DEBUG_printf(("2cupsEncodeOptions2: option=\"%s\", value=\"%s\", count=%d", option->name, option->value, count)); /* * Allocate memory for the attribute values... @@ -633,6 +632,7 @@ cupsEncodeOptions2( * Skip quoted character... */ + memmove(sep, sep + 1, strlen(sep)); sep ++; } } @@ -853,5 +853,5 @@ compare_ipp_options(_ipp_option_t *a, /* I - First option */ /* - * End of "$Id: encode.c 12668 2015-05-27 19:30:32Z msweet $". + * End of "$Id: encode.c 13064 2016-01-27 16:05:09Z msweet $". */ diff --git a/cups/testoptions.c b/cups/testoptions.c index d14b64f8db..5789e3b81d 100644 --- a/cups/testoptions.c +++ b/cups/testoptions.c @@ -1,21 +1,17 @@ /* - * "$Id: testoptions.c 1992 2010-03-24 14:32:08Z msweet $" + * "$Id: testoptions.c 13061 2016-01-26 21:31:40Z msweet $" * - * Option test program for CUPS. + * Option unit test program for CUPS. * - * Copyright 2008-2010 by Apple Inc. + * Copyright 2008-2016 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/". + * 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. - * - * Contents: - * - * main() - Test option processing functions. + * This file is subject to the Apple OS-Developed Software exception. */ /* @@ -37,6 +33,9 @@ main(int argc, /* I - Number of command-line arguments */ num_options; /* Number of options */ cups_option_t *options; /* Options */ const char *value; /* Value of an option */ + ipp_t *request; /* IPP request */ + ipp_attribute_t *attr; /* IPP attribute */ + int count; /* Number of attributes */ if (argc == 1) @@ -53,11 +52,12 @@ main(int argc, /* I - Number of command-line arguments */ "baz={param1=1 param2=2} " "foobar=FOO\\ BAR " "barfoo=barfoo " - "barfoo=\"\'BAR FOO\'\"", 0, &options); + "barfoo=\"\'BAR FOO\'\" " + "auth-info=user,pass\\\\,word\\\\\\\\", 0, &options); - if (num_options != 5) + if (num_options != 6) { - printf("FAIL (num_options=%d, expected 5)\n", num_options); + printf("FAIL (num_options=%d, expected 6)\n", num_options); status ++; } else if ((value = cupsGetOption("foo", num_options, options)) == NULL || @@ -91,6 +91,71 @@ main(int argc, /* I - Number of command-line arguments */ printf("FAIL (barfoo=\"%s\", expected \"\'BAR FOO\'\")\n", value); status ++; } + else if ((value = cupsGetOption("auth-info", num_options, options)) == NULL || + strcmp(value, "user,pass\\,word\\\\")) + { + printf("FAIL (auth-info=\"%s\", expected \"user,pass\\,word\\\\\")\n", value); + status ++; + } + else + puts("PASS"); + + fputs("cupsEncodeOptions2: ", stdout); + request = ippNew(); + ippSetOperation(request, IPP_OP_PRINT_JOB); + + cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB); + for (count = 0, attr = ippFirstAttribute(request); attr; attr = ippNextAttribute(request), count ++); + if (count != 6) + { + printf("FAIL (%d attributes, expected 6)\n", count); + status ++; + } + else if ((attr = ippFindAttribute(request, "foo", IPP_TAG_ZERO)) == NULL) + { + puts("FAIL (Unable to find attribute \"foo\")"); + status ++; + } + else if (ippGetValueTag(attr) != IPP_TAG_NAME) + { + printf("FAIL (\"foo\" of type %s, expected name)\n", ippTagString(ippGetValueTag(attr))); + status ++; + } + else if (ippGetCount(attr) != 1) + { + printf("FAIL (\"foo\" has %d values, expected 1)\n", (int)ippGetCount(attr)); + status ++; + } + else if (strcmp(ippGetString(attr, 0, NULL), "1234")) + { + printf("FAIL (\"foo\" has value %s, expected 1234)\n", ippGetString(attr, 0, NULL)); + status ++; + } + else if ((attr = ippFindAttribute(request, "auth-info", IPP_TAG_ZERO)) == NULL) + { + puts("FAIL (Unable to find attribute \"auth-info\")"); + status ++; + } + else if (ippGetValueTag(attr) != IPP_TAG_TEXT) + { + printf("FAIL (\"auth-info\" of type %s, expected text)\n", ippTagString(ippGetValueTag(attr))); + status ++; + } + else if (ippGetCount(attr) != 2) + { + printf("FAIL (\"auth-info\" has %d values, expected 2)\n", (int)ippGetCount(attr)); + status ++; + } + else if (strcmp(ippGetString(attr, 0, NULL), "user")) + { + printf("FAIL (\"auth-info\"[0] has value \"%s\", expected \"user\")\n", ippGetString(attr, 0, NULL)); + status ++; + } + else if (strcmp(ippGetString(attr, 1, NULL), "pass,word\\")) + { + printf("FAIL (\"auth-info\"[1] has value \"%s\", expected \"pass,word\\\")\n", ippGetString(attr, 1, NULL)); + status ++; + } else puts("PASS"); } @@ -112,5 +177,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: testoptions.c 1992 2010-03-24 14:32:08Z msweet $". + * End of "$Id: testoptions.c 13061 2016-01-26 21:31:40Z msweet $". */ diff --git a/cups/usersys.c b/cups/usersys.c index 7c0eb3bb90..55e6964a6a 100644 --- a/cups/usersys.c +++ b/cups/usersys.c @@ -1,5 +1,5 @@ /* - * "$Id: usersys.c 12817 2015-07-30 15:45:46Z msweet $" + * "$Id: usersys.c 13030 2016-01-04 14:35:45Z msweet $" * * User, system, and password routines for CUPS. * @@ -710,6 +710,8 @@ _cupsGetPassword(const char *prompt) /* I - Prompt string */ noecho = original; noecho.c_lflag &= (tcflag_t)~(ICANON | ECHO | ECHOE | ISIG); + noecho.c_cc[VMIN] = 1; + noecho.c_cc[VTIME] = 0; if (tcsetattr(tty, TCSAFLUSH, &noecho)) { @@ -1237,7 +1239,7 @@ cups_set_ssl_options( for (start = temp; *start; start = end) { - /* + /* * Find end of keyword... */ @@ -1285,5 +1287,5 @@ cups_set_user( /* - * End of "$Id: usersys.c 12817 2015-07-30 15:45:46Z msweet $". + * End of "$Id: usersys.c 13030 2016-01-04 14:35:45Z msweet $". */ diff --git a/filter/rastertolabel.c b/filter/rastertolabel.c index f5c6d12dbf..afcac96ec5 100644 --- a/filter/rastertolabel.c +++ b/filter/rastertolabel.c @@ -1,5 +1,5 @@ /* - * "$Id: rastertolabel.c 12945 2015-10-26 19:46:02Z msweet $" + * "$Id: rastertolabel.c 13022 2015-12-16 18:35:26Z msweet $" * * Label printer filter for CUPS. * @@ -471,6 +471,13 @@ EndPage(ppd_file_t *ppd, /* I - PPD file */ */ puts("P1"); + + /* + * Cut the label as needed... + */ + + if (header->CutMedia) + puts("C"); break; case ZEBRA_ZPL : @@ -602,6 +609,13 @@ EndPage(ppd_file_t *ppd, /* I - PPD file */ puts("^IDR:CUPS.GRF^FS"); puts("^XZ"); + + /* + * Cut the label as needed... + */ + + if (header->CutMedia) + puts("^CN1"); break; case ZEBRA_CPCL : @@ -1267,5 +1281,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: rastertolabel.c 12945 2015-10-26 19:46:02Z msweet $". + * End of "$Id: rastertolabel.c 13022 2015-12-16 18:35:26Z msweet $". */ diff --git a/notifier/testnotify.c b/notifier/testnotify.c index 67441cee93..e4db4c1f15 100644 --- a/notifier/testnotify.c +++ b/notifier/testnotify.c @@ -1,9 +1,9 @@ /* - * "$Id: testnotify.c 10996 2013-05-29 11:51:34Z msweet $" + * "$Id: testnotify.c 13040 2016-01-11 20:29:13Z msweet $" * * Test notifier for CUPS. * - * Copyright 2007-2011 by Apple Inc. + * Copyright 2007-2016 by Apple Inc. * Copyright 1997-2005 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -115,7 +115,7 @@ print_attributes(ipp_t *ipp, /* I - IPP request */ ippAttributeString(attr, buffer, sizeof(buffer)); - fprintf(stderr, "DEBUG: %*s%s (%s%s) %s", indent, "", attr->name, + fprintf(stderr, "DEBUG: %*s%s (%s%s) %s\n", indent, "", attr->name, attr->num_values > 1 ? "1setOf " : "", ippTagString(attr->value_tag), buffer); } @@ -123,5 +123,5 @@ print_attributes(ipp_t *ipp, /* I - IPP request */ /* - * End of "$Id: testnotify.c 10996 2013-05-29 11:51:34Z msweet $". + * End of "$Id: testnotify.c 13040 2016-01-11 20:29:13Z msweet $". */ diff --git a/packaging/cups.spec b/packaging/cups.spec index 2d5219bb92..ce06e07f52 100644 --- a/packaging/cups.spec +++ b/packaging/cups.spec @@ -45,12 +45,12 @@ Summary: CUPS Name: cups -Version: 2.1.2 +Version: 2.1.3 Release: 1 Epoch: 1 License: GPL Group: System Environment/Daemons -Source: http://www.cups.org/software/2.1.2/cups-2.1.2-source.tar.bz2 +Source: http://www.cups.org/software/2.1.3/cups-2.1.3-source.tar.bz2 Url: http://www.cups.org Packager: Anonymous Vendor: Apple Inc. diff --git a/scheduler/client.c b/scheduler/client.c index 3ec3b5c91f..6a5e740b44 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -1,5 +1,5 @@ /* - * "$Id: client.c 12978 2015-11-17 19:29:52Z msweet $" + * "$Id: client.c 13061 2016-01-26 21:31:40Z msweet $" * * Client routines for the CUPS scheduler. * @@ -1156,29 +1156,28 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ break; } } - else if (!WebInterface) - { - /* - * Web interface is disabled. Show an appropriate message... - */ - - if (!cupsdSendError(con, HTTP_STATUS_CUPS_WEBIF_DISABLED, CUPSD_AUTH_NONE)) - { - cupsdCloseClient(con); - return; - } - - break; - } - if ((!strncmp(con->uri, "/admin", 6) && - strncmp(con->uri, "/admin/conf/", 12) && - strncmp(con->uri, "/admin/log/", 11)) || + if ((!strncmp(con->uri, "/admin", 6) && strcmp(con->uri, "/admin/conf/cupsd.conf") && strncmp(con->uri, "/admin/log/", 11)) || !strncmp(con->uri, "/printers", 9) || !strncmp(con->uri, "/classes", 8) || !strncmp(con->uri, "/help", 5) || !strncmp(con->uri, "/jobs", 5)) { + if (!WebInterface) + { + /* + * Web interface is disabled. Show an appropriate message... + */ + + if (!cupsdSendError(con, HTTP_STATUS_CUPS_WEBIF_DISABLED, CUPSD_AUTH_NONE)) + { + cupsdCloseClient(con); + return; + } + + break; + } + /* * Send CGI output... */ @@ -1245,20 +1244,14 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ if (httpGetVersion(con->http) <= HTTP_VERSION_1_0) httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF); } - else if ((!strncmp(con->uri, "/admin/conf/", 12) && - (strchr(con->uri + 12, '/') || - strlen(con->uri) == 12)) || - (!strncmp(con->uri, "/admin/log/", 11) && - (strchr(con->uri + 11, '/') || - strlen(con->uri) == 11))) + else if (!strncmp(con->uri, "/admin/log/", 11) && (strchr(con->uri + 11, '/') || strlen(con->uri) == 11)) { /* * GET can only be done to configuration files directly under * /admin/conf... */ - cupsdLogClient(con, CUPSD_LOG_ERROR, - "Request for subdirectory \"%s\"!", con->uri); + cupsdLogClient(con, CUPSD_LOG_ERROR, "Request for subdirectory \"%s\".", con->uri); if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE)) { @@ -1396,9 +1389,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ break; } - else if ((!strncmp(con->uri, "/admin", 6) && - strncmp(con->uri, "/admin/conf/", 12) && - strncmp(con->uri, "/admin/log/", 11)) || + else if ((!strncmp(con->uri, "/admin", 6) && strncmp(con->uri, "/admin/log/", 11)) || !strncmp(con->uri, "/printers", 9) || !strncmp(con->uri, "/classes", 8) || !strncmp(con->uri, "/help", 5) || @@ -1648,9 +1639,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ break; } - if ((!strncmp(con->uri, "/admin", 6) && - strncmp(con->uri, "/admin/conf/", 12) && - strncmp(con->uri, "/admin/log/", 11)) || + if ((!strncmp(con->uri, "/admin", 6) && strcmp(con->uri, "/admin/conf/cupsd.conf") && strncmp(con->uri, "/admin/log/", 11)) || !strncmp(con->uri, "/printers", 9) || !strncmp(con->uri, "/classes", 8) || !strncmp(con->uri, "/help", 5) || @@ -1670,12 +1659,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ cupsdLogRequest(con, HTTP_STATUS_OK); } - else if ((!strncmp(con->uri, "/admin/conf/", 12) && - (strchr(con->uri + 12, '/') || - strlen(con->uri) == 12)) || - (!strncmp(con->uri, "/admin/log/", 11) && - (strchr(con->uri + 11, '/') || - strlen(con->uri) == 11))) + else if (!strncmp(con->uri, "/admin/log/", 11) && (strchr(con->uri + 11, '/') || strlen(con->uri) == 11)) { /* * HEAD can only be done to configuration files under @@ -4093,5 +4077,5 @@ write_pipe(cupsd_client_t *con) /* I - Client connection */ /* - * End of "$Id: client.c 12978 2015-11-17 19:29:52Z msweet $". + * End of "$Id: client.c 13061 2016-01-26 21:31:40Z msweet $". */ diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 763dc96bd6..b7c65fda33 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -1,9 +1,9 @@ /* - * "$Id: ipp.c 12978 2015-11-17 19:29:52Z msweet $" + * "$Id: ipp.c 13040 2016-01-11 20:29:13Z msweet $" * * IPP routines for the CUPS scheduler. * - * Copyright 2007-2015 by Apple Inc. + * Copyright 2007-2016 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * This file contains Kerberos support code, copyright 2006 by @@ -7308,6 +7308,12 @@ get_subscription_attrs( "get_subscription_attrs(con=%p[%d], sub_id=%d)", con, con->number, sub_id); + /* + * Expire subscriptions as needed... + */ + + cupsdExpireSubscriptions(NULL, NULL); + /* * Is the subscription ID valid? */ @@ -7457,6 +7463,12 @@ get_subscriptions(cupsd_client_t *con, /* I - Client connection */ return; } + /* + * Expire subscriptions as needed... + */ + + cupsdExpireSubscriptions(NULL, NULL); + /* * Copy the subscription attributes to the response using the * requested-attributes attribute that may be provided by the client. @@ -11169,5 +11181,5 @@ validate_user(cupsd_job_t *job, /* I - Job */ /* - * End of "$Id: ipp.c 12978 2015-11-17 19:29:52Z msweet $". + * End of "$Id: ipp.c 13040 2016-01-11 20:29:13Z msweet $". */ diff --git a/scheduler/job.c b/scheduler/job.c index 54ee4ed7ca..0fb0362a06 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -1,5 +1,5 @@ /* - * "$Id: job.c 12856 2015-08-31 14:27:39Z msweet $" + * "$Id: job.c 13047 2016-01-13 19:16:12Z msweet $" * * Job management routines for the CUPS scheduler. * @@ -2316,7 +2316,10 @@ cupsdSetJobHoldUntil(cupsd_job_t *job, /* I - Job */ } - ippSetString(job->attrs, &job->reasons, 0, "job-hold-until-specified"); + if (strcmp(when, "no-hold")) + ippSetString(job->attrs, &job->reasons, 0, "job-hold-until-specified"); + else + ippSetString(job->attrs, &job->reasons, 0, "none"); /* * Update the hold time... @@ -5341,5 +5344,5 @@ update_job_attrs(cupsd_job_t *job, /* I - Job to update */ /* - * End of "$Id: job.c 12856 2015-08-31 14:27:39Z msweet $". + * End of "$Id: job.c 13047 2016-01-13 19:16:12Z msweet $". */ diff --git a/scheduler/main.c b/scheduler/main.c index b1aa50375d..0656d68d8b 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -1,9 +1,9 @@ /* - * "$Id: main.c 12700 2015-06-08 18:32:35Z msweet $" + * "$Id: main.c 13040 2016-01-11 20:29:13Z msweet $" * * Main loop for the CUPS scheduler. * - * Copyright 2007-2015 by Apple Inc. + * Copyright 2007-2016 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -1573,7 +1573,6 @@ select_timeout(int fds) /* I - Number of descriptors returned */ time_t now; /* Current time */ cupsd_client_t *con; /* Client information */ cupsd_job_t *job; /* Job information */ - cupsd_subscription_t *sub; /* Subscription information */ const char *why; /* Debugging aid */ @@ -1710,19 +1709,6 @@ select_timeout(int fds) /* I - Number of descriptors returned */ } #endif /* HAVE_MALLINFO */ - /* - * Expire subscriptions as needed... - */ - - for (sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions); - sub; - sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions)) - if (!sub->job && sub->expire && sub->expire < timeout) - { - timeout = sub->expire; - why = "expire subscription"; - } - /* * Adjust from absolute to relative time. We add 1 second to the timeout since * events occur after the timeout expires, and limit the timeout to 86400 @@ -2189,5 +2175,5 @@ usage(int status) /* O - Exit status */ /* - * End of "$Id: main.c 12700 2015-06-08 18:32:35Z msweet $". + * End of "$Id: main.c 13040 2016-01-11 20:29:13Z msweet $". */ diff --git a/scheduler/org.cups.cupsd.plist b/scheduler/org.cups.cupsd.plist index c0755c47b2..abc91333c3 100644 --- a/scheduler/org.cups.cupsd.plist +++ b/scheduler/org.cups.cupsd.plist @@ -9,7 +9,7 @@ EnableTransactions EnablePressuredExit - + ExitTimeOut 60 KeepAlive diff --git a/scheduler/subscriptions.c b/scheduler/subscriptions.c index 5d0e8228e9..cf8a90d6f8 100644 --- a/scheduler/subscriptions.c +++ b/scheduler/subscriptions.c @@ -1,5 +1,5 @@ /* - * "$Id: subscriptions.c 12978 2015-11-17 19:29:52Z msweet $" + * "$Id: subscriptions.c 13040 2016-01-11 20:29:13Z msweet $" * * Subscription routines for the CUPS scheduler. * @@ -657,6 +657,8 @@ cupsdExpireSubscriptions( curtime = time(NULL); update = 0; + cupsdLogMessage(CUPSD_LOG_INFO, "Expiring subscriptions..."); + for (sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions); sub; sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions)) @@ -1615,5 +1617,5 @@ cupsd_update_notifier(void) /* - * End of "$Id: subscriptions.c 12978 2015-11-17 19:29:52Z msweet $". + * End of "$Id: subscriptions.c 13040 2016-01-11 20:29:13Z msweet $". */ diff --git a/templates/de/jobs-header.tmpl b/templates/de/jobs-header.tmpl index e3935fe558..4855f6bb61 100644 --- a/templates/de/jobs-header.tmpl +++ b/templates/de/jobs-header.tmpl @@ -2,4 +2,4 @@ {?which_jobs=completed?:
} {?which_jobs=all?:
} -

{total=0?Keine Aufträge:Zeige {#job_id} von {total} {?which_jobs=?aktiven:{which_jobs=all?:beendeten}} {total=1?:s}Auftrag:Aufträgen}.

+

{total=0?Keine Aufträge:Zeige {#job_id} von {total} {?which_jobs=?aktiven:{which_jobs=all?:beendeten}} {total=1?Auftrag:Aufträgen}}.

diff --git a/test/ipptool.c b/test/ipptool.c index 64d827b66b..69c305a0ce 100644 --- a/test/ipptool.c +++ b/test/ipptool.c @@ -1,9 +1,9 @@ /* - * "$Id: ipptool.c 12952 2015-10-28 17:22:39Z msweet $" + * "$Id: ipptool.c 13075 2016-01-29 21:14:05Z msweet $" * * ipptool command for CUPS. * - * Copyright 2007-2015 by Apple Inc. + * Copyright 2007-2016 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -868,7 +868,7 @@ do_tests(FILE *outfile, /* I - Output file */ (cups_afree_func_t)free); file_id[0] = '\0'; pass = 1; - linenum = 1; + linenum = 0; request_id = (CUPS_RAND() % 1000) * 137 + 1; while (!Cancel && get_token(fp, token, sizeof(token), &linenum) != NULL) @@ -1744,7 +1744,7 @@ do_tests(FILE *outfile, /* I - Output file */ tokenptr = ptr; } else - i = (int)strtol(tokenptr, &tokenptr, 0); + i = (int)strtol(token, &tokenptr, 0); values[0] = i; @@ -1780,10 +1780,10 @@ do_tests(FILE *outfile, /* I - Output file */ attrptr = ippAddIntegers(request, group, value, attr, num_values, values); } - if (!tokenptr || *tokenptr) + if ((!token[0] || !tokenptr || *tokenptr) && !skip_test) { - print_fatal_error(outfile, "Bad %s value \"%s\" on line %d.", - ippTagString(value), token, linenum); + print_fatal_error(outfile, "Bad %s value \'%s\' for \"%s\" on line %d.", + ippTagString(value), token, attr, linenum); pass = 0; goto test_exit; } @@ -1808,8 +1808,10 @@ do_tests(FILE *outfile, /* I - Output file */ _cups_strcasecmp(ptr, "dpcm") && _cups_strcasecmp(ptr, "other"))) { - print_fatal_error(outfile, "Bad resolution value \"%s\" on line %d.", - token, linenum); + if (skip_test) + break; + + print_fatal_error(outfile, "Bad resolution value \'%s\' for \"%s\" on line %d.", token, attr, linenum); pass = 0; goto test_exit; } @@ -1839,8 +1841,10 @@ do_tests(FILE *outfile, /* I - Output file */ if ((num_vals & 1) || num_vals == 0) { - print_fatal_error(outfile, "Bad rangeOfInteger value \"%s\" on line " - "%d.", token, linenum); + if (skip_test) + break; + + print_fatal_error(outfile, "Bad rangeOfInteger value \'%s\' for \"%s\" on line %d.", token, attr, linenum); pass = 0; goto test_exit; } @@ -1867,10 +1871,11 @@ do_tests(FILE *outfile, /* I - Output file */ goto test_exit; } } + else if (skip_test) + break; else { - print_fatal_error(outfile, "Bad ATTR collection value on line %d.", - linenum); + print_fatal_error(outfile, "Bad ATTR collection value for \"%s\" on line %d.", attr, linenum); pass = 0; goto test_exit; } @@ -1878,14 +1883,16 @@ do_tests(FILE *outfile, /* I - Output file */ do { ipp_t *col; /* Collection value */ - long pos = ftell(fp); /* Save position of file */ + long savepos = ftell(fp); /* Save position of file */ + int savelinenum = linenum; /* Save line number */ if (!get_token(fp, token, sizeof(token), &linenum)) break; if (strcmp(token, ",")) { - fseek(fp, pos, SEEK_SET); + fseek(fp, savepos, SEEK_SET); + linenum = savelinenum; break; } @@ -1911,8 +1918,7 @@ do_tests(FILE *outfile, /* I - Output file */ break; default : - print_fatal_error(outfile, "Unsupported ATTR value tag %s on line %d.", - ippTagString(value), linenum); + print_fatal_error(outfile, "Unsupported ATTR value tag %s for \"%s\" on line %d.", ippTagString(value), attr, linenum); pass = 0; goto test_exit; @@ -1960,10 +1966,9 @@ do_tests(FILE *outfile, /* I - Output file */ break; } - if (!attrptr) + if (!attrptr && !skip_test) { - print_fatal_error(outfile, "Unable to add attribute on line %d: %s", linenum, - cupsLastErrorString()); + print_fatal_error(outfile, "Unable to add attribute \"%s\" on line %d.", attr, linenum); pass = 0; goto test_exit; } @@ -2657,7 +2662,7 @@ do_tests(FILE *outfile, /* I - Output file */ http->error != ETIMEDOUT) #endif /* WIN32 */ { - if (httpReconnect(http)) + if (httpReconnect2(http, 30000, NULL)) prev_pass = 0; } else if (status == HTTP_STATUS_ERROR || status == HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED) @@ -2684,13 +2689,13 @@ do_tests(FILE *outfile, /* I - Output file */ http->error != ETIMEDOUT) #endif /* WIN32 */ { - if (httpReconnect(http)) + if (httpReconnect2(http, 30000, NULL)) prev_pass = 0; } else if (status == HTTP_STATUS_ERROR) { if (!Cancel) - httpReconnect(http); + httpReconnect2(http, 30000, NULL); prev_pass = 0; } @@ -3869,6 +3874,11 @@ get_collection(FILE *outfile, /* I - Output file */ break; } } + else + { + print_fatal_error(outfile, "Unexpected token %s seen on line %d.", token, *linenum); + goto col_error; + } } return (col); @@ -6191,5 +6201,5 @@ with_value_from( /* - * End of "$Id: ipptool.c 12952 2015-10-28 17:22:39Z msweet $". + * End of "$Id: ipptool.c 13075 2016-01-29 21:14:05Z msweet $". */ diff --git a/xcode/CUPS.xcodeproj/project.pbxproj b/xcode/CUPS.xcodeproj/project.pbxproj index 6f85ea9152..3dda13f67c 100644 --- a/xcode/CUPS.xcodeproj/project.pbxproj +++ b/xcode/CUPS.xcodeproj/project.pbxproj @@ -4915,6 +4915,7 @@ CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES;