From: msweet Date: Mon, 6 Jan 2014 22:21:15 +0000 (+0000) Subject: Mirror fixes from trunk. X-Git-Tag: release-2.1.4~16^2~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=530f64721a16eb86186ab404d57471d16c4dde62;p=thirdparty%2Fcups.git Mirror fixes from trunk. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.7@11500 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES.txt b/CHANGES.txt index 99ee6a267c..cb048a8c3a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,4 @@ -CHANGES.txt - 1.7.1 - 2013-12-21 +CHANGES.txt - 1.7.1 - 2014-01-06 -------------------------------- CHANGES IN CUPS V1.7.1 @@ -32,6 +32,10 @@ CHANGES IN CUPS V1.7.1 before attempting to print () - CUPS did not support "auto-monochrome" or "process-monochrome" for the "print-color-mode" option () + - Using "@IF(name)" in an Allow or Deny rule did not work (STR #4328) + - lpq and lpstat did not list jobs in the correct order when priorities + were specified (STR #4326) + - The D-BUS notifier did not remove its lockfile (STR #4314) CHANGES IN CUPS V1.7.0 diff --git a/notifier/dbus.c b/notifier/dbus.c index 1629c4e7fc..ae96551091 100644 --- a/notifier/dbus.c +++ b/notifier/dbus.c @@ -1,23 +1,18 @@ /* * "$Id$" * - * D-Bus notifier for CUPS. + * D-Bus notifier for CUPS. * - * Copyright 2008-2012 by Apple Inc. - * Copyright (C) 2011 Red Hat, Inc. - * Copyright (C) 2007 Tim Waugh - * Copyright 1997-2005 by Easy Software Products. + * Copyright 2008-2014 by Apple Inc. + * Copyright (C) 2011, 2013 Red Hat, Inc. + * Copyright (C) 2007 Tim Waugh + * Copyright 1997-2005 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: - * - * main() - Read events and send DBUS notifications. - * acquire_lock() - Acquire a lock so we only have a single notifier running. + * 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/". */ /* @@ -153,11 +148,19 @@ enum }; +/* + * Global variables... + */ + +static char lock_filename[1024]; /* Lock filename */ + + /* * Local functions... */ static int acquire_lock(int *fd, char *lockfile, size_t locksize); +static void release_lock(void); /* @@ -176,8 +179,6 @@ main(int argc, /* I - Number of command-line args */ DBusMessage *message; /* Message to send */ DBusMessageIter iter; /* Iterator for message data */ int lock_fd = -1; /* Lock file descriptor */ - char lock_filename[1024]; - /* Lock filename */ /* @@ -578,13 +579,34 @@ main(int argc, /* I - Number of command-line args */ if (lock_fd >= 0) { close(lock_fd); - unlink(lock_filename); + release_lock(); } return (0); } +/* + * 'release_lock()' - Release the singleton lock. + */ + +static void +release_lock(void) +{ + unlink(lock_filename); +} + + +/* + * 'handle_sigterm()' - Handle SIGTERM signal. + */ +static void +handle_sigterm(int signum) +{ + release_lock(); + _exit(0); +} + /* * 'acquire_lock()' - Acquire a lock so we only have a single notifier running. */ @@ -594,7 +616,8 @@ acquire_lock(int *fd, /* O - Lock file descriptor */ char *lockfile, /* I - Lock filename buffer */ size_t locksize) /* I - Size of filename buffer */ { - const char *tmpdir; /* Temporary directory */ + const char *tmpdir; /* Temporary directory */ + struct sigaction action; /* POSIX sigaction data */ /* @@ -612,8 +635,16 @@ acquire_lock(int *fd, /* O - Lock file descriptor */ if ((*fd = open(lockfile, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) < 0) return (-1); - else - return (0); + + /* + * Set a SIGTERM handler to make sure we release the lock if the + * scheduler decides to stop us. + */ + memset(&action, 0, sizeof(action)); + action.sa_handler = handle_sigterm; + sigaction(SIGTERM, &action, NULL); + + return (0); } #else /* !HAVE_DBUS */ int diff --git a/scheduler/auth.c b/scheduler/auth.c index 5c7f05731e..98be77fbed 100644 --- a/scheduler/auth.c +++ b/scheduler/auth.c @@ -1302,6 +1302,8 @@ cupsdCheckAuth(unsigned ip[4], /* I - Client address */ netip6[3] = htonl(ip[3]); #endif /* AF_INET6 */ + cupsdNetIFUpdate(); + if (!strcmp(mask->mask.name.name, "*")) { #ifdef __APPLE__ @@ -1317,8 +1319,6 @@ cupsdCheckAuth(unsigned ip[4], /* I - Client address */ * Check against all local interfaces... */ - cupsdNetIFUpdate(); - for (iface = (cupsd_netif_t *)cupsArrayFirst(NetIFList); iface; iface = (cupsd_netif_t *)cupsArrayNext(NetIFList)) diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 2c1afe0123..8dce9b0ca3 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -1,102 +1,19 @@ /* * "$Id$" * - * IPP routines for the CUPS scheduler. + * IPP routines for the CUPS scheduler. * - * Copyright 2007-2013 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products, all rights reserved. + * Copyright 2007-2014 by Apple Inc. + * Copyright 1997-2007 by Easy Software Products, all rights reserved. * - * This file contains Kerberos support code, copyright 2006 by - * Jelmer Vernooij. + * This file contains Kerberos support code, copyright 2006 by + * Jelmer Vernooij. * - * 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: - * - * cupsdProcessIPPRequest() - Process an incoming IPP request. - * cupsdTimeoutJob() - Timeout a job waiting on job files. - * accept_jobs() - Accept print jobs to a printer. - * add_class() - Add a class to the system. - * add_file() - Add a file to a job. - * add_job() - Add a job to a print queue. - * add_job_subscriptions() - Add any subscriptions for a job. - * add_job_uuid() - Add job-uuid attribute to a job. - * add_printer() - Add a printer to the system. - * add_printer_state_reasons() - Add the "printer-state-reasons" attribute - * based upon the printer state... - * add_queued_job_count() - Add the "queued-job-count" attribute for the - * specified printer or class. - * apply_printer_defaults() - Apply printer default options to a job. - * authenticate_job() - Set job authentication info. - * cancel_all_jobs() - Cancel all or selected print jobs. - * cancel_job() - Cancel a print job. - * cancel_subscription() - Cancel a subscription. - * check_rss_recipient() - Check that we do not have a duplicate RSS - * feed URI. - * check_quotas() - Check quotas for a printer and user. - * close_job() - Close a multi-file job. - * copy_attrs() - Copy attributes from one request to another. - * copy_banner() - Copy a banner file to the requests directory - * for the specified job. - * copy_file() - Copy a PPD file or interface script... - * copy_model() - Copy a PPD model file, substituting default - * values as needed... - * copy_job_attrs() - Copy job attributes. - * copy_printer_attrs() - Copy printer attributes. - * copy_subscription_attrs() - Copy subscription attributes. - * create_job() - Print a file to a printer or class. - * create_requested_array() - Create an array for the requested-attributes. - * create_subscription() - Create a notification subscription. - * delete_printer() - Remove a printer or class from the system. - * get_default() - Get the default destination. - * get_devices() - Get the list of available devices on the - * local system. - * get_document() - Get a copy of a job file. - * get_job_attrs() - Get job attributes. - * get_jobs() - Get a list of jobs for the specified printer. - * get_notifications() - Get events for a subscription. - * get_ppd() - Get a named PPD from the local system. - * get_ppds() - Get the list of PPD files on the local - * system. - * get_printer_attrs() - Get printer attributes. - * get_printer_supported() - Get printer supported values. - * get_printers() - Get a list of printers or classes. - * get_subscription_attrs() - Get subscription attributes. - * get_subscriptions() - Get subscriptions. - * get_username() - Get the username associated with a request. - * hold_job() - Hold a print job. - * hold_new_jobs() - Hold pending/new jobs on a printer or class. - * move_job() - Move a job to a new destination. - * ppd_parse_line() - Parse a PPD default line. - * print_job() - Print a file to a printer or class. - * read_job_ticket() - Read a job ticket embedded in a print file. - * reject_jobs() - Reject print jobs to a printer. - * release_held_new_jobs() - Release pending/new jobs on a printer or - * class. - * release_job() - Release a held print job. - * renew_subscription() - Renew an existing subscription... - * restart_job() - Restart an old print job. - * save_auth_info() - Save authentication information for a job. - * send_document() - Send a file to a printer or class. - * send_http_error() - Send a HTTP error back to the IPP client. - * send_ipp_status() - Send a status back to the IPP client. - * set_default() - Set the default destination... - * set_job_attrs() - Set job attributes. - * set_printer_attrs() - Set printer attributes. - * set_printer_defaults() - Set printer default options from a request. - * start_printer() - Start a printer. - * stop_printer() - Stop a printer. - * url_encode_attr() - URL-encode a string attribute. - * url_encode_string() - URL-encode a string. - * user_allowed() - See if a user is allowed to print to a queue. - * validate_job() - Validate printer options and destination. - * validate_name() - Make sure the printer name only contains - * valid chars. - * validate_user() - Validate the user for the request. + * 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/". */ /* @@ -6309,7 +6226,7 @@ get_jobs(cupsd_client_t *con, /* I - Client connection */ { job_comparison = -1; job_state = IPP_JOB_STOPPED; - list = Jobs; + list = ActiveJobs; } else if (!strcmp(attr->values[0].string.text, "completed")) { diff --git a/scheduler/network.c b/scheduler/network.c index 054faa50fe..4c07600ab0 100644 --- a/scheduler/network.c +++ b/scheduler/network.c @@ -133,7 +133,10 @@ cupsdNetIFUpdate(void) */ if (getifaddrs(&addrs) < 0) + { + cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdNetIFUpdate: Unable to get interface list - %s", strerror(errno)); return; + } for (addr = addrs; addr != NULL; addr = addr->ifa_next) { @@ -148,7 +151,10 @@ cupsdNetIFUpdate(void) #endif ) || addr->ifa_netmask == NULL || addr->ifa_name == NULL) + { + cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdNetIFUpdate: Ignoring \"%s\".", addr->ifa_name); continue; + } /* * Try looking up the hostname for the address as needed... @@ -178,7 +184,10 @@ cupsdNetIFUpdate(void) hostlen = strlen(hostname); if ((temp = calloc(1, sizeof(cupsd_netif_t) + hostlen)) == NULL) + { + cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdNetIFUpdate: Unable to allocate memory for interface."); break; + } /* * Copy all of the information...