From 2346ce0f707055bea948241e9b87c32c5fb5ec4a Mon Sep 17 00:00:00 2001 From: root Date: Mon, 30 Jul 2012 17:08:18 +0400 Subject: [PATCH] update to cooker --- .abf.yml | 2 +- cups-1.3.7-peercred.patch | 11 - cups-1.4.3-both-usblp-and-libusb.patch | 569 -------- cups-1.4.4-no-hostname-broadcast.patch | 33 - cups-1.4.4-page-label.patch | 91 -- cups-1.4.4-str3461-1.4.reverted.patch | 250 ---- cups-1.4.8-CVE-2011-3170.diff | 38 - ...ions.patch => cups-1.5.3-permissions.patch | 8 +- cups-avahi-1-config.patch | 42 + ...-avahi.patch => cups-avahi-2-backend.patch | 382 ++--- cups-avahi-3-timeouts.patch | 381 +++++ cups-avahi-4-poll.patch | 529 +++++++ cups-avahi-5-services.patch | 1272 +++++++++++++++++ cups-banners.patch | 7 +- cups-build.patch | 42 + cups-cups-get-classes.patch | 21 +- cups-direct-usb.patch | 27 + cups-dnssd-deviceid.patch | 38 + cups-driverd-timeout.patch | 10 +- cups-eggcups.patch | 38 +- cups-filter-debug.patch | 32 + ...-1.4.4-getpass.patch => cups-getpass.patch | 27 +- cups-hp-deviceid-oid.patch | 21 + cups-icc.patch | 1042 ++++++++++++++ cups-logrotate.patch | 12 +- cups-lpr-help.patch | 24 +- cups-multilib.patch | 7 +- cups-no-export-ssllibs.patch | 10 +- cups-no-gzip-man.patch | 6 +- cups-peercred.patch | 11 + cups-pid.patch | 11 +- cups-res_init.patch | 24 +- cups-ricoh-deviceid-oid.patch | 21 + cups-serial.patch | 11 + cups-serverbin-compat.patch | 122 +- cups-snmp-quirks.patch | 115 ++ cups-str3382.patch | 64 + cups-strict-ppd-line-length.patch | 30 + cups-system-auth.patch | 38 + cups-systemd-socket.patch | 527 +++++++ cups-uri-compat.patch | 51 + cups-usb-paperout.patch | 52 + cups.spec | 611 +++----- do-not-broadcast-with-hostnames.patch | 24 + 44 files changed, 4958 insertions(+), 1726 deletions(-) delete mode 100644 cups-1.3.7-peercred.patch delete mode 100644 cups-1.4.3-both-usblp-and-libusb.patch delete mode 100644 cups-1.4.4-no-hostname-broadcast.patch delete mode 100644 cups-1.4.4-page-label.patch delete mode 100644 cups-1.4.4-str3461-1.4.reverted.patch delete mode 100644 cups-1.4.8-CVE-2011-3170.diff rename cups-1.4-permissions.patch => cups-1.5.3-permissions.patch (71%) create mode 100644 cups-avahi-1-config.patch rename cups-avahi.patch => cups-avahi-2-backend.patch (78%) create mode 100644 cups-avahi-3-timeouts.patch create mode 100644 cups-avahi-4-poll.patch create mode 100644 cups-avahi-5-services.patch create mode 100644 cups-build.patch create mode 100644 cups-direct-usb.patch create mode 100644 cups-dnssd-deviceid.patch create mode 100644 cups-filter-debug.patch rename cups-1.4.4-getpass.patch => cups-getpass.patch (59%) create mode 100644 cups-hp-deviceid-oid.patch create mode 100644 cups-icc.patch create mode 100644 cups-peercred.patch create mode 100644 cups-ricoh-deviceid-oid.patch create mode 100644 cups-serial.patch create mode 100644 cups-snmp-quirks.patch create mode 100644 cups-str3382.patch create mode 100644 cups-strict-ppd-line-length.patch create mode 100644 cups-system-auth.patch create mode 100644 cups-systemd-socket.patch create mode 100644 cups-uri-compat.patch create mode 100644 cups-usb-paperout.patch create mode 100644 do-not-broadcast-with-hostnames.patch diff --git a/.abf.yml b/.abf.yml index 0ed0421..0c61ee5 100644 --- a/.abf.yml +++ b/.abf.yml @@ -1,4 +1,4 @@ sources: - "cups-1.4.8-source.tar.bz2": 9167f556e78e0bc075f1eb2f695d79cc1f334007 + "cups-1.5.3-source.tar.bz2": f7c4fc7d115da20dbbb6a3a568259df6702a7caa "pap-backend.tar.bz2": 89e1e7eb4258d47069d2a60c383b8bd555a11e63 "pap-docu.pdf.bz2": 7e7d44bb58532ab2fc4c1ca3581787877f1b5733 diff --git a/cups-1.3.7-peercred.patch b/cups-1.3.7-peercred.patch deleted file mode 100644 index 4e579b4..0000000 --- a/cups-1.3.7-peercred.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -up cups-1.3.5/scheduler/auth.c.peercred cups-1.3.5/scheduler/auth.c ---- cups-1.3.5/scheduler/auth.c.peercred 2008-02-05 16:52:20.000000000 +0000 -+++ cups-1.3.5/scheduler/auth.c 2008-02-05 18:20:06.000000000 +0000 -@@ -54,6 +54,7 @@ - * Include necessary headers... - */ - -+#define _GNU_SOURCE - #include "cupsd.h" - #include - #ifdef HAVE_SHADOW_H diff --git a/cups-1.4.3-both-usblp-and-libusb.patch b/cups-1.4.3-both-usblp-and-libusb.patch deleted file mode 100644 index 1db63ae..0000000 --- a/cups-1.4.3-both-usblp-and-libusb.patch +++ /dev/null @@ -1,569 +0,0 @@ -diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/ieee1284.c cups-1.4.3-both-usblp-and-libusb/backend/ieee1284.c ---- cups-1.4.3/backend/ieee1284.c 2009-12-08 03:13:42.000000000 +0100 -+++ cups-1.4.3-both-usblp-and-libusb/backend/ieee1284.c 2010-03-31 13:53:53.000000000 +0200 -@@ -255,6 +255,7 @@ - cups_option_t *values; /* Keys and values in device ID */ - const char *mfg, /* Manufacturer */ - *mdl, /* Model */ -+ *des, /* Description */ - *sern; /* Serial number */ - char temp[256], /* Temporary manufacturer string */ - *tempptr; /* Pointer into temp string */ -@@ -285,10 +286,20 @@ - } - else - { -- strlcpy(temp, make_model, sizeof(temp)); -+ /* -+ * No manufacturer? Use the model string or description... -+ */ -+ -+ if (mdl) -+ _ppdNormalizeMakeAndModel(mdl, temp, sizeof(temp)); -+ else if ((des = cupsGetOption("DESCRIPTION", num_values, values)) != NULL || -+ (des = cupsGetOption("DES", num_values, values)) != NULL) -+ _ppdNormalizeMakeAndModel(des, temp, sizeof(temp)); -+ else -+ strlcpy(temp, "Unknown", sizeof(temp)); - - if ((tempptr = strchr(temp, ' ')) != NULL) -- *tempptr = '\0'; -+ *tempptr = '\0'; - - mfg = temp; - } -diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/Makefile cups-1.4.3-both-usblp-and-libusb/backend/Makefile ---- cups-1.4.3/backend/Makefile 2009-03-03 20:39:21.000000000 +0100 -+++ cups-1.4.3-both-usblp-and-libusb/backend/Makefile 2010-03-31 13:53:53.000000000 +0200 -@@ -267,7 +267,7 @@ - echo Linking $@... - $(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \ - $(BACKLIBS) $(LIBS) --usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c -+usb.o: usb.c usb-darwin.c usb-hybrid.c usb-libusb.c usb-unix.c - - - # -diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/usb.c cups-1.4.3-both-usblp-and-libusb/backend/usb.c ---- cups-1.4.3/backend/usb.c 2008-06-24 03:28:36.000000000 +0200 -+++ cups-1.4.3-both-usblp-and-libusb/backend/usb.c 2010-03-31 13:53:53.000000000 +0200 -@@ -56,7 +56,7 @@ - */ - - #ifdef HAVE_USB_H --# include "usb-libusb.c" -+# include "usb-hybrid.c" - #elif defined(__APPLE__) - # include "usb-darwin.c" - #elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) -diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/usb-hybrid.c cups-1.4.3-both-usblp-and-libusb/backend/usb-hybrid.c ---- cups-1.4.3/backend/usb-hybrid.c 1970-01-01 01:00:00.000000000 +0100 -+++ cups-1.4.3-both-usblp-and-libusb/backend/usb-hybrid.c 2010-03-31 13:53:53.000000000 +0200 -@@ -0,0 +1,87 @@ -+/* -+ * "$Id: usb-hybrid.c 8807 2009-08-31 18:45:43Z mike $" -+ * -+ * USB port backend for the Common UNIX Printing System (CUPS). -+ * -+ * This file is included from "usb.c" when compiled on Linux. -+ * -+ * Copyright 2007-2008 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" -+ * "LICENSE" which should have been included with this file. If this -+ * 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: -+ * -+ * print_device() - Print a file to a USB device. -+ * list_devices() - List all USB devices. -+ */ -+ -+/* -+ * Include necessary headers. -+ */ -+ -+#include -+ -+/* -+ * Include the two USB implementations used under Linux ... -+ */ -+ -+#include "usb-libusb.c" -+#include "usb-unix.c" -+ -+/* -+ * 'print_device()' - Print a file to a USB device. -+ */ -+ -+int /* O - Exit status */ -+print_device(const char *uri, /* I - Device URI */ -+ const char *hostname, /* I - Hostname/manufacturer */ -+ const char *resource, /* I - Resource/modelname */ -+ char *options, /* I - Device options/serial number */ -+ int print_fd, /* I - File descriptor to print */ -+ int copies, /* I - Copies to print */ -+ int argc, /* I - Number of command-line arguments (6 or 7) */ -+ char *argv[]) /* I - Command-line arguments */ -+{ -+ int result; -+ for(;;) -+ { -+ result = print_device_unix(uri, hostname, resource, options, print_fd, -+ copies, argc, argv); -+ if (result == -1) -+ { -+ result = print_device_libusb(uri, hostname, resource, options, print_fd, -+ copies, argc, argv); -+ if (result == -1) -+ sleep(5); -+ else -+ return(result); -+ } -+ else -+ return(result); -+ } -+} -+ -+/* -+ * 'list_devices()' - List all USB devices. -+ */ -+ -+void -+list_devices(void) -+{ -+ /* Try both discovery methods, each device will appear only under one -+ of them */ -+ list_devices_libusb(); -+ list_devices_unix(); -+} -+ -+ -+/* -+ * End of "$Id: usb-hybrid.c 8807 2009-08-31 18:45:43Z mike $". -+ */ -diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/usb-libusb.c cups-1.4.3-both-usblp-and-libusb/backend/usb-libusb.c ---- cups-1.4.3/backend/usb-libusb.c 2009-09-11 22:03:31.000000000 +0200 -+++ cups-1.4.3-both-usblp-and-libusb/backend/usb-libusb.c 2010-03-31 13:53:53.000000000 +0200 -@@ -13,16 +13,16 @@ - * - * Contents: - * -- * list_devices() - List the available printers. -- * print_device() - Print a file to a USB device. -+ * list_devices_libusb() - List the available printers. -+ * print_device_libusb() - Print a file to a USB device. - * close_device() - Close the connection to the USB printer. - * find_device() - Find or enumerate USB printers. - * get_device_id() - Get the IEEE-1284 device ID for the printer. - * list_cb() - List USB printers for discovery. - * make_device_uri() - Create a device URI for a USB printer. -- * open_device() - Open a connection to the USB printer. -+ * open_device_libusb() - Open a connection to the USB printer. - * print_cb() - Find a USB printer for printing. -- * side_cb() - Handle side-channel requests. -+ * side_cb_libusb() - Handle side-channel requests. - */ - - /* -@@ -65,30 +65,30 @@ - static char *make_device_uri(usb_printer_t *printer, - const char *device_id, - char *uri, size_t uri_size); --static int open_device(usb_printer_t *printer, int verbose); -+static int open_device_libusb(usb_printer_t *printer, int verbose); - static int print_cb(usb_printer_t *printer, const char *device_uri, - const char *device_id, const void *data); --static ssize_t side_cb(usb_printer_t *printer, int print_fd); -+static ssize_t side_cb_libusb(usb_printer_t *printer, int print_fd); - - - /* -- * 'list_devices()' - List the available printers. -+ * 'list_devices_libusb()' - List the available printers. - */ - - void --list_devices(void) -+list_devices_libusb(void) - { -- fputs("DEBUG: list_devices\n", stderr); -+ fputs("DEBUG: list_devices_libusb\n", stderr); - find_device(list_cb, NULL); - } - - - /* -- * 'print_device()' - Print a file to a USB device. -+ * 'print_device_libusb()' - Print a file to a USB device. - */ - - int /* O - Exit status */ --print_device(const char *uri, /* I - Device URI */ -+print_device_libusb(const char *uri, /* I - Device URI */ - const char *hostname, /* I - Hostname/manufacturer */ - const char *resource, /* I - Resource/modelname */ - char *options, /* I - Device options/serial number */ -@@ -105,19 +105,23 @@ - struct pollfd pfds[2]; /* Poll descriptors */ - - -- fputs("DEBUG: print_device\n", stderr); -+ fputs("DEBUG: print_device_libusb\n", stderr); - - /* - * Connect to the printer... - */ - -+#if defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) -+ if ((printer = find_device(print_cb, uri)) == NULL) -+ return(-1); -+#else - while ((printer = find_device(print_cb, uri)) == NULL) - { - _cupsLangPuts(stderr, - _("INFO: Waiting for printer to become available...\n")); - sleep(5); - } -- -+#endif - - /* - * If we are printing data from a print driver on stdin, ignore SIGTERM -@@ -189,7 +193,7 @@ - - if (pfds[1].revents & (POLLIN | POLLHUP)) - { -- if ((bytes = side_cb(printer, print_fd)) < 0) -+ if ((bytes = side_cb_libusb(printer, print_fd)) < 0) - pfds[1].events = 0; /* Filter has gone away... */ - else - tbytes += bytes; -@@ -359,7 +363,7 @@ - printer.iface = iface; - printer.handle = NULL; - -- if (!open_device(&printer, data != NULL)) -+ if (!open_device_libusb(&printer, data != NULL)) - { - if (!get_device_id(&printer, device_id, sizeof(device_id))) - { -@@ -583,6 +587,14 @@ - mfg = tempmfg; - } - -+ if (!strncasecmp(mdl, mfg, strlen(mfg))) -+ { -+ mdl += strlen(mfg); -+ -+ while (isspace(*mdl & 255)) -+ mdl ++; -+ } -+ - /* - * Generate the device URI from the manufacturer, model, serial number, - * and interface number... -@@ -611,11 +623,11 @@ - - - /* -- * 'open_device()' - Open a connection to the USB printer. -+ * 'open_device_libusb()' - Open a connection to the USB printer. - */ - - static int /* O - 0 on success, -1 on error */ --open_device(usb_printer_t *printer, /* I - Printer */ -+open_device_libusb(usb_printer_t *printer, /* I - Printer */ - int verbose) /* I - Update connecting-to-device state? */ - { - int number; /* Configuration/interface/altset numbers */ -@@ -733,16 +745,73 @@ - const char *device_id, /* I - IEEE-1284 device ID */ - const void *data) /* I - User data (make, model, S/N) */ - { -- return (!strcmp((char *)data, device_uri)); -+ char *uri = (char *)data, -+ *str1, -+ *str2, -+ buf[255], -+ requested_uri[1024]; -+ -+ /* Work on a copy of uri */ -+ strncpy(requested_uri, uri, sizeof(requested_uri)); -+ requested_uri[sizeof(requested_uri) - 1] = '\0'; -+ -+ /* -+ * libusb-discovered URIs can have an "interface" specification and this -+ * never happens for usblp-discovered URIs, so remove the "interface" -+ * specification from the URI which we are checking currently. This way a -+ * queue for a usblp-discovered printer can now be accessed via libusb -+ */ -+ if (((str1 = strstr(requested_uri, "interface=")) == NULL) && -+ ((str2 = strstr(device_uri, "interface=")) != NULL)) -+ { -+ *(str2 - 1) = '\0'; -+ } -+ -+ /* -+ * Old URI with "serial=?". Cut this part off and consider this as -+ * an URI without serial number -+ */ -+ if ((str1 = strstr(requested_uri, "serial=?")) != NULL) -+ *(str1 - 1) = '\0'; -+ -+ /* -+ * Old URI without serial number. Match it also with URIs with serial -+ * number -+ */ -+ if (((str1 = strstr(requested_uri, "serial=")) == NULL) && -+ ((str2 = strstr(device_uri, "serial=")) != NULL)) -+ *(str2 - 1) = '\0'; -+ -+ /* -+ * libusb-discovered URIs can have a "serial" specification when the -+ * usblp-discovered URI for the same printer does not have one, as -+ * with libusb we can discover serial numbers also with other methods -+ * than only via the device ID. Therefore we accept also a -+ * usblp-discovered printer without serial number as a match. This we -+ * do by removing the serial number from the queue's (libusb-discovered) -+ * URI before comparing. Also warn the user because of the incapability -+ * of the usblp-based access to distinguish printers by the serial -+ * number. -+ */ -+ if (((str1 = strstr(requested_uri, "serial=")) == NULL) && -+ ((str2 = strstr(device_uri, "serial=")) != NULL)) -+ { -+ *(str2 - 1) = '\0'; -+ if (backendGetMakeModel(device_id, buf, sizeof(buf)) == 0) -+ fprintf(stderr, "WARNING: If you have more than one %s printer connected to this machine, please make sure that the \"usblp\" kernel module is always unloaded (and blacklisted) and re-create the queues for these printers. Otherwise CUPS will not be able to distinguish them.\n", -+ buf); -+ } -+ -+ return (!strcmp(requested_uri, device_uri)); - } - - - /* -- * 'side_cb()' - Handle side-channel requests. -+ * 'side_cb_libusb()' - Handle side-channel requests. - */ - - static ssize_t /* O - Number of bytes written */ --side_cb(usb_printer_t *printer, /* I - Printer */ -+side_cb_libusb(usb_printer_t *printer, /* I - Printer */ - int print_fd) /* I - File to print */ - { - ssize_t bytes, /* Bytes read/written */ -diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/usb-unix.c cups-1.4.3-both-usblp-and-libusb/backend/usb-unix.c ---- cups-1.4.3/backend/usb-unix.c 2009-12-08 03:13:42.000000000 +0100 -+++ cups-1.4.3-both-usblp-and-libusb/backend/usb-unix.c 2010-03-31 13:59:05.000000000 +0200 -@@ -18,10 +18,10 @@ - * - * Contents: - * -- * print_device() - Print a file to a USB device. -- * list_devices() - List all USB devices. -- * open_device() - Open a USB device... -- * side_cb() - Handle side-channel requests... -+ * print_device_unix() - Print a file to a USB device. -+ * list_devices_unix() - List all USB devices. -+ * open_device_unix() - Open a USB device... -+ * side_cb_unix() - Handle side-channel requests... - */ - - /* -@@ -35,17 +35,17 @@ - * Local functions... - */ - --static int open_device(const char *uri, int *use_bc); --static int side_cb(int print_fd, int device_fd, int snmp_fd, -+static int open_device_unix(const char *uri, int *use_bc); -+static int side_cb_unix(int print_fd, int device_fd, int snmp_fd, - http_addr_t *addr, int use_bc); - - - /* -- * 'print_device()' - Print a file to a USB device. -+ * 'print_device_unix()' - Print a file to a USB device. - */ - - int /* O - Exit status */ --print_device(const char *uri, /* I - Device URI */ -+print_device_unix(const char *uri, /* I - Device URI */ - const char *hostname, /* I - Hostname/manufacturer */ - const char *resource, /* I - Resource/modelname */ - char *options, /* I - Device options/serial number */ -@@ -102,7 +102,7 @@ - strncasecmp(hostname, "Minolta", 7); - #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ - -- if ((device_fd = open_device(uri, &use_bc)) == -1) -+ if ((device_fd = open_device_unix(uri, &use_bc)) == -1) - { - if (getenv("CLASS") != NULL) - { -@@ -132,6 +132,10 @@ - _("INFO: Printer busy; will retry in 10 seconds...\n")); - sleep(10); - } -+#ifdef HAVE_USB_H -+ else -+ return (-1); -+#else - else if (errno == ENXIO || errno == EIO || errno == ENOENT || - errno == ENODEV) - { -@@ -147,6 +151,7 @@ - resource, strerror(errno)); - return (CUPS_BACKEND_FAILED); - } -+#endif - } - } - while (device_fd < 0); -@@ -190,7 +195,7 @@ - tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, NULL); - - #else -- tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb); -+ tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb_unix); - #endif /* __sun */ - - if (print_fd != 0 && tbytes >= 0) -@@ -214,11 +219,11 @@ - - - /* -- * 'list_devices()' - List all USB devices. -+ * 'list_devices_unix()' - List all USB devices. - */ - - void --list_devices(void) -+list_devices_unix(void) - { - #ifdef __linux - int i; /* Looping var */ -@@ -320,11 +325,11 @@ - - - /* -- * 'open_device()' - Open a USB device... -+ * 'open_device_unix()' - Open a USB device... - */ - - static int /* O - File descriptor or -1 on error */ --open_device(const char *uri, /* I - Device URI */ -+open_device_unix(const char *uri, /* I - Device URI */ - int *use_bc) /* O - Set to 0 for unidirectional */ - { - int fd; /* File descriptor */ -@@ -357,9 +362,12 @@ - char device[255], /* Device filename */ - device_id[1024], /* Device ID string */ - make_model[1024], /* Make and model */ -- device_uri[1024]; /* Device URI string */ -- -+ device_uri[1024], /* Device URI string */ -+ requested_uri[1024], /* Device URI string */ -+ *str1, -+ *str2; - -+ - /* - * Find the correct USB device... - */ -@@ -407,7 +415,55 @@ - device_uri[0] = '\0'; - } - -- if (!strcmp(uri, device_uri)) -+ /* Work on a copy of uri */ -+ strncpy(requested_uri, uri, sizeof(requested_uri)); -+ requested_uri[sizeof(requested_uri) - 1] = '\0'; -+ -+ /* -+ * libusb-discovered URIs can have an "interface" specification and this -+ * never happens for usblp-discovered URIs, so remove the "interface" -+ * specification from the URI of the print queue. This way a queue for -+ * a libusb-discovered printer can now be accessed via the usblip kernel -+ * module -+ */ -+ if ((str1 = strstr(requested_uri, "interface=")) != NULL) -+ *(str1 - 1) = '\0'; -+ -+ /* -+ * Old URI with "serial=?". Cut this part off and consider this as -+ * an URI without serial number -+ */ -+ if ((str1 = strstr(requested_uri, "serial=?")) != NULL) -+ *(str1 - 1) = '\0'; -+ -+ /* -+ * Old URI without serial number. Match it also with URIs with serial -+ * number -+ */ -+ if (((str1 = strstr(requested_uri, "serial=")) == NULL) && -+ ((str2 = strstr(device_uri, "serial=")) != NULL)) -+ *(str2 - 1) = '\0'; -+ -+ /* -+ * libusb-discovered URIs can have a "serial" specification when the -+ * usblp-discovered URI for the same printer does not have one, as -+ * with libusb we can discover serial numbers also with other methods -+ * than only via the device ID. Therefore we accept also a -+ * usblp-discovered printer without serial number as a match. This we -+ * do by removing the serial number from the queue's (libusb-discovered) -+ * URI before comparing. Also warn the user because of the incapability -+ * of the usblp-based access to distinguish printers by the serial -+ * number. -+ */ -+ if (((str1 = strstr(requested_uri, "serial=")) != NULL) && -+ ((str2 = strstr(device_uri, "serial=")) == NULL)) -+ { -+ *(str1 - 1) = '\0'; -+ fprintf(stderr, "WARNING: If you have more than one %s printer connected to this machine, please unload (and blacklist) the \"usblp\" kernel module as otherwise CUPS will not be able to distinguish your printers.\n", -+ make_model); -+ } -+ -+ if (!strcmp(requested_uri, device_uri)) - { - /* - * Yes, return this file descriptor... -@@ -433,10 +489,14 @@ - */ - - if (busy) -+ { - _cupsLangPuts(stderr, - _("INFO: Printer busy; will retry in 5 seconds...\n")); - -- sleep(5); -+ sleep(5); -+ } -+ else -+ return -1; - } - } - #elif defined(__sun) && defined(ECPPIOC_GETDEVID) -@@ -557,11 +617,11 @@ - - - /* -- * 'side_cb()' - Handle side-channel requests... -+ * 'side_cb_unix()' - Handle side-channel requests... - */ - --static int /* O - 0 on success, -1 on error */ --side_cb(int print_fd, /* I - Print file */ -+static int -+side_cb_unix(int print_fd, /* I - Print file */ - int device_fd, /* I - Device file */ - int snmp_fd, /* I - SNMP socket (unused) */ - http_addr_t *addr, /* I - Device address (unused) */ diff --git a/cups-1.4.4-no-hostname-broadcast.patch b/cups-1.4.4-no-hostname-broadcast.patch deleted file mode 100644 index b4513ba..0000000 --- a/cups-1.4.4-no-hostname-broadcast.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -Naurp cups-1.4.8/scheduler/client.c cups-1.4.8.oden/scheduler/client.c ---- cups-1.4.8/scheduler/client.c 2011-01-22 01:07:22.000000000 +0100 -+++ cups-1.4.8.oden/scheduler/client.c 2011-08-23 12:32:14.592896201 +0200 -@@ -430,7 +430,7 @@ cupsdAcceptClient(cupsd_listener_t *lis) - { - if (httpAddrLocalhost(&temp)) - strlcpy(con->servername, "localhost", sizeof(con->servername)); -- else if (HostNameLookups || RemotePort) -+ else if (HostNameLookups) - httpAddrLookup(&temp, con->servername, sizeof(con->servername)); - else - httpAddrString(&temp, con->servername, sizeof(con->servername)); -@@ -443,7 +443,7 @@ cupsdAcceptClient(cupsd_listener_t *lis) - { - if (httpAddrLocalhost(&temp)) - strlcpy(con->servername, "localhost", sizeof(con->servername)); -- else if (HostNameLookups || RemotePort) -+ else if (HostNameLookups) - httpAddrLookup(&temp, con->servername, sizeof(con->servername)); - else - httpAddrString(&temp, con->servername, sizeof(con->servername)); -diff -Naurp cups-1.4.8/scheduler/conf.c cups-1.4.8.oden/scheduler/conf.c ---- cups-1.4.8/scheduler/conf.c 2011-01-11 08:05:58.000000000 +0100 -+++ cups-1.4.8.oden/scheduler/conf.c 2011-08-23 12:32:14.593896179 +0200 -@@ -750,7 +750,7 @@ cupsdReadConfiguration(void) - cupsdAddAlias(ServerAlias, temp); - cupsdLogMessage(CUPSD_LOG_DEBUG, "Added auto ServerAlias %s", temp); - -- if (HostNameLookups || RemotePort) -+ if (HostNameLookups) - { - struct hostent *host; /* Host entry to get FQDN */ - diff --git a/cups-1.4.4-page-label.patch b/cups-1.4.4-page-label.patch deleted file mode 100644 index 4e0792c..0000000 --- a/cups-1.4.4-page-label.patch +++ /dev/null @@ -1,91 +0,0 @@ ---- filter/pstops.c 2010-11-17 20:58:22.000000000 +0100 -+++ filter/pstops.c.oden 2011-01-08 13:01:17.450527001 +0100 -@@ -108,6 +108,7 @@ typedef struct /**** Document informa - int num_options; /* Number of document-wide options */ - cups_option_t *options; /* Document-wide options */ - int normal_landscape, /* Normal rotation for landscape? */ -+ orientation, /* Original orientation of the document */ - saw_eof, /* Saw the %%EOF comment? */ - slow_collate, /* Collate copies by hand? */ - slow_duplex, /* Duplex pages slowly? */ -@@ -2083,7 +2084,7 @@ do_setup(pstops_doc_t *doc, /* I - Docu - * of the pages... - */ - -- if (Orientation & 1) -+ if (doc->orientation & 1) - write_label_prolog(doc, doc->page_label, PageBottom, - PageWidth - PageLength + PageTop, PageLength); - else -@@ -2091,7 +2092,30 @@ do_setup(pstops_doc_t *doc, /* I - Docu - PageLength); - } - else -- write_label_prolog(doc, doc->page_label, PageBottom, PageTop, PageWidth); -+ { -+ switch (doc->orientation) -+ { -+ case 0 : -+ write_label_prolog(doc, doc->page_label, PageBottom, PageTop, -+ PageWidth); -+ break; -+ -+ case 1 : -+ write_label_prolog(doc, doc->page_label, PageLeft, PageRight, -+ PageLength); -+ break; -+ -+ case 2 : -+ write_label_prolog(doc, doc->page_label, PageLength - PageTop, -+ PageLength - PageBottom, PageWidth); -+ break; -+ -+ case 3 : -+ write_label_prolog(doc, doc->page_label, PageWidth - PageRight, -+ PageWidth - PageLeft, PageLength); -+ break; -+ } -+ } - } - - -@@ -2176,7 +2200,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum - case 1 : - if (doc->use_ESPshowpage) - { -- write_labels(doc, Orientation); -+ write_labels(doc, doc->orientation); - doc_puts(doc, "ESPshowpage\n"); - } - break; -@@ -2191,7 +2215,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum - * Rotate the labels back to portrait... - */ - -- write_labels(doc, Orientation - 1); -+ write_labels(doc, doc->orientation - 1); - } - else if (Orientation == 0) - { -@@ -2217,7 +2241,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum - default : - if (is_last_page(number) && doc->use_ESPshowpage) - { -- write_labels(doc, Orientation); -+ write_labels(doc, doc->orientation); - doc_puts(doc, "ESPshowpage\n"); - } - break; -@@ -2421,6 +2445,12 @@ set_pstops_options( - doc->new_bounding_box[3] = INT_MIN; - - /* -+ * Save original orientation of the document -+ */ -+ -+ doc->orientation = Orientation; -+ -+ /* - * AP_FIRSTPAGE_* and the corresponding non-first-page options. - */ - diff --git a/cups-1.4.4-str3461-1.4.reverted.patch b/cups-1.4.4-str3461-1.4.reverted.patch deleted file mode 100644 index 92ddec5..0000000 --- a/cups-1.4.4-str3461-1.4.reverted.patch +++ /dev/null @@ -1,250 +0,0 @@ -diff -rup cups-1.4.4/cups/http.c cups-1.4.4-str3461-1.4.patch.reverted/cups/http.c ---- cups-1.4.4/cups/http.c 2010-06-16 07:27:41.000000000 +0200 -+++ cups-1.4.4-str3461-1.4.patch.reverted/cups/http.c 2010-06-25 11:02:31.000000000 +0200 -@@ -83,12 +83,10 @@ - * http_debug_hex() - Do a hex dump of a buffer. - * http_field() - Return the field index for a field name. - * http_read_ssl() - Read from a SSL/TLS connection. -- * http_locking_cb() - Lock/unlock a thread's mutex. - * http_send() - Send a request with all fields and the trailing - * blank line. - * http_setup_ssl() - Set up SSL/TLS support on a connection. - * http_shutdown_ssl() - Shut down SSL/TLS on a connection. -- * http_threadid_cb() - Return the current thread ID. - * http_upgrade() - Force upgrade to TLS encryption. - * http_write() - Write a buffer to a HTTP connection. - * http_write_chunk() - Write a chunked buffer. -@@ -146,19 +144,6 @@ static int http_setup_ssl(http_t *http) - static void http_shutdown_ssl(http_t *http); - static int http_upgrade(http_t *http); - static int http_write_ssl(http_t *http, const char *buf, int len); -- --# ifdef HAVE_GNUTLS --# ifdef HAVE_PTHREAD_H --GCRY_THREAD_OPTION_PTHREAD_IMPL; --# endif /* HAVE_PTHREAD_H */ -- --# elif defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H) --static pthread_mutex_t *http_locks; /* OpenSSL lock mutexes */ -- --static void http_locking_cb(int mode, int type, const char *file, -- int line); --static unsigned long http_threadid_cb(void); --# endif /* HAVE_GNUTLS */ - #endif /* HAVE_SSL */ - - -@@ -1188,22 +1173,21 @@ httpHead(http_t *http, /* I - Conne - void - httpInitialize(void) - { -- static int initialized = 0; /* Have we been called before? */ --#ifdef WIN32 -- WSADATA winsockdata; /* WinSock data */ --#endif /* WIN32 */ - #ifdef HAVE_LIBSSL -- int i; /* Looping var */ -- unsigned char data[1024]; /* Seed data */ -+# ifndef WIN32 -+ struct timeval curtime; /* Current time in microseconds */ -+# endif /* !WIN32 */ -+ int i; /* Looping var */ -+ unsigned char data[1024]; /* Seed data */ - #endif /* HAVE_LIBSSL */ - -- -- if (initialized) -- return; -- - #ifdef WIN32 -- WSAStartup(MAKEWORD(2,2), &winsockdata); -+ WSADATA winsockdata; /* WinSock data */ - -+ -+ static int initialized = 0; /* Has WinSock been initialized? */ -+ if (!initialized) -+ WSAStartup(MAKEWORD(1,1), &winsockdata); - #elif !defined(SO_NOSIGPIPE) - /* - * Ignore SIGPIPE signals... -@@ -1226,56 +1210,29 @@ httpInitialize(void) - #endif /* WIN32 */ - - #ifdef HAVE_GNUTLS -- /* -- * Make sure we handle threading properly... -- */ -- --# ifdef HAVE_PTHREAD_H -- gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); --# endif /* HAVE_PTHREAD_H */ -- -- /* -- * Initialize GNU TLS... -- */ -- - gnutls_global_init(); -+#endif /* HAVE_GNUTLS */ - --#elif defined(HAVE_LIBSSL) -- /* -- * Initialize OpenSSL... -- */ -- -+#ifdef HAVE_LIBSSL - SSL_load_error_strings(); - SSL_library_init(); - - /* -- * Set the threading callbacks... -- */ -- --# ifdef HAVE_PTHREAD_H -- http_locks = calloc(CRYPTO_num_locks(), sizeof(pthread_mutex_t)); -- -- for (i = 0; i < CRYPTO_num_locks(); i ++) -- pthread_mutex_init(http_locks + i, NULL); -- -- CRYPTO_set_id_callback(http_threadid_cb); -- CRYPTO_set_locking_callback(http_locking_cb); --# endif /* HAVE_PTHREAD_H */ -- -- /* - * Using the current time is a dubious random seed, but on some systems - * it is the best we can do (on others, this seed isn't even used...) - */ - -- CUPS_SRAND(time(NULL)); -+# ifdef WIN32 -+# else -+ gettimeofday(&curtime, NULL); -+ srand(curtime.tv_sec + curtime.tv_usec); -+# endif /* WIN32 */ - - for (i = 0; i < sizeof(data); i ++) -- data[i] = CUPS_RAND(); -+ data[i] = rand(); - - RAND_seed(data, sizeof(data)); --#endif /* HAVE_GNUTLS */ -- -- initialized = 1; -+#endif /* HAVE_LIBSSL */ - } - - -@@ -2834,25 +2791,6 @@ http_read_ssl(http_t *http, /* I - Conn - #endif /* HAVE_SSL */ - - --#if defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H) --/* -- * 'http_locking_cb()' - Lock/unlock a thread's mutex. -- */ -- --static void --http_locking_cb(int mode, /* I - Lock mode */ -- int type, /* I - Lock type */ -- const char *file, /* I - Source file */ -- int line) /* I - Line number */ --{ -- if (mode & CRYPTO_LOCK) -- pthread_mutex_lock(http_locks + type); -- else -- pthread_mutex_unlock(http_locks + type); --} --#endif /* HAVE_LIBSSL && HAVE_PTHREAD_H */ -- -- - /* - * 'http_send()' - Send a request with all fields and the trailing blank line. - */ -@@ -3224,19 +3162,6 @@ http_shutdown_ssl(http_t *http) /* I - - #endif /* HAVE_SSL */ - - --#if defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H) --/* -- * 'http_threadid_cb()' - Return the current thread ID. -- */ -- --static unsigned long /* O - Thread ID */ --http_threadid_cb(void) --{ -- return ((unsigned long)pthread_self()); --} --#endif /* HAVE_LIBSSL && HAVE_PTHREAD_H */ -- -- - #ifdef HAVE_SSL - /* - * 'http_upgrade()' - Force upgrade to TLS encryption. -diff -rup cups-1.4.4/cups/http-private.h cups-1.4.4-str3461-1.4.patch.reverted/cups/http-private.h ---- cups-1.4.4/cups/http-private.h 2010-04-12 06:03:53.000000000 +0200 -+++ cups-1.4.4-str3461-1.4.patch.reverted/cups/http-private.h 2010-06-25 11:03:34.000000000 +0200 -@@ -98,7 +98,6 @@ extern BIO_METHOD *_httpBIOMethods(void) - * The GNU TLS library is more of a "bare metal" SSL/TLS library... - */ - # include --# include - - typedef struct - { -diff -rup cups-1.4.4/scheduler/main.c cups-1.4.4-str3461-1.4.patch.reverted/scheduler/main.c ---- cups-1.4.4/scheduler/main.c 2010-04-23 20:56:34.000000000 +0200 -+++ cups-1.4.4-str3461-1.4.patch.reverted/scheduler/main.c 2010-06-25 11:14:07.000000000 +0200 -@@ -549,8 +549,6 @@ main(int argc, /* I - Number of comm - * Startup the server... - */ - -- httpInitialize(); -- - cupsdStartServer(); - - /* -diff -rup cups-1.4.4/scheduler/server.c cups-1.4.4-str3461-1.4.patch.reverted/scheduler/server.c ---- cups-1.4.4/scheduler/server.c 2010-04-12 06:03:53.000000000 +0200 -+++ cups-1.4.4-str3461-1.4.patch.reverted/scheduler/server.c 2010-06-25 11:12:52.000000000 +0200 -@@ -44,6 +44,42 @@ static int started = 0; - void - cupsdStartServer(void) - { -+#ifdef HAVE_LIBSSL -+ int i; /* Looping var */ -+ struct timeval curtime; /* Current time in microseconds */ -+ unsigned char data[1024]; /* Seed data */ -+#endif /* HAVE_LIBSSL */ -+ -+ -+#ifdef HAVE_LIBSSL -+ /* -+ * Initialize the encryption libraries... -+ */ -+ -+ SSL_library_init(); -+ SSL_load_error_strings(); -+ -+ /* -+ * Using the current time is a dubious random seed, but on some systems -+ * it is the best we can do (on others, this seed isn't even used...) -+ */ -+ -+ gettimeofday(&curtime, NULL); -+ srand(curtime.tv_sec + curtime.tv_usec); -+ -+ for (i = 0; i < sizeof(data); i ++) -+ data[i] = rand(); /* Yes, this is a poor source of random data... */ -+ -+ RAND_seed(&data, sizeof(data)); -+#elif defined(HAVE_GNUTLS) -+ /* -+ * Initialize the encryption libraries... -+ */ -+ -+ gnutls_global_init(); -+#endif /* HAVE_LIBSSL */ -+ -+ - /* - * Create the default security profile... - */ diff --git a/cups-1.4.8-CVE-2011-3170.diff b/cups-1.4.8-CVE-2011-3170.diff deleted file mode 100644 index 1c2908e..0000000 --- a/cups-1.4.8-CVE-2011-3170.diff +++ /dev/null @@ -1,38 +0,0 @@ - -http://www.cups.org/str.php?L3914 - -svn diff -c 9865 http://svn.easysw.com/public/cups/ -https://bugzilla.redhat.com/show_bug.cgi?id=727800#c8 - ---- filter/image-gif.c 2011-06-20 20:37:51.000000000 +0000 -+++ filter/image-gif.c.oden 2011-10-10 08:50:17.000000000 +0000 -@@ -648,11 +648,13 @@ gif_read_lzw(FILE *fp, /* I - File to - - if (code == max_code) - { -- *sp++ = firstcode; -- code = oldcode; -+ if (sp < (stack + 8192)) -+ *sp++ = firstcode; -+ -+ code = oldcode; - } - -- while (code >= clear_code) -+ while (code >= clear_code && sp < (stack + 8192)) - { - *sp++ = table[1][code]; - if (code == table[0][code]) -@@ -661,8 +663,10 @@ gif_read_lzw(FILE *fp, /* I - File to - code = table[0][code]; - } - -- *sp++ = firstcode = table[1][code]; -- code = max_code; -+ if (sp < (stack + 8192)) -+ *sp++ = firstcode = table[1][code]; -+ -+ code = max_code; - - if (code < 4096) - { diff --git a/cups-1.4-permissions.patch b/cups-1.5.3-permissions.patch similarity index 71% rename from cups-1.4-permissions.patch rename to cups-1.5.3-permissions.patch index 13aba3a..54919e4 100644 --- a/cups-1.4-permissions.patch +++ b/cups-1.5.3-permissions.patch @@ -1,13 +1,15 @@ ---- cups-1.4svn-r8684/Makedefs.in~ 2009-05-21 19:20:06.000000000 +0200 -+++ cups-1.4svn-r8684/Makedefs.in 2009-05-26 21:50:03.000000000 +0200 -@@ -40,13 +40,13 @@ +--- cups-1.5.3/Makedefs.in.orig 2012-03-01 00:05:55.000000000 +0000 ++++ cups-1.5.3/Makedefs.in 2012-05-15 17:14:21.437124026 +0000 +@@ -41,14 +41,14 @@ # Installation programs... # -INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@ +INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@ INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@ +-INSTALL_COMPDATA = $(INSTALL) -c -m 444 @INSTALL_GZIP@ -INSTALL_DATA = $(INSTALL) -c -m 444 ++INSTALL_COMPDATA = $(INSTALL) -c -m 644 @INSTALL_GZIP@ +INSTALL_DATA = $(INSTALL) -c -m 644 INSTALL_DIR = $(INSTALL) -d -INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@ diff --git a/cups-avahi-1-config.patch b/cups-avahi-1-config.patch new file mode 100644 index 0000000..516e01f --- /dev/null +++ b/cups-avahi-1-config.patch @@ -0,0 +1,42 @@ +diff -up cups-1.5.2/config.h.in.avahi-1-config cups-1.5.2/config.h.in +--- cups-1.5.2/config.h.in.avahi-1-config 2011-06-16 21:12:16.000000000 +0100 ++++ cups-1.5.2/config.h.in 2012-03-14 15:04:51.365347165 +0000 +@@ -390,6 +390,13 @@ + + + /* ++ * Do we have Avahi for DNS Service Discovery? ++ */ ++ ++#undef HAVE_AVAHI ++ ++ ++/* + * Do we have ? + */ + +diff -up cups-1.5.2/config-scripts/cups-dnssd.m4.avahi-1-config cups-1.5.2/config-scripts/cups-dnssd.m4 +--- cups-1.5.2/config-scripts/cups-dnssd.m4.avahi-1-config 2011-05-12 06:21:56.000000000 +0100 ++++ cups-1.5.2/config-scripts/cups-dnssd.m4 2012-03-14 15:04:51.365347165 +0000 +@@ -23,6 +23,21 @@ AC_ARG_WITH(dnssd-includes, [ --with-dn + DNSSDLIBS="" + DNSSD_BACKEND="" + ++AC_ARG_ENABLE(avahi, [ --enable-avahi turn on DNS Service Discovery support, default=no], ++ [if test x$enable_avahi = xyes; then ++ AC_MSG_CHECKING(for Avahi) ++ if $PKGCONFIG --exists avahi-client; then ++ AC_MSG_RESULT(yes) ++ CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`" ++ DNSSDLIBS="`$PKGCONFIG --libs avahi-client`" ++ DNSSD_BACKEND="dnssd" ++ AC_DEFINE(HAVE_AVAHI) ++ enable_dnssd=no ++ else ++ AC_MSG_RESULT(no) ++ fi ++ fi]) ++ + if test x$enable_dnssd != xno; then + AC_CHECK_HEADER(dns_sd.h, [ + case "$uname" in diff --git a/cups-avahi.patch b/cups-avahi-2-backend.patch similarity index 78% rename from cups-avahi.patch rename to cups-avahi-2-backend.patch index a1d3f80..9fa3677 100644 --- a/cups-avahi.patch +++ b/cups-avahi-2-backend.patch @@ -1,15 +1,29 @@ -diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c ---- cups-1.4.5/backend/dnssd.c 2009-08-08 00:27:12.000000000 +0200 -+++ cups-1.4.5.oden/backend/dnssd.c 2010-11-13 12:35:53.207594044 +0100 -@@ -22,6 +22,7 @@ +diff -up cups-1.5.3/backend/dnssd.c.avahi-2-backend cups-1.5.3/backend/dnssd.c +--- cups-1.5.3/backend/dnssd.c.avahi-2-backend 2012-05-15 16:53:18.164774446 +0200 ++++ cups-1.5.3/backend/dnssd.c 2012-05-15 17:09:07.684155704 +0200 +@@ -15,14 +15,21 @@ + * + * Contents: + * ++ * next_txt_record() - Get next TXT record from a cups_txt_records_t. ++ * parse_txt_record_pair() - Read key/value pair in cups_txt_records_t. + * main() - Browse for printers. + * browse_callback() - Browse devices. + * browse_local_callback() - Browse local devices. + * compare_devices() - Compare two devices. * exec_backend() - Execute the backend that corresponds to the * resolved service name. ++ * device_type() - Get DNS-SD type enumeration from string. * get_device() - Create or update a device. -+* find_device() * query_callback() - Process query data. ++ * avahi_client_callback() - Avahi client callback function. ++ * avahi_query_callback() - Avahi query callback function. ++ * avahi_browse_callback() - Avahi browse callback function. ++ * find_device() - Find a device from its name and domain. * sigterm_handler() - Handle termination signals... * unquote() - Unquote a name string. -@@ -33,7 +34,18 @@ + */ +@@ -33,7 +40,18 @@ #include "backend-private.h" #include @@ -29,7 +43,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c /* -@@ -52,7 +64,12 @@ typedef enum +@@ -53,7 +71,12 @@ typedef enum typedef struct { @@ -42,7 +56,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c char *name, /* Service name */ *domain, /* Domain name */ *fullName, /* Full name */ -@@ -64,6 +81,20 @@ typedef struct +@@ -65,6 +88,20 @@ typedef struct sent; /* Did we list the device? */ } cups_device_t; @@ -63,7 +77,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c /* * Local globals... -@@ -77,6 +108,7 @@ static int job_canceled = 0; +@@ -78,6 +115,7 @@ static int job_canceled = 0; * Local functions... */ @@ -71,23 +85,24 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c static void browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, -@@ -92,12 +124,6 @@ static void browse_local_callback(DNSSe - const char *regtype, +@@ -95,13 +133,6 @@ static void browse_local_callback(DNSSe const char *replyDomain, - void *context); + void *context) + __attribute__((nonnull(1,5,6,7,8))); -static int compare_devices(cups_device_t *a, cups_device_t *b); -static void exec_backend(char **argv); -static cups_device_t *get_device(cups_array_t *devices, - const char *serviceName, - const char *regtype, -- const char *replyDomain); +- const char *replyDomain) +- __attribute__((nonnull(1,2,3,4))); static void query_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, -@@ -106,9 +132,111 @@ static void query_callback(DNSServiceRe - uint16_t rrclass, uint16_t rdlen, +@@ -111,10 +142,119 @@ static void query_callback(DNSServiceRe const void *rdata, uint32_t ttl, - void *context); + void *context) + __attribute__((nonnull(1,5,9,11))); +#endif /* HAVE_DNSSD */ +#ifdef HAVE_AVAHI +static void avahi_client_callback (AvahiClient *client, @@ -103,7 +118,6 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c + AvahiLookupResultFlags flags, + void *context); +#endif /* HAVE_AVAHI */ -+ +static cups_device_t * find_device (cups_array_t *devices, + cups_txt_records_t *txt, + cups_device_t *dkey); @@ -112,9 +126,11 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c +static cups_device_t *get_device(cups_array_t *devices, + const char *serviceName, + const char *regtype, -+ const char *replyDomain); ++ const char *replyDomain) ++ __attribute__((nonnull(1,2,3,4))); static void sigterm_handler(int sig); - static void unquote(char *dst, const char *src, size_t dstsize); + static void unquote(char *dst, const char *src, size_t dstsize) + __attribute__((nonnull(1,2))); +#ifdef HAVE_AVAHI +static AvahiSimplePoll *simple_poll = NULL; @@ -123,8 +139,9 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c + + +/* -+ * cups_txt_records_t access functions ++ * 'next_txt_record()' - Get next TXT record from a cups_txt_records_t. + */ ++ +static cups_txt_records_t * +next_txt_record (cups_txt_records_t *txt) +{ @@ -139,6 +156,11 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c + return txt; +} + ++ ++/* ++ * 'parse_txt_record_pair()' - Read key/value pair in cups_txt_records_t. ++ */ ++ +static int +parse_txt_record_pair (cups_txt_records_t *txt) +{ @@ -154,7 +176,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c + */ + + datalen = *data++; -+ if (!datalen || (data + datalen) >= txt->dataend) ++ if (!datalen || (data + datalen) > txt->dataend) + return NULL; + txt->datanext = data + datalen; + @@ -193,10 +215,11 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c + + return 0; +} ++ /* * 'main()' - Browse for printers. -@@ -119,6 +247,13 @@ main(int argc, /* I - Number of comm +@@ -125,6 +265,13 @@ main(int argc, /* I - Number of comm char *argv[]) /* I - Command-line arguments */ { const char *name; /* Backend name */ @@ -210,7 +233,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c DNSServiceRef main_ref, /* Main service reference */ fax_ipp_ref, /* IPP fax service reference */ ipp_ref, /* IPP service reference */ -@@ -130,12 +265,11 @@ main(int argc, /* I - Number of comm +@@ -138,12 +285,11 @@ main(int argc, /* I - Number of comm pdl_datastream_ref, /* AppSocket service reference */ printer_ref, /* LPD service reference */ riousbprint_ref; /* Remote IO service reference */ @@ -228,7 +251,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Actions for POSIX signals */ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */ -@@ -194,6 +328,49 @@ main(int argc, /* I - Number of comm +@@ -203,6 +349,49 @@ main(int argc, /* I - Number of comm * Browse for different kinds of printers... */ @@ -278,7 +301,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c if (DNSServiceCreateConnection(&main_ref) != kDNSServiceErr_NoError) { perror("ERROR: Unable to create service connection"); -@@ -245,6 +422,7 @@ main(int argc, /* I - Number of comm +@@ -263,6 +452,7 @@ main(int argc, /* I - Number of comm riousbprint_ref = main_ref; DNSServiceBrowse(&riousbprint_ref, kDNSServiceFlagsShareConnection, 0, "_riousbprint._tcp", NULL, browse_callback, devices); @@ -286,7 +309,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c /* * Loop until we are killed... -@@ -252,6 +430,9 @@ main(int argc, /* I - Number of comm +@@ -270,6 +460,9 @@ main(int argc, /* I - Number of comm while (!job_canceled) { @@ -296,7 +319,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c FD_ZERO(&input); FD_SET(fd, &input); -@@ -271,11 +452,35 @@ main(int argc, /* I - Number of comm +@@ -289,11 +482,35 @@ main(int argc, /* I - Number of comm } else { @@ -332,15 +355,15 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c cups_device_t *best; /* Best matching device */ char device_uri[1024]; /* Device URI */ int count; /* Number of queries */ -@@ -285,6 +490,7 @@ main(int argc, /* I - Number of comm - best = NULL, count = 0; - device; - device = (cups_device_t *)cupsArrayNext(devices)) +@@ -307,6 +524,7 @@ main(int argc, /* I - Number of comm + if (device->sent) + sent ++; + +#ifdef HAVE_DNSSD - if (!device->ref && !device->sent) - { - /* -@@ -313,14 +519,23 @@ main(int argc, /* I - Number of comm + if (device->ref) + count ++; + +@@ -338,14 +556,23 @@ main(int argc, /* I - Number of comm count ++; } } @@ -365,30 +388,15 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c if (!best) best = device; -@@ -372,6 +587,7 @@ main(int argc, /* I - Number of comm +@@ -406,6 +633,7 @@ main(int argc, /* I - Number of comm + } + + ++#ifdef HAVE_DNSSD + /* * 'browse_callback()' - Browse devices. */ - -+#ifdef HAVE_DNSSD - static void - browse_callback( - DNSServiceRef sdRef, /* I - Service reference */ -@@ -405,12 +621,14 @@ browse_callback( - - get_device((cups_array_t *)context, serviceName, regtype, replyDomain); - } -+#endif /* HAVE_DNSSD */ - - - /* - * 'browse_local_callback()' - Browse local devices. - */ - -+#ifdef HAVE_DNSSD - static void - browse_local_callback( - DNSServiceRef sdRef, /* I - Service reference */ -@@ -456,6 +674,7 @@ browse_local_callback( +@@ -494,6 +722,7 @@ browse_local_callback( device->fullName); device->sent = 1; } @@ -396,25 +404,32 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c /* -@@ -528,6 +747,32 @@ exec_backend(char **argv) /* I - Comman - exit(CUPS_BACKEND_STOP); - } +@@ -574,6 +803,41 @@ exec_backend(char **argv) /* I - Comman + + /* ++ * 'device_type()' - Get DNS-SD type enumeration from string. ++ */ ++ +static int +device_type (const char *regtype) +{ +#ifdef HAVE_AVAHI -+ if (!strcmp(regtype, "_ipp._tcp") || -+ !strcmp(regtype, "_ipp-tls._tcp")) ++ if (!strcmp(regtype, "_ipp._tcp")) + return (CUPS_DEVICE_IPP); ++ else if (!strcmp(regtype, "_ipps._tcp") || ++ !strcmp(regtype, "_ipp-tls._tcp")) ++ return (CUPS_DEVICE_IPPS); + else if (!strcmp(regtype, "_fax-ipp._tcp")) + return (CUPS_DEVICE_FAX_IPP); + else if (!strcmp(regtype, "_printer._tcp")) + return (CUPS_DEVICE_PDL_DATASTREAM); +#else -+ if (!strcmp(regtype, "_ipp._tcp.") || -+ !strcmp(regtype, "_ipp-tls._tcp.")) ++ if (!strcmp(regtype, "_ipp._tcp.")) + return (CUPS_DEVICE_IPP); ++ else if (!strcmp(regtype, "_ipps._tcp.") || ++ !strcmp(regtype, "_ipp-tls._tcp.")) ++ return (CUPS_DEVICE_IPPS); + else if (!strcmp(regtype, "_fax-ipp._tcp.")) + return (CUPS_DEVICE_FAX_IPP); + else if (!strcmp(regtype, "_printer._tcp.")) @@ -426,17 +441,21 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c + return (CUPS_DEVICE_RIOUSBPRINT); +} + - - /* ++ ++/* * 'get_device()' - Create or update a device. -@@ -550,18 +795,7 @@ get_device(cups_array_t *devices, /* I - + */ + +@@ -594,20 +858,7 @@ get_device(cups_array_t *devices, /* I - */ key.name = (char *)serviceName; - -- if (!strcmp(regtype, "_ipp._tcp.") || -- !strcmp(regtype, "_ipp-tls._tcp.")) +- if (!strcmp(regtype, "_ipp._tcp.")) - key.type = CUPS_DEVICE_IPP; +- else if (!strcmp(regtype, "_ipps._tcp.") || +- !strcmp(regtype, "_ipp-tls._tcp.")) +- key.type = CUPS_DEVICE_IPPS; - else if (!strcmp(regtype, "_fax-ipp._tcp.")) - key.type = CUPS_DEVICE_FAX_IPP; - else if (!strcmp(regtype, "_printer._tcp.")) @@ -449,7 +468,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c for (device = cupsArrayFind(devices, &key); device; -@@ -581,8 +815,14 @@ get_device(cups_array_t *devices, /* I - +@@ -627,8 +878,14 @@ get_device(cups_array_t *devices, /* I - free(device->domain); device->domain = strdup(replyDomain); @@ -464,7 +483,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c free(device->fullName); device->fullName = strdup(fullName); } -@@ -602,6 +842,9 @@ get_device(cups_array_t *devices, /* I - +@@ -648,6 +905,9 @@ get_device(cups_array_t *devices, /* I - device->domain = strdup(replyDomain); device->type = key.type; device->priority = 50; @@ -474,7 +493,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c cupsArrayAdd(devices, device); -@@ -609,7 +852,13 @@ get_device(cups_array_t *devices, /* I - +@@ -655,13 +915,20 @@ get_device(cups_array_t *devices, /* I - * Set the "full name" of this service, which is used for queries... */ @@ -488,15 +507,14 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c device->fullName = strdup(fullName); return (device); -@@ -620,6 +869,7 @@ get_device(cups_array_t *devices, /* I - - * 'query_callback()' - Process query data. - */ + } + +#ifdef HAVE_DNSSD - static void - query_callback( - DNSServiceRef sdRef, /* I - Service reference */ -@@ -639,7 +889,7 @@ query_callback( + /* + * 'query_callback()' - Process query data. + */ +@@ -685,7 +952,7 @@ query_callback( *ptr; /* Pointer into string */ cups_device_t dkey, /* Search key */ *device; /* Device */ @@ -505,13 +523,15 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c fprintf(stderr, "DEBUG2: query_callback(sdRef=%p, flags=%x, " "interfaceIndex=%d, errorCode=%d, fullName=\"%s\", " -@@ -673,84 +923,212 @@ query_callback( +@@ -719,94 +986,233 @@ query_callback( if ((ptr = strstr(name, "._")) != NULL) *ptr = '\0'; -- if (strstr(fullName, "_ipp._tcp.") || -- strstr(fullName, "_ipp-tls._tcp.")) +- if (strstr(fullName, "_ipp._tcp.")) - dkey.type = CUPS_DEVICE_IPP; +- else if (strstr(fullName, "_ipps._tcp.") || +- strstr(fullName, "_ipp-tls._tcp.")) +- dkey.type = CUPS_DEVICE_IPPS; - else if (strstr(fullName, "_fax-ipp._tcp.")) - dkey.type = CUPS_DEVICE_FAX_IPP; - else if (strstr(fullName, "_printer._tcp.")) @@ -528,7 +548,12 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c +} +#endif /* HAVE_DNSSD */ + ++ +#ifdef HAVE_AVAHI ++/* ++ * 'avahi_client_callback()' - Avahi client callback function. ++ */ ++ +static void +avahi_client_callback(AvahiClient *client, + AvahiClientState state, @@ -545,6 +570,11 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c + } +} + ++ ++/* ++ * 'avahi_query_callback()' - Avahi query callback function. ++ */ ++ +static void +avahi_query_callback(AvahiServiceResolver *resolver, + AvahiIfIndex interface, @@ -610,10 +640,16 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c else - dkey.type = CUPS_DEVICE_RIOUSBPRINT; + fprintf (stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", name); -+ + +- for (device = cupsArrayFind(devices, &dkey); + avahi_service_resolver_free (resolver); +} + ++ ++/* ++ * 'avahi_browse_callback()' - Avahi browse callback function. ++ */ ++ +static void +avahi_browse_callback(AvahiServiceBrowser *browser, + AvahiIfIndex interface, @@ -671,16 +707,20 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c + } + + break; - -- for (device = cupsArrayFind(devices, &dkey); ++ + case AVAHI_BROWSER_REMOVE: + case AVAHI_BROWSER_ALL_FOR_NOW: + case AVAHI_BROWSER_CACHE_EXHAUSTED: + break; -+ } ++ } +} +#endif /* HAVE_AVAHI */ + ++ ++/* ++ * 'find_device()' - Find a device from its name and domain. ++ */ ++ +static cups_device_t * +find_device (cups_array_t *devices, + cups_txt_records_t *txt, @@ -693,10 +733,10 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c device; device = cupsArrayNext(devices)) { -- if (strcasecmp(device->name, dkey.name) || -- strcasecmp(device->domain, dkey.domain)) -+ if (strcasecmp(device->name, dkey->name) || -+ strcasecmp(device->domain, dkey->domain)) +- if (_cups_strcasecmp(device->name, dkey.name) || +- _cups_strcasecmp(device->domain, dkey.domain)) ++ if (_cups_strcasecmp(device->name, dkey->name) || ++ _cups_strcasecmp(device->domain, dkey->domain)) { device = NULL; break; @@ -741,17 +781,17 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c - - datalen = *data++; - -- if (!datalen || (data + datalen) >= dataend) +- if (!datalen || (data + datalen) > dataend) - break; - - datanext = data + datalen; -+ char *key; -+ char *value; - +- - for (ptr = key; data < datanext && *data != '='; data ++) - *ptr++ = *data; - *ptr = '\0'; -- ++ char *key; ++ char *value; + - if (data < datanext && *data == '=') - { - data ++; @@ -759,18 +799,27 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c - if (data < datanext) - memcpy(value, data, datanext - data); - value[datanext - data] = '\0'; -- } -- else -- continue; + if (parse_txt_record_pair (txt)) + goto next; +- fprintf(stderr, "DEBUG2: query_callback: \"%s=%s\".\n", +- key, value); +- } +- else +- { +- fprintf(stderr, "DEBUG2: query_callback: \"%s\" with no value.\n", +- key); +- continue; +- } +- +- if (!_cups_strncasecmp(key, "usb_", 4)) + key = txt->key; + value = txt->value; - if (!strncasecmp(key, "usb_", 4)) ++ if (!strncasecmp(key, "usb_", 4)) { /* -@@ -805,6 +1183,10 @@ query_callback( + * Add USB device ID information... +@@ -861,6 +1267,10 @@ query_callback( if (device->type == CUPS_DEVICE_PRINTER) device->sent = 1; } @@ -781,7 +830,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c } if (device->device_id) -@@ -854,11 +1236,9 @@ query_callback( +@@ -917,11 +1327,9 @@ query_callback( } } @@ -794,54 +843,23 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c /* * 'sigterm_handler()' - Handle termination signals... */ -diff -Naurp cups-1.4.5/config.h.in cups-1.4.5.oden/config.h.in ---- cups-1.4.5/config.h.in 2010-08-13 06:11:46.000000000 +0200 -+++ cups-1.4.5.oden/config.h.in 2010-11-13 12:35:53.207594044 +0100 -@@ -344,6 +344,13 @@ - - - /* -+ * Do we have Avahi for DNS Service Discovery? -+ */ -+ -+#undef HAVE_AVAHI -+ -+ -+/* - * Do we have ? +diff -up cups-1.5.3/cups/http-support.c.avahi-2-backend cups-1.5.3/cups/http-support.c +--- cups-1.5.3/cups/http-support.c.avahi-2-backend 2012-02-15 02:06:12.000000000 +0100 ++++ cups-1.5.3/cups/http-support.c 2012-05-15 17:04:51.045944634 +0200 +@@ -43,6 +43,10 @@ + * http_copy_decode() - Copy and decode a URI. + * http_copy_encode() - Copy and encode a URI. + * http_resolve_cb() - Build a device URI for the given service name. ++ * avahi_resolve_uri_client_cb() ++ * - Avahi client callback for resolving URI. ++ * avahi_resolve_uri_resolver_cb() ++ * - Avahi resolver callback for resolving URI. */ -diff -Naurp cups-1.4.5/config-scripts/cups-dnssd.m4 cups-1.4.5.oden/config-scripts/cups-dnssd.m4 ---- cups-1.4.5/config-scripts/cups-dnssd.m4 2009-08-29 00:54:34.000000000 +0200 -+++ cups-1.4.5.oden/config-scripts/cups-dnssd.m4 2010-11-13 12:35:53.208594023 +0100 -@@ -27,6 +27,21 @@ AC_ARG_WITH(dnssd-includes, [ --with-dn - DNSSDLIBS="" - DNSSD_BACKEND="" - -+AC_ARG_ENABLE(avahi, [ --enable-avahi turn on DNS Service Discovery support, default=no], -+ [if test x$enable_avahi = xyes; then -+ AC_MSG_CHECKING(for Avahi) -+ if $PKGCONFIG --exists avahi-client; then -+ AC_MSG_RESULT(yes) -+ CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`" -+ DNSSDLIBS="`$PKGCONFIG --libs avahi-client`" -+ DNSSD_BACKEND="dnssd" -+ AC_DEFINE(HAVE_AVAHI) -+ enable_dnssd=no -+ else -+ AC_MSG_RESULT(no) -+ fi -+ fi]) -+ - if test x$enable_dnssd != xno; then - AC_CHECK_HEADER(dns_sd.h, [ - case "$uname" in -diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c ---- cups-1.4.5/cups/http-support.c 2010-10-02 00:40:38.000000000 +0200 -+++ cups-1.4.5.oden/cups/http-support.c 2010-11-13 12:40:27.275112586 +0100 -@@ -55,6 +55,11 @@ - # include - # include + /* +@@ -60,6 +64,11 @@ + # include + # endif /* WIN32 */ #endif /* HAVE_DNSSD */ +#ifdef HAVE_AVAHI +# include @@ -851,8 +869,8 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c /* -@@ -121,6 +126,24 @@ static void resolve_callback(DNSService - void *context); +@@ -127,6 +136,24 @@ static void DNSSD_API http_resolve_cb(DN + void *context); #endif /* HAVE_DNSSD */ +#ifdef HAVE_AVAHI @@ -876,7 +894,7 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c /* * 'httpAssembleURI()' - Assemble a uniform resource identifier from its -@@ -1351,17 +1374,27 @@ _httpResolveURI( +@@ -1434,6 +1461,9 @@ _httpResolveURI( if (strstr(hostname, "._tcp")) { @@ -884,16 +902,12 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c + char *regtype, /* Pointer to type in hostname */ + *domain; /* Pointer to domain in hostname */ #ifdef HAVE_DNSSD - DNSServiceRef ref, /* DNS-SD master service reference */ - domainref, /* DNS-SD service reference for domain */ - localref; /* DNS-SD service reference for .local */ - int domainsent = 0, /* Send the domain resolve? */ - offline = 0; /* offline-report state set? */ -- char *regtype, /* Pointer to type in hostname */ -- *domain; /* Pointer to domain in hostname */ - _http_uribuf_t uribuf; /* URI buffer */ - struct pollfd polldata; /* Polling data */ -- + # ifdef WIN32 + # pragma comment(lib, "dnssd.lib") +@@ -1452,6 +1482,17 @@ _httpResolveURI( + fd_set input_set; /* Input set for select() */ + struct timeval stimeout; /* Timeout value for select() */ + #endif /* HAVE_POLL */ +#else /* HAVE_AVAHI */ + AvahiSimplePoll *simple_poll; + AvahiClient *client; @@ -904,32 +918,28 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c + _http_uribuf_t uribuf; + } user_data; +#endif /* HAVE_DNSSD */ ++ - if (logit) + if (options & _HTTP_RESOLVE_STDERR) fprintf(stderr, "DEBUG: Resolving \"%s\"...\n", hostname); -@@ -1382,7 +1415,6 @@ _httpResolveURI( - *regtype++ = '\0'; - break; - } -- - if (regtype <= hostname) - { - DEBUG_puts("5_httpResolveURI: Bad hostname, returning NULL"); -@@ -1398,8 +1430,13 @@ _httpResolveURI( +@@ -1488,9 +1529,16 @@ _httpResolveURI( if (domain) *domain++ = '\0'; +#ifdef HAVE_DNSSD - uribuf.buffer = resolved_uri; - uribuf.bufsize = resolved_size; + uribuf.buffer = resolved_uri; + uribuf.bufsize = resolved_size; + uribuf.options = options; +#else + user_data.uribuf.buffer = resolved_uri; + user_data.uribuf.bufsize = resolved_size; ++ user_data.uribuf.options = options; +#endif - ++ resolved_uri[0] = '\0'; -@@ -1414,6 +1451,7 @@ _httpResolveURI( + DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", " +@@ -1504,6 +1552,7 @@ _httpResolveURI( uri = NULL; @@ -937,7 +947,7 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError) { localref = ref; -@@ -1500,6 +1538,36 @@ _httpResolveURI( +@@ -1611,6 +1660,36 @@ _httpResolveURI( DNSServiceRefDeallocate(ref); } @@ -972,9 +982,9 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c + } +#endif /* HAVE_DNSSD */ - if (logit) + if (options & _HTTP_RESOLVE_STDERR) { -@@ -1511,13 +1579,13 @@ _httpResolveURI( +@@ -1622,13 +1701,13 @@ _httpResolveURI( fputs("STATE: -connecting-to-device,offline-report\n", stderr); } @@ -988,13 +998,17 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c -#endif /* HAVE_DNSSD */ +#endif /* HAVE_DNSSD || HAVE_AVAHI */ - if (logit && !uri) - _cupsLangPuts(stderr, _("Unable to find printer!\n")); -@@ -1722,6 +1790,105 @@ resolve_callback( + if ((options & _HTTP_RESOLVE_STDERR) && !uri) + _cupsLangPrintFilter(stderr, "ERROR", _("Unable to find printer.")); +@@ -1916,6 +1995,115 @@ http_resolve_cb( } #endif /* HAVE_DNSSD */ +#ifdef HAVE_AVAHI ++/* ++ * 'avahi_resolve_uri_client_cb()' - Avahi client callback for resolving URI. ++ */ ++ +static void +avahi_resolve_uri_client_cb (AvahiClient *client, + AvahiClientState state, @@ -1011,6 +1025,12 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c + avahi_simple_poll_quit (simple_poll); +} + ++ ++/* ++ * 'avahi_resolve_uri_resolver_cb()' - Avahi resolver callback for resolving ++ * URI. ++ */ ++ +static void +avahi_resolve_uri_resolver_cb (AvahiServiceResolver *resolver, + AvahiIfIndex interface, @@ -1095,4 +1115,4 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c + /* - * End of "$Id: http-support.c 9322 2010-10-01 22:40:38Z mike $". + * End of "$Id: http-support.c 10284 2012-02-15 01:06:12Z mike $". diff --git a/cups-avahi-3-timeouts.patch b/cups-avahi-3-timeouts.patch new file mode 100644 index 0000000..daf852a --- /dev/null +++ b/cups-avahi-3-timeouts.patch @@ -0,0 +1,381 @@ +diff -up cups-1.5.2/scheduler/cupsd.h.avahi-3-timeouts cups-1.5.2/scheduler/cupsd.h +--- cups-1.5.2/scheduler/cupsd.h.avahi-3-timeouts 2011-05-11 23:17:34.000000000 +0100 ++++ cups-1.5.2/scheduler/cupsd.h 2012-03-14 15:06:36.509476983 +0000 +@@ -140,6 +140,15 @@ extern const char *cups_hstrerror(int); + + typedef void (*cupsd_selfunc_t)(void *data); + ++#ifdef HAVE_AVAHI ++/* ++ * Timeout callback function type... ++ */ ++ ++typedef struct _cupsd_timeout_s cupsd_timeout_t; ++typedef void (*cupsd_timeoutfunc_t)(cupsd_timeout_t *timeout, void *data); ++#endif /* HAVE_AVAHI */ ++ + + /* + * Globals... +@@ -173,6 +182,11 @@ VAR int Launchd VALUE(0); + /* Running from launchd */ + #endif /* HAVE_LAUNCH_H */ + ++#ifdef HAVE_AVAHI ++VAR cups_array_t *Timeouts; /* Timed callbacks for main loop */ ++#endif /* HAVE_AVAHI */ ++ ++ + + /* + * Prototypes... +@@ -242,6 +256,20 @@ extern void cupsdStopSelect(void); + extern void cupsdStartServer(void); + extern void cupsdStopServer(void); + ++#ifdef HAVE_AVAHI ++extern void cupsdInitTimeouts(void); ++extern cupsd_timeout_t *cupsdAddTimeout (const struct timeval *tv, ++ cupsd_timeoutfunc_t cb, ++ void *data); ++extern cupsd_timeout_t *cupsdNextTimeout (long *delay); ++extern void cupsdRunTimeout (cupsd_timeout_t *timeout); ++extern void cupsdUpdateTimeout (cupsd_timeout_t *timeout, ++ const struct timeval *tv); ++extern void cupsdRemoveTimeout (cupsd_timeout_t *timeout); ++#endif /* HAVE_AVAHI */ ++ ++extern int cupsdRemoveFile(const char *filename); ++ + + /* + * End of "$Id: cupsd.h 9766 2011-05-11 22:17:34Z mike $". +diff -up cups-1.5.2/scheduler/main.c.avahi-3-timeouts cups-1.5.2/scheduler/main.c +--- cups-1.5.2/scheduler/main.c.avahi-3-timeouts 2012-03-14 15:04:17.655305548 +0000 ++++ cups-1.5.2/scheduler/main.c 2012-03-14 15:06:36.511476986 +0000 +@@ -146,6 +146,10 @@ main(int argc, /* I - Number of comm + int launchd_idle_exit; + /* Idle exit on select timeout? */ + #endif /* HAVE_LAUNCHD */ ++#ifdef HAVE_AVAHI ++ cupsd_timeout_t *tmo; /* Next scheduled timed callback */ ++ long tmo_delay; /* Time before it must be called */ ++#endif /* HAVE_AVAHI */ + + + #ifdef HAVE_GETEUID +@@ -535,6 +539,14 @@ main(int argc, /* I - Number of comm + + httpInitialize(); + ++#ifdef HAVE_AVAHI ++ /* ++ * Initialize timed callback structures. ++ */ ++ ++ cupsdInitTimeouts(); ++#endif /* HAVE_AVAHI */ ++ + cupsdStartServer(); + + /* +@@ -874,6 +886,16 @@ main(int argc, /* I - Number of comm + } + #endif /* __APPLE__ */ + ++#ifdef HAVE_AVAHI ++ /* ++ * If a timed callback is due, run it. ++ */ ++ ++ tmo = cupsdNextTimeout (&tmo_delay); ++ if (tmo && tmo_delay == 0) ++ cupsdRunTimeout (tmo); ++#endif /* HAVE_AVAHI */ ++ + #ifndef __APPLE__ + /* + * Update the network interfaces once a minute... +@@ -1787,6 +1809,10 @@ select_timeout(int fds) /* I - Number + cupsd_job_t *job; /* Job information */ + cupsd_subscription_t *sub; /* Subscription information */ + const char *why; /* Debugging aid */ ++#ifdef HAVE_AVAHI ++ cupsd_timeout_t *tmo; /* Timed callback */ ++ long tmo_delay; /* Seconds before calling it */ ++#endif /* HAVE_AVAHI */ + + + /* +@@ -1829,6 +1855,19 @@ select_timeout(int fds) /* I - Number + } + #endif /* __APPLE__ */ + ++#ifdef HAVE_AVAHI ++ /* ++ * See if there are any scheduled timed callbacks to run. ++ */ ++ ++ if ((tmo = cupsdNextTimeout(&tmo_delay)) != NULL && ++ (now + tmo_delay) < timeout) ++ { ++ timeout = tmo_delay; ++ why = "run a timed callback"; ++ } ++#endif /* HAVE_AVAHI */ ++ + /* + * Check whether we are accepting new connections... + */ +diff -up cups-1.5.2/scheduler/Makefile.avahi-3-timeouts cups-1.5.2/scheduler/Makefile +--- cups-1.5.2/scheduler/Makefile.avahi-3-timeouts 2012-03-14 15:04:17.685305586 +0000 ++++ cups-1.5.2/scheduler/Makefile 2012-03-14 15:06:36.508476980 +0000 +@@ -39,7 +39,8 @@ CUPSDOBJS = \ + server.o \ + statbuf.o \ + subscriptions.o \ +- sysman.o ++ sysman.o \ ++ timeout.o + LIBOBJS = \ + filter.o \ + mime.o \ +diff -up cups-1.5.2/scheduler/timeout.c.avahi-3-timeouts cups-1.5.2/scheduler/timeout.c +--- cups-1.5.2/scheduler/timeout.c.avahi-3-timeouts 2012-03-14 15:06:36.552477037 +0000 ++++ cups-1.5.2/scheduler/timeout.c 2012-03-14 15:06:36.552477037 +0000 +@@ -0,0 +1,235 @@ ++/* ++ * "$Id$" ++ * ++ * Timeout functions for the Common UNIX Printing System (CUPS). ++ * ++ * Copyright (C) 2010, 2011 Red Hat, Inc. ++ * Authors: ++ * Tim Waugh ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++ * OF THE POSSIBILITY OF SUCH DAMAGE. ++ * ++ * Contents: ++ * ++ * cupsdInitTimeouts() - Initialise timeout structure. ++ * cupsdAddTimeout() - Add a timed callback. ++ * cupsdNextTimeout() - Find the next enabled timed callback. ++ * cupsdUpdateTimeout() - Adjust the time of a timed callback or disable it. ++ * cupsdRemoveTimeout() - Discard a timed callback. ++ * compare_timeouts() - Compare timed callbacks for array sorting. ++ */ ++ ++#include ++ ++#ifdef HAVE_AVAHI /* Applies to entire file... */ ++ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "cupsd.h" ++ ++#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) ++# include ++#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */ ++ ++#ifdef HAVE_AVAHI ++# include ++#endif /* HAVE_AVAHI */ ++ ++ ++struct _cupsd_timeout_s ++{ ++ struct timeval when; ++ int enabled; ++ cupsd_timeoutfunc_t callback; ++ void *data; ++}; ++ ++/* ++ * Local functions... ++ */ ++ ++/* ++ * 'compare_timeouts()' - Compare timed callbacks for array sorting. ++ */ ++ ++static int ++compare_addrs (void *p0, void *p1) ++{ ++ if (p0 == p1) ++ return (0); ++ if (p0 < p1) ++ return (-1); ++ return (1); ++} ++ ++static int ++compare_timeouts (cupsd_timeout_t *p0, cupsd_timeout_t *p1) ++{ ++ int addrsdiff = compare_addrs (p0, p1); ++ int tvdiff; ++ ++ if (addrsdiff == 0) ++ return (0); ++ ++ if (!p0->enabled || !p1->enabled) ++ { ++ if (!p0->enabled && !p1->enabled) ++ return (addrsdiff); ++ ++ return (p0->enabled ? -1 : 1); ++ } ++ ++ tvdiff = avahi_timeval_compare (&p0->when, &p1->when); ++ if (tvdiff != 0) ++ return (tvdiff); ++ ++ return (addrsdiff); ++} ++ ++ ++/* ++ * 'cupsdInitTimeouts()' - Initialise timeout structures. ++ */ ++ ++void ++cupsdInitTimeouts(void) ++{ ++ Timeouts = cupsArrayNew ((cups_array_func_t)compare_timeouts, NULL); ++} ++ ++ ++/* ++ * 'cupsdAddTimeout()' - Add a timed callback. ++ */ ++ ++cupsd_timeout_t * /* O - Timeout handle */ ++cupsdAddTimeout(const struct timeval *tv, /* I - Absolute time */ ++ cupsd_timeoutfunc_t cb, /* I - Callback function */ ++ void *data) /* I - User data */ ++{ ++ cupsd_timeout_t *timeout; ++ ++ timeout = malloc (sizeof(cupsd_timeout_t)); ++ if (timeout != NULL) ++ { ++ timeout->enabled = (tv != NULL); ++ if (tv) ++ { ++ timeout->when.tv_sec = tv->tv_sec; ++ timeout->when.tv_usec = tv->tv_usec; ++ } ++ ++ timeout->callback = cb; ++ timeout->data = data; ++ cupsArrayAdd (Timeouts, timeout); ++ } ++ ++ return timeout; ++} ++ ++ ++/* ++ * 'cupsdNextTimeout()' - Find the next enabled timed callback. ++ */ ++ ++cupsd_timeout_t * /* O - Next enabled timeout or NULL */ ++cupsdNextTimeout(long *delay) /* O - Seconds before scheduled */ ++{ ++ cupsd_timeout_t *first = cupsArrayFirst (Timeouts); ++ struct timeval curtime; ++ ++ if (first && !first->enabled) ++ first = NULL; ++ ++ if (first && delay) ++ { ++ gettimeofday (&curtime, NULL); ++ if (avahi_timeval_compare (&curtime, &first->when) > 0) ++ { ++ *delay = 0; ++ } else { ++ *delay = 1 + first->when.tv_sec - curtime.tv_sec; ++ if (first->when.tv_usec < curtime.tv_usec) ++ (*delay)--; ++ } ++ } ++ ++ return (first); ++} ++ ++ ++/* ++ * 'cupsdRunTimeout()' - Run a timed callback. ++ */ ++ ++void ++cupsdRunTimeout(cupsd_timeout_t *timeout) /* I - Timeout */ ++{ ++ if (!timeout) ++ return; ++ timeout->enabled = 0; ++ if (!timeout->callback) ++ return; ++ timeout->callback (timeout, timeout->data); ++} ++ ++/* ++ * 'cupsdUpdateTimeout()' - Adjust the time of a timed callback or disable it. ++ */ ++ ++void ++cupsdUpdateTimeout(cupsd_timeout_t *timeout, /* I - Timeout */ ++ const struct timeval *tv) /* I - Absolute time or NULL */ ++{ ++ cupsArrayRemove (Timeouts, timeout); ++ timeout->enabled = (tv != NULL); ++ if (tv) ++ { ++ timeout->when.tv_sec = tv->tv_sec; ++ timeout->when.tv_usec = tv->tv_usec; ++ } ++ cupsArrayAdd (Timeouts, timeout); ++} ++ ++ ++/* ++ * 'cupsdRemoveTimeout()' - Discard a timed callback. ++ */ ++ ++void ++cupsdRemoveTimeout(cupsd_timeout_t *timeout) /* I - Timeout */ ++{ ++ cupsArrayRemove (Timeouts, timeout); ++ free (timeout); ++} ++ ++ ++#endif /* HAVE_AVAHI ... from top of file */ ++ ++/* ++ * End of "$Id$". ++ */ diff --git a/cups-avahi-4-poll.patch b/cups-avahi-4-poll.patch new file mode 100644 index 0000000..d7fa5fd --- /dev/null +++ b/cups-avahi-4-poll.patch @@ -0,0 +1,529 @@ +diff -up cups-1.5.2/scheduler/avahi.c.avahi-4-poll cups-1.5.2/scheduler/avahi.c +--- cups-1.5.2/scheduler/avahi.c.avahi-4-poll 2012-03-14 15:07:29.477542381 +0000 ++++ cups-1.5.2/scheduler/avahi.c 2012-03-14 15:07:29.477542381 +0000 +@@ -0,0 +1,441 @@ ++/* ++ * "$Id$" ++ * ++ * Avahi poll implementation for the CUPS scheduler. ++ * ++ * Copyright (C) 2010, 2011 Red Hat, Inc. ++ * Authors: ++ * Tim Waugh ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++ * OF THE POSSIBILITY OF SUCH DAMAGE. ++ * ++ * Contents: ++ * ++ * watch_read_cb - Read callback for file descriptor ++ * watch_write_cb - Write callback for file descriptor ++ * watched_fd_add_select() - Call cupsdAddSelect() as needed ++ * watch_new() - Create a new file descriptor watch ++ * watch_free() - Free a file descriptor watch ++ * watch_update() - Update watched events for a file descriptor ++ * watch_get_events() - Get events that happened for a file descriptor ++ * timeout_cb() - Run a timed Avahi callback ++ * timeout_new() - Set a wakeup time ++ * timeout_update() - Update the expiration time for a timeout ++ * timeout_free() - Free a timeout ++ * compare_watched_fds() - Compare watched file descriptors for array sorting ++ * avahi_cups_poll_new() - Create a new Avahi main loop object for CUPS ++ * avahi_cups_poll_free() - Free an Avahi main loop object for CUPS ++ * avahi_cups_poll_get() - Get the abstract poll API structure ++ */ ++ ++#include ++ ++#ifdef HAVE_AVAHI /* Applies to entire file... */ ++ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "cupsd.h" ++ ++#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) ++# include ++#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */ ++ ++#ifdef HAVE_AVAHI ++# include ++#endif /* HAVE_AVAHI */ ++ ++ ++typedef struct ++{ ++ AvahiCupsPoll *cups_poll; ++ ++ int fd; ++ AvahiWatchEvent occurred; ++ cups_array_t *watches; ++} cupsd_watched_fd_t; ++ ++struct AvahiWatch ++{ ++ cupsd_watched_fd_t *watched_fd; ++ ++ AvahiWatchEvent events; ++ AvahiWatchCallback callback; ++ void *userdata; ++}; ++ ++struct AvahiTimeout ++{ ++ AvahiCupsPoll *cups_poll; ++ AvahiTimeoutCallback callback; ++ void *userdata; ++ cupsd_timeout_t *cupsd_timeout; ++}; ++ ++/* ++ * Local functions... ++ */ ++ ++static AvahiWatch * watch_new(const AvahiPoll *api, ++ int fd, ++ AvahiWatchEvent events, ++ AvahiWatchCallback callback, ++ void *userdata); ++static void watch_free(AvahiWatch *watch); ++static void watch_update(AvahiWatch *watch, ++ AvahiWatchEvent events); ++static AvahiWatchEvent watch_get_events(AvahiWatch *watch); ++ ++ ++/* ++ * 'watch_read_cb' - Read callback for file descriptor ++ */ ++ ++static void ++watch_read_cb (void *userdata) ++{ ++ AvahiWatch *watch; ++ cupsd_watched_fd_t *watched_fd = userdata; ++ watched_fd->occurred |= AVAHI_WATCH_IN; ++ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches); ++ watch; ++ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) ++ { ++ if (watch->events & watched_fd->occurred) ++ { ++ (watch->callback) (watch, watched_fd->fd, ++ AVAHI_WATCH_IN, watch->userdata); ++ watched_fd->occurred &= ~AVAHI_WATCH_IN; ++ break; ++ } ++ } ++} ++ ++ ++/* ++ * 'watch_write_cb' - Write callback for file descriptor ++ */ ++ ++static void ++watch_write_cb (void *userdata) ++{ ++ AvahiWatch *watch; ++ cupsd_watched_fd_t *watched_fd = userdata; ++ watched_fd->occurred |= AVAHI_WATCH_OUT; ++ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches); ++ watch; ++ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) ++ { ++ if (watch->events & watched_fd->occurred) ++ { ++ (watch->callback) (watch, watched_fd->fd, ++ AVAHI_WATCH_OUT, watch->userdata); ++ watched_fd->occurred &= ~AVAHI_WATCH_OUT; ++ break; ++ } ++ } ++} ++ ++ ++/* ++ * 'watched_fd_add_select' - Call cupsdAddSelect() as needed ++ */ ++ ++static int /* O - Watches? */ ++watched_fd_add_select (cupsd_watched_fd_t *watched_fd) ++{ ++ AvahiWatch *watch; ++ cupsd_selfunc_t read_cb = NULL, write_cb = NULL; ++ int any_watches = 0; ++ ++ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches); ++ watch; ++ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) ++ { ++ any_watches = 1; ++ if (watch->events & (AVAHI_WATCH_IN | ++ AVAHI_WATCH_ERR | ++ AVAHI_WATCH_HUP)) ++ { ++ read_cb = (cupsd_selfunc_t)watch_read_cb; ++ if (write_cb != NULL) ++ break; ++ } ++ ++ if (watch->events & AVAHI_WATCH_OUT) ++ { ++ write_cb = (cupsd_selfunc_t)watch_write_cb; ++ if (read_cb != NULL) ++ break; ++ } ++ } ++ ++ if (read_cb || write_cb) ++ cupsdAddSelect (watched_fd->fd, read_cb, write_cb, watched_fd); ++ else ++ cupsdRemoveSelect (watched_fd->fd); ++ ++ return (any_watches); ++} ++ ++/* ++ * 'watch_new' - Create a new file descriptor watch ++ */ ++ ++static AvahiWatch * ++watch_new (const AvahiPoll *api, ++ int fd, ++ AvahiWatchEvent events, ++ AvahiWatchCallback callback, ++ void *userdata) ++{ ++ cupsd_watched_fd_t key, *watched_fd; ++ AvahiCupsPoll *cups_poll = api->userdata; ++ AvahiWatch *watch = malloc(sizeof(AvahiWatch)); ++ if (watch == NULL) ++ return (NULL); ++ ++ watch->events = events; ++ watch->callback = callback; ++ watch->userdata = userdata; ++ ++ key.fd = fd; ++ watched_fd = cupsArrayFind (cups_poll->watched_fds, &key); ++ if (watched_fd == NULL) ++ { ++ watched_fd = malloc(sizeof(cupsd_watched_fd_t)); ++ if (watched_fd == NULL) ++ { ++ free (watch); ++ return (NULL); ++ } ++ ++ watched_fd->fd = fd; ++ watched_fd->occurred = 0; ++ watched_fd->cups_poll = cups_poll; ++ watched_fd->watches = cupsArrayNew (NULL, NULL); ++ cupsArrayAdd (cups_poll->watched_fds, watched_fd); ++ } ++ ++ watch->watched_fd = watched_fd; ++ cupsArrayAdd(watched_fd->watches, watch); ++ watched_fd_add_select (watched_fd); ++ return (watch); ++} ++ ++ ++/* ++ * 'watch_free' - Free a file descriptor watch ++ */ ++ ++static void ++watch_free (AvahiWatch *watch) ++{ ++ cupsd_watched_fd_t *watched_fd = watch->watched_fd; ++ AvahiCupsPoll *cups_poll = watched_fd->cups_poll; ++ ++ cupsArrayRemove (watched_fd->watches, watch); ++ free (watch); ++ ++ if (!watched_fd_add_select (watched_fd)) ++ { ++ /* No more watches */ ++ cupsArrayRemove (cups_poll->watched_fds, watched_fd); ++ free (watched_fd); ++ } ++} ++ ++ ++/* ++ * 'watch_update' - Update watched events for a file descriptor ++ */ ++ ++static void ++watch_update (AvahiWatch *watch, ++ AvahiWatchEvent events) ++{ ++ watch->events = events; ++ watched_fd_add_select (watch->watched_fd); ++} ++ ++ ++/* ++ * 'watch_get_events' - Get events that happened for a file descriptor ++ */ ++ ++static AvahiWatchEvent ++watch_get_events (AvahiWatch *watch) ++{ ++ return (watch->watched_fd->occurred); ++} ++ ++ ++/* ++ * 'timeout_cb()' - Run a timed Avahi callback ++ */ ++ ++static void ++timeout_cb (cupsd_timeout_t *cupsd_timeout, void *userdata) ++{ ++ AvahiTimeout *timeout = userdata; ++ (timeout->callback) (timeout, timeout->userdata); ++} ++ ++ ++/* ++ * 'timeout_new' - Set a wakeup time ++ */ ++ ++static AvahiTimeout * ++timeout_new (const AvahiPoll *api, ++ const struct timeval *tv, ++ AvahiTimeoutCallback callback, ++ void *userdata) ++{ ++ AvahiTimeout *timeout; ++ AvahiCupsPoll *cups_poll = api->userdata; ++ ++ timeout = malloc(sizeof(AvahiTimeout)); ++ if (timeout == NULL) ++ return (NULL); ++ ++ timeout->cups_poll = cups_poll; ++ timeout->callback = callback; ++ timeout->userdata = userdata; ++ timeout->cupsd_timeout = cupsdAddTimeout (tv, ++ (cupsd_timeoutfunc_t)timeout_cb, ++ timeout); ++ cupsArrayAdd (cups_poll->timeouts, timeout); ++ return (timeout); ++} ++ ++ ++/* ++ * 'timeout_update' - Update the expiration time for a timeout ++ */ ++ ++static void ++timeout_update (AvahiTimeout *timeout, ++ const struct timeval *tv) ++{ ++ cupsdUpdateTimeout (timeout->cupsd_timeout, tv); ++} ++ ++ ++/* ++ * ' timeout_free' - Free a timeout ++ */ ++ ++static void ++timeout_free (AvahiTimeout *timeout) ++{ ++ cupsArrayRemove (timeout->cups_poll->timeouts, timeout); ++ cupsdRemoveTimeout (timeout->cupsd_timeout); ++ free (timeout); ++} ++ ++ ++/* ++ * 'compare_watched_fds' - Compare watched file descriptors for array sorting ++ */ ++static int ++compare_watched_fds(cupsd_watched_fd_t *p0, ++ cupsd_watched_fd_t *p1) ++{ ++ /* ++ * Compare by fd (no two elements have the same fd) ++ */ ++ ++ if (p0->fd == p1->fd) ++ return 0; ++ ++ return (p0->fd < p1->fd ? -1 : 1); ++} ++ ++ ++/* ++ * 'avahi_cups_poll_new' - Create a new Avahi main loop object for CUPS ++ */ ++ ++AvahiCupsPoll * ++avahi_cups_poll_new (void) ++{ ++ AvahiCupsPoll *cups_poll = malloc(sizeof(AvahiCupsPoll)); ++ if (cups_poll == NULL) ++ return (NULL); ++ ++ cups_poll->watched_fds = cupsArrayNew ((cups_array_func_t)compare_watched_fds, ++ NULL); ++ cups_poll->timeouts = cupsArrayNew (NULL, NULL); ++ ++ cups_poll->api.userdata = cups_poll; ++ cups_poll->api.watch_new = watch_new; ++ cups_poll->api.watch_free = watch_free; ++ cups_poll->api.watch_update = watch_update; ++ cups_poll->api.watch_get_events = watch_get_events; ++ ++ cups_poll->api.timeout_new = timeout_new; ++ cups_poll->api.timeout_update = timeout_update; ++ cups_poll->api.timeout_free = timeout_free; ++ ++ return (cups_poll); ++} ++ ++ ++/* ++ * 'avahi_cups_poll_free' - Free an Avahi main loop object for CUPS ++ */ ++void ++avahi_cups_poll_free (AvahiCupsPoll *cups_poll) ++{ ++ cupsd_watched_fd_t *watched_fd; ++ ++ for (watched_fd = (cupsd_watched_fd_t*)cupsArrayFirst(cups_poll->watched_fds); ++ watched_fd; ++ watched_fd = (cupsd_watched_fd_t*)cupsArrayNext(cups_poll->watched_fds)) ++ cupsArrayClear (watched_fd->watches); ++ ++ cupsArrayClear (cups_poll->watched_fds); ++ cupsArrayClear (cups_poll->timeouts); ++} ++ ++ ++/* ++ * 'avahi_cups_poll_get' - Get the abstract poll API structure ++ */ ++ ++const AvahiPoll * ++avahi_cups_poll_get (AvahiCupsPoll *cups_poll) ++{ ++ return (&cups_poll->api); ++} ++ ++ ++#endif /* HAVE_AVAHI ... from top of file */ ++ ++/* ++ * End of "$Id$". ++ */ +diff -up cups-1.5.2/scheduler/avahi.h.avahi-4-poll cups-1.5.2/scheduler/avahi.h +--- cups-1.5.2/scheduler/avahi.h.avahi-4-poll 2012-03-14 15:07:29.477542381 +0000 ++++ cups-1.5.2/scheduler/avahi.h 2012-03-14 15:07:29.477542381 +0000 +@@ -0,0 +1,69 @@ ++/* ++ * "$Id$" ++ * ++ * Avahi poll implementation for the CUPS scheduler. ++ * ++ * Copyright (C) 2010, 2011 Red Hat, Inc. ++ * Authors: ++ * Tim Waugh ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++ * OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include ++ ++#ifdef HAVE_AVAHI ++# include ++# include ++#endif /* HAVE_AVAHI */ ++ ++#ifdef HAVE_AUTHORIZATION_H ++# include ++#endif /* HAVE_AUTHORIZATION_H */ ++ ++ ++#ifdef HAVE_AVAHI ++typedef struct ++{ ++ AvahiPoll api; ++ cups_array_t *watched_fds; ++ cups_array_t *timeouts; ++} AvahiCupsPoll; ++#endif /* HAVE_AVAHI */ ++ ++/* ++ * Prototypes... ++ */ ++ ++#ifdef HAVE_AVAHI ++extern AvahiCupsPoll * avahi_cups_poll_new(void); ++extern void avahi_cups_poll_free(AvahiCupsPoll *cups_poll); ++extern const AvahiPoll *avahi_cups_poll_get(AvahiCupsPoll *cups_poll); ++#endif /* HAVE_AVAHI */ ++ ++ ++/* ++ * End of "$Id$". ++ */ +diff -up cups-1.5.2/scheduler/Makefile.avahi-4-poll cups-1.5.2/scheduler/Makefile +--- cups-1.5.2/scheduler/Makefile.avahi-4-poll 2012-03-14 15:06:36.508476980 +0000 ++++ cups-1.5.2/scheduler/Makefile 2012-03-14 15:07:29.476542380 +0000 +@@ -17,6 +17,7 @@ include ../Makedefs + + CUPSDOBJS = \ + auth.o \ ++ avahi.o \ + banners.o \ + cert.o \ + classes.o \ diff --git a/cups-avahi-5-services.patch b/cups-avahi-5-services.patch new file mode 100644 index 0000000..820b3c3 --- /dev/null +++ b/cups-avahi-5-services.patch @@ -0,0 +1,1272 @@ +diff -up cups-1.5.2/cgi-bin/admin.c.avahi-5-services cups-1.5.2/cgi-bin/admin.c +--- cups-1.5.2/cgi-bin/admin.c.avahi-5-services 2011-08-17 22:01:53.000000000 +0100 ++++ cups-1.5.2/cgi-bin/admin.c 2012-03-14 15:08:25.701611799 +0000 +@@ -1643,7 +1643,7 @@ do_config_server(http_t *http) /* I - H + else + local_protocols[0] = '\0'; + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + if (cgiGetVariable("BROWSE_LOCAL_DNSSD")) + { + if (local_protocols[0]) +@@ -1651,7 +1651,7 @@ do_config_server(http_t *http) /* I - H + else + strcat(local_protocols, "dnssd"); + } +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + #ifdef HAVE_LDAP + if (cgiGetVariable("BROWSE_LOCAL_LDAP")) +@@ -2718,9 +2718,9 @@ do_menu(http_t *http) /* I - HTTP conn + #endif /* HAVE_GSSAPI */ + cgiSetVariable("KERBEROS", ""); + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + cgiSetVariable("HAVE_DNSSD", "1"); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + #ifdef HAVE_LDAP + cgiSetVariable("HAVE_LDAP", "1"); +diff -up cups-1.5.2/scheduler/avahi.h.avahi-5-services cups-1.5.2/scheduler/avahi.h +--- cups-1.5.2/scheduler/avahi.h.avahi-5-services 2012-03-14 15:07:29.477542381 +0000 ++++ cups-1.5.2/scheduler/avahi.h 2012-03-14 15:08:25.701611799 +0000 +@@ -3,7 +3,7 @@ + * + * Avahi poll implementation for the CUPS scheduler. + * +- * Copyright (C) 2010, 2011 Red Hat, Inc. ++ * Copyright (C) 2010, 2011, 2012 Red Hat, Inc. + * Authors: + * Tim Waugh + * +@@ -32,37 +32,40 @@ + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +-#include ++#ifndef _CUPS_AVAHI_H_ ++# define _CUPS_AVAHI_H_ + +-#ifdef HAVE_AVAHI +-# include +-# include +-#endif /* HAVE_AVAHI */ ++/* ++ * Include necessary headers... ++ */ + +-#ifdef HAVE_AUTHORIZATION_H +-# include +-#endif /* HAVE_AUTHORIZATION_H */ ++# include + ++# ifdef HAVE_AVAHI ++# include ++# include ++# endif /* HAVE_AVAHI */ + +-#ifdef HAVE_AVAHI ++# ifdef HAVE_AVAHI + typedef struct + { + AvahiPoll api; + cups_array_t *watched_fds; + cups_array_t *timeouts; + } AvahiCupsPoll; +-#endif /* HAVE_AVAHI */ ++# endif /* HAVE_AVAHI */ + + /* + * Prototypes... + */ + +-#ifdef HAVE_AVAHI ++# ifdef HAVE_AVAHI + extern AvahiCupsPoll * avahi_cups_poll_new(void); + extern void avahi_cups_poll_free(AvahiCupsPoll *cups_poll); + extern const AvahiPoll *avahi_cups_poll_get(AvahiCupsPoll *cups_poll); +-#endif /* HAVE_AVAHI */ ++# endif /* HAVE_AVAHI */ + ++#endif /* !_CUPS_AVAHI_H_ */ + + /* + * End of "$Id$". +diff -up cups-1.5.2/scheduler/client.c.avahi-5-services cups-1.5.2/scheduler/client.c +--- cups-1.5.2/scheduler/client.c.avahi-5-services 2012-01-13 23:00:22.000000000 +0000 ++++ cups-1.5.2/scheduler/client.c 2012-03-14 15:08:25.703611797 +0000 +@@ -4989,7 +4989,7 @@ valid_host(cupsd_client_t *con) /* I - + !strncmp(host, "[::1]:", 6)); + } + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + /* + * Check if the hostname is something.local (Bonjour); if so, allow it. + */ +@@ -4998,7 +4998,7 @@ valid_host(cupsd_client_t *con) /* I - + (!_cups_strcasecmp(end, ".local") || !_cups_strncasecmp(end, ".local:", 7) || + !_cups_strcasecmp(end, ".local.") || !_cups_strncasecmp(end, ".local.:", 8))) + return (1); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + /* + * Check if the hostname is an IP address... +diff -up cups-1.5.2/scheduler/conf.c.avahi-5-services cups-1.5.2/scheduler/conf.c +--- cups-1.5.2/scheduler/conf.c.avahi-5-services 2012-03-14 15:04:17.636305526 +0000 ++++ cups-1.5.2/scheduler/conf.c 2012-03-14 15:08:25.706611803 +0000 +@@ -652,7 +652,7 @@ cupsdReadConfiguration(void) + Browsing = CUPS_DEFAULT_BROWSING; + DefaultShared = CUPS_DEFAULT_DEFAULT_SHARED; + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + cupsdSetString(&DNSSDRegType, "_ipp._tcp,_cups"); + #endif /* HAVE_DNSSD */ + +diff -up cups-1.5.2/scheduler/dirsvc.c.avahi-5-services cups-1.5.2/scheduler/dirsvc.c +--- cups-1.5.2/scheduler/dirsvc.c.avahi-5-services 2012-03-14 15:04:17.674305572 +0000 ++++ cups-1.5.2/scheduler/dirsvc.c 2012-03-14 15:08:25.709611806 +0000 +@@ -27,6 +27,7 @@ + * ldap_connect() - Start new LDAP connection + * ldap_reconnect() - Reconnect to LDAP Server + * ldap_disconnect() - Disconnect from LDAP Server ++ * cupsdStartAvahiClient() - Start an Avahi client if needed + * cupsdStartBrowsing() - Start sending and receiving broadcast + * information. + * cupsdStartPolling() - Start polling servers as needed. +@@ -40,11 +41,12 @@ + * dequote() - Remote quotes from a string. + * dnssdAddAlias() - Add a DNS-SD alias name. + * dnssdBuildTxtRecord() - Build a TXT record from printer info. +- * dnssdComparePrinters() - Compare the registered names of two printers. + * dnssdDeregisterPrinter() - Stop sending broadcast information for a + * printer. + * dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT + * record format. ++ * avahiPackTxtRecord() - Pack an array of key/value pairs into an ++ * AvahiStringList. + * dnssdRegisterCallback() - DNSServiceRegister callback. + * dnssdRegisterPrinter() - Start sending broadcast information for a + * printer or update the broadcast contents. +@@ -83,6 +85,7 @@ + */ + + #include "cupsd.h" ++#include + #include + + #ifdef HAVE_DNSSD +@@ -97,6 +100,17 @@ + # endif /* HAVE_SYSTEMCONFIGURATION */ + # endif /* __APPLE__ */ + #endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++# include ++#endif /* HAVE_AVAHI */ ++ ++ ++#ifdef HAVE_DNSSD ++typedef char *cupsd_txt_record_t; ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++typedef AvahiStringList *cupsd_txt_record_t; ++#endif /* HAVE_AVAHI */ + + + /* +@@ -159,27 +173,38 @@ static void update_polling(void); + static void update_smb(int onoff); + + ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) ++static cupsd_txt_record_t dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p, ++ int for_lpd); ++static void dnssdDeregisterPrinter(cupsd_printer_t *p); ++static void dnssdRegisterPrinter(cupsd_printer_t *p); ++static void dnssdStop(void); ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ ++ + #ifdef HAVE_DNSSD + # ifdef HAVE_COREFOUNDATION + static void dnssdAddAlias(const void *key, const void *value, + void *context); + # endif /* HAVE_COREFOUNDATION */ +-static char *dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p, +- int for_lpd); +-static int dnssdComparePrinters(cupsd_printer_t *a, cupsd_printer_t *b); +-static void dnssdDeregisterPrinter(cupsd_printer_t *p); +-static char *dnssdPackTxtRecord(int *txt_len, char *keyvalue[][2], +- int count); + static void dnssdRegisterCallback(DNSServiceRef sdRef, + DNSServiceFlags flags, + DNSServiceErrorType errorCode, + const char *name, const char *regtype, + const char *domain, void *context); +-static void dnssdRegisterPrinter(cupsd_printer_t *p); +-static void dnssdStop(void); + static void dnssdUpdate(void); + #endif /* HAVE_DNSSD */ + ++#ifdef HAVE_AVAHI ++static AvahiStringList *avahiPackTxtRecord(char *keyvalue[][2], ++ int count); ++static void avahi_entry_group_cb (AvahiEntryGroup *group, ++ AvahiEntryGroupState state, ++ void *userdata); ++static void avahi_client_cb (AvahiClient *client, ++ AvahiClientState state, ++ void *userdata); ++#endif /* HAVE_AVAHI */ ++ + #ifdef HAVE_LDAP + static const char * const ldap_attrs[] =/* CUPS LDAP attributes */ + { +@@ -283,10 +308,10 @@ cupsdDeregisterPrinter( + ldap_dereg_printer(p); + #endif /* HAVE_LDAP */ + +-#ifdef HAVE_DNSSD +- if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef) ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) ++ if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD)) + dnssdDeregisterPrinter(p); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + } + + +@@ -702,10 +727,10 @@ cupsdRegisterPrinter(cupsd_printer_t *p) + slpRegisterPrinter(p); */ + #endif /* HAVE_LIBSLP */ + +-#ifdef HAVE_DNSSD +- if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef) ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) ++ if ((BrowseLocalProtocols & BROWSE_DNSSD)) + dnssdRegisterPrinter(p); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + } + + +@@ -1419,6 +1444,36 @@ ldap_disconnect(LDAP *ld) /* I - LDAP h + #endif /* HAVE_LDAP */ + + ++#ifdef HAVE_AVAHI ++/* ++ * 'cupsdStartAvahiClient()' - Start an Avahi client if needed ++ */ ++ ++void ++cupsdStartAvahiClient(void) ++{ ++ int error = 0; ++ ++ if (!AvahiCupsClient && !AvahiCupsClientConnecting) ++ { ++ if (!AvahiCupsPollHandle) ++ AvahiCupsPollHandle = avahi_cups_poll_new (); ++ ++ if (AvahiCupsPollHandle) ++ { ++ if (avahi_client_new (avahi_cups_poll_get (AvahiCupsPollHandle), ++ AVAHI_CLIENT_NO_FAIL, ++ avahi_client_cb, NULL, ++ &error) != NULL) ++ AvahiCupsClientConnecting = 1; ++ else ++ cupsdLogMessage (CUPSD_LOG_WARN, "Avahi client failed: %d", error); ++ } ++ } ++} ++#endif /* HAVE_AVAHI */ ++ ++ + /* + * 'cupsdStartBrowsing()' - Start sending and receiving broadcast information. + */ +@@ -1542,13 +1597,16 @@ cupsdStartBrowsing(void) + else + BrowseSocket = -1; + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_DNSSD) + { ++#ifdef HAVE_DNSSD + DNSServiceErrorType error; /* Error from service creation */ ++#endif /* HAVE_DNSSD */ + cupsd_listener_t *lis; /* Current listening socket */ + + ++#ifdef HAVE_DNSSD + /* + * First create a "master" connection for all registrations... + */ +@@ -1573,6 +1631,7 @@ cupsdStartBrowsing(void) + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); + + cupsdAddSelect(fd, (cupsd_selfunc_t)dnssdUpdate, NULL, NULL); ++#endif /* HAVE_DNSSD */ + + /* + * Then get the port we use for registrations. If we are not listening +@@ -1598,17 +1657,23 @@ cupsdStartBrowsing(void) + */ + + if (BrowseRemoteProtocols & BROWSE_DNSSD) +- DNSSDPrinters = cupsArrayNew((cups_array_func_t)dnssdComparePrinters, +- NULL); ++ DNSSDPrinters = cupsArrayNew(NULL, NULL); + + /* + * Set the computer name and register the web interface... + */ + + cupsdUpdateDNSSDName(); ++ ++#ifdef HAVE_AVAHI ++ cupsdStartAvahiClient (); ++#endif /* HAVE_AVAHI */ ++ ++#ifdef HAVE_DNSSD + } +- } + #endif /* HAVE_DNSSD */ ++ } ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + #ifdef HAVE_LIBSLP + if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) +@@ -1834,10 +1899,10 @@ cupsdStopBrowsing(void) + BrowseSocket = -1; + } + +-#ifdef HAVE_DNSSD +- if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef) ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) ++ if ((BrowseLocalProtocols & BROWSE_DNSSD)) + dnssdStop(); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + #ifdef HAVE_LIBSLP + if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) && +@@ -1902,7 +1967,7 @@ cupsdStopPolling(void) + } + + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + /* + * 'cupsdUpdateDNSSDName()' - Update the computer name we use for browsing... + */ +@@ -1910,8 +1975,14 @@ cupsdStopPolling(void) + void + cupsdUpdateDNSSDName(void) + { ++#ifdef HAVE_DNSSD + DNSServiceErrorType error; /* Error from service creation */ + char webif[1024]; /* Web interface share name */ ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ int ret; /* Error from service creation */ ++ char webif[AVAHI_LABEL_MAX]; /* Web interface share name */ ++#endif /* HAVE_AVAHI */ + # ifdef HAVE_SYSTEMCONFIGURATION + SCDynamicStoreRef sc; /* Context for dynamic store */ + CFDictionaryRef btmm; /* Back-to-My-Mac domains */ +@@ -2042,6 +2113,7 @@ cupsdUpdateDNSSDName(void) + else + strlcpy(webif, "CUPS Web Interface", sizeof(webif)); + ++#ifdef HAVE_DNSSD + if (WebIFRef) + DNSServiceRefDeallocate(WebIFRef); + +@@ -2054,9 +2126,45 @@ cupsdUpdateDNSSDName(void) + NULL)) != kDNSServiceErr_NoError) + cupsdLogMessage(CUPSD_LOG_ERROR, + "DNS-SD web interface registration failed: %d", error); ++#endif /* HAVE_DNSSD */ ++ ++#ifdef HAVE_AVAHI ++ if (!AvahiCupsClient) ++ /* ++ * Client not yet running. ++ */ ++ return; ++ ++ if (AvahiWebIFGroup) ++ avahi_entry_group_reset (AvahiWebIFGroup); ++ else ++ AvahiWebIFGroup = avahi_entry_group_new (AvahiCupsClient, ++ avahi_entry_group_cb, ++ NULL); ++ ++ if (AvahiWebIFGroup) ++ { ++ ret = avahi_entry_group_add_service (AvahiWebIFGroup, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, /* flags */ ++ webif, /* name */ ++ "_http._tcp", /* type */ ++ NULL, /* domain */ ++ NULL, /* host */ ++ DNSSDPort, /* port */ ++ "path=/", NULL); ++ if (ret == 0) ++ ret = avahi_entry_group_commit (AvahiWebIFGroup); ++ ++ if (ret != 0) ++ cupsdLogMessage (CUPSD_LOG_ERROR, ++ "Avahi web interface registration failed: %d", ret); ++ } ++#endif /* HAVE_AVAHI */ + } + } +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + + #ifdef HAVE_LDAP +@@ -2334,13 +2442,15 @@ dnssdAddAlias(const void *key, /* I - K + "Bad Back to My Mac domain in dynamic store!"); + } + # endif /* HAVE_COREFOUNDATION */ ++#endif /* HAVE_DNSSD */ + + ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + /* + * 'dnssdBuildTxtRecord()' - Build a TXT record from printer info. + */ + +-static char * /* O - TXT record */ ++static cupsd_txt_record_t /* O - TXT record */ + dnssdBuildTxtRecord( + int *txt_len, /* O - TXT record length */ + cupsd_printer_t *p, /* I - Printer information */ +@@ -2379,7 +2489,12 @@ dnssdBuildTxtRecord( + keyvalue[i ][0] = "ty"; + keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown"; + +- snprintf(admin_hostname, sizeof(admin_hostname), "%s.local.", DNSSDHostName); ++ snprintf(admin_hostname, sizeof(admin_hostname), ++ "%s.local" ++#ifdef HAVE_DNSSD ++ "." /* terminating dot no good for Avahi */ ++#endif /* HAVE_DNSSD */ ++ , DNSSDHostName); + httpAssembleURIf(HTTP_URI_CODING_ALL, adminurl_str, sizeof(adminurl_str), + "http", NULL, admin_hostname, DNSSDPort, "/%s/%s", + (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers", +@@ -2462,19 +2577,12 @@ dnssdBuildTxtRecord( + * Then pack them into a proper txt record... + */ + ++#ifdef HAVE_DNSSD + return (dnssdPackTxtRecord(txt_len, keyvalue, i)); +-} +- +- +-/* +- * 'dnssdComparePrinters()' - Compare the registered names of two printers. +- */ +- +-static int /* O - Result of comparison */ +-dnssdComparePrinters(cupsd_printer_t *a,/* I - First printer */ +- cupsd_printer_t *b)/* I - Second printer */ +-{ +- return (_cups_strcasecmp(a->reg_name, b->reg_name)); ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ return (avahiPackTxtRecord(keyvalue, i)); ++#endif /* HAVE_AVAHI */ + } + + +@@ -2489,6 +2597,10 @@ dnssdDeregisterPrinter( + { + cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdDeregisterPrinter(%s)", p->name); + ++#ifdef HAVE_DNSSD ++ if (!DNSSDRef) ++ return; ++ + /* + * Closing the socket deregisters the service + */ +@@ -2524,6 +2636,24 @@ dnssdDeregisterPrinter( + free(p->printer_txt); + p->printer_txt = NULL; + } ++#endif /* HAVE_DNSSD */ ++ ++#ifdef HAVE_AVAHI ++ if (p->avahi_group) ++ { ++ avahi_entry_group_reset (p->avahi_group); ++ avahi_entry_group_free (p->avahi_group); ++ p->avahi_group = NULL; ++ ++ if (p->ipp_txt) ++ avahi_string_list_free (p->ipp_txt); ++ ++ if (p->printer_txt) ++ avahi_string_list_free (p->printer_txt); ++ ++ p->ipp_txt = p->printer_txt = NULL; ++ } ++#endif /* HAVE_AVAHI */ + + /* + * Remove the printer from the array of DNS-SD printers, then clear the +@@ -2533,8 +2663,10 @@ dnssdDeregisterPrinter( + cupsArrayRemove(DNSSDPrinters, p); + cupsdClearString(&p->reg_name); + } ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + ++#ifdef HAVE_DNSSD + /* + * 'dnssdPackTxtRecord()' - Pack an array of key/value pairs into the + * TXT record format. +@@ -2644,8 +2776,10 @@ dnssdRegisterCallback( + LastEvent |= CUPSD_EVENT_PRINTER_MODIFIED; + } + } ++#endif /* HAVE_DNSSD */ + + ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + /* + * 'dnssdRegisterPrinter()' - Start sending broadcast information for a printer + * or update the broadcast contents. +@@ -2654,20 +2788,40 @@ dnssdRegisterCallback( + static void + dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */ + { ++#ifdef HAVE_DNSSD + DNSServiceErrorType se; /* dnssd errors */ + char *ipp_txt, /* IPP TXT record buffer */ + *printer_txt, /* LPD TXT record buffer */ +- name[1024], /* Service name */ +- *nameptr; /* Pointer into name */ ++ name[1024]; /* Service name */ + int ipp_len, /* IPP TXT record length */ + printer_len, /* LPD TXT record length */ + printer_port; /* LPD port number */ ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ int ret; /* Error code */ ++ AvahiStringList *ipp_txt, /* IPP TXT record */ ++ *printer_txt; /* LPD TXT record */ ++ char name[AVAHI_LABEL_MAX], /* Service name */ ++ fullsubtype[AVAHI_LABEL_MAX]; /* Full subtype */ ++ char *regtype_copy, /* Writeable copy of reg type */ ++ *subtype, /* Current service sub type */ ++ *nextsubtype; /* Next service sub type */ ++#endif /* HAVE_AVAHI */ ++ char *nameptr; /* Pointer into name */ + const char *regtype; /* Registration type */ + + ++#ifdef HAVE_DNSSD ++ if (!DNSSDRef) ++ return; ++ + cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name, + !p->ipp_ref ? "new" : "update"); +- ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name, ++ !p->avahi_group ? "new" : "update"); ++#endif /* HAVE_AVAHI */ + /* + * If per-printer sharing was just disabled make sure we're not + * registered before returning. +@@ -2686,12 +2840,36 @@ dnssdRegisterPrinter(cupsd_printer_t *p) + if (p->info && strlen(p->info) > 0) + { + if (DNSSDComputerName) +- snprintf(name, sizeof(name), "%s @ %s", p->info, DNSSDComputerName); ++ { ++ /* ++ * Make sure there is room for at least 15 characters of ++ * DNSSDComputerName. ++ */ ++ ++ assert(sizeof(name) >= 15 + 4); ++ nameptr = name + strlcpy(name, p->info, ++ sizeof(name) - 4 - ++ strnlen(DNSSDComputerName, 15)); ++ nameptr += strlcpy(nameptr, " @ ", sizeof(name) - (nameptr - name)); ++ strlcpy(nameptr, DNSSDComputerName, sizeof(name) - (nameptr - name)); ++ } + else + strlcpy(name, p->info, sizeof(name)); + } + else if (DNSSDComputerName) +- snprintf(name, sizeof(name), "%s @ %s", p->name, DNSSDComputerName); ++ { ++ /* ++ * Make sure there is room for at least 15 characters of ++ * DNSSDComputerName. ++ */ ++ ++ assert(sizeof(name) >= 15 + 4); ++ nameptr = name + strlcpy(name, p->info, ++ sizeof(name) - 4 - ++ strnlen(DNSSDComputerName, 15)); ++ nameptr += strlcpy(nameptr, " @ ", sizeof(name) - (nameptr - name)); ++ strlcpy(nameptr, DNSSDComputerName, sizeof(name) - (nameptr - name)); ++ } + else + strlcpy(name, p->name, sizeof(name)); + +@@ -2712,6 +2890,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p) + * Register IPP and (optionally) LPD... + */ + ++#ifdef HAVE_DNSSD + ipp_len = 0; /* anti-compiler-warning-code */ + ipp_txt = dnssdBuildTxtRecord(&ipp_len, p, 0); + +@@ -2884,6 +3063,209 @@ dnssdRegisterPrinter(cupsd_printer_t *p) + + if (printer_txt) + free(printer_txt); ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ if (!AvahiCupsClient) ++ /* ++ * Client not running yet. The client callback will call us again later. ++ */ ++ return; ++ ++ ipp_txt = dnssdBuildTxtRecord(NULL, p, 0); ++ printer_txt = dnssdBuildTxtRecord(NULL, p, 1); ++ regtype = (p->type & CUPS_PRINTER_FAX) ? "_fax-ipp._tcp" : DNSSDRegType; ++ ++ if (p->avahi_group && p->ipp_txt && ipp_txt && ++ !avahi_string_list_equal (p->ipp_txt, ipp_txt)) ++ { ++ /* ++ * Update the existing registration... ++ */ ++ ++ avahi_string_list_free (p->ipp_txt); ++ ++ if (p->printer_txt) ++ avahi_string_list_free (p->printer_txt); ++ ++ /* ++ * Update the service group entry. ++ */ ++ ++ regtype_copy = strdup (regtype); ++ subtype = strchr (regtype_copy, ','); ++ if (subtype) ++ *subtype = '\0'; ++ ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Updating TXT record for %s (%s)", name, regtype_copy); ++ ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, ++ regtype_copy, ++ NULL, ipp_txt); ++ free (regtype_copy); ++ ++ if (ret < 0) ++ goto update_failed; ++ ++ p->ipp_txt = ipp_txt; ++ ipp_txt = NULL; ++ ++ if (BrowseLocalProtocols & BROWSE_LPD) ++ { ++ ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, ++ "_printer._tcp", NULL, ++ printer_txt); ++ if (ret < 0) ++ goto update_failed; ++ ++ p->printer_txt = printer_txt; ++ printer_txt = NULL; ++ } ++ ++ ret = avahi_entry_group_commit (p->avahi_group); ++ if (ret < 0) ++ { ++ update_failed: ++ cupsdLogMessage (CUPSD_LOG_ERROR, ++ "Failed to update TXT record for %s: %d", ++ name, ret); ++ avahi_entry_group_reset (p->avahi_group); ++ avahi_entry_group_free (p->avahi_group); ++ p->avahi_group = NULL; ++ ipp_txt = p->ipp_txt; ++ p->ipp_txt = NULL; ++ } ++ } ++ ++ if (!p->avahi_group) ++ { ++ /* ++ * Initial registration. Use the _fax subtype for fax queues... ++ */ ++ ++ p->avahi_group = avahi_entry_group_new (AvahiCupsClient, ++ avahi_entry_group_cb, ++ p); ++ ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "Registering Avahi printer %s with name \"%s\" and " ++ "type \"%s\"", p->name, name, regtype); ++ ++ if (!p->avahi_group) ++ { ++ ret = 0; ++ goto add_failed; ++ } ++ ++ /* ++ * Add each service type (DNSSDRegType may contain several, ++ * separated by commas). ++ */ ++ ++ subtype = regtype_copy = strdup (regtype); ++ while (subtype && *subtype) ++ { ++ nextsubtype = strchr (subtype, ','); ++ if (nextsubtype) ++ *nextsubtype++ = '\0'; ++ ++ if (subtype == regtype_copy) ++ { ++ /* ++ * Main type entry. ++ */ ++ ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Adding TXT record for %s (%s)", name, regtype_copy); ++ ret = avahi_entry_group_add_service_strlst (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, regtype_copy, ++ NULL, NULL, ++ DNSSDPort, ++ ipp_txt); ++ } ++ else ++ { ++ /* ++ * Sub-type entry. ++ */ ++ ++ snprintf (fullsubtype, sizeof(fullsubtype), ++ "%s._sub.%s", subtype, regtype_copy); ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Adding TXT record for %s (%s)", name, fullsubtype); ++ ret = avahi_entry_group_add_service_subtype (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, ++ regtype_copy, ++ NULL, fullsubtype); ++ } ++ ++ if (ret < 0) ++ { ++ free (regtype_copy); ++ goto add_failed; ++ } ++ ++ subtype = nextsubtype; ++ } ++ ++ free (regtype_copy); ++ p->ipp_txt = ipp_txt; ++ ipp_txt = NULL; ++ ++ if (BrowseLocalProtocols & BROWSE_LPD) ++ { ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "Registering Avahi printer %s with name \"%s\" and " ++ "type \"_printer._tcp\"", p->name, name); ++ ++ ret = avahi_entry_group_add_service_strlst (p->avahi_group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, name, ++ "_printer._tcp", NULL, NULL, ++ 515, ++ printer_txt); ++ if (ret < 0) ++ goto add_failed; ++ ++ p->printer_txt = printer_txt; ++ printer_txt = NULL; ++ } ++ ++ ret = avahi_entry_group_commit (p->avahi_group); ++ ++ if (ret < 0) ++ { ++ add_failed: ++ cupsdLogMessage (CUPSD_LOG_ERROR, ++ "Failed to add Avahi entry for %s: %d", ++ name, ret); ++ if (p->avahi_group) ++ { ++ avahi_entry_group_reset (p->avahi_group); ++ avahi_entry_group_free (p->avahi_group); ++ p->avahi_group = NULL; ++ } ++ ipp_txt = p->ipp_txt; ++ p->ipp_txt = NULL; ++ } ++ } ++ ++ if (ipp_txt) ++ avahi_string_list_free (ipp_txt); ++ ++ if (printer_txt) ++ avahi_string_list_free (printer_txt); ++#endif /* HAVE_AVAHI */ + } + + +@@ -2896,6 +3278,10 @@ dnssdStop(void) + { + cupsd_printer_t *p; /* Current printer */ + ++#ifdef HAVE_DNSSD ++ if (!DNSSDRef) ++ return; ++#endif /* HAVE_DNSSD */ + + /* + * De-register the individual printers +@@ -2910,12 +3296,23 @@ dnssdStop(void) + * Shutdown the rest of the service refs... + */ + ++#ifdef HAVE_DNSSD + if (WebIFRef) + { + DNSServiceRefDeallocate(WebIFRef); + WebIFRef = NULL; + } ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ if (AvahiWebIFGroup) ++ { ++ avahi_entry_group_reset (AvahiWebIFGroup); ++ avahi_entry_group_free (AvahiWebIFGroup); ++ AvahiWebIFGroup = NULL; ++ } ++#endif /* HAVE_AVAHI */ + ++#ifdef HAVE_DNSSD + if (RemoteRef) + { + DNSServiceRefDeallocate(RemoteRef); +@@ -2926,14 +3323,17 @@ dnssdStop(void) + + DNSServiceRefDeallocate(DNSSDRef); + DNSSDRef = NULL; ++#endif /* HAVE_DNSSD */ + + cupsArrayDelete(DNSSDPrinters); + DNSSDPrinters = NULL; + + DNSSDPort = 0; + } ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + ++#ifdef HAVE_DNSSD + /* + * 'dnssdUpdate()' - Handle DNS-SD queries. + */ +@@ -2955,6 +3355,153 @@ dnssdUpdate(void) + #endif /* HAVE_DNSSD */ + + ++#ifdef HAVE_AVAHI ++/* ++ * 'avahiPackTxtRecord()' - Pack an array of key/value pairs into an ++ * AvahiStringList. ++ */ ++ ++static AvahiStringList * /* O - new string list */ ++avahiPackTxtRecord(char *keyvalue[][2], /* I - Table of key value pairs */ ++ int count) /* I - Number of items in table */ ++{ ++ AvahiStringList *strlst = NULL; ++ char **elements; ++ size_t len; ++ int i = 0; ++ ++ elements = malloc ((1 + count) * sizeof (char *)); ++ if (!elements) ++ goto cleanup; ++ ++ for (i = 0; i < count; i++) ++ { ++ len = (1 + strlen (keyvalue[i][0]) + ++ (keyvalue[i][1] ? 1 + strlen (keyvalue[i][1]) : 1)); ++ elements[i] = malloc (len * sizeof (char)); ++ if (!elements[i]) ++ goto cleanup; ++ ++ snprintf (elements[i], len, "%s=%s", keyvalue[i][0], keyvalue[i][1]); ++ } ++ ++ strlst = avahi_string_list_new_from_array ((const char **) elements, count); ++ ++cleanup: ++ while (--i >= 0) ++ free (elements[i]); ++ ++ free (elements); ++ return (strlst); ++} ++ ++ ++/* ++ * 'avahi_entry_group_cb()' - Avahi entry group callback function. ++ */ ++static void ++avahi_entry_group_cb (AvahiEntryGroup *group, ++ AvahiEntryGroupState state, ++ void *userdata) ++{ ++ char *name; ++ ++ if (userdata) ++ name = ((cupsd_printer_t *) userdata)->reg_name; ++ else ++ name = "CUPS web interface"; ++ ++ switch (state) ++ { ++ case AVAHI_ENTRY_GROUP_UNCOMMITED: ++ case AVAHI_ENTRY_GROUP_REGISTERING: ++ break; ++ ++ case AVAHI_ENTRY_GROUP_ESTABLISHED: ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Avahi entry group established for %s", name); ++ break; ++ ++ default: ++ cupsdLogMessage (CUPSD_LOG_DEBUG, ++ "Avahi entry group %s has state %d", ++ name, state); ++ break; ++ } ++} ++ ++ ++/* ++ * 'avahi_client_cb()' - Avahi client callback function. ++ */ ++static void ++avahi_client_cb (AvahiClient *client, ++ AvahiClientState state, ++ void *userdata) ++{ ++ cupsd_printer_t *printer; ++ switch (state) ++ { ++ case AVAHI_CLIENT_S_RUNNING: ++ /* ++ * Avahi client started successfully. ++ */ ++ AvahiCupsClient = client; ++ AvahiCupsClientConnecting = 0; ++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client started"); ++ ++ cupsdUpdateDNSSDName (); ++ ++ for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers); ++ printer; ++ printer = (cupsd_printer_t *)cupsArrayNext(Printers)) ++ if (Browsing && (BrowseLocalProtocols & BROWSE_DNSSD) && ++ (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT | ++ CUPS_PRINTER_SCANNER))) && printer->shared) ++ dnssdRegisterPrinter (printer); ++ ++ break; ++ ++ case AVAHI_CLIENT_CONNECTING: ++ /* ++ * No Avahi daemon, client is waiting. ++ */ ++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client connecting"); ++ break; ++ ++ case AVAHI_CLIENT_S_REGISTERING: ++ /* ++ * Not yet registered. ++ */ ++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client registering"); ++ break; ++ ++ case AVAHI_CLIENT_FAILURE: ++ /* ++ * Avahi client failed, close it to allow a clean restart. ++ */ ++ cupsdLogMessage (CUPSD_LOG_ERROR, ++ "Avahi client failed, " ++ "closing client to allow a clean restart"); ++ ++ for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers); ++ printer; ++ printer = (cupsd_printer_t *)cupsArrayNext(Printers)) ++ dnssdDeregisterPrinter (printer); ++ ++ avahi_client_free(client); ++ AvahiCupsClientConnecting = 0; ++ AvahiCupsClient = NULL; ++ ++ break; ++ ++ default: ++ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client state: %d", state); ++ } ++} ++#endif /* HAVE_AVAHI */ ++ ++ + /* + * 'get_auth_info_required()' - Get the auth-info-required value to advertise. + */ +diff -up cups-1.5.2/scheduler/dirsvc.h.avahi-5-services cups-1.5.2/scheduler/dirsvc.h +--- cups-1.5.2/scheduler/dirsvc.h.avahi-5-services 2011-03-21 02:12:14.000000000 +0000 ++++ cups-1.5.2/scheduler/dirsvc.h 2012-03-14 15:08:25.711611808 +0000 +@@ -31,6 +31,10 @@ + # endif /* HAVE_LDAP_SSL_H */ + #endif /* HAVE_LDAP */ + ++#ifdef HAVE_AVAHI ++# include ++#endif /* HAVE_AVAHI */ ++ + /* + * Browse protocols... + */ +@@ -131,19 +135,22 @@ VAR int PollPipe VALUE(0); + VAR cupsd_statbuf_t *PollStatusBuffer VALUE(NULL); + /* Status buffer for pollers */ + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + VAR char *DNSSDComputerName VALUE(NULL), + /* Computer/server name */ + *DNSSDHostName VALUE(NULL), + /* Hostname */ + *DNSSDRegType VALUE(NULL); + /* Bonjour registration type */ +-VAR cups_array_t *DNSSDAlias VALUE(NULL); +- /* List of dynamic ServerAlias's */ + VAR int DNSSDPort VALUE(0); + /* Port number to register */ + VAR cups_array_t *DNSSDPrinters VALUE(NULL); + /* Printers we have registered */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ ++ ++#ifdef HAVE_DNSSD ++VAR cups_array_t *DNSSDAlias VALUE(NULL); ++ /* List of dynamic ServerAlias's */ + VAR DNSServiceRef DNSSDRef VALUE(NULL), + /* Master DNS-SD service reference */ + WebIFRef VALUE(NULL), +@@ -152,6 +159,17 @@ VAR DNSServiceRef DNSSDRef VALUE(NULL), + /* Remote printer browse reference */ + #endif /* HAVE_DNSSD */ + ++#ifdef HAVE_AVAHI ++VAR AvahiCupsPoll *AvahiCupsPollHandle VALUE(NULL); ++ /* AvahiCupsPoll object */ ++VAR AvahiClient *AvahiCupsClient VALUE(NULL); ++ /* AvahiClient object */ ++VAR int AvahiCupsClientConnecting VALUE(0); ++ /* Is AvahiClient object connecting? */ ++VAR AvahiEntryGroup *AvahiWebIFGroup VALUE(NULL); ++ /* Web interface entry group */ ++#endif /* HAVE_AVAHI */ ++ + #ifdef HAVE_LIBSLP + VAR SLPHandle BrowseSLPHandle VALUE(NULL); + /* SLP API handle */ +@@ -195,13 +213,14 @@ extern void cupsdRegisterPrinter(cupsd_p + extern void cupsdRestartPolling(void); + extern void cupsdSaveRemoteCache(void); + extern void cupsdSendBrowseList(void); ++extern void cupsdStartAvahiClient(void); + extern void cupsdStartBrowsing(void); + extern void cupsdStartPolling(void); + extern void cupsdStopBrowsing(void); + extern void cupsdStopPolling(void); +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + extern void cupsdUpdateDNSSDName(void); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + #ifdef HAVE_LDAP + extern void cupsdUpdateLDAPBrowse(void); + #endif /* HAVE_LDAP */ +diff -up cups-1.5.2/scheduler/ipp.c.avahi-5-services cups-1.5.2/scheduler/ipp.c +--- cups-1.5.2/scheduler/ipp.c.avahi-5-services 2012-03-14 15:04:17.665305560 +0000 ++++ cups-1.5.2/scheduler/ipp.c 2012-03-14 15:08:25.715611813 +0000 +@@ -6099,7 +6099,7 @@ copy_printer_attrs( + ippAddDate(con->response, IPP_TAG_PRINTER, "printer-current-time", + ippTimeToDate(curtime)); + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + if (!ra || cupsArrayFind(ra, "printer-dns-sd-name")) + { + if (printer->reg_name) +@@ -6109,7 +6109,7 @@ copy_printer_attrs( + ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_NOVALUE, + "printer-dns-sd-name", 0); + } +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + if (!ra || cupsArrayFind(ra, "printer-error-policy")) + ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_NAME, +diff -up cups-1.5.2/scheduler/main.c.avahi-5-services cups-1.5.2/scheduler/main.c +--- cups-1.5.2/scheduler/main.c.avahi-5-services 2012-03-14 15:06:36.511476986 +0000 ++++ cups-1.5.2/scheduler/main.c 2012-03-14 15:08:25.718611817 +0000 +@@ -120,6 +120,10 @@ main(int argc, /* I - Number of comm + cupsd_listener_t *lis; /* Current listener */ + time_t current_time, /* Current time */ + activity, /* Client activity timer */ ++#ifdef HAVE_AVAHI ++ avahi_client_time, /* Time for next Avahi client ++ check */ ++#endif /* HAVE_AVAHI */ + browse_time, /* Next browse send time */ + senddoc_time, /* Send-Document time */ + expire_time, /* Subscription expire time */ +@@ -672,6 +676,9 @@ main(int argc, /* I - Number of comm + */ + + current_time = time(NULL); ++#ifdef HAVE_AVAHI ++ avahi_client_time = current_time; ++#endif /* HAVE_AVAHI */ + browse_time = current_time; + event_time = current_time; + expire_time = current_time; +@@ -894,6 +901,16 @@ main(int argc, /* I - Number of comm + tmo = cupsdNextTimeout (&tmo_delay); + if (tmo && tmo_delay == 0) + cupsdRunTimeout (tmo); ++ ++ /* ++ * Try to restart the Avahi client every 10 seconds if needed... ++ */ ++ ++ if ((current_time - avahi_client_time) >= 10) ++ { ++ avahi_client_time = current_time; ++ cupsdStartAvahiClient(); ++ } + #endif /* HAVE_AVAHI */ + + #ifndef __APPLE__ +diff -up cups-1.5.2/scheduler/printers.c.avahi-5-services cups-1.5.2/scheduler/printers.c +--- cups-1.5.2/scheduler/printers.c.avahi-5-services 2012-03-14 15:04:17.646305537 +0000 ++++ cups-1.5.2/scheduler/printers.c 2012-03-14 15:08:25.720611819 +0000 +@@ -883,9 +883,9 @@ cupsdDeletePrinter( + cupsdClearString(&p->alert); + cupsdClearString(&p->alert_description); + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + cupsdClearString(&p->pdl); +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + + cupsArrayDelete(p->filetypes); + +@@ -3787,7 +3787,7 @@ add_printer_formats(cupsd_printer_t *p) + attr->values[i].string.text = _cupsStrAlloc(mimetype); + } + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + { + char pdl[1024]; /* Buffer to build pdl list */ + mime_filter_t *filter; /* MIME filter looping var */ +@@ -3843,7 +3843,7 @@ add_printer_formats(cupsd_printer_t *p) + + cupsdSetString(&p->pdl, pdl); + } +-#endif /* HAVE_DNSSD */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ + } + + +diff -up cups-1.5.2/scheduler/printers.h.avahi-5-services cups-1.5.2/scheduler/printers.h +--- cups-1.5.2/scheduler/printers.h.avahi-5-services 2011-03-18 18:42:46.000000000 +0000 ++++ cups-1.5.2/scheduler/printers.h 2012-03-14 15:08:25.721611820 +0000 +@@ -16,6 +16,9 @@ + #ifdef HAVE_DNSSD + # include + #endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++# include "avahi.h" ++#endif /* HAVE_AVAHI */ + #include + + +@@ -95,16 +98,23 @@ struct cupsd_printer_s + time_t marker_time; /* Last time marker attributes were updated */ + _ppd_cache_t *pc; /* PPD cache and mapping data */ + +-#ifdef HAVE_DNSSD ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) + char *reg_name, /* Name used for service registration */ +- *pdl, /* pdl value for TXT record */ +- *ipp_txt, /* IPP TXT record contents */ ++ *pdl; /* pdl value for TXT record */ ++#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */ ++#ifdef HAVE_DNSSD ++ char *ipp_txt, /* IPP TXT record contents */ + *printer_txt; /* LPD TXT record contents */ + int ipp_len, /* IPP TXT record length */ + printer_len; /* LPD TXT record length */ + DNSServiceRef ipp_ref, /* Reference for _ipp._tcp,_cups */ + printer_ref; /* Reference for _printer._tcp */ + #endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ AvahiStringList *ipp_txt, /* IPP TXT record */ ++ *printer_txt; /* LPD TXT record */ ++ AvahiEntryGroup *avahi_group; /* Avahi entry group */ ++#endif /* HAVE_AVAHI */ + }; + + diff --git a/cups-banners.patch b/cups-banners.patch index 6907c91..aa19282 100644 --- a/cups-banners.patch +++ b/cups-banners.patch @@ -1,6 +1,7 @@ ---- cups-1.2rc2/scheduler/banners.c.banners 2006-04-19 16:12:07.000000000 +0100 -+++ cups-1.2rc2/scheduler/banners.c 2006-04-19 16:12:42.000000000 +0100 -@@ -119,6 +119,8 @@ +diff -up cups-1.5b1/scheduler/banners.c.banners cups-1.5b1/scheduler/banners.c +--- cups-1.5b1/scheduler/banners.c.banners 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/scheduler/banners.c 2011-05-23 17:35:30.000000000 +0200 +@@ -110,6 +110,8 @@ cupsdLoadBanners(const char *d) /* I - if ((ext = strrchr(dent->filename, '.')) != NULL) if (!strcmp(ext, ".bck") || !strcmp(ext, ".bak") || diff --git a/cups-build.patch b/cups-build.patch new file mode 100644 index 0000000..c229a76 --- /dev/null +++ b/cups-build.patch @@ -0,0 +1,42 @@ +diff -up cups-1.5b1/Makedefs.in.build cups-1.5b1/Makedefs.in +--- cups-1.5b1/Makedefs.in.build 2011-05-04 06:28:00.000000000 +0200 ++++ cups-1.5b1/Makedefs.in 2011-05-24 15:54:03.000000000 +0200 +@@ -138,7 +138,7 @@ BACKLIBS = @BACKLIBS@ + BANNERTOPS = @BANNERTOPS@ + BUILDDIRS = @BUILDDIRS@ + CFLAGS = @CPPFLAGS@ @CFLAGS@ +-COMMONLIBS = @LIBS@ ++COMMONLIBS = @LIBS@ $(DNSSDLIBS) + CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ + CXXLIBS = @CXXLIBS@ + DBUS_NOTIFIER = @DBUS_NOTIFIER@ +diff -up cups-1.5b1/scheduler/dirsvc.c.build cups-1.5b1/scheduler/dirsvc.c +--- cups-1.5b1/scheduler/dirsvc.c.build 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/scheduler/dirsvc.c 2011-05-24 15:55:26.000000000 +0200 +@@ -2047,7 +2047,7 @@ cupsdUpdateDNSSDName(void) + + WebIFRef = DNSSDRef; + if ((error = DNSServiceRegister(&WebIFRef, +- kDNSServiceFlagsShareConnection, ++ 0, + 0, webif, "_http._tcp", NULL, + NULL, htons(DNSSDPort), 7, + "\006path=/", dnssdRegisterCallback, +@@ -2769,7 +2769,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p) + do + { + p->ipp_ref = DNSSDRef; +- if ((se = DNSServiceRegister(&p->ipp_ref, kDNSServiceFlagsShareConnection, ++ if ((se = DNSServiceRegister(&p->ipp_ref, 0, + 0, name, regtype, NULL, NULL, + htons(DNSSDPort), ipp_len, ipp_txt, + dnssdRegisterCallback, +@@ -2866,7 +2866,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p) + + p->printer_ref = DNSSDRef; + if ((se = DNSServiceRegister(&p->printer_ref, +- kDNSServiceFlagsShareConnection, ++ 0, + 0, name, "_printer._tcp", NULL, NULL, + htons(printer_port), printer_len, printer_txt, + dnssdRegisterCallback, diff --git a/cups-cups-get-classes.patch b/cups-cups-get-classes.patch index 196f5f1..c998852 100644 --- a/cups-cups-get-classes.patch +++ b/cups-cups-get-classes.patch @@ -1,7 +1,7 @@ -diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c ---- cups-1.4rc1/cups/dest.c.cups-get-classes 2009-05-13 22:39:17.000000000 +0100 -+++ cups-1.4rc1/cups/dest.c 2009-07-28 22:17:40.285709944 +0100 -@@ -1735,6 +1735,7 @@ cups_get_sdests(http_t *http, /* I +diff -up cups-1.5.0/cups/dest.c.cups-get-classes cups-1.5.0/cups/dest.c +--- cups-1.5.0/cups/dest.c.cups-get-classes 2011-05-20 04:49:49.000000000 +0100 ++++ cups-1.5.0/cups/dest.c 2011-09-14 12:10:05.111635428 +0100 +@@ -534,6 +534,7 @@ _cupsGetDests(http_t *http, /* I - char uri[1024]; /* printer-uri value */ int num_options; /* Number of options */ cups_option_t *options; /* Options */ @@ -9,7 +9,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c #ifdef __APPLE__ char media_default[41]; /* Default paper size */ #endif /* __APPLE__ */ -@@ -1791,6 +1792,8 @@ cups_get_sdests(http_t *http, /* I +@@ -590,6 +591,8 @@ _cupsGetDests(http_t *http, /* I - * printer-uri [for IPP_GET_PRINTER_ATTRIBUTES] */ @@ -18,7 +18,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c request = ippNewRequest(op); ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, -@@ -1848,6 +1851,23 @@ cups_get_sdests(http_t *http, /* I +@@ -647,6 +650,23 @@ _cupsGetDests(http_t *http, /* I - attr->value_tag != IPP_TAG_URI) continue; @@ -42,7 +42,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c if (!strcmp(attr->name, "auth-info-required") || !strcmp(attr->name, "device-uri") || !strcmp(attr->name, "marker-change-time") || -@@ -1939,6 +1959,28 @@ cups_get_sdests(http_t *http, /* I +@@ -738,6 +758,28 @@ _cupsGetDests(http_t *http, /* I - continue; } @@ -52,7 +52,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c + * early if so. + */ + -+ if (op == CUPS_GET_CLASSES) ++ if (op == CUPS_GET_CLASSES && num_dests > 0) + { + int diff; + cups_find_dest (printer_name, NULL, num_dests, *dests, 0, &diff); @@ -71,7 +71,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c if ((dest = cups_add_dest(printer_name, NULL, &num_dests, dests)) != NULL) { dest->num_options = num_options; -@@ -1955,6 +1997,16 @@ cups_get_sdests(http_t *http, /* I +@@ -754,6 +796,15 @@ _cupsGetDests(http_t *http, /* I - } /* @@ -81,8 +81,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c + */ + + if (get_classes) -+ num_dests = cups_get_sdests (http, CUPS_GET_CLASSES, name, -+ num_dests, dests); ++ num_dests = _cupsGetDests (http, CUPS_GET_CLASSES, name, dests); + + /* * Return the count... diff --git a/cups-direct-usb.patch b/cups-direct-usb.patch new file mode 100644 index 0000000..4e25ce7 --- /dev/null +++ b/cups-direct-usb.patch @@ -0,0 +1,27 @@ +diff -up cups-1.5b1/backend/usb-unix.c.direct-usb cups-1.5b1/backend/usb-unix.c +--- cups-1.5b1/backend/usb-unix.c.direct-usb 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/backend/usb-unix.c 2011-05-23 17:52:14.000000000 +0200 +@@ -102,6 +102,9 @@ print_device(const char *uri, /* I - De + _cups_strncasecmp(hostname, "Minolta", 7); + #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ + ++ if (use_bc && !strncmp(uri, "usb:/dev/", 9)) ++ use_bc = 0; ++ + if ((device_fd = open_device(uri, &use_bc)) == -1) + { + if (getenv("CLASS") != NULL) +@@ -331,12 +334,7 @@ open_device(const char *uri, /* I - Dev + if (!strncmp(uri, "usb:/dev/", 9)) + #ifdef __linux + { +- /* +- * Do not allow direct devices anymore... +- */ +- +- errno = ENODEV; +- return (-1); ++ return (open(uri + 4, O_RDWR | O_EXCL)); + } + else if (!strncmp(uri, "usb://", 6)) + { diff --git a/cups-dnssd-deviceid.patch b/cups-dnssd-deviceid.patch new file mode 100644 index 0000000..dedbcb2 --- /dev/null +++ b/cups-dnssd-deviceid.patch @@ -0,0 +1,38 @@ +diff -up cups-1.5b1/backend/dnssd.c.dnssd-deviceid cups-1.5b1/backend/dnssd.c +--- cups-1.5b1/backend/dnssd.c.dnssd-deviceid 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/backend/dnssd.c 2011-05-24 17:28:18.000000000 +0200 +@@ -817,15 +817,22 @@ query_callback( + if (device->device_id) + free(device->device_id); + ++ if (device_id[0]) ++ { ++ /* Mark this as the real device ID. */ ++ ptr = device_id + strlen(device_id); ++ snprintf(ptr, sizeof(device_id) - (ptr - device_id), "FZY:0;"); ++ } ++ + if (!device_id[0] && strcmp(model, "Unknown")) + { + if (make_and_model[0]) +- snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;", ++ snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;FZY:1;", + make_and_model, model); + else if (!_cups_strncasecmp(model, "designjet ", 10)) +- snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s", model + 10); ++ snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s;FZY:1;", model + 10); + else if (!_cups_strncasecmp(model, "stylus ", 7)) +- snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s", model + 7); ++ snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s;FZY:1;", model + 7); + else if ((ptr = strchr(model, ' ')) != NULL) + { + /* +@@ -835,7 +842,7 @@ query_callback( + memcpy(make_and_model, model, ptr - model); + make_and_model[ptr - model] = '\0'; + +- snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s", ++ snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;FZY:1;", + make_and_model, ptr + 1); + } + } diff --git a/cups-driverd-timeout.patch b/cups-driverd-timeout.patch index 222fb09..cb9e5cf 100644 --- a/cups-driverd-timeout.patch +++ b/cups-driverd-timeout.patch @@ -1,7 +1,7 @@ -diff -up cups-1.3.7/scheduler/ipp.c.driverd-timeout cups-1.3.7/scheduler/ipp.c ---- cups-1.3.7/scheduler/ipp.c.driverd-timeout 2008-07-15 13:40:51.000000000 +0100 -+++ cups-1.3.7/scheduler/ipp.c 2008-07-15 13:40:51.000000000 +0100 -@@ -4293,7 +4293,7 @@ copy_model(cupsd_client_t *con, /* I - +diff -up cups-1.5.0/scheduler/ipp.c.driverd-timeout cups-1.5.0/scheduler/ipp.c +--- cups-1.5.0/scheduler/ipp.c.driverd-timeout 2011-10-10 17:03:41.801690962 +0100 ++++ cups-1.5.0/scheduler/ipp.c 2011-10-10 17:03:41.861689834 +0100 +@@ -5723,7 +5723,7 @@ copy_model(cupsd_client_t *con, /* I - close(temppipe[1]); /* @@ -10,7 +10,7 @@ diff -up cups-1.3.7/scheduler/ipp.c.driverd-timeout cups-1.3.7/scheduler/ipp.c */ total = 0; -@@ -4315,7 +4315,7 @@ copy_model(cupsd_client_t *con, /* I - +@@ -5743,7 +5743,7 @@ copy_model(cupsd_client_t *con, /* I - FD_SET(temppipe[0], &input); FD_SET(CGIPipes[0], &input); diff --git a/cups-eggcups.patch b/cups-eggcups.patch index fde1e07..981d920 100644 --- a/cups-eggcups.patch +++ b/cups-eggcups.patch @@ -1,9 +1,9 @@ -diff -up cups-1.4b1/backend/ipp.c.eggcups cups-1.4b1/backend/ipp.c ---- cups-1.4b1/backend/ipp.c.eggcups 2008-10-15 19:27:45.000000000 +0100 -+++ cups-1.4b1/backend/ipp.c 2008-11-11 15:43:30.000000000 +0000 -@@ -51,6 +51,70 @@ static char pstmpname[1024] = ""; /* Tem - static char tmpfilename[1024] = ""; /* Temporary spool file name */ - static int job_cancelled = 0; /* Job cancelled? */ +diff -up cups-1.5.3/backend/ipp.c.eggcups cups-1.5.3/backend/ipp.c +--- cups-1.5.3/backend/ipp.c.eggcups 2012-05-05 01:00:01.000000000 +0200 ++++ cups-1.5.3/backend/ipp.c 2012-05-15 16:50:41.142868986 +0200 +@@ -138,6 +138,70 @@ static cups_array_t *state_reasons; /* A + static char tmpfilename[1024] = ""; + /* Temporary spool file name */ +#if HAVE_DBUS +#include @@ -72,8 +72,8 @@ diff -up cups-1.4b1/backend/ipp.c.eggcups cups-1.4b1/backend/ipp.c /* * Local functions... -@@ -1058,6 +1122,15 @@ main(int argc, /* I - Number of comm - job_id); +@@ -1520,6 +1584,15 @@ main(int argc, /* I - Number of comm + _("Print file accepted - job ID %d."), job_id); } +#if HAVE_DBUS @@ -85,25 +85,25 @@ diff -up cups-1.4b1/backend/ipp.c.eggcups cups-1.4b1/backend/ipp.c + getenv ("PRINTER")); +#endif /* HAVE_DBUS */ + + fprintf(stderr, "DEBUG: job-id=%d\n", job_id); ippDelete(response); - if (job_cancelled) -diff -up cups-1.4b1/backend/Makefile.eggcups cups-1.4b1/backend/Makefile ---- cups-1.4b1/backend/Makefile.eggcups 2008-10-06 22:08:27.000000000 +0100 -+++ cups-1.4b1/backend/Makefile 2008-11-11 15:45:31.000000000 +0000 -@@ -188,7 +188,7 @@ dnssd: dnssd.o ../cups/$(LIBCUPS) libbac +diff -up cups-1.5.3/backend/Makefile.eggcups cups-1.5.3/backend/Makefile +--- cups-1.5.3/backend/Makefile.eggcups 2012-04-23 19:42:12.000000000 +0200 ++++ cups-1.5.3/backend/Makefile 2012-05-15 16:48:17.253871982 +0200 +@@ -212,7 +212,7 @@ dnssd: dnssd.o ../cups/$(LIBCUPS) libbac ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a echo Linking $@... - $(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) -+ $(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(CUPSDLIBS) ++ $(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(SERVERLIBS) $(RM) http $(LN) ipp http -diff -up cups-1.4b1/scheduler/subscriptions.c.eggcups cups-1.4b1/scheduler/subscriptions.c ---- cups-1.4b1/scheduler/subscriptions.c.eggcups 2008-08-01 22:11:55.000000000 +0100 -+++ cups-1.4b1/scheduler/subscriptions.c 2008-11-11 15:43:30.000000000 +0000 -@@ -1302,13 +1302,13 @@ cupsd_send_dbus(cupsd_eventmask_t event, +diff -up cups-1.5.3/scheduler/subscriptions.c.eggcups cups-1.5.3/scheduler/subscriptions.c +--- cups-1.5.3/scheduler/subscriptions.c.eggcups 2012-02-12 06:48:09.000000000 +0100 ++++ cups-1.5.3/scheduler/subscriptions.c 2012-05-15 16:48:17.253871982 +0200 +@@ -1314,13 +1314,13 @@ cupsd_send_dbus(cupsd_eventmask_t event, what = "PrinterAdded"; else if (event & CUPSD_EVENT_PRINTER_DELETED) what = "PrinterRemoved"; @@ -119,7 +119,7 @@ diff -up cups-1.4b1/scheduler/subscriptions.c.eggcups cups-1.4b1/scheduler/subsc else return; -@@ -1344,7 +1344,7 @@ cupsd_send_dbus(cupsd_eventmask_t event, +@@ -1356,7 +1356,7 @@ cupsd_send_dbus(cupsd_eventmask_t event, dbus_message_append_iter_init(message, &iter); if (dest) dbus_message_iter_append_string(&iter, dest->name); diff --git a/cups-filter-debug.patch b/cups-filter-debug.patch new file mode 100644 index 0000000..2a42343 --- /dev/null +++ b/cups-filter-debug.patch @@ -0,0 +1,32 @@ +diff -up cups-1.5b1/scheduler/job.c.filter-debug cups-1.5b1/scheduler/job.c +--- cups-1.5b1/scheduler/job.c.filter-debug 2011-05-24 15:58:07.000000000 +0200 ++++ cups-1.5b1/scheduler/job.c 2011-05-24 15:58:07.000000000 +0200 +@@ -557,10 +557,28 @@ cupsdContinueJob(cupsd_job_t *job) /* I + + if (!filters) + { ++ mime_filter_t *current; ++ + cupsdLogJob(job, CUPSD_LOG_ERROR, + "Unable to convert file %d to printable format!", + job->current_file); + ++ cupsdLogJob(job, CUPSD_LOG_ERROR, ++ "Required: %s/%s -> %s/%s", ++ job->filetypes[job->current_file]->super, ++ job->filetypes[job->current_file]->type, ++ job->printer->filetype->super, ++ job->printer->filetype->type); ++ ++ for (current = (mime_filter_t *)cupsArrayFirst(MimeDatabase->srcs); ++ current; ++ current = (mime_filter_t *)cupsArrayNext(MimeDatabase->srcs)) ++ cupsdLogJob(job, CUPSD_LOG_ERROR, ++ "Available: %s/%s -> %s/%s (%s)", ++ current->src->super, current->src->type, ++ current->dst->super, current->dst->type, ++ current->filter); ++ + abort_message = "Aborting job because it cannot be printed."; + abort_state = IPP_JOB_ABORTED; + diff --git a/cups-1.4.4-getpass.patch b/cups-getpass.patch similarity index 59% rename from cups-1.4.4-getpass.patch rename to cups-getpass.patch index 930afe2..7b089a7 100644 --- a/cups-1.4.4-getpass.patch +++ b/cups-getpass.patch @@ -1,8 +1,8 @@ -diff -Naur -x '*.orig' -x '*.rej' -x '*~' cups-1.4.4/cups/usersys.c cups-1.4.4-getpass//cups/usersys.c ---- cups-1.4.4/cups/usersys.c 2010-03-31 00:07:33.000000000 +0200 -+++ cups-1.4.4-getpass//cups/usersys.c 2010-09-09 19:57:49.000000000 +0200 -@@ -41,6 +41,8 @@ - #include "globals.h" +diff -up cups-1.5b1/cups/usersys.c.getpass cups-1.5b1/cups/usersys.c +--- cups-1.5b1/cups/usersys.c.getpass 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/cups/usersys.c 2011-05-24 15:41:33.000000000 +0200 +@@ -43,6 +43,8 @@ + #include "cups-private.h" #include #include +#include @@ -10,11 +10,16 @@ diff -Naur -x '*.orig' -x '*.rej' -x '*~' cups-1.4.4/cups/usersys.c cups-1.4.4-g #ifdef WIN32 # include #else -@@ -406,7 +408,29 @@ - * Use the standard getpass function to get a password from the console. +@@ -501,13 +503,31 @@ _cupsGetPassword(const char *prompt) /* + * empty password is treated as canceling the authentication request. */ -- return (getpass(prompt)); +- const char *password = getpass(prompt); +- /* Password string */ +- +- if (!password || !password[0]) +- return (NULL); +- else + static char password[100]; + struct termios oldtio, newtio; + sigset_t oldset, newset; @@ -34,10 +39,12 @@ diff -Naur -x '*.orig' -x '*.rej' -x '*~' cups-1.4.4/cups/usersys.c cups-1.4.4-g + fputc ('\n', stdout); + sigprocmask (SIG_SETMASK, &oldset, NULL); + if (nread > 0) ++ { + password[nread - 1] = '\0'; + return (password); ++ } + else -+ password[0] ='\0'; -+ return password; ++ return (NULL); #endif /* WIN32 */ } diff --git a/cups-hp-deviceid-oid.patch b/cups-hp-deviceid-oid.patch new file mode 100644 index 0000000..da5136a --- /dev/null +++ b/cups-hp-deviceid-oid.patch @@ -0,0 +1,21 @@ +diff -up cups-1.5b1/backend/snmp.c.hp-deviceid-oid cups-1.5b1/backend/snmp.c +--- cups-1.5b1/backend/snmp.c.hp-deviceid-oid 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/backend/snmp.c 2011-05-24 17:24:48.000000000 +0200 +@@ -187,6 +187,7 @@ static const int UriOID[] = { CUPS_OID_p + static const int LexmarkProductOID[] = { 1,3,6,1,4,1,641,2,1,2,1,2,1,-1 }; + static const int LexmarkProductOID2[] = { 1,3,6,1,4,1,674,10898,100,2,1,2,1,2,1,-1 }; + static const int LexmarkDeviceIdOID[] = { 1,3,6,1,4,1,641,2,1,2,1,3,1,-1 }; ++static const int HPDeviceIdOID[] = { 1,3,6,1,4,1,11,2,3,9,1,1,7,0,-1 }; + static const int XeroxProductOID[] = { 1,3,6,1,4,1,128,2,1,3,1,2,0,-1 }; + static cups_array_t *DeviceURIs = NULL; + static int HostNameLookups = 0; +@@ -1006,6 +1007,9 @@ read_snmp_response(int fd) /* I - SNMP + _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1, + packet.community, CUPS_ASN1_GET_REQUEST, + DEVICE_PRODUCT, XeroxProductOID); ++ _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1, ++ packet.community, CUPS_ASN1_GET_REQUEST, ++ DEVICE_ID, HPDeviceIdOID); + break; + + case DEVICE_DESCRIPTION : diff --git a/cups-icc.patch b/cups-icc.patch new file mode 100644 index 0000000..db4ae22 --- /dev/null +++ b/cups-icc.patch @@ -0,0 +1,1042 @@ +From db29c24e3ff75938775aa1f4072e346aeb7f6a9c Mon Sep 17 00:00:00 2001 +From: Richard Hughes +Date: Tue, 1 Mar 2011 16:05:48 +0000 +Subject: [PATCH] Add colord support to CUPS which allows Linux printers to be + color managed + +This functionality is possible because of lots of help from Tim Waugh -- thanks! +--- + scheduler/Makefile | 1 + + scheduler/colord.c | 784 ++++++++++++++++++++++++++++++++++++++++++++++++++ + scheduler/colord.h | 41 +++ + scheduler/ipp.c | 18 +- + scheduler/printers.c | 69 +++++ + scheduler/printers.h | 4 + + 6 files changed, 914 insertions(+), 3 deletions(-) + create mode 100644 scheduler/colord.c + create mode 100644 scheduler/colord.h + +diff --git a/scheduler/Makefile b/scheduler/Makefile +index 3c7da8e..b9c47d3 100644 +--- a/scheduler/Makefile ++++ b/scheduler/Makefile +@@ -27,6 +27,7 @@ CUPSDOBJS = \ + file.o \ + main.o \ + ipp.o \ ++ colord.o \ + listen.o \ + job.o \ + log.o \ +diff --git a/scheduler/colord.c b/scheduler/colord.c +new file mode 100644 +index 0000000..bd06e1c +--- /dev/null ++++ b/scheduler/colord.c +@@ -0,0 +1,784 @@ ++/* ++ * "$Id$" ++ * ++ * colord integration for the CUPS scheduler. ++ * ++ * Copyright 2011 Red Hat, Inc. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++ * OF THE POSSIBILITY OF SUCH DAMAGE. ++ * ++ * Contents: ++ * ++ * colordRegisterPrinter() - Register profiles for a printer. ++ * colordUnregisterPrinter() - Unregister profiles for a printer. ++ * colordStart() - Get a connection to the system bus. ++ * colordStop() - Release any connection to the system bus ++ * so that added profiles and devices are ++ * automatically removed. ++ */ ++ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "cupsd.h" ++ ++#ifdef HAVE_DBUS ++ ++#include ++#include ++ ++/* ++ * Defines used by colord. See the reference docs for further details: ++ * http://colord.hughsie.com/api/ref-dbus.html ++ */ ++#define COLORD_SCOPE_NORMAL "normal" /* System scope */ ++#define COLORD_SCOPE_TEMP "temp" /* Process scope */ ++#define COLORD_SCOPE_DISK "disk" /* Lives forever, as stored in DB */ ++ ++#define COLORD_RELATION_SOFT "soft" /* Mapping is not default */ ++#define COLORD_RELATION_HARD "hard" /* Explicitly mapped profile */ ++ ++#define COLORD_SPACE_RGB "rgb" /* RGB colorspace */ ++#define COLORD_SPACE_CMYK "cmyk" /* CMYK colorspace */ ++#define COLORD_SPACE_GRAY "gray" /* Gray colorspace */ ++#define COLORD_SPACE_UNKNOWN "unknown" /* Unknown colorspace */ ++ ++#define COLORD_MODE_PHYSICAL "physical" /* Actual device */ ++#define COLORD_MODE_VIRTUAL "virtual" /* Virtual device with no hardware */ ++ ++#define COLORD_KIND_PRINTER "printer" /* printing output device */ ++ ++/* the timeout for connecting to colord */ ++#define COLORD_DBUS_TIMEOUT 5000 /* ms */ ++ ++/* This is static */ ++static DBusConnection *con = NULL; ++ ++/* ++ * 'colordStart()' - Get a connection to the system bus. ++ */ ++ ++void ++colordStart(void) ++{ ++ if (con) ++ return; ++ con = dbus_bus_get (DBUS_BUS_SYSTEM, NULL); ++} ++ ++/* ++ * 'colordStop()' - Release any connection to the system bus so that ++ * added profiles and devices are automatically removed. ++ */ ++ ++void ++colordStop(void) ++{ ++ if (con == NULL) ++ return; ++ dbus_connection_unref(con); ++ con = NULL; ++} ++ ++/* ++ * 'message_dict_add_strings()' - add two strings to a dictionary. ++ */ ++ ++static void ++message_dict_add_strings (DBusMessageIter *dict, ++ const char *key, ++ const char *value) ++{ ++ DBusMessageIter entry; ++ dbus_message_iter_open_container(dict, ++ DBUS_TYPE_DICT_ENTRY, ++ NULL, ++ &entry); ++ dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key); ++ dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &value); ++ dbus_message_iter_close_container(dict, &entry); ++} ++ ++/* ++ * 'colordCreateProfile()' - Create a color profile for a printer. ++ * ++ * Notes: When creating the device, we can create ++ */ ++ ++static void ++colordCreateProfile (cups_array_t *profiles, /* I - Profiles array */ ++ const char *printer_name, /* I - Printer name */ ++ const char *qualifier, /* I - Profile qualifier */ ++ const char *colorspace, /* I - Profile colorspace */ ++ const char **format, /* I - Profile qualifier format */ ++ const char *iccfile, /* I - ICC filename */ ++ const char *scope) /* I - The scope of the profile, e.g. ++ 'normal', 'temp' or 'disk' */ ++{ ++ DBusMessage *message = NULL; /* D-Bus request */ ++ DBusMessage *reply = NULL; /* D-Bus reply */ ++ DBusMessageIter args; /* D-Bus method arguments */ ++ DBusMessageIter dict; /* D-Bus method arguments */ ++ DBusError error; /* D-Bus error */ ++ char *idstr; /* Profile ID string */ ++ size_t idstrlen; /* Profile ID allocated length */ ++ const char *profile_path; /* Device object path */ ++ char format_str[1024]; /* Qualifier format as a string */ ++ ++ /* ++ * Create the profile... ++ */ ++ ++ message = dbus_message_new_method_call("org.freedesktop.ColorManager", ++ "/org/freedesktop/ColorManager", ++ "org.freedesktop.ColorManager", ++ "CreateProfile"); ++ ++ /* create a profile id */ ++ idstrlen = strlen (printer_name) + 1 + strlen (qualifier) + 1; ++ idstr = malloc (idstrlen); ++ if (!idstr) ++ goto out; ++ snprintf (idstr, idstrlen, "%s-%s", printer_name, qualifier); ++ cupsdLogMessage(CUPSD_LOG_DEBUG, "Using profile id of %s", ++ idstr); ++ ++ dbus_message_iter_init_append(message, &args); ++ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &idstr); ++ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &scope); ++ ++ /* mush the qualifier format into a simple string */ ++ snprintf(format_str, sizeof(format_str), "%s.%s.%s", ++ format[0], ++ format[1], ++ format[2]); ++ ++ /* set initial properties */ ++ dbus_message_iter_open_container(&args, ++ DBUS_TYPE_ARRAY, ++ "{ss}", ++ &dict); ++ message_dict_add_strings(&dict, "Qualifier", qualifier); ++ message_dict_add_strings(&dict, "Format", format_str); ++ message_dict_add_strings(&dict, "Colorspace", colorspace); ++ if (iccfile != NULL) ++ message_dict_add_strings(&dict, "Filename", iccfile); ++ dbus_message_iter_close_container(&args, &dict); ++ ++ /* send syncronous */ ++ dbus_error_init(&error); ++ cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling CreateProfile(%s,%s)", ++ idstr, scope); ++ reply = dbus_connection_send_with_reply_and_block(con, ++ message, ++ COLORD_DBUS_TIMEOUT, ++ &error); ++ if (reply == NULL) ++ { ++ cupsdLogMessage(CUPSD_LOG_WARN, ++ "failed to CreateProfile: %s:%s", ++ error.name, error.message); ++ dbus_error_free(&error); ++ goto out; ++ } ++ ++ /* get reply data */ ++ dbus_message_iter_init(reply, &args); ++ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) ++ { ++ cupsdLogMessage(CUPSD_LOG_WARN, ++ "incorrect reply type"); ++ goto out; ++ } ++ dbus_message_iter_get_basic(&args, &profile_path); ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "created profile %s", ++ profile_path); ++ cupsArrayAdd(profiles, strdup(profile_path)); ++ ++out: ++ if (message != NULL) ++ dbus_message_unref(message); ++ if (reply != NULL) ++ dbus_message_unref(reply); ++ free (idstr); ++} ++ ++/* ++ * 'colordDeviceAddProfile()' - Assign a profile to a device. ++ */ ++ ++static void ++colordDeviceAddProfile (const char *device_path, /* I - Device object path */ ++ const char *profile_path, /* I - Profile object path */ ++ const char *relation) /* I - Device relation, either 'soft' or 'hard' */ ++{ ++ DBusMessage *message = NULL; /* D-Bus request */ ++ DBusMessage *reply = NULL; /* D-Bus reply */ ++ DBusMessageIter args; /* D-Bus method arguments */ ++ DBusError error; /* D-Bus error */ ++ ++ message = dbus_message_new_method_call("org.freedesktop.ColorManager", ++ device_path, ++ "org.freedesktop.ColorManager.Device", ++ "AddProfile"); ++ ++ /* send profile path as the argument */ ++ dbus_message_iter_init_append(message, &args); ++ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &relation); ++ dbus_message_iter_append_basic(&args, DBUS_TYPE_OBJECT_PATH, &profile_path); ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "Calling %s:AddProfile(%s) [%s]", ++ device_path, profile_path, relation); ++ ++ /* send syncronous */ ++ dbus_error_init(&error); ++ reply = dbus_connection_send_with_reply_and_block(con, ++ message, ++ COLORD_DBUS_TIMEOUT, ++ &error); ++ if (reply == NULL) ++ { ++ cupsdLogMessage(CUPSD_LOG_WARN, ++ "failed to AddProfile: %s:%s", ++ error.name, error.message); ++ dbus_error_free(&error); ++ goto out; ++ } ++out: ++ if (message != NULL) ++ dbus_message_unref(message); ++ if (reply != NULL) ++ dbus_message_unref(reply); ++} ++ ++/* ++ * 'colordCreateDevice()' - Create a device and register profiles. ++ */ ++ ++static void ++colordCreateDevice (cupsd_printer_t *p, /* I - Printer */ ++ ppd_file_t *ppd, /* I - PPD file */ ++ cups_array_t *profiles, /* I - Profiles array */ ++ const char *colorspace, /* I - Device colorspace, e.g. 'rgb' */ ++ char **format, /* I - Device qualifier format */ ++ const char *relation, /* I - Profile relation, either 'soft' or 'hard' */ ++ const char *scope) /* I - The scope of the device, e.g. ++ 'normal', 'temp' or 'disk' */ ++{ ++ DBusMessage *message = NULL; /* D-Bus request */ ++ DBusMessage *reply = NULL; /* D-Bus reply */ ++ DBusMessageIter args; /* D-Bus method arguments */ ++ DBusMessageIter dict; /* D-Bus method arguments */ ++ DBusError error; /* D-Bus error */ ++ const char *device_path; /* Device object path */ ++ const char *profile_path; /* Profile path */ ++ char *default_profile_path = NULL; ++ /* Default profile path */ ++ char device_id[1024]; /* Device ID as understood by colord */ ++ char format_str[1024]; /* Qualifier format as a string */ ++ ++ /* ++ * Create the device... ++ */ ++ ++ snprintf(device_id, sizeof(device_id), "cups-%s", p->name); ++ device_path = device_id; ++ ++ message = dbus_message_new_method_call("org.freedesktop.ColorManager", ++ "/org/freedesktop/ColorManager", ++ "org.freedesktop.ColorManager", ++ "CreateDevice"); ++ ++ dbus_message_iter_init_append(message, &args); ++ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &device_path); ++ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &scope); ++ ++ /* mush the qualifier format into a simple string */ ++ snprintf(format_str, sizeof(format_str), "%s.%s.%s", ++ format[0], ++ format[1], ++ format[2]); ++ ++ /* set initial properties */ ++ dbus_message_iter_open_container(&args, ++ DBUS_TYPE_ARRAY, ++ "{ss}", ++ &dict); ++ message_dict_add_strings(&dict, "Colorspace", colorspace); ++ message_dict_add_strings(&dict, "Mode", COLORD_MODE_PHYSICAL); ++ if (ppd->manufacturer != NULL) ++ message_dict_add_strings(&dict, "Vendor", ppd->manufacturer); ++ if (ppd->modelname != NULL) ++ message_dict_add_strings(&dict, "Model", ppd->modelname); ++ if (p->sanitized_device_uri != NULL) ++ message_dict_add_strings(&dict, "Serial", p->sanitized_device_uri); ++ message_dict_add_strings(&dict, "Format", format_str); ++ message_dict_add_strings(&dict, "Kind", COLORD_KIND_PRINTER); ++ dbus_message_iter_close_container(&args, &dict); ++ ++ /* send syncronous */ ++ dbus_error_init(&error); ++ cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling CreateDevice(%s,%s)", ++ device_id, scope); ++ reply = dbus_connection_send_with_reply_and_block(con, ++ message, ++ COLORD_DBUS_TIMEOUT, ++ &error); ++ if (reply == NULL) ++ { ++ cupsdLogMessage(CUPSD_LOG_WARN, ++ "failed to CreateDevice: %s:%s", ++ error.name, error.message); ++ dbus_error_free(&error); ++ goto out; ++ } ++ ++ /* get reply data */ ++ dbus_message_iter_init(reply, &args); ++ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) ++ { ++ cupsdLogMessage(CUPSD_LOG_WARN, ++ "incorrect reply type"); ++ goto out; ++ } ++ dbus_message_iter_get_basic(&args, &device_path); ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "created device %s", ++ device_path); ++ ++ /* add profiles */ ++ for (profile_path = cupsArrayFirst(profiles); ++ profile_path; ++ profile_path = cupsArrayNext(profiles)) ++ { ++ colordDeviceAddProfile (device_path, profile_path, relation); ++ } ++ ++out: ++ free(default_profile_path); ++ if (message != NULL) ++ dbus_message_unref(message); ++ if (reply != NULL) ++ dbus_message_unref(reply); ++} ++ ++/* ++ * 'colordFindDeviceById()' - Finds a device ++ */ ++ ++static char * ++colordFindDeviceById (const char *device_id) /* I - Device ID string */ ++{ ++ DBusMessage *message = NULL; /* D-Bus request */ ++ DBusMessage *reply = NULL; /* D-Bus reply */ ++ DBusMessageIter args; /* D-Bus method arguments */ ++ DBusError error; /* D-Bus error */ ++ const char *device_path_tmp; /* Device object path */ ++ char *device_path = NULL; /* Device object path */ ++ ++ message = dbus_message_new_method_call("org.freedesktop.ColorManager", ++ "/org/freedesktop/ColorManager", ++ "org.freedesktop.ColorManager", ++ "FindDeviceById"); ++ ++ dbus_message_iter_init_append(message, &args); ++ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &device_id); ++ ++ /* send syncronous */ ++ dbus_error_init(&error); ++ cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling FindDeviceById(%s)", device_id); ++ reply = dbus_connection_send_with_reply_and_block(con, ++ message, ++ COLORD_DBUS_TIMEOUT, ++ &error); ++ if (reply == NULL) ++ { ++ /* this can happen normally on start-up */ ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "failed to DeleteDevice: %s:%s", ++ error.name, error.message); ++ dbus_error_free(&error); ++ goto out; ++ } ++ ++ /* get reply data */ ++ dbus_message_iter_init(reply, &args); ++ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) ++ { ++ cupsdLogMessage(CUPSD_LOG_WARN, ++ "incorrect reply type"); ++ goto out; ++ } ++ dbus_message_iter_get_basic(&args, &device_path_tmp); ++ if (device_path_tmp != NULL) ++ device_path = strdup (device_path_tmp); ++out: ++ if (message != NULL) ++ dbus_message_unref(message); ++ if (reply != NULL) ++ dbus_message_unref(reply); ++ return device_path; ++} ++ ++/* ++ * 'colordDeleteDevice()' - Delete a device ++ */ ++ ++static void ++colordDeleteDevice (const char *device_id) /* I - Device ID string */ ++{ ++ DBusMessage *message = NULL; /* D-Bus request */ ++ DBusMessage *reply = NULL; /* D-Bus reply */ ++ DBusMessageIter args; /* D-Bus method arguments */ ++ DBusError error; /* D-Bus error */ ++ char *device_path; /* Device object path */ ++ ++ /* ++ * Find the device... ++ */ ++ ++ device_path = colordFindDeviceById (device_id); ++ if (device_path == NULL) ++ { ++ /* this can happen normally on start-up */ ++ cupsdLogMessage(CUPSD_LOG_WARN, ++ "failed to find device: %s", ++ device_id); ++ goto out; ++ } ++ ++ /* ++ * Delete the device... ++ */ ++ ++ message = dbus_message_new_method_call("org.freedesktop.ColorManager", ++ "/org/freedesktop/ColorManager", ++ "org.freedesktop.ColorManager", ++ "DeleteDevice"); ++ ++ dbus_message_iter_init_append(message, &args); ++ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &device_id); ++ ++ /* send syncronous */ ++ dbus_error_init(&error); ++ cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling DeleteDevice(%s)", device_id); ++ reply = dbus_connection_send_with_reply_and_block(con, ++ message, ++ COLORD_DBUS_TIMEOUT, ++ &error); ++ if (reply == NULL) ++ { ++ /* this can happen normally on start-up */ ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "failed to DeleteDevice: %s:%s", ++ error.name, error.message); ++ dbus_error_free(&error); ++ goto out; ++ } ++out: ++ free (device_path); ++ if (message != NULL) ++ dbus_message_unref(message); ++ if (reply != NULL) ++ dbus_message_unref(reply); ++} ++ ++/* ++ * 'colordGetQualifierFormat()' - Get the qualifier format. ++ * ++ * Notes: Returns a value of "ColorSpace.MediaType.Resolution" by default ++ */ ++ ++char ** ++colordGetQualifierFormat(ppd_file_t *ppd) ++{ ++ char **format; /* Qualifier format tuple */ ++ const char *tmp; /* Temporary string */ ++ ppd_attr_t *attr; /* Profile attributes */ ++ ++ /* create 3-tuple */ ++ format = calloc(3, sizeof(char*)); ++ ++ /* get 1st section */ ++ tmp = "cupsICCQualifier1"; ++ attr = ppdFindAttr(ppd, tmp, NULL); ++ if (attr != NULL) ++ tmp = attr->value; ++ else ++ { ++ tmp = "DefaultColorSpace"; ++ attr = ppdFindAttr(ppd, tmp, NULL); ++ } ++ if (attr == NULL) ++ { ++ tmp = "DefaultColorModel"; ++ attr = ppdFindAttr(ppd, tmp, NULL); ++ } ++ if (attr == NULL) ++ { ++ tmp = ""; ++ } ++ if (strncmp(tmp, "Default", 7) == 0) ++ tmp += 7; ++ format[0] = strdup(tmp); ++ ++ /* get 2nd section */ ++ tmp = "cupsICCQualifier2"; ++ attr = ppdFindAttr(ppd, tmp, NULL); ++ if (attr != NULL) ++ tmp = attr->value; ++ else ++ { ++ tmp = "DefaultMediaType"; ++ attr = ppdFindAttr(ppd, tmp, NULL); ++ } ++ if (attr == NULL) ++ { ++ tmp = ""; ++ } ++ if (strncmp(tmp, "Default", 7) == 0) ++ tmp += 7; ++ format[1] = strdup(tmp); ++ ++ /* get 3rd section */ ++ tmp = "cupsICCQualifier3"; ++ attr = ppdFindAttr(ppd, tmp, NULL); ++ if (attr != NULL) ++ tmp = attr->value; ++ else ++ { ++ tmp = "DefaultResolution"; ++ attr = ppdFindAttr(ppd, tmp, NULL); ++ } ++ if (attr == NULL) ++ { ++ tmp = ""; ++ } ++ if (strncmp(tmp, "Default", 7) == 0) ++ tmp += 7; ++ format[2] = strdup(tmp); ++ ++ return format; ++} ++ ++/* ++ * 'colordRegisterPrinter()' - Register profiles for a printer. ++ */ ++ ++void ++colordRegisterPrinter(cupsd_printer_t *p) /* I - printer */ ++{ ++ char ppdfile[1024], /* PPD filename */ ++ iccfile[1024]; /* ICC filename */ ++ ppd_file_t *ppd; /* PPD file */ ++ cups_array_t *profiles; /* Profile paths array */ ++ const char *profile_key; /* Profile keyword */ ++ ppd_attr_t *attr; /* Profile attributes */ ++ const char *device_colorspace; /* Device colorspace */ ++ char **format; /* Qualifier format tuple */ ++ int i; /* Loop counter */ ++ ++ /* ++ * Do nothing for discovered printers as they will have local color ++ * correction ++ */ ++ ++ if (p->type & CUPS_PRINTER_DISCOVERED) ++ return; ++ ++ /* ++ * Ensure we have a DBus connection ++ */ ++ ++ colordStart(); ++ if (con == NULL) ++ return; ++ ++ /* ++ * Try opening the PPD file for this printer... ++ */ ++ ++ snprintf(ppdfile, sizeof(ppdfile), "%s/ppd/%s.ppd", ServerRoot, p->name); ++ if ((ppd = ppdOpenFile(ppdfile)) == NULL) ++ { ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "cannot open %s", ++ ppdfile); ++ return; ++ } ++ ++ /* ++ * Find out the qualifier format ++ */ ++ ++ format = colordGetQualifierFormat(ppd); ++ ++ /* ++ * See if we have any embedded profiles... ++ */ ++ ++ profiles = cupsArrayNew3 (NULL, NULL, NULL, 0, NULL, ++ (cups_afree_func_t) free); ++ profile_key = "cupsICCProfile"; ++ attr = ppdFindAttr(ppd, profile_key, NULL); ++ for (; attr; attr = ppdFindNextAttr(ppd, profile_key, NULL)) ++ if (attr->spec[0] && attr->value && attr->value[0]) ++ { ++ if (attr->value[0] != '/') ++ snprintf(iccfile, sizeof(iccfile), "%s/profiles/%s", DataDir, ++ attr->value); ++ else ++ strlcpy(iccfile, attr->value, sizeof(iccfile)); ++ ++ if (access(iccfile, 0)) ++ { ++ cupsdLogMessage(CUPSD_LOG_WARN, ++ "no access to %s", ++ iccfile); ++ continue; ++ } ++ ++ colordCreateProfile(profiles, ++ p->name, ++ attr->spec, ++ COLORD_SPACE_UNKNOWN, ++ (const char **)format, ++ iccfile, ++ COLORD_SCOPE_TEMP); ++ } ++ ++ /* ++ * Add the grayscale profile first. We always have a grayscale profile. ++ */ ++ ++ colordCreateProfile(profiles, ++ p->name, ++ "Gray..", ++ COLORD_SPACE_GRAY, ++ (const char **)format, ++ NULL, ++ COLORD_SCOPE_TEMP); ++ ++ /* ++ * Then add the RGB/CMYK/DeviceN color profile... ++ */ ++ ++ device_colorspace = "unknown"; ++ switch (ppd->colorspace) ++ { ++ case PPD_CS_RGB : ++ case PPD_CS_CMY : ++ device_colorspace = COLORD_SPACE_RGB; ++ colordCreateProfile(profiles, ++ p->name, ++ "RGB..", ++ COLORD_SPACE_RGB, ++ (const char **)format, ++ NULL, ++ COLORD_SCOPE_TEMP); ++ break; ++ case PPD_CS_RGBK : ++ case PPD_CS_CMYK : ++ device_colorspace = COLORD_SPACE_CMYK; ++ colordCreateProfile(profiles, ++ p->name, ++ "CMYK..", ++ COLORD_SPACE_CMYK, ++ (const char **)format, ++ NULL, ++ COLORD_SCOPE_TEMP); ++ break; ++ case PPD_CS_GRAY : ++ device_colorspace = COLORD_SPACE_GRAY; ++ break; ++ case PPD_CS_N : ++ colordCreateProfile(profiles, ++ p->name, ++ "DeviceN..", ++ COLORD_SPACE_UNKNOWN, ++ (const char **)format, ++ NULL, ++ COLORD_SCOPE_TEMP); ++ break; ++ } ++ ++ /* ++ * Register the device with colord. ++ */ ++ ++ cupsdLogMessage(CUPSD_LOG_INFO, "Registering ICC color profiles for \"%s\"", ++ p->name); ++ colordCreateDevice (p, ++ ppd, ++ profiles, ++ device_colorspace, ++ format, ++ COLORD_RELATION_SOFT, ++ COLORD_SCOPE_TEMP); ++ ++ /* ++ * Free any memory we used... ++ */ ++ ++ cupsArrayDelete(profiles); ++ for (i=0; i<3; i++) ++ free(format[i]); ++ free(format); ++ ++ ppdClose(ppd); ++} ++ ++/* ++ * 'colordUnregisterPrinter()' - Unregister profiles for a printer. ++ */ ++ ++void ++colordUnregisterPrinter(cupsd_printer_t *p) /* I - printer */ ++{ ++ char device_id[1024]; /* Device ID as understood by colord */ ++ ++ /* ++ * Ensure we have a DBus connection ++ */ ++ ++ colordStart(); ++ if (con == NULL) ++ return; ++ ++ /* ++ * Just delete the device itself, and leave the profiles registered ++ */ ++ ++ snprintf(device_id, sizeof(device_id), "cups-%s", p->name); ++ colordDeleteDevice(device_id); ++} ++ ++#endif /* HAVE_DBUS */ ++ ++/* ++ * End of "$Id$". ++ */ +diff --git a/scheduler/colord.h b/scheduler/colord.h +new file mode 100644 +index 0000000..75bdd3b +--- /dev/null ++++ b/scheduler/colord.h +@@ -0,0 +1,41 @@ ++/* ++ * "$Id$" ++ * ++ * colord integration for the CUPS scheduler. ++ * ++ * Copyright 2011 Red Hat, Inc. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++ * OF THE POSSIBILITY OF SUCH DAMAGE. ++ * ++ */ ++ ++void colordRegisterPrinter(cupsd_printer_t *p); ++void colordUnregisterPrinter(cupsd_printer_t *p); ++void colordStart(void); ++void colordStop(void); ++ ++/* ++ * End of "$Id$". ++ */ +diff --git a/scheduler/ipp.c b/scheduler/ipp.c +index b9903d1..b5af36f 100644 +--- a/scheduler/ipp.c ++++ b/scheduler/ipp.c +@@ -2921,17 +2921,23 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ + + cupsdSetPrinterReasons(printer, "none"); + +-#ifdef __APPLE__ + /* + * (Re)register color profiles... + */ + + if (!RunUser) + { ++ cupsdCmsRegisterPrinter(printer); ++#ifdef __APPLE__ ++ /* ++ * FIXME: ideally the ColorSync stuff would be moved to colorsync.c ++ * and the colorsyncRegisterProfiles() would be called from ++ * cupsdCmsRegisterPrinter() in printers.c ++ */ + apple_unregister_profiles(printer); + apple_register_profiles(printer); +- } + #endif /* __APPLE__ */ ++ } + } + + /* +@@ -7028,11 +7034,17 @@ delete_printer(cupsd_client_t *con, /* I - Client connection */ + snprintf(filename, sizeof(filename), "%s/%s.data", CacheDir, printer->name); + unlink(filename); + +-#ifdef __APPLE__ + /* + * Unregister color profiles... + */ + ++ cupsdCmsUnregisterPrinter(printer); ++#ifdef __APPLE__ ++ /* ++ * FIXME: ideally the ColorSync stuff would be moved to colorsync.c ++ * and the colorsyncUnregisterPrinter() would be called from ++ * cupsdCmsUnregisterPrinter() in printers.c ++ */ + apple_unregister_profiles(printer); + #endif /* __APPLE__ */ + +diff --git a/scheduler/printers.c b/scheduler/printers.c +index 6920801..e830499 100644 +--- a/scheduler/printers.c ++++ b/scheduler/printers.c +@@ -80,6 +80,9 @@ + # include + #endif /* __APPLE__ */ + ++#ifdef HAVE_DBUS ++# include "colord.h" ++#endif /* HAVE_DBUS */ + + /* + * Local functions... +@@ -712,6 +715,53 @@ cupsdDeleteAllPrinters(void) + } + } + ++/* ++ * 'cupsdCmsRegisterPrinter()' - Registers a printer and profiles with the CMS ++ */ ++ ++void ++cupsdCmsRegisterPrinter(cupsd_printer_t *p) ++{ ++#if defined(HAVE_DBUS) ++ colordRegisterPrinter(p); ++#endif /* defined(HAVE_DBUS) */ ++} ++ ++/* ++ * 'cupsdCmsUnregisterPrinter()' - Unregisters a printer and profiles with the CMS ++ */ ++ ++void ++cupsdCmsUnregisterPrinter(cupsd_printer_t *p) ++{ ++#if defined(HAVE_DBUS) ++ colordUnregisterPrinter(p); ++#endif /* defined(HAVE_DBUS) */ ++} ++ ++/* ++ * 'cupsdCmsStart()' - Starts the CMS ++ */ ++ ++void ++cupsdCmsStart(void) ++{ ++#if defined(HAVE_DBUS) ++ colordStart(); ++#endif /* defined(HAVE_DBUS) */ ++} ++ ++/* ++ * 'cupsdCmsStop()' - Stops the CMS ++ */ ++ ++void ++cupsdCmsStop(void) ++{ ++#if defined(HAVE_DBUS) ++ colordStop(); ++#endif /* defined(HAVE_DBUS) */ ++} + + /* + * 'cupsdDeletePrinter()' - Delete a printer from the system. +@@ -752,6 +802,12 @@ cupsdDeletePrinter( + "Job stopped."); + + /* ++ * Unregister profiles... ++ */ ++ ++ cupsdCmsUnregisterPrinter(p); ++ ++ /* + * If this printer is the next for browsing, point to the next one... + */ + +@@ -1418,6 +1474,12 @@ cupsdRenamePrinter( + } + + /* ++ * Unregister profiles... ++ */ ++ ++ cupsdCmsUnregisterPrinter(p); ++ ++ /* + * Rename the printer... + */ + +@@ -2644,6 +2706,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */ + #endif /* __sgi */ + + /* ++ * Re-register profiles... ++ */ ++ ++ cupsdCmsUnregisterPrinter(p); ++ cupsdCmsRegisterPrinter(p); ++ ++ /* + * Let the browse protocols reflect the change + */ + +diff --git a/scheduler/printers.h b/scheduler/printers.h +index 1751578..3820428 100644 +--- a/scheduler/printers.h ++++ b/scheduler/printers.h +@@ -170,6 +170,10 @@ extern const char *cupsdValidateDest(const char *uri, + cups_ptype_t *dtype, + cupsd_printer_t **printer); + extern void cupsdWritePrintcap(void); ++extern void cupsdCmsRegisterPrinter(cupsd_printer_t *p); ++extern void cupsdCmsUnregisterPrinter(cupsd_printer_t *p); ++extern void cupsdCmsStart(void); ++extern void cupsdCmsStop(void); + + + /* +-- +1.7.6.2 + diff --git a/cups-logrotate.patch b/cups-logrotate.patch index 559cbdc..a6485a9 100644 --- a/cups-logrotate.patch +++ b/cups-logrotate.patch @@ -1,7 +1,7 @@ -diff -up cups-1.3.5/scheduler/log.c.logrotate cups-1.3.5/scheduler/log.c ---- cups-1.3.5/scheduler/log.c.logrotate 2008-02-14 12:21:25.000000000 +0000 -+++ cups-1.3.5/scheduler/log.c 2008-02-14 12:24:16.000000000 +0000 -@@ -29,6 +29,9 @@ +diff -up cups-1.5b1/scheduler/log.c.logrotate cups-1.5b1/scheduler/log.c +--- cups-1.5b1/scheduler/log.c.logrotate 2011-05-14 01:04:16.000000000 +0200 ++++ cups-1.5b1/scheduler/log.c 2011-05-24 15:47:20.000000000 +0200 +@@ -32,6 +32,9 @@ #include "cupsd.h" #include #include @@ -11,7 +11,7 @@ diff -up cups-1.3.5/scheduler/log.c.logrotate cups-1.3.5/scheduler/log.c /* -@@ -467,12 +470,10 @@ check_log_file(cups_file_t **lf, /* IO - +@@ -71,12 +74,10 @@ cupsdCheckLogFile(cups_file_t **lf, /* I return (1); /* @@ -26,7 +26,7 @@ diff -up cups-1.3.5/scheduler/log.c.logrotate cups-1.3.5/scheduler/log.c { /* * Handle format strings... -@@ -565,6 +566,34 @@ check_log_file(cups_file_t **lf, /* IO - +@@ -186,6 +187,34 @@ cupsdCheckLogFile(cups_file_t **lf, /* I } /* diff --git a/cups-lpr-help.patch b/cups-lpr-help.patch index 1a68297..c42434d 100644 --- a/cups-lpr-help.patch +++ b/cups-lpr-help.patch @@ -1,8 +1,8 @@ -diff -up cups-1.4b1/berkeley/lpr.c.lpr-help cups-1.4b1/berkeley/lpr.c ---- cups-1.4b1/berkeley/lpr.c.lpr-help 2008-07-11 23:46:21.000000000 +0100 -+++ cups-1.4b1/berkeley/lpr.c 2008-11-11 16:20:32.000000000 +0000 -@@ -30,6 +30,31 @@ - #include +diff -up cups-1.5b1/berkeley/lpr.c.lpr-help cups-1.5b1/berkeley/lpr.c +--- cups-1.5b1/berkeley/lpr.c.lpr-help 2011-03-21 23:02:00.000000000 +0100 ++++ cups-1.5b1/berkeley/lpr.c 2011-05-23 17:58:06.000000000 +0200 +@@ -24,6 +24,31 @@ + #include +static void @@ -33,15 +33,7 @@ diff -up cups-1.4b1/berkeley/lpr.c.lpr-help cups-1.4b1/berkeley/lpr.c /* * 'main()' - Parse options and send files for printing. */ -@@ -54,7 +79,6 @@ main(int argc, /* I - Number of comm - int deletefile; /* Delete file after print? */ - char buffer[8192]; /* Copy buffer */ - -- - _cupsSetLocale(argv); - - deletefile = 0; -@@ -282,6 +306,12 @@ main(int argc, /* I - Number of comm +@@ -270,6 +294,12 @@ main(int argc, /* I - Number of comm break; default : @@ -52,5 +44,5 @@ diff -up cups-1.4b1/berkeley/lpr.c.lpr-help cups-1.4b1/berkeley/lpr.c + } + _cupsLangPrintf(stderr, - _("%s: Error - unknown option \'%c\'!\n"), - argv[0], argv[i][1]); + _("%s: Error - unknown option \"%c\"."), argv[0], + argv[i][1]); diff --git a/cups-multilib.patch b/cups-multilib.patch index 21db4cb..3c6bc39 100644 --- a/cups-multilib.patch +++ b/cups-multilib.patch @@ -1,6 +1,7 @@ ---- cups-1.2.3/cups-config.in.multilib 2006-08-03 01:54:38.000000000 +0100 -+++ cups-1.2.3/cups-config.in 2006-08-30 15:47:35.000000000 +0100 -@@ -30,8 +30,10 @@ +diff -up cups-1.5b1/cups-config.in.multilib cups-1.5b1/cups-config.in +--- cups-1.5b1/cups-config.in.multilib 2010-06-16 02:48:25.000000000 +0200 ++++ cups-1.5b1/cups-config.in 2011-05-23 17:33:31.000000000 +0200 +@@ -22,8 +22,10 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ includedir=@includedir@ diff --git a/cups-no-export-ssllibs.patch b/cups-no-export-ssllibs.patch index 9effc8e..de277d8 100644 --- a/cups-no-export-ssllibs.patch +++ b/cups-no-export-ssllibs.patch @@ -1,7 +1,7 @@ -diff -up cups-1.4b2-svn8404/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.4b2-svn8404/config-scripts/cups-ssl.m4 ---- cups-1.4b2-svn8404/config-scripts/cups-ssl.m4.no-export-ssllibs 2009-02-17 17:45:27.000000000 +0000 -+++ cups-1.4b2-svn8404/config-scripts/cups-ssl.m4 2009-03-05 11:12:59.000000000 +0000 -@@ -110,7 +110,7 @@ fi +diff -up cups-1.5.3/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.5.3/config-scripts/cups-ssl.m4 +--- cups-1.5.3/config-scripts/cups-ssl.m4.no-export-ssllibs 2012-03-21 05:45:48.000000000 +0100 ++++ cups-1.5.3/config-scripts/cups-ssl.m4 2012-05-15 16:47:13.753314620 +0200 +@@ -173,7 +173,7 @@ AC_SUBST(IPPALIASES) AC_SUBST(SSLFLAGS) AC_SUBST(SSLLIBS) @@ -9,4 +9,4 @@ diff -up cups-1.4b2-svn8404/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1. +EXPORT_SSLLIBS="" AC_SUBST(EXPORT_SSLLIBS) - + dnl diff --git a/cups-no-gzip-man.patch b/cups-no-gzip-man.patch index 4a08503..6786c44 100644 --- a/cups-no-gzip-man.patch +++ b/cups-no-gzip-man.patch @@ -1,6 +1,6 @@ -diff -up cups-1.4b2-svn8404/config-scripts/cups-manpages.m4.no-gzip-man cups-1.4b2-svn8404/config-scripts/cups-manpages.m4 ---- cups-1.4b2-svn8404/config-scripts/cups-manpages.m4.no-gzip-man 2009-01-16 08:58:42.000000000 +0000 -+++ cups-1.4b2-svn8404/config-scripts/cups-manpages.m4 2009-03-05 11:11:12.000000000 +0000 +diff -up cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man cups-1.5b1/config-scripts/cups-manpages.m4 +--- cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man 2011-05-12 07:21:56.000000000 +0200 ++++ cups-1.5b1/config-scripts/cups-manpages.m4 2011-05-23 17:25:50.000000000 +0200 @@ -69,10 +69,10 @@ case "$uname" in ;; Linux* | GNU* | Darwin*) diff --git a/cups-peercred.patch b/cups-peercred.patch new file mode 100644 index 0000000..a106abb --- /dev/null +++ b/cups-peercred.patch @@ -0,0 +1,11 @@ +diff -up cups-1.5b1/scheduler/auth.c.peercred cups-1.5b1/scheduler/auth.c +--- cups-1.5b1/scheduler/auth.c.peercred 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/scheduler/auth.c 2011-05-23 18:00:18.000000000 +0200 +@@ -52,6 +52,7 @@ + * Include necessary headers... + */ + ++#define _GNU_SOURCE + #include "cupsd.h" + #include + #ifdef HAVE_SHADOW_H diff --git a/cups-pid.patch b/cups-pid.patch index ab4ff84..23ffd47 100644 --- a/cups-pid.patch +++ b/cups-pid.patch @@ -1,6 +1,7 @@ ---- cups-1.1.21/scheduler/main.c.pid 2004-09-24 11:29:05.073748138 +0100 -+++ cups-1.1.21/scheduler/main.c 2004-09-24 11:44:35.826446564 +0100 -@@ -349,6 +349,8 @@ +diff -up cups-1.5b1/scheduler/main.c.pid cups-1.5b1/scheduler/main.c +--- cups-1.5b1/scheduler/main.c.pid 2011-05-18 22:44:16.000000000 +0200 ++++ cups-1.5b1/scheduler/main.c 2011-05-23 18:01:20.000000000 +0200 +@@ -311,6 +311,8 @@ main(int argc, /* I - Number of comm * Setup signal handlers for the parent... */ @@ -9,7 +10,7 @@ #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */ sigset(SIGUSR1, parent_handler); sigset(SIGCHLD, parent_handler); -@@ -372,7 +374,7 @@ +@@ -334,7 +336,7 @@ main(int argc, /* I - Number of comm signal(SIGHUP, SIG_IGN); #endif /* HAVE_SIGSET */ @@ -18,7 +19,7 @@ { /* * OK, wait for the child to startup and send us SIGUSR1 or to crash -@@ -384,7 +386,15 @@ +@@ -346,7 +348,15 @@ main(int argc, /* I - Number of comm sleep(1); if (parent_signal == SIGUSR1) diff --git a/cups-res_init.patch b/cups-res_init.patch index 1660f07..1dc110e 100644 --- a/cups-res_init.patch +++ b/cups-res_init.patch @@ -1,12 +1,26 @@ -diff -up cups-1.4b2-svn8404/cups/http-addrlist.c.res_init cups-1.4b2-svn8404/cups/http-addrlist.c ---- cups-1.4b2-svn8404/cups/http-addrlist.c.res_init 2009-03-23 17:41:03.000000000 +0000 -+++ cups-1.4b2-svn8404/cups/http-addrlist.c 2009-03-23 17:41:26.000000000 +0000 -@@ -373,7 +373,7 @@ httpAddrGetList(const char *hostname, /* +diff -up cups-1.5b1/cups/http-addr.c.res_init cups-1.5b1/cups/http-addr.c +--- cups-1.5b1/cups/http-addr.c.res_init 2011-04-16 01:38:13.000000000 +0200 ++++ cups-1.5b1/cups/http-addr.c 2011-05-24 15:56:50.000000000 +0200 +@@ -256,7 +256,8 @@ httpAddrLookup( + + if (error) + { +- if (error == EAI_FAIL) ++ if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA || ++ error == EAI_NONAME) + cg->need_res_init = 1; + + return (httpAddrString(addr, name, namelen)); +diff -up cups-1.5b1/cups/http-addrlist.c.res_init cups-1.5b1/cups/http-addrlist.c +--- cups-1.5b1/cups/http-addrlist.c.res_init 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/cups/http-addrlist.c 2011-05-24 15:56:50.000000000 +0200 +@@ -386,7 +386,8 @@ httpAddrGetList(const char *hostname, /* freeaddrinfo(results); } - else if (error == EAI_FAIL) -+ else if (error == EAI_FAIL || error == EAI_AGAIN) ++ else if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA || ++ error == EAI_NONAME) cg->need_res_init = 1; #else diff --git a/cups-ricoh-deviceid-oid.patch b/cups-ricoh-deviceid-oid.patch new file mode 100644 index 0000000..c148f95 --- /dev/null +++ b/cups-ricoh-deviceid-oid.patch @@ -0,0 +1,21 @@ +diff -up cups-1.5b1/backend/snmp.c.ricoh-deviceid-oid cups-1.5b1/backend/snmp.c +--- cups-1.5b1/backend/snmp.c.ricoh-deviceid-oid 2011-05-24 17:29:48.000000000 +0200 ++++ cups-1.5b1/backend/snmp.c 2011-05-24 17:29:48.000000000 +0200 +@@ -188,6 +188,7 @@ static const int LexmarkProductOID[] = { + static const int LexmarkProductOID2[] = { 1,3,6,1,4,1,674,10898,100,2,1,2,1,2,1,-1 }; + static const int LexmarkDeviceIdOID[] = { 1,3,6,1,4,1,641,2,1,2,1,3,1,-1 }; + static const int HPDeviceIdOID[] = { 1,3,6,1,4,1,11,2,3,9,1,1,7,0,-1 }; ++static const int RicohDeviceIdOID[] = { 1,3,6,1,4,1,367,3,2,1,1,1,11,0,-1 }; + static const int XeroxProductOID[] = { 1,3,6,1,4,1,128,2,1,3,1,2,0,-1 }; + static cups_array_t *DeviceURIs = NULL; + static int HostNameLookups = 0; +@@ -1005,6 +1006,9 @@ read_snmp_response(int fd) /* I - SNMP + packet.community, CUPS_ASN1_GET_REQUEST, + DEVICE_ID, LexmarkDeviceIdOID); + _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1, ++ packet.community, CUPS_ASN1_GET_REQUEST, ++ DEVICE_ID, RicohDeviceIdOID); ++ _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1, + packet.community, CUPS_ASN1_GET_REQUEST, + DEVICE_PRODUCT, XeroxProductOID); + _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1, diff --git a/cups-serial.patch b/cups-serial.patch new file mode 100644 index 0000000..d17c9cb --- /dev/null +++ b/cups-serial.patch @@ -0,0 +1,11 @@ +diff -up cups-1.5b1/backend/serial.c.serial cups-1.5b1/backend/serial.c +--- cups-1.5b1/backend/serial.c.serial 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/backend/serial.c 2011-05-23 17:34:33.000000000 +0200 +@@ -75,6 +75,7 @@ + #endif /* __APPLE__ */ + + #if defined(__linux) && defined(TIOCGSERIAL) ++# include + # include + # include + #endif /* __linux && TIOCGSERIAL */ diff --git a/cups-serverbin-compat.patch b/cups-serverbin-compat.patch index 0d1ab10..0ca72fd 100644 --- a/cups-serverbin-compat.patch +++ b/cups-serverbin-compat.patch @@ -1,7 +1,7 @@ -diff -up cups-1.4rc1/scheduler/conf.c.serverbin-compat cups-1.4rc1/scheduler/conf.c ---- cups-1.4rc1/scheduler/conf.c.serverbin-compat 2009-05-26 16:41:04.000000000 +0100 -+++ cups-1.4rc1/scheduler/conf.c 2009-06-17 11:03:24.286442640 +0100 -@@ -490,6 +490,9 @@ cupsdReadConfiguration(void) +diff -up cups-1.5b1/scheduler/conf.c.serverbin-compat cups-1.5b1/scheduler/conf.c +--- cups-1.5b1/scheduler/conf.c.serverbin-compat 2011-05-20 06:24:54.000000000 +0200 ++++ cups-1.5b1/scheduler/conf.c 2011-05-23 17:20:33.000000000 +0200 +@@ -491,6 +491,9 @@ cupsdReadConfiguration(void) cupsdClearString(&ServerName); cupsdClearString(&ServerAdmin); cupsdSetString(&ServerBin, CUPS_SERVERBIN); @@ -11,7 +11,7 @@ diff -up cups-1.4rc1/scheduler/conf.c.serverbin-compat cups-1.4rc1/scheduler/con cupsdSetString(&RequestRoot, CUPS_REQUESTS); cupsdSetString(&CacheDir, CUPS_CACHEDIR); cupsdSetString(&DataDir, CUPS_DATADIR); -@@ -1320,7 +1323,12 @@ cupsdReadConfiguration(void) +@@ -1378,7 +1381,12 @@ cupsdReadConfiguration(void) * Read the MIME type and conversion database... */ @@ -23,11 +23,11 @@ diff -up cups-1.4rc1/scheduler/conf.c.serverbin-compat cups-1.4rc1/scheduler/con +#endif snprintf(mimedir, sizeof(mimedir), "%s/mime", DataDir); - MimeDatabase = mimeLoadTypes(NULL, mimedir); -diff -up cups-1.4rc1/scheduler/conf.h.serverbin-compat cups-1.4rc1/scheduler/conf.h ---- cups-1.4rc1/scheduler/conf.h.serverbin-compat 2009-05-11 23:46:01.000000000 +0100 -+++ cups-1.4rc1/scheduler/conf.h 2009-06-17 11:03:24.287442308 +0100 -@@ -106,6 +106,10 @@ VAR char *ConfigurationFile VALUE(NULL) + MimeDatabase = mimeNew(); +diff -up cups-1.5b1/scheduler/conf.h.serverbin-compat cups-1.5b1/scheduler/conf.h +--- cups-1.5b1/scheduler/conf.h.serverbin-compat 2011-04-22 19:47:03.000000000 +0200 ++++ cups-1.5b1/scheduler/conf.h 2011-05-23 15:34:25.000000000 +0200 +@@ -105,6 +105,10 @@ VAR char *ConfigurationFile VALUE(NULL) /* Root directory for scheduler */ *ServerBin VALUE(NULL), /* Root directory for binaries */ @@ -38,27 +38,27 @@ diff -up cups-1.4rc1/scheduler/conf.h.serverbin-compat cups-1.4rc1/scheduler/con *StateDir VALUE(NULL), /* Root directory for state data */ *RequestRoot VALUE(NULL), -diff -up cups-1.4rc1/scheduler/env.c.serverbin-compat cups-1.4rc1/scheduler/env.c ---- cups-1.4rc1/scheduler/env.c.serverbin-compat 2008-06-18 23:31:26.000000000 +0100 -+++ cups-1.4rc1/scheduler/env.c 2009-06-17 11:03:24.288442597 +0100 -@@ -86,8 +86,13 @@ cupsdInitEnv(void) - cupsdSetEnv("LD_LIBRARY_PATH", NULL); - cupsdSetEnv("LD_PRELOAD", NULL); - cupsdSetEnv("NLSPATH", NULL); +diff -up cups-1.5b1/scheduler/env.c.serverbin-compat cups-1.5b1/scheduler/env.c +--- cups-1.5b1/scheduler/env.c.serverbin-compat 2011-01-11 04:48:42.000000000 +0100 ++++ cups-1.5b1/scheduler/env.c 2011-05-23 17:07:17.000000000 +0200 +@@ -218,8 +218,13 @@ cupsdUpdateEnv(void) + set_if_undefined("LD_PRELOAD", NULL); + set_if_undefined("NLSPATH", NULL); + if (find_env("PATH") < 0) +#ifdef __x86_64__ -+ cupsdSetEnvf("PATH", "%s/filter:%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR -+ ":/bin:/usr/bin", ServerBin, ServerBin_compat); ++ cupsdSetEnvf("PATH", "%s/filter:%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR ++ ":/bin:/usr/bin", ServerBin, ServerBin_compat); +#else /* ! defined(__x86_64__) */ - cupsdSetEnvf("PATH", "%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR - ":/bin:/usr/bin", ServerBin); + cupsdSetEnvf("PATH", "%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR + ":/bin:/usr/bin", ServerBin); +#endif - cupsdSetEnv("SERVER_ADMIN", ServerAdmin); - cupsdSetEnv("SHLIB_PATH", NULL); - cupsdSetEnv("SOFTWARE", CUPS_MINIMAL); -diff -up cups-1.4rc1/scheduler/ipp.c.serverbin-compat cups-1.4rc1/scheduler/ipp.c ---- cups-1.4rc1/scheduler/ipp.c.serverbin-compat 2009-05-26 23:01:23.000000000 +0100 -+++ cups-1.4rc1/scheduler/ipp.c 2009-06-17 11:03:24.295443078 +0100 -@@ -2539,9 +2539,18 @@ add_printer(cupsd_client_t *con, /* I - + set_if_undefined("SERVER_ADMIN", ServerAdmin); + set_if_undefined("SHLIB_PATH", NULL); + set_if_undefined("SOFTWARE", CUPS_MINIMAL); +diff -up cups-1.5b1/scheduler/ipp.c.serverbin-compat cups-1.5b1/scheduler/ipp.c +--- cups-1.5b1/scheduler/ipp.c.serverbin-compat 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/scheduler/ipp.c 2011-05-23 16:09:57.000000000 +0200 +@@ -2586,9 +2586,18 @@ add_printer(cupsd_client_t *con, /* I - * Could not find device in list! */ @@ -68,8 +68,8 @@ diff -up cups-1.4rc1/scheduler/ipp.c.serverbin-compat cups-1.4rc1/scheduler/ipp. + if (access(srcfile, X_OK)) + { +#endif /* __x86_64__ */ - send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri scheme \"%s\"!"), - scheme); + send_ipp_status(con, IPP_NOT_POSSIBLE, + _("Bad device-uri scheme \"%s\"."), scheme); return; +#ifdef __x86_64__ + } @@ -77,10 +77,10 @@ diff -up cups-1.4rc1/scheduler/ipp.c.serverbin-compat cups-1.4rc1/scheduler/ipp. } } -diff -up cups-1.4rc1/scheduler/job.c.serverbin-compat cups-1.4rc1/scheduler/job.c ---- cups-1.4rc1/scheduler/job.c.serverbin-compat 2009-05-11 23:46:01.000000000 +0100 -+++ cups-1.4rc1/scheduler/job.c 2009-06-17 11:03:24.305442437 +0100 -@@ -972,8 +972,32 @@ cupsdContinueJob(cupsd_job_t *job) /* I +diff -up cups-1.5b1/scheduler/job.c.serverbin-compat cups-1.5b1/scheduler/job.c +--- cups-1.5b1/scheduler/job.c.serverbin-compat 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/scheduler/job.c 2011-05-23 16:18:57.000000000 +0200 +@@ -1047,8 +1047,32 @@ cupsdContinueJob(cupsd_job_t *job) /* I i ++, filter = (mime_filter_t *)cupsArrayNext(filters)) { if (filter->filter[0] != '/') @@ -115,21 +115,21 @@ diff -up cups-1.4rc1/scheduler/job.c.serverbin-compat cups-1.4rc1/scheduler/job. else strlcpy(command, filter->filter, sizeof(command)); -@@ -1119,6 +1143,28 @@ cupsdContinueJob(cupsd_job_t *job) /* I - cupsdClosePipe(job->print_pipes); +@@ -1199,6 +1223,28 @@ cupsdContinueJob(cupsd_job_t *job) /* I + { cupsdClosePipe(job->back_pipes); cupsdClosePipe(job->side_pipes); +#ifdef __x86_64__ + if (access(command, F_OK)) + { + snprintf(command, sizeof(command), "%s/backend/%s", ServerBin_compat, -+ method); ++ scheme); + if (!access(command, F_OK)) + { + /* Not in the correct directory, but we found it in the compat + * directory. Issue a warning. */ + cupsdLogMessage(CUPSD_LOG_INFO, -+ "Backend '%s' not in %s/backend!", method, ++ "Backend '%s' not in %s/backend!", scheme, + ServerBin); + } + else @@ -137,17 +137,17 @@ diff -up cups-1.4rc1/scheduler/job.c.serverbin-compat cups-1.4rc1/scheduler/job. + /* Not in the compat directory either; make any error + messages use the correct directory name then. */ + snprintf(command, sizeof(command), "%s/backend/%s", ServerBin, -+ method); ++ scheme); + } + } +#endif /* __x86_64__ */ close(job->status_pipes[1]); job->status_pipes[1] = -1; -diff -up cups-1.4rc1/scheduler/printers.c.serverbin-compat cups-1.4rc1/scheduler/printers.c ---- cups-1.4rc1/scheduler/printers.c.serverbin-compat 2009-05-16 22:49:57.000000000 +0100 -+++ cups-1.4rc1/scheduler/printers.c 2009-06-17 11:08:13.888317742 +0100 -@@ -1015,9 +1015,19 @@ cupsdLoadAllPrinters(void) +diff -up cups-1.5b1/scheduler/printers.c.serverbin-compat cups-1.5b1/scheduler/printers.c +--- cups-1.5b1/scheduler/printers.c.serverbin-compat 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/scheduler/printers.c 2011-05-23 17:09:04.000000000 +0200 +@@ -1030,9 +1030,19 @@ cupsdLoadAllPrinters(void) * Backend does not exist, stop printer... */ @@ -167,26 +167,24 @@ diff -up cups-1.4rc1/scheduler/printers.c.serverbin-compat cups-1.4rc1/scheduler } } -@@ -3549,6 +3559,12 @@ add_printer_filter( +@@ -3621,8 +3631,20 @@ add_printer_filter( + else + snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin, program); - if (stat(filename, &fileinfo)) - { +#ifdef __x86_64__ ++ if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser, ++ cupsdLogFCMessage, p) == _CUPS_FILE_CHECK_MISSING) { + snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin_compat, -+ program); -+ if (stat(filename, &fileinfo)) -+ { -+#endif /* __x86_64__ */ - memset(&fileinfo, 0, sizeof(fileinfo)); ++ program); ++ if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser, ++ cupsdLogFCMessage, p) == _CUPS_FILE_CHECK_MISSING) ++ snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin, ++ program); ++ } ++#else /* ! defined(__x86_64__) */ + _cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser, + cupsdLogFCMessage, p); ++#endif + } - snprintf(p->state_message, sizeof(p->state_message), -@@ -3557,6 +3573,9 @@ add_printer_filter( - cupsdSetPrinterReasons(p, "+cups-missing-filter-warning"); - - cupsdLogMessage(CUPSD_LOG_ERROR, "%s", p->state_message); -+#ifdef __x86_64__ -+ } -+#endif /* __x86_64__ */ - } - - /* + /* diff --git a/cups-snmp-quirks.patch b/cups-snmp-quirks.patch new file mode 100644 index 0000000..535f6c0 --- /dev/null +++ b/cups-snmp-quirks.patch @@ -0,0 +1,115 @@ +diff -up cups-1.5.2/backend/snmp-supplies.c.snmp-quirks cups-1.5.2/backend/snmp-supplies.c +--- cups-1.5.2/backend/snmp-supplies.c.snmp-quirks 2011-10-07 23:41:07.000000000 +0200 ++++ cups-1.5.2/backend/snmp-supplies.c 2012-02-06 10:48:47.543906526 +0100 +@@ -47,6 +47,13 @@ + + + /* ++ * Printer quirks... ++ */ ++ ++#define QUIRK_CAPACITY (1<<0) ++ ++ ++/* + * Local structures... + */ + +@@ -66,6 +73,12 @@ typedef struct /**** Printer state ta + const char *keyword; /* IPP printer-state-reasons keyword */ + } backend_state_t; + ++typedef struct /**** Quirk names table ****/ ++{ ++ int bit; /* Quirk bit */ ++ const char *keyword; /* cupsSNMPQuirks keyword */ ++} quirk_name_t; ++ + + /* + * Local globals... +@@ -77,6 +90,7 @@ static int current_state = -1; + static int charset = -1; /* Character set for supply names */ + static int num_supplies = 0; + /* Number of supplies found */ ++static int quirks = 0; /* Printer quirks */ + static backend_supplies_t supplies[CUPS_MAX_SUPPLIES]; + /* Supply information */ + static int supply_state = -1; +@@ -176,6 +190,15 @@ static const backend_state_t const suppl + { CUPS_TONER_EMPTY, "toner-empty-warning" } + }; + ++static const quirk_name_t const quirk_names[] = ++ { ++ /* ++ * The prtMarkerSuppliesLevel values are ++ * percentages, not levels relative to the ++ * stated capacity. ++ */ ++ { QUIRK_CAPACITY, "capacity" } ++ }; + + /* + * Local functions... +@@ -229,6 +252,9 @@ backendSNMPSupplies( + + for (i = 0, ptr = value; i < num_supplies; i ++, ptr += strlen(ptr)) + { ++ if (quirks & QUIRK_CAPACITY) ++ supplies[i].max_capacity = 100; ++ + if (supplies[i].max_capacity > 0 && supplies[i].level >= 0) + percent = 100 * supplies[i].level / supplies[i].max_capacity; + else +@@ -401,6 +427,7 @@ backend_init_supplies( + http_addr_t *addr) /* I - Printer address */ + { + int i, /* Looping var */ ++ len, /* Quirk name length */ + type; /* Current marker type */ + cups_file_t *cachefile; /* Cache file */ + const char *cachedir; /* CUPS_CACHEDIR value */ +@@ -462,6 +489,7 @@ backend_init_supplies( + current_state = -1; + num_supplies = -1; + charset = -1; ++ quirks = 0; + + memset(supplies, 0, sizeof(supplies)); + +@@ -477,6 +505,34 @@ backend_init_supplies( + return; + } + ++ if (ppd && ++ (ppdattr = ppdFindAttr(ppd, "cupsSNMPQuirks", NULL)) != NULL && ++ ppdattr->value) ++ { ++ ptr = ppdattr->value; ++ while (*ptr != '\0') ++ { ++ /* ++ * Match keyword against quirk_names table. ++ */ ++ ++ for (i = 0; i < sizeof (quirk_names) / sizeof (quirk_names[0]); i++) ++ { ++ len = strlen (quirk_names[i].keyword); ++ if (!strncmp (ptr, quirk_names[i].keyword, len) && ++ (ptr[len] == '\0' || ptr[len] == ' ')) ++ quirks |= quirk_names[i].bit; ++ } ++ ++ /* ++ * Advance to next keyword. ++ */ ++ ++ ptr += strcspn (ptr, " "); ++ ptr += strspn (ptr, " "); ++ } ++ } ++ + ppdClose(ppd); + + /* diff --git a/cups-str3382.patch b/cups-str3382.patch new file mode 100644 index 0000000..2e8736d --- /dev/null +++ b/cups-str3382.patch @@ -0,0 +1,64 @@ +diff -up cups-1.5b1/cups/tempfile.c.str3382 cups-1.5b1/cups/tempfile.c +--- cups-1.5b1/cups/tempfile.c.str3382 2010-03-24 01:45:34.000000000 +0100 ++++ cups-1.5b1/cups/tempfile.c 2011-05-24 16:04:47.000000000 +0200 +@@ -33,6 +33,7 @@ + # include + #else + # include ++# include + #endif /* WIN32 || __EMX__ */ + + +@@ -54,7 +55,7 @@ cupsTempFd(char *filename, /* I - Point + char tmppath[1024]; /* Windows temporary directory */ + DWORD curtime; /* Current time */ + #else +- struct timeval curtime; /* Current time */ ++ mode_t old_umask; /* Old umask before using mkstemp() */ + #endif /* WIN32 */ + + +@@ -105,33 +106,25 @@ cupsTempFd(char *filename, /* I - Point + + snprintf(filename, len - 1, "%s/%05lx%08lx", tmpdir, + GetCurrentProcessId(), curtime); +-#else +- /* +- * Get the current time of day... +- */ +- +- gettimeofday(&curtime, NULL); +- +- /* +- * Format a string using the hex time values... +- */ +- +- snprintf(filename, len - 1, "%s/%05x%08x", tmpdir, (unsigned)getpid(), +- (unsigned)(curtime.tv_sec + curtime.tv_usec + tries)); +-#endif /* WIN32 */ + + /* + * Open the file in "exclusive" mode, making sure that we don't + * stomp on an existing file or someone's symlink crack... + */ + +-#ifdef WIN32 + fd = open(filename, _O_CREAT | _O_RDWR | _O_TRUNC | _O_BINARY, + _S_IREAD | _S_IWRITE); +-#elif defined(O_NOFOLLOW) +- fd = open(filename, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW, 0600); + #else +- fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600); ++ ++ /* ++ * Use the standard mkstemp() call to make a temporary filename ++ * securely. -- andrew.wood@jdplc.com ++ */ ++ snprintf(filename, len - 1, "%s/cupsXXXXXX", tmpdir); ++ ++ old_umask = umask(0077); ++ fd = mkstemp(filename); ++ umask(old_umask); + #endif /* WIN32 */ + + if (fd < 0 && errno != EEXIST) diff --git a/cups-strict-ppd-line-length.patch b/cups-strict-ppd-line-length.patch new file mode 100644 index 0000000..b2697ec --- /dev/null +++ b/cups-strict-ppd-line-length.patch @@ -0,0 +1,30 @@ +diff -up cups-1.5b1/cups/ppd.c.strict-ppd-line-length cups-1.5b1/cups/ppd.c +--- cups-1.5b1/cups/ppd.c.strict-ppd-line-length 2011-05-20 05:49:49.000000000 +0200 ++++ cups-1.5b1/cups/ppd.c 2011-05-24 15:46:13.000000000 +0200 +@@ -2786,7 +2786,7 @@ ppd_read(cups_file_t *fp, /* I - Fil + *lineptr++ = ch; + col ++; + +- if (col > (PPD_MAX_LINE - 1)) ++ if (col > (PPD_MAX_LINE - 1) && cg->ppd_conform == PPD_CONFORM_STRICT) + { + /* + * Line is too long... +@@ -2847,7 +2847,7 @@ ppd_read(cups_file_t *fp, /* I - Fil + { + col ++; + +- if (col > (PPD_MAX_LINE - 1)) ++ if (col > (PPD_MAX_LINE - 1) && cg->ppd_conform == PPD_CONFORM_STRICT) + { + /* + * Line is too long... +@@ -2906,7 +2906,7 @@ ppd_read(cups_file_t *fp, /* I - Fil + { + col ++; + +- if (col > (PPD_MAX_LINE - 1)) ++ if (col > (PPD_MAX_LINE - 1) && cg->ppd_conform == PPD_CONFORM_STRICT) + { + /* + * Line is too long... diff --git a/cups-system-auth.patch b/cups-system-auth.patch new file mode 100644 index 0000000..60117a9 --- /dev/null +++ b/cups-system-auth.patch @@ -0,0 +1,38 @@ +diff -up cups-1.5b1/conf/cups.password-auth.system-auth cups-1.5b1/conf/cups.password-auth +--- cups-1.5b1/conf/cups.password-auth.system-auth 2011-05-23 17:27:27.000000000 +0200 ++++ cups-1.5b1/conf/cups.password-auth 2011-05-23 17:27:27.000000000 +0200 +@@ -0,0 +1,4 @@ ++#%PAM-1.0 ++# Use password-auth common PAM configuration for the daemon ++auth include password-auth ++account include password-auth +diff -up cups-1.5b1/conf/cups.system-auth.system-auth cups-1.5b1/conf/cups.system-auth +--- cups-1.5b1/conf/cups.system-auth.system-auth 2011-05-23 17:27:27.000000000 +0200 ++++ cups-1.5b1/conf/cups.system-auth 2011-05-23 17:27:27.000000000 +0200 +@@ -0,0 +1,3 @@ ++#%PAM-1.0 ++auth include system-auth ++account include system-auth +diff -up cups-1.5b1/conf/Makefile.system-auth cups-1.5b1/conf/Makefile +--- cups-1.5b1/conf/Makefile.system-auth 2011-05-12 07:21:56.000000000 +0200 ++++ cups-1.5b1/conf/Makefile 2011-05-23 17:27:27.000000000 +0200 +@@ -90,10 +90,16 @@ install-data: + done + -if test x$(PAMDIR) != x; then \ + $(INSTALL_DIR) -m 755 $(BUILDROOT)$(PAMDIR); \ +- if test -r $(BUILDROOT)$(PAMDIR)/cups ; then \ +- $(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups.N ; \ ++ if test -f /etc/pam.d/password-auth; then \ ++ $(INSTALL_DATA) cups.password-auth $(BUILDROOT)$(PAMDIR)/cups; \ ++ elif test -f /etc/pam.d/system-auth; then \ ++ $(INSTALL_DATA) cups.system-auth $(BUILDROOT)$(PAMDIR)/cups; \ + else \ +- $(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups ; \ ++ if test -r $(BUILDROOT)$(PAMDIR)/cups ; then \ ++ $(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups.N ; \ ++ else \ ++ $(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups ; \ ++ fi ; \ + fi ; \ + fi + diff --git a/cups-systemd-socket.patch b/cups-systemd-socket.patch new file mode 100644 index 0000000..09d17d4 --- /dev/null +++ b/cups-systemd-socket.patch @@ -0,0 +1,527 @@ +diff -up cups-1.5.2/config.h.in.systemd-socket cups-1.5.2/config.h.in +--- cups-1.5.2/config.h.in.systemd-socket 2012-03-16 14:50:57.089449755 +0000 ++++ cups-1.5.2/config.h.in 2012-03-16 14:50:57.146449787 +0000 +@@ -503,6 +503,13 @@ + + + /* ++ * Do we have systemd support? ++ */ ++ ++#undef HAVE_SYSTEMD ++ ++ ++/* + * Various scripting languages... + */ + +diff -up cups-1.5.2/config-scripts/cups-systemd.m4.systemd-socket cups-1.5.2/config-scripts/cups-systemd.m4 +--- cups-1.5.2/config-scripts/cups-systemd.m4.systemd-socket 2012-03-16 14:50:57.146449787 +0000 ++++ cups-1.5.2/config-scripts/cups-systemd.m4 2012-03-16 14:50:57.146449787 +0000 +@@ -0,0 +1,36 @@ ++dnl ++dnl "$Id$" ++dnl ++dnl systemd stuff for CUPS. ++ ++dnl Find whether systemd is available ++ ++SDLIBS="" ++AC_ARG_WITH([systemdsystemunitdir], ++ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), ++ [], [with_systemdsystemunitdir=$($PKGCONFIG --variable=systemdsystemunitdir systemd)]) ++if test "x$with_systemdsystemunitdir" != xno; then ++ AC_MSG_CHECKING(for libsystemd-daemon) ++ if $PKGCONFIG --exists libsystemd-daemon; then ++ AC_MSG_RESULT(yes) ++ SDCFLAGS=`$PKGCONFIG --cflags libsystemd-daemon` ++ SDLIBS=`$PKGCONFIG --libs libsystemd-daemon` ++ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) ++ AC_DEFINE(HAVE_SYSTEMD) ++ else ++ AC_MSG_RESULT(no) ++ fi ++fi ++ ++if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then ++ SYSTEMD_UNITS="cups.service cups.socket cups.path" ++else ++ SYSTEMD_UNITS="" ++fi ++ ++AC_SUBST(SYSTEMD_UNITS) ++AC_SUBST(SDLIBS) ++ ++dnl ++dnl "$Id$" ++dnl +diff -up cups-1.5.2/configure.in.systemd-socket cups-1.5.2/configure.in +--- cups-1.5.2/configure.in.systemd-socket 2011-08-31 02:36:33.000000000 +0100 ++++ cups-1.5.2/configure.in 2012-03-16 14:50:57.146449787 +0000 +@@ -37,6 +37,7 @@ sinclude(config-scripts/cups-pam.m4) + sinclude(config-scripts/cups-largefile.m4) + sinclude(config-scripts/cups-dnssd.m4) + sinclude(config-scripts/cups-launchd.m4) ++sinclude(config-scripts/cups-systemd.m4) + sinclude(config-scripts/cups-defaults.m4) + sinclude(config-scripts/cups-pdf.m4) + sinclude(config-scripts/cups-scripting.m4) +@@ -71,6 +72,9 @@ AC_OUTPUT(Makedefs + conf/snmp.conf + cups-config + data/testprint ++ data/cups.service ++ data/cups.socket ++ data/cups.path + desktop/cups.desktop + doc/help/ref-cupsd-conf.html + doc/help/standard.html +diff -up cups-1.5.2/cups/usersys.c.systemd-socket cups-1.5.2/cups/usersys.c +--- cups-1.5.2/cups/usersys.c.systemd-socket 2012-03-16 14:50:57.054449734 +0000 ++++ cups-1.5.2/cups/usersys.c 2012-03-16 14:50:57.148449788 +0000 +@@ -778,7 +778,7 @@ cups_read_client_conf( + struct stat sockinfo; /* Domain socket information */ + + if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) && +- (sockinfo.st_mode & S_IRWXO) == S_IRWXO) ++ (sockinfo.st_mode & (S_IROTH | S_IWOTH)) == (S_IROTH | S_IWOTH)) + cups_server = CUPS_DEFAULT_DOMAINSOCKET; + else + #endif /* CUPS_DEFAULT_DOMAINSOCKET */ +diff -up cups-1.5.2/data/cups.path.in.systemd-socket cups-1.5.2/data/cups.path.in +--- cups-1.5.2/data/cups.path.in.systemd-socket 2012-03-16 14:50:57.148449788 +0000 ++++ cups-1.5.2/data/cups.path.in 2012-03-16 14:50:57.148449788 +0000 +@@ -0,0 +1,8 @@ ++[Unit] ++Description=CUPS Printer Service Spool ++ ++[Path] ++PathExistsGlob=@CUPS_REQUESTS@/d* ++ ++[Install] ++WantedBy=multi-user.target +diff -up cups-1.5.2/data/cups.service.in.systemd-socket cups-1.5.2/data/cups.service.in +--- cups-1.5.2/data/cups.service.in.systemd-socket 2012-03-16 14:50:57.149449788 +0000 ++++ cups-1.5.2/data/cups.service.in 2012-03-16 14:50:57.149449788 +0000 +@@ -0,0 +1,10 @@ ++[Unit] ++Description=CUPS Printing Service ++ ++[Service] ++ExecStart=@sbindir@/cupsd -f ++PrivateTmp=true ++ ++[Install] ++Also=cups.socket cups.path ++WantedBy=printer.target +diff -up cups-1.5.2/data/cups.socket.in.systemd-socket cups-1.5.2/data/cups.socket.in +--- cups-1.5.2/data/cups.socket.in.systemd-socket 2012-03-16 14:50:57.150449788 +0000 ++++ cups-1.5.2/data/cups.socket.in 2012-03-16 14:50:57.150449788 +0000 +@@ -0,0 +1,11 @@ ++[Unit] ++Description=CUPS Printing Service Sockets ++ ++[Socket] ++ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@ ++ListenStream=631 ++ListenDatagram=0.0.0.0:631 ++BindIPv6Only=ipv6-only ++ ++[Install] ++WantedBy=sockets.target +diff -up cups-1.5.2/data/Makefile.systemd-socket cups-1.5.2/data/Makefile +--- cups-1.5.2/data/Makefile.systemd-socket 2011-05-12 06:21:56.000000000 +0100 ++++ cups-1.5.2/data/Makefile 2012-03-16 14:50:57.151449789 +0000 +@@ -112,6 +112,12 @@ install-data: + $(INSTALL_DATA) $$file $(DATADIR)/ppdc; \ + done + $(INSTALL_DIR) -m 755 $(DATADIR)/profiles ++ if test "x$(SYSTEMD_UNITS)" != "x" ; then \ ++ $(INSTALL_DIR) -m 755 $(SYSTEMDUNITDIR); \ ++ for file in $(SYSTEMD_UNITS); do \ ++ $(INSTALL_DATA) $$file $(SYSTEMDUNITDIR); \ ++ done; \ ++ fi + + + # +@@ -159,6 +165,9 @@ uninstall: + -$(RMDIR) $(DATADIR)/charsets + -$(RMDIR) $(DATADIR)/banners + -$(RMDIR) $(DATADIR) ++ for file in $(SYSTEMD_UNITS); do \ ++ $(RM) $(SYSTEMDUNITDIR)/$$file; \ ++ done + + + # +diff -up cups-1.5.2/Makedefs.in.systemd-socket cups-1.5.2/Makedefs.in +--- cups-1.5.2/Makedefs.in.systemd-socket 2012-03-16 14:50:57.081449751 +0000 ++++ cups-1.5.2/Makedefs.in 2012-03-16 14:50:57.152449790 +0000 +@@ -143,6 +143,7 @@ CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ + CXXLIBS = @CXXLIBS@ + DBUS_NOTIFIER = @DBUS_NOTIFIER@ + DBUS_NOTIFIERLIBS = @DBUS_NOTIFIERLIBS@ ++SYSTEMD_UNITS = @SYSTEMD_UNITS@ + DNSSD_BACKEND = @DNSSD_BACKEND@ + DSOFLAGS = -L../cups @DSOFLAGS@ + DSOLIBS = @DSOLIBS@ $(COMMONLIBS) +@@ -151,6 +152,7 @@ FONTS = @FONTS@ + IMGLIBS = @IMGLIBS@ + IMGFILTERS = @IMGFILTERS@ + LAUNCHDLIBS = @LAUNCHDLIBS@ ++SDLIBS = @SDLIBS@ + LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \ + -L../scheduler @LDARCHFLAGS@ \ + @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM) +@@ -267,6 +269,7 @@ PAMFILE = @PAMFILE@ + + DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@ + DBUSDIR = @DBUSDIR@ ++SYSTEMDUNITDIR = $(BUILDROOT)@systemdsystemunitdir@ + + + # +diff -up cups-1.5.2/scheduler/client.h.systemd-socket cups-1.5.2/scheduler/client.h +--- cups-1.5.2/scheduler/client.h.systemd-socket 2011-03-25 21:25:38.000000000 +0000 ++++ cups-1.5.2/scheduler/client.h 2012-03-16 14:50:57.153449791 +0000 +@@ -75,6 +75,9 @@ typedef struct + int fd; /* File descriptor for this server */ + http_addr_t address; /* Bind address of socket */ + http_encryption_t encryption; /* To encrypt or not to encrypt... */ ++#ifdef HAVE_SYSTEMD ++ int is_systemd; /* Is this a systemd socket? */ ++#endif /* HAVE_SYSTEMD */ + } cupsd_listener_t; + + +diff -up cups-1.5.2/scheduler/dirsvc.c.systemd-socket cups-1.5.2/scheduler/dirsvc.c +--- cups-1.5.2/scheduler/dirsvc.c.systemd-socket 2012-03-16 14:50:57.112449768 +0000 ++++ cups-1.5.2/scheduler/dirsvc.c 2012-03-16 14:50:57.155449792 +0000 +@@ -1512,7 +1512,7 @@ cupsdStartBrowsing(void) + } + } + +- if (BrowseSocket >= 0) ++ if (BrowseSocket >= 0 && !BrowseSocketIsSystemd) + { + /* + * Bind the socket to browse port... +@@ -1556,13 +1556,17 @@ cupsdStartBrowsing(void) + cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to set broadcast mode - %s.", + strerror(errno)); + ++ if (!BrowseSocketIsSystemd) ++ { + #ifdef WIN32 +- closesocket(BrowseSocket); ++ closesocket(BrowseSocket); + #else +- close(BrowseSocket); ++ close(BrowseSocket); + #endif /* WIN32 */ + +- BrowseSocket = -1; ++ BrowseSocket = -1; ++ } ++ + BrowseLocalProtocols &= ~BROWSE_CUPS; + BrowseRemoteProtocols &= ~BROWSE_CUPS; + +@@ -1885,15 +1889,22 @@ cupsdStopBrowsing(void) + if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS) && + BrowseSocket >= 0) + { +- /* +- * Close the socket and remove it from the input selection set. +- */ ++ if (!BrowseSocketIsSystemd) ++ { ++ /* ++ * Close the socket. ++ */ + + #ifdef WIN32 +- closesocket(BrowseSocket); ++ closesocket(BrowseSocket); + #else +- close(BrowseSocket); ++ close(BrowseSocket); + #endif /* WIN32 */ ++ } ++ ++ /* ++ * Remove it from the input selection set. ++ */ + + cupsdRemoveSelect(BrowseSocket); + BrowseSocket = -1; +@@ -5693,11 +5704,14 @@ update_cups_browse(void) + strerror(errno)); + cupsdLogMessage(CUPSD_LOG_ERROR, "CUPS browsing turned off."); + ++ if (!BrowseSocketIsSystemd) ++ { + #ifdef WIN32 +- closesocket(BrowseSocket); ++ closesocket(BrowseSocket); + #else +- close(BrowseSocket); ++ close(BrowseSocket); + #endif /* WIN32 */ ++ } + + cupsdRemoveSelect(BrowseSocket); + BrowseSocket = -1; +diff -up cups-1.5.2/scheduler/dirsvc.h.systemd-socket cups-1.5.2/scheduler/dirsvc.h +--- cups-1.5.2/scheduler/dirsvc.h.systemd-socket 2012-03-16 14:50:57.113449769 +0000 ++++ cups-1.5.2/scheduler/dirsvc.h 2012-03-16 14:50:57.157449792 +0000 +@@ -100,6 +100,8 @@ VAR int Browsing VALUE(TRUE), + /* Short names for remote printers? */ + BrowseSocket VALUE(-1), + /* Socket for browsing */ ++ BrowseSocketIsSystemd VALUE(0), ++ /* BrowseSocket is systemd-provided? */ + BrowsePort VALUE(IPP_PORT), + /* Port number for broadcasts */ + BrowseInterval VALUE(DEFAULT_INTERVAL), +diff -up cups-1.5.2/scheduler/listen.c.systemd-socket cups-1.5.2/scheduler/listen.c +--- cups-1.5.2/scheduler/listen.c.systemd-socket 2011-04-16 00:38:13.000000000 +0100 ++++ cups-1.5.2/scheduler/listen.c 2012-03-16 14:50:57.158449792 +0000 +@@ -401,7 +401,11 @@ cupsdStopListening(void) + lis; + lis = (cupsd_listener_t *)cupsArrayNext(Listeners)) + { +- if (lis->fd != -1) ++ if (lis->fd != -1 ++#ifdef HAVE_SYSTEMD ++ && !lis->is_systemd ++#endif /* HAVE_SYSTEMD */ ++ ) + { + #ifdef WIN32 + closesocket(lis->fd); +diff -up cups-1.5.2/scheduler/main.c.systemd-socket cups-1.5.2/scheduler/main.c +--- cups-1.5.2/scheduler/main.c.systemd-socket 2012-03-16 14:50:57.121449773 +0000 ++++ cups-1.5.2/scheduler/main.c 2012-03-16 14:51:55.409483636 +0000 +@@ -26,6 +26,8 @@ + * launchd_checkin() - Check-in with launchd and collect the listening + * fds. + * launchd_checkout() - Update the launchd KeepAlive file as needed. ++ * systemd_checkin() - Check-in with systemd and collect the ++ * listening fds. + * parent_handler() - Catch USR1/CHLD signals... + * process_children() - Process all dead children... + * select_timeout() - Calculate the select timeout value. +@@ -62,6 +64,10 @@ + # endif /* !LAUNCH_JOBKEY_SERVICEIPC */ + #endif /* HAVE_LAUNCH_H */ + ++#ifdef HAVE_SYSTEMD ++#include ++#endif /* HAVE_SYSTEMD */ ++ + #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) + # include + #endif /* HAVE_MALLOC_H && HAVE_MALLINFO */ +@@ -78,6 +84,9 @@ + static void launchd_checkin(void); + static void launchd_checkout(void); + #endif /* HAVE_LAUNCHD */ ++#ifdef HAVE_SYSTEMD ++static void systemd_checkin(void); ++#endif /* HAVE_SYSTEMD */ + static void parent_handler(int sig); + static void process_children(void); + static void sigchld_handler(int sig); +@@ -537,6 +546,13 @@ main(int argc, /* I - Number of comm + } + #endif /* HAVE_LAUNCHD */ + ++#ifdef HAVE_SYSTEMD ++ /* ++ * If we were started by systemd get the listen sockets file descriptors... ++ */ ++ systemd_checkin(); ++#endif /* HAVE_SYSTEMD */ ++ + /* + * Startup the server... + */ +@@ -759,6 +775,15 @@ main(int argc, /* I - Number of comm + } + #endif /* HAVE_LAUNCHD */ + ++#ifdef HAVE_SYSTEMD ++ /* ++ * If we were started by systemd get the listen sockets file ++ * descriptors... ++ */ ++ ++ systemd_checkin(); ++#endif /* HAVE_SYSTEMD */ ++ + /* + * Startup the server... + */ +@@ -1584,6 +1609,139 @@ launchd_checkout(void) + } + #endif /* HAVE_LAUNCHD */ + ++#ifdef HAVE_SYSTEMD ++static void ++systemd_checkin(void) ++{ ++ int n, fd; ++ ++ n = sd_listen_fds(0); ++ if (n < 0) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Failed to acquire sockets from systemd - %s", ++ strerror(-n)); ++ exit(EXIT_FAILURE); ++ return; ++ } ++ ++ if (n == 0) ++ return; ++ ++ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++) ++ { ++ http_addr_t addr; ++ socklen_t addrlen = sizeof (addr); ++ int r; ++ cupsd_listener_t *lis; ++ char s[256]; ++ ++ r = sd_is_socket(fd, AF_UNSPEC, SOCK_STREAM, 1); ++ if (r < 0) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to verify socket type - %s", ++ strerror(-r)); ++ continue; ++ } ++ ++ if (!r) ++ { ++ if (Browsing && ++ ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS)) ++ { ++ r = sd_is_socket(fd, AF_UNSPEC, SOCK_DGRAM, 0); ++ if (r < 0) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to verify socket type - %s", ++ strerror(-r)); ++ continue; ++ } ++ ++ if (r) ++ { ++ /* ++ * This is the browse socket. ++ */ ++ ++ char addrstr[256]; ++ if (getsockname(fd, (struct sockaddr*) &addr, &addrlen)) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to get local address - %s", ++ strerror(errno)); ++ continue; ++ } ++ ++ httpAddrString (&addr, addrstr, sizeof (addrstr)); ++ BrowseSocket = fd; ++ BrowseSocketIsSystemd = 1; ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "systemd_checkin: Matched browse (port %d) with fd %d:%s...", ++ BrowsePort, fd, addrstr); ++ continue; ++ } ++ ++ } ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Socket not of the right type"); ++ continue; ++ } ++ ++ if (getsockname(fd, (struct sockaddr*) &addr, &addrlen)) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to get local address - %s", ++ strerror(errno)); ++ continue; ++ } ++ ++ /* ++ * Try to match the systemd socket address to one of the listeners... ++ */ ++ ++ for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners); ++ lis; ++ lis = (cupsd_listener_t *)cupsArrayNext(Listeners)) ++ if (httpAddrEqual(&lis->address, &addr)) ++ break; ++ ++ if (lis) ++ { ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "systemd_checkin: Matched existing listener %s with fd %d...", ++ httpAddrString(&(lis->address), s, sizeof(s)), fd); ++ } ++ else ++ { ++ cupsdLogMessage(CUPSD_LOG_DEBUG, ++ "systemd_checkin: Adding new listener %s with fd %d...", ++ httpAddrString(&addr, s, sizeof(s)), fd); ++ ++ if ((lis = calloc(1, sizeof(cupsd_listener_t))) == NULL) ++ { ++ cupsdLogMessage(CUPSD_LOG_ERROR, ++ "systemd_checkin: Unable to allocate listener - " ++ "%s.", strerror(errno)); ++ exit(EXIT_FAILURE); ++ } ++ ++ cupsArrayAdd(Listeners, lis); ++ ++ memcpy(&lis->address, &addr, sizeof(lis->address)); ++ } ++ ++ lis->fd = fd; ++ lis->is_systemd = 1; ++ ++# ifdef HAVE_SSL ++ if (_httpAddrPort(&(lis->address)) == 443) ++ lis->encryption = HTTP_ENCRYPT_ALWAYS; ++# endif /* HAVE_SSL */ ++ } ++} ++#endif /* HAVE_SYSTEMD */ + + /* + * 'parent_handler()' - Catch USR1/CHLD signals... +diff -up cups-1.5.2/scheduler/Makefile.systemd-socket cups-1.5.2/scheduler/Makefile +--- cups-1.5.2/scheduler/Makefile.systemd-socket 2012-03-16 14:50:57.130449778 +0000 ++++ cups-1.5.2/scheduler/Makefile 2012-03-16 14:50:57.160449794 +0000 +@@ -382,7 +382,7 @@ cupsd: $(CUPSDOBJS) $(LIBCUPSMIME) ../cu + $(CC) $(LDFLAGS) -o cupsd $(CUPSDOBJS) -L. -lcupsmime \ + $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \ + $(LIBPAPER) $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBS) \ +- $(LIBGSSAPI) $(LIBWRAP) ++ $(LIBGSSAPI) $(LIBWRAP) $(SDLIBS) + + cupsd-static: $(CUPSDOBJS) libcupsmime.a ../cups/$(LIBCUPSSTATIC) + echo Linking $@... +@@ -390,7 +390,7 @@ cupsd-static: $(CUPSDOBJS) libcupsmime.a + $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \ + ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(LIBPAPER) \ + $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBGSSAPI) \ +- $(LIBWRAP) ++ $(LIBWRAP) $(SDLIBS) + + + # diff --git a/cups-uri-compat.patch b/cups-uri-compat.patch new file mode 100644 index 0000000..2520a5b --- /dev/null +++ b/cups-uri-compat.patch @@ -0,0 +1,51 @@ +diff -up cups-1.5b1/backend/usb-unix.c.uri-compat cups-1.5b1/backend/usb-unix.c +--- cups-1.5b1/backend/usb-unix.c.uri-compat 2011-05-24 15:59:05.000000000 +0200 ++++ cups-1.5b1/backend/usb-unix.c 2011-05-24 16:02:03.000000000 +0200 +@@ -63,11 +63,34 @@ print_device(const char *uri, /* I - De + int device_fd; /* USB device */ + ssize_t tbytes; /* Total number of bytes written */ + struct termios opts; /* Parallel port options */ ++ char *fixed_uri = strdup (uri); ++ char *p; + + + (void)argc; + (void)argv; + ++ p = strchr (fixed_uri, ':'); ++ if (p++ != NULL) ++ { ++ char *e; ++ p += strspn (p, "/"); ++ e = strchr (p, '/'); ++ if (e > p) ++ { ++ size_t mfrlen = e - p; ++ e++; ++ if (!strncasecmp (e, p, mfrlen)) ++ { ++ char *x = e + mfrlen; ++ if (!strncmp (x, "%20", 3)) ++ /* Take mfr name out of mdl name for compatibility with ++ * Fedora 11 before bug #507244 was fixed. */ ++ strcpy (e, x + 3); puts(fixed_uri); ++ } ++ } ++ } ++ + /* + * Open the USB port device... + */ +@@ -107,10 +130,10 @@ print_device(const char *uri, /* I - De + _cups_strncasecmp(hostname, "Minolta", 7); + #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ + +- if (use_bc && !strncmp(uri, "usb:/dev/", 9)) ++ if (use_bc && !strncmp(fixed_uri, "usb:/dev/", 9)) + use_bc = 0; + +- if ((device_fd = open_device(uri, &use_bc)) == -1) ++ if ((device_fd = open_device(fixed_uri, &use_bc)) == -1) + { + if (getenv("CLASS") != NULL) + { diff --git a/cups-usb-paperout.patch b/cups-usb-paperout.patch new file mode 100644 index 0000000..f1f73f0 --- /dev/null +++ b/cups-usb-paperout.patch @@ -0,0 +1,52 @@ +diff -up cups-1.5b1/backend/usb-unix.c.usb-paperout cups-1.5b1/backend/usb-unix.c +--- cups-1.5b1/backend/usb-unix.c.usb-paperout 2011-05-24 15:51:39.000000000 +0200 ++++ cups-1.5b1/backend/usb-unix.c 2011-05-24 15:51:39.000000000 +0200 +@@ -30,6 +30,11 @@ + + #include + ++#ifdef __linux ++#include ++#include ++#endif /* __linux */ ++ + + /* + * Local functions... +@@ -334,7 +339,19 @@ open_device(const char *uri, /* I - Dev + if (!strncmp(uri, "usb:/dev/", 9)) + #ifdef __linux + { +- return (open(uri + 4, O_RDWR | O_EXCL)); ++ fd = open(uri + 4, O_RDWR | O_EXCL); ++ ++ if (fd != -1) ++ { ++ /* ++ * Tell the driver to return from write() with errno==ENOSPACE ++ * on paper-out. ++ */ ++ unsigned int t = 1; ++ ioctl (fd, LPABORT, &t); ++ } ++ ++ return fd; + } + else if (!strncmp(uri, "usb://", 6)) + { +@@ -400,7 +417,14 @@ open_device(const char *uri, /* I - Dev + if (!strcmp(uri, device_uri)) + { + /* +- * Yes, return this file descriptor... ++ * Yes, tell the driver to return from write() with ++ * errno==ENOSPACE on paper-out. ++ */ ++ unsigned int t = 1; ++ ioctl (fd, LPABORT, &t); ++ ++ /* ++ * Return this file descriptor... + */ + + fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n", diff --git a/cups.spec b/cups.spec index d6575b2..0cdcf37 100644 --- a/cups.spec +++ b/cups.spec @@ -1,57 +1,29 @@ -%define svnsnapshot 0 -%define cupsbasename cups -%if %{svnsnapshot} -%define cupsnameext %nil -%define cupssvnrevision 8703 -%define cupsversion 1.4 -%define cupsminorversion .0 -%define cupsextraversion svn-r%{cupssvnrevision} -%define release %mkrel 0.%{cupssvnrevision}.1 -%else -%define cupsnameext %nil -%define cupssvnrevision %nil -%define cupsversion 1.4.8 -%define cupsminorversion %nil -%define cupsextraversion %nil -%define release %mkrel 9 -%endif -%define cupstarballname %{cupsbasename}-%{cupsversion}%{cupsextraversion} - %define major 2 -%define libname %mklibname %{cupsbasename} %{major}%{cupsnameext} +%define libname %mklibname %{name} %{major} +%define develname %mklibname %{name} -d -# Turning this on lets CUPS to be built in debug mode (with debugger -# symbols) -%define debug 1 - -# Links in the man page directories get deleted due to a bug in Mandriva's -# RPM helper script. So we copy the man pages for now -%define manpagelinks 0 +# Turning this on lets CUPS to be built in debug mode (with debugger symbols) +%define debug 0 +%define enable_check 0 %define bootstrap 0 -%{?_without_bootstrap: %global bootstrap 0} -%{?_with_bootstrap: %global bootstrap 1} - +%if !%{bootstrap} %define _with_systemd 1 - - -##### GENERAL STUFF ##### +%endif Summary: Common Unix Printing System - Server package -Name: %{cupsbasename}%{cupsnameext} -Version: %{cupsversion}%{cupsminorversion} -Release: %{release} +Name: cups +Version: 1.5.3 +Release: 2 License: GPLv2 and LGPLv2 Group: System/Printing -%define real_version %{version} - -##### SOURCE FILES ##### - -Source: ftp://ftp.easysw.com/pub/cups/%{cupsversion}/%{cupstarballname}-source.tar.bz2 +Url: http://www.cups.org +Source0: ftp://ftp.easysw.com/pub/cups/%{version}/%{name}-%{version}-source.tar.bz2 # Small C program to get list of all installed PPD files Source1: poll_ppd_base.c # Small C program to list the printer-specific options of a particular printer +# fails to build now Source2: lphelp.c # Complete replacement for startup script to have it the # Mandriva Linux way @@ -72,118 +44,105 @@ Source14: http://www.linuxprinting.org/download/printing/photo_print Source15: http://printing.kde.org/downloads/pdfdistiller Source16: cjktexttops Source17: cups.service + # Nice level for now. bug #16387 Source18: cups.sysconfig Patch10: cups-1.4.0-recommended.patch - # fhimpe: make installed binary files writeable as root -Patch32: cups-1.4-permissions.patch -# Debian/Ubuntu patch: make the USB -# backend supporting both printer access via libusb and via the usblp kernel -# module. Make it also printing via libusb if the URI for the queue was -# generated via usblp and vice versa. This should solve most USB printing -# problems which occured on the transition to CUPS 1.4.x (Launchpad #420015, -# #436495; bugs.debian.org: #546558, #545288, #545453) -Patch34: cups-1.4.3-both-usblp-and-libusb.patch +Patch32: cups-1.5.3-permissions.patch +#RosaLabs - needs to be rediff'd +#Patch9999: cups-1.4.8-l10n-ru.patch + # Ubuntu patch, Launchpad #449586: Do not use host # names for broadcasting print queues and managing print queues broadcasted # from other servers by default. Many networks do not have valid host names # for all machines -Patch35: cups-1.4.4-no-hostname-broadcast.patch -# Suse patch, Novell bug #617026, Mandriva bug #61009 -# reverts changes by CUPS STR #3461 as band-aid workaround -# to avoid https://bugzilla.novell.com/show_bug.cgi?id=617026 for now -Patch36: cups-1.4.4-str3461-1.4.reverted.patch - -# Fedora patches: -# don't gzip man pages +Patch35: do-not-broadcast-with-hostnames.patch +#fedora patches all shifted by 1000 Patch1001: cups-no-gzip-man.patch -# use correct libdir +Patch1002: cups-system-auth.patch Patch1003: cups-multilib.patch -# Ignore .rpmnew and .rpmsave banner files. +Patch1004: cups-serial.patch Patch1005: cups-banners.patch -# https://bugzilla.redhat.com/show_bug.cgi?id=194005 -# disabled: breaks build on x86_64 Patch1006: cups-serverbin-compat.patch -# Don't export in SSLLIBS to cups-config. Patch1007: cups-no-export-ssllibs.patch -# Add '--help' option to lpr command (RH bug #206380, STR #1989). +Patch1008: cups-direct-usb.patch Patch1009: cups-lpr-help.patch -# Fix compilation of peer credentials support. -Patch1010: cups-1.3.7-peercred.patch -# Write a pid file (RH bug #132987). +Patch1010: cups-peercred.patch Patch1011: cups-pid.patch -# Fixed orientation of page labels when printing text in landscape -# mode (RH bug #520141, STR #3334). -Patch1012: cups-1.4.4-page-label.patch -# Send QueueChanged D-Bus signal on all job state changes. -Patch1013: cups-eggcups.patch -# Don't use getpass() (RH bug #125133). -Patch1014: cups-1.4.4-getpass.patch -# Increased PPD timeout in copy_model() (RH bug #216065) -Patch1015: cups-driverd-timeout.patch -# Don't do logrotation in cups, so that logrotate can take care of it -Patch1017: cups-logrotate.patch -# cups-polld: reinit the resolver if we haven't yet resolved the -# hostname (RH bug #354071). -Patch1020: cups-res_init.patch -# Cheaply restore compatibility with 1.1.x by having cups_get_sdests() -# perform a CUPS_GET_CLASSES request if it is not sure it is talking -# to CUPS 1.2 or later (RH bug #512866). -Patch1023: cups-cups-get-classes.patch -# build against avahi (RH bug #245824). -Patch1024: cups-avahi.patch -Patch1025: cups-1.4.8-CVE-2011-3170.diff +Patch1012: cups-eggcups.patch +Patch1013: cups-getpass.patch +Patch1014: cups-driverd-timeout.patch +Patch1015: cups-strict-ppd-line-length.patch +Patch1016: cups-logrotate.patch +Patch1017: cups-usb-paperout.patch +Patch1018: cups-build.patch +Patch1019: cups-res_init.patch +Patch1020: cups-filter-debug.patch +Patch1021: cups-uri-compat.patch +Patch1022: cups-cups-get-classes.patch +Patch1023: cups-str3382.patch +#NOT_IN_FEDPatch1024: cups-str3947.patch +#same as mdv patch cups-1.4-permissions.patch +#Patch1025: cups-0755.patch +Patch1026: cups-snmp-quirks.patch +Patch1027: cups-hp-deviceid-oid.patch +Patch1028: cups-dnssd-deviceid.patch +Patch1029: cups-ricoh-deviceid-oid.patch -##### ADDITIONAL DEFINITIONS ##### +Patch1030: cups-avahi-1-config.patch +Patch1031: cups-avahi-2-backend.patch +Patch1032: cups-avahi-3-timeouts.patch +Patch1033: cups-avahi-4-poll.patch +Patch1034: cups-avahi-5-services.patch + +Patch1035: cups-icc.patch +Patch1036: cups-systemd-socket.patch +# selinux +#Patch1100: cups-lspp.patch -Url: http://www.cups.org -Requires: %{libname} >= %{version}-%{release} %{name}-common >= %{version}-%{release} openssl net-tools -Requires: printer-testpages -# Take care that device files are created with correct permissions -Requires: udev -# For desktop menus -Requires: xdg-utils -Suggests: avahi -%if !%bootstrap -Requires: poppler -%endif -BuildRequires: autoconf2.5 -BuildRequires: openssl-devel -BuildRequires: libpam-devel -BuildRequires: libopenslp-devel, libldap-devel -%if %mdkver >= 200700 -BuildRequires: libdbus-devel >= 0.50 -%endif -BuildRequires: glibc BuildRequires: htmldoc -#BuildRequires: libdbus-1-devel -BuildRequires: libgnutls-devel -BuildRequires: php-devel >= 5.1.0 php-cli -BuildRequires: libjpeg-devel, libpng-devel, libtiff-devel, libz-devel -%if !%bootstrap -buildRequires: poppler -%endif +BuildRequires: php-cli +BuildRequires: xdg-utils +Buildrequires: xinetd BuildRequires: acl-devel -Buildrequires: xinetd -BuildRequires: avahi-compat-libdns_sd-devel -BuildRequires: libusb-devel -BuildRequires: krb-devel +BuildRequires: jpeg-devel +BuildRequires: krb5-devel +BuildRequires: libldap-devel +BuildRequires: openslp-devel +BuildRequires: pam-devel +BuildRequires: php-devel >= 5.1.0 +BuildRequires: tiff-devel +BuildRequires: pkgconfig(avahi-compat-libdns_sd) +BuildRequires: pkgconfig(dbus-1) >= 0.50 +BuildRequires: pkgconfig(gnutls) >= 3.0 +BuildRequires: pkgconfig(libcrypto) +BuildRequires: pkgconfig(libpng) +BuildRequires: pkgconfig(libssl) +BuildRequires: pkgconfig(libusb) < 1.0 +BuildRequires: pkgconfig(libusb-1.0) +BuildRequires: pkgconfig(zlib) +%if !%{bootstrap} +BuildRequires: poppler %if %{_with_systemd} BuildRequires: systemd-units %endif -# workraround for abf bug -BuildRequires: desktop-file-utils -Requires: portreserve -Provides: cupsddk-drivers -Obsoletes: cupsddk-drivers < 1.2.3-5 -Obsoletes: cupsddk < 1.4.0 +%endif -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot - - - -##### SUB-PACKAGES ##### +Requires: %{name}-common >= %{version}-%{release} +Requires: net-tools +%if !%{bootstrap} +Requires: poppler +Suggests: avahi +%endif +Requires: portreserve +Requires: printer-testpages +# Take care that device files are created with correct permissions +Requires: udev +Requires: update-alternatives +# For desktop menus +Requires: xdg-utils +%rename cupsddk-drivers %description The Common Unix Printing System provides a portable printing layer for @@ -201,7 +160,8 @@ need to be assigned to a specific CUPS server by an Summary: Common Unix Printing System - Common stuff License: GPLv2 Group: System/Printing -Requires: %{libname} >= %{version}-%{release} rpm >= 3.0.4-6mdk update-alternatives openssl net-tools +Requires: update-alternatives +Requires: net-tools # To satisfy LSB/FHS Provides: lpddaemon @@ -221,9 +181,6 @@ This package you need for both CUPS clients and servers. Summary: Common Unix Printing System - CUPS library License: LGPLv2 Group: System/Libraries -Requires: openssl net-tools -Obsoletes: libcups1 -Provides: libcups1 = %{version} %description -n %{libname} CUPS 1.4 is fully compatible with CUPS-1.1 machines in the network and @@ -237,20 +194,15 @@ CUPS frontends (lpr-cups, xpp, qtcups, kups, ...). This package you need for both CUPS clients and servers. It is also needed by Samba. -%package -n %{libname}-devel +%package -n %{develname} Summary: Common Unix Printing System - Development environment "libcups" License: LGPLv2 Group: Development/C -Requires: libgnutls-devel -Requires: cups-common = %{version}-%{release} -Requires: %{libname} >= %{version}-%{release} openssl openssl-devel -Provides: libcups-devel = %{version}-%{release} -Provides: libcups2_1-devel = %{version}-%{release} -Obsoletes: cups-devel, libcups1-devel -Provides: cups-devel = %{version}, libcups1-devel = %{version} -Conflicts: cupsddk < 1.4.0 +Requires: %{libname} >= %{version}-%{release} +Provides: cups-devel +Obsoletes: %mklibname %{name}2 -d -%description -n %{libname}-devel +%description -n %{develname} CUPS 1.4 is fully compatible with CUPS-1.1 machines in the network and with software built against CUPS-1.1 libraries. @@ -287,66 +239,10 @@ Provides: php4-cups Provides bindings to the functions of libcups, to give direct access to the CUPS printing environment from PHP programs. -##### PREP ##### - %prep +%setup -q +%apply_patches - -%if %{svnsnapshot} -# SVN version -rm -rf $RPM_BUILD_DIR/%{cupstarballname} -%setup -q -n %{cupstarballname} -%else -# Released version -rm -rf $RPM_BUILD_DIR/%{cupsbasename}-%{version} -%setup -q -n %{cupsbasename}-%{real_version} -%endif - -# Downdated pstops filter due to problems with multiple page documents -#bzcat %{SOURCE9} > $RPM_BUILD_DIR/%{cupsbasename}-%{real_version}/filter/pstops.c - -# Do NEVER use cups.suse (this package is for Mandriva) -#cp -f data/cups.pam data/cups.suse - -# Patch away ugly "(Recommended)" tag removal -%patch10 -p1 -b .recommended -%patch32 -p1 -b .permissions -%patch34 -p1 -b .usb -%patch35 -p1 -b .broadcast -%patch36 -p1 -b .str3461-revert - -# fedora patches -%patch1001 -p1 -b .no-gzip-man -%patch1003 -p1 -b .multilib -%patch1005 -p1 -b .banners -#%patch1006 -p1 -b .serverbin-compat -%patch1007 -p1 -b .no-export-ssllibs -%patch1009 -p1 -b .lpr-help -%patch1010 -p1 -b .peercred -%patch1011 -p1 -b .pid -%patch1012 -p0 -b .page-label -%patch1013 -p1 -b .eggcups -%patch1014 -p1 -b .getpass -%patch1015 -p1 -b .driverd-timeout -%patch1017 -p1 -b .logrotate -%patch1020 -p1 -b .res_init -%patch1023 -p1 -b .cups-get-classes -%patch1024 -p1 -b .avahi -%patch1025 -p0 -0 .CVE-2011-3170 - -%if 0 -# Fix libdir for 64-bit architectures -mv config-scripts/cups-directories.m4 config-scripts/cups-directories.m4.orig -cat << EOF > config-scripts/cups-directories.m4 -libdir=%{_libdir} -EOF -cat config-scripts/cups-directories.m4.orig >> \ - config-scripts/cups-directories.m4 -# Need to regenerate configure script -WANT_AUTOCONF_2_5=1 autoconf -%endif - -#if 0 # Set CUPS users and groups perl -p -i -e 's:(SystemGroup\s+.*)$:$1\nGroup sys\nUser lp:' conf/cupsd.conf.in @@ -359,18 +255,12 @@ perl -p -i -e 's:():$1\n Allow \@LOCAL:' conf/cupsd.conf.in # so no security problem) perl -p -i -e 's:():$1\n Allow \@LOCAL:' conf/cupsd.conf.in -%if %mdkver >= 200700 # Replace the PAM configuration file cat << EOF > scheduler/cups.pam auth include system-auth account include system-auth EOF cp -f scheduler/cups.pam conf/pam.std.in -%else -# Adapt PAM configuration to Mandriva Linux (former patch #6) -perl -p -i -e 's:(auth\s+required\s+?).*$:${1}pam_stack.so service=system-auth:' scheduler/cups.pam conf/pam.std.in -perl -p -i -e 's:(account\s+required\s+?).*$:${1}pam_stack.so service=system-auth:' scheduler/cups.pam conf/pam.std.in -%endif # Let the Makefiles not trying to set file ownerships perl -p -i -e "s/ -o \\$.CUPS_USER.//" scheduler/Makefile @@ -378,9 +268,6 @@ perl -p -i -e "s/ -g \\$.CUPS_GROUP.//" scheduler/Makefile perl -p -i -e "s/ -o \\$.CUPS_USER.//" systemv/Makefile perl -p -i -e "s/ -g \\$.CUPS_GROUP.//" systemv/Makefile -# Correct hard-coded path for pam_appl.h -#perl -p -i -e 's:pam/pam_appl.h:security/pam_appl.h:' config-scripts/cups-pam.m4 */*.[ch]* - # Work around bug on Mandriva compilation cluster (32-bit machine has # /usr/lib64 directory) perl -p -i -e 's:(libdir=")\$exec_prefix/lib64("):$1%{_libdir}$2:' config-scripts/cups-directories.m4 configure @@ -388,29 +275,13 @@ perl -p -i -e 's:(libdir=")\$exec_prefix/lib64("):$1%{_libdir}$2:' config-script # Let's look at the compilation command lines. perl -p -i -e "s,^.SILENT:,," Makedefs.in -%if 0 -# Recode all translations to UTF 8 -for l in `ls -1 locale/*/cups_* | cut -d '/' -f 2`; do - enc=`head -1 locale/$l/cups_$l` - iconv -f $enc -t utf-8 -o locale/$l/cups_$l.new locale/$l/cups_$l && \ - mv -f locale/$l/cups_$l.new locale/$l/cups_$l && \ - perl -p -i -e "s/$enc/utf-8/" locale/$l/cups_$l -done -for f in doc/fr/*.*html; do - iconv -f iso-8859-15 -t utf-8 -o $f.new $f && mv -f $f.new $f -done -for f in templates/fr/*.tmpl; do - iconv -f iso-8859-15 -t utf-8 -o $f.new $f && mv -f $f.new $f -done -%endif - # Load additional tools cp %{SOURCE1} poll_ppd_base.c cp %{SOURCE2} lphelp.c # Load nprint backend cp %{SOURCE11} nprint # Load AppleTalk "pap" backend -%setup -q -T -D -a 12 -n %{cupstarballname} +%setup -q -T -D -a 12 -n %{name}-%{version} # Load the "pap" documentation bzcat %{SOURCE13} > pap-docu.pdf # Load the "photo_print" utility @@ -422,100 +293,56 @@ cp %{SOURCE16} cjktexttops # systemd service cp %{SOURCE17} cups.service - - -##### BUILD ##### - %build -%serverbuild -# For 'configure' the macro is not used, because otherwise one does not get the -# /etc and /var directories correctly hardcoded into the executables (they -# would get /usr/etc and /usr/var. In addition, the "--with-docdir" option -# has to be given because the default setting is broken. "aclocal" and -# "autoconf" are needed if we have a Subversion snapshot or patched the -# files of the build system. -%if %{svnsnapshot} -aclocal -WANT_AUTOCONF_2_5=1 autoconf -%endif +# needed by additional SOURCES aclocal autoconf +# for the PHP module +%define _disable_ld_no_undefined 1 +#setup_compile_flags +%if %{debug} # Debug mode -%if %debug export DONT_STRIP=1 export CFLAGS="-g" export CXXFLAGS="-g" -./configure \ +%endif +# cups uses $DSOFLAGS instead of $LDFLAGS for shared libs +export DSOFLAGS="$LDFLAGS" +%configure2_5x \ --enable-avahi \ +%if %{debug} --enable-debug=yes \ +%endif --disable-libpaper \ --enable-raw-printing \ --enable-ssl \ - --enable-static \ + --disable-static \ --with-cups-group=sys \ --with-cups-user=lp \ --with-docdir=%{_datadir}/cups/doc \ --with-icondir=%{_datadir}/icons \ --with-system-groups="lpadmin root" \ -%if !%bootstrap + --enable-relro \ +%if !%{bootstrap} --with-pdftops=pdftops %endif -# Let Makefiles not execute the /usr/bin/strip command -export STRIP=":" +%if %{debug} # Remove "-s" (stripping) option from "install" command used for binaries # by "make install" perl -p -i -e 's:^(\s*INSTALL_BIN\s*=.*)-s:$1:' Makedefs -%else -export CFLAGS="$RPM_OPT_FLAGS -fPIC" -export CXXFLAGS="$RPM_OPT_FLAGS -fPIC" -./configure \ - --enable-avahi \ - --disable-libpaper \ - --enable-raw-printing \ - --enable-ssl \ - --enable-static \ - --with-cups-group=sys \ - --with-cups-user=lp \ - --with-docdir=%{_datadir}/cups/doc \ - --with-icondir=%{_datadir}/icons \ - --with-system-groups="lpadmin root" \ -%if !%bootstrap - --with-pdftops=pdftops %endif -#configure2_5x --enable-ssl --with-docdir=%{_datadir}/cups/doc -export STRIP="/usr/bin/strip" -%endif # Remove hardcoded "chgrp" from Makefiles perl -p -i -e 's/chgrp/:/' Makefile */Makefile -%ifnarch %{ix86} -export REAL_CFLAGS="$CFLAGS -fPIC" -%else -export REAL_CFLAGS="$CFLAGS" -%endif -make CHOWN=":" STRIP="$STRIP" OPTIM="$REAL_CFLAGS" \ - REQUESTS=%{buildroot}%{_var}/spool/cups \ - LOGDIR=%{buildroot}%{_var}/log/cups \ - STATEDIR=%{buildroot}%{_var}/run/cups - -%if 0 -%make LOGDIR=%{buildroot}%{_var}/log/cups \ - REQUESTS=%{buildroot}%{_var}/spool/cups \ - SERVERROOT=%{buildroot}%{_sysconfdir}/cups \ - MANDIR=%{buildroot}%{_mandir} \ - PAMDIR=%{buildroot}%{_sysconfdir}/pam.d \ - BINDIR=%{buildroot}%{_bindir} \ - SBINDIR=%{buildroot}%{_sbindir} \ - INITDIR=%{buildroot}%{_sysconfdir}/rc.d \ - DOCDIR=%{buildroot}%{_datadir}/cups/doc \ - CHOWN=":" STRIP="$STRIP" OPTIM="$REAL_CFLAGS" -%endif +%make # Compile additional tools -gcc -opoll_ppd_base -I. -I./cups -L./cups -lcups poll_ppd_base.c -gcc -olphelp -I. -I./cups -L./cups -lcups lphelp.c +gcc %optflags %ldflags -opoll_ppd_base -I. -I./cups poll_ppd_base.c -L./cups -lcups +#no longer compiles +#gcc %optflags %ldflags -olphelp -I. -I./cups lphelp.c -L./cups -lcups +%if !%{bootstrap} && %{enable_check} %check export LC_ALL=C export LC_MESSAGES=C @@ -524,17 +351,13 @@ export LANGUAGE=C make test << EOF EOF - - -##### INSTALL ##### - -%install -rm -rf %{buildroot} -# Debug mode -%if %debug -export DONT_STRIP=1 %endif +%install +# Debug mode +%if %{debug} +export DONT_STRIP=1 +%endif make install BUILDROOT=%{buildroot} \ DOCDIR=%{buildroot}%{_datadir}/cups/doc \ CHOWN=":" CHGRP=":" STRIP="$STRIP" \ @@ -542,23 +365,7 @@ make install BUILDROOT=%{buildroot} \ REQUESTS=%{buildroot}%{_var}/spool/cups \ STATEDIR=%{buildroot}%{_var}/run/cups -%if 0 -make install BUILDROOT=%{buildroot} \ - LOGDIR=%{buildroot}%{_var}/log/cups \ - SERVERROOT=%{buildroot}%{_sysconfdir}/cups \ - AMANDIR=%{buildroot}%{_mandir} \ - PMANDIR=%{buildroot}%{_mandir} \ - MANDIR=%{buildroot}%{_mandir} \ - PAMDIR=%{buildroot}%{_sysconfdir}/pam.d \ - BINDIR=%{buildroot}%{_bindir} \ - SBINDIR=%{buildroot}%{_sbindir} \ - INITDIR=%{buildroot}%{_sysconfdir}/rc.d \ - DOCDIR=%{buildroot}%{_datadir}/cups/doc \ - CHOWN=":" CHGRP=":" STRIP="$STRIP" - -# DOCDIR=%{buildroot}%{_defaultdocdir}/cups \ -%endif - +rm -f %{buildroot}%{_libdir}/lib*.la # Make a directory for PPD generators mkdir -p %{buildroot}%{_prefix}/lib/cups/driver @@ -573,14 +380,14 @@ mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d # Install additional tools install -m 755 poll_ppd_base %{buildroot}%{_bindir} -install -m 755 lphelp %{buildroot}%{_bindir} +#install -m 755 lphelp %{buildroot}%{_bindir} # Install nprint backend install -m 755 nprint %{buildroot}%{_prefix}/lib/cups/backend/ # Install AppleTalk backend install -m 755 pap-backend/pap %{buildroot}%{_prefix}/lib/cups/backend/ -install -m 644 pap-docu.pdf %{buildroot}%{_datadir}/%{cupsbasename}/doc +install -m 644 pap-docu.pdf %{buildroot}%{_datadir}/%{name}/doc # Install "photo_print" install -m 755 photo_print %{buildroot}%{_bindir} @@ -601,7 +408,6 @@ install -m644 cups.service %{buildroot}/lib/systemd/system %endif # Set link to test page in /usr/share/printer-testpages -#rm -f %{buildroot}%{_datadir}/cups/data/testprint.ps ln -s %{_datadir}/printer-testpages/testprint.ps %{buildroot}%{_datadir}/cups/data/testprint-mdv.ps # Install startup script @@ -629,28 +435,19 @@ chmod a+rx ./cleanppd.pl # Do the clean-up find %{buildroot}%{_datadir}/cups/model -name "*.ppd" -exec ./cleanppd.pl '{}' \; -# bzip2 all man pages already now, so that we can link man pages without # RPM breaking it. Links need to be deleted and afterwards regenerated rm -f %{buildroot}%{_mandir}/man8/cupsdisable.8 rm -f %{buildroot}%{_mandir}/man8/reject.8 -#bzme -F %{buildroot}%{_mandir}/man*/*.[0-9n].gz # Set compatibility links for the man pages and executables ln -s %{_sbindir}/cupsenable %{buildroot}%{_bindir}/enable ln -s %{_sbindir}/cupsdisable %{buildroot}%{_bindir}/disable ln -s %{_sbindir}/cupsenable %{buildroot}%{_sbindir}/enable ln -s %{_sbindir}/cupsdisable %{buildroot}%{_sbindir}/disable -%if %manpagelinks ln -s %{_mandir}/man8/cupsenable.8 %{buildroot}%{_mandir}/man8/cupsdisable.8 ln -s %{_mandir}/man8/cupsdisable.8 %{buildroot}%{_mandir}/man8/disable.8 ln -s %{_mandir}/man8/cupsenable.8 %{buildroot}%{_mandir}/man8/enable.8 ln -s %{_mandir}/man8/accept.8 %{buildroot}%{_mandir}/man8/reject.8 -%else -cp %{buildroot}%{_mandir}/man8/cupsenable.8 %{buildroot}%{_mandir}/man8/cupsdisable.8 -cp %{buildroot}%{_mandir}/man8/cupsdisable.8 %{buildroot}%{_mandir}/man8/disable.8 -cp %{buildroot}%{_mandir}/man8/cupsenable.8 %{buildroot}%{_mandir}/man8/enable.8 -cp %{buildroot}%{_mandir}/man8/accept.8 %{buildroot}%{_mandir}/man8/reject.8 -%endif %ifarch x86_64 # This one will be removed soon, when all other packages are @@ -705,8 +502,8 @@ rm -rf %{buildroot}%{_mandir}/*/cat rm -rf %{buildroot}%{_mandir}/*/cat? # Install missing headers (Thanks to Oden Eriksson) -install -m644 cups/debug.h %{buildroot}%{_includedir}/cups/ -install -m644 cups/string.h %{buildroot}%{_includedir}/cups/ +install -m644 cups/debug-private.h %{buildroot}%{_includedir}/cups/ +install -m644 cups/string-private.h %{buildroot}%{_includedir}/cups/ install -m644 config.h %{buildroot}%{_includedir}/cups/ # Multiarch fixes @@ -727,11 +524,9 @@ EOF # Prefer xdg-utils than htmlview (kde one) sed -i s/htmlview/xdg-open/ %{buildroot}%{_datadir}/applications/*.desktop -# Hide .desktop-file by default +## Hide desktop file echo -e '\nHidden=true' >> %{buildroot}%{_datadir}/applications/%{cupsbasename}.desktop -#find_lang %{name} - # http://qa.mandriva.com/show_bug.cgi?id=28383 # Common PPD dirs mkdir -p %{buildroot}%{_datadir}/ppd @@ -745,8 +540,6 @@ ln -s %{_datadir}/ppd %{buildroot}%{_datadir}/cups/model/3-distribution mkdir -p %{buildroot}%{_libdir}/printdriver # Other dirs can't be handled here, but on %post instead. -##### PRE/POST INSTALL SCRIPTS ##### - %pre %ifarch x86_64 # Fix /usr/lib/cups directory, so that updates can be done @@ -794,10 +587,6 @@ done %{_sbindir}/update-alternatives --install %{_sbindir}/lpmove lpmove %{_sbindir}/lpmove-cups 10 --slave %{_mandir}/man8/lpmove.8%{_extension} lpmove.8%{_extension} %{_mandir}/man8/lpmove-cups.8%{_extension} %{_sbindir}/update-alternatives --install %{_sbindir}/reject reject %{_sbindir}/reject-cups 10 --slave %{_mandir}/man8/reject.8%{_extension} reject.8%{_extension} %{_mandir}/man8/reject-cups.8%{_extension} -%if %mdkversion < 200900 -%post -n %{libname} -p /sbin/ldconfig -%endif - %preun # Let CUPS daemon not be automatically started at boot time any more %_preun_service cups @@ -822,23 +611,7 @@ fi %postun %_postun_groupdel lpadmin -%if %mdkversion < 200900 -%postun -n %{libname} -p /sbin/ldconfig -%endif - - - -%clean -##### CLEAN UP ##### -rm -rf %{buildroot} - - - -##### FILE LISTS FOR ALL BINARY PACKAGES ##### - -#####cups %files -%defattr(-,root,root) %doc *.txt %attr(511,lp,lpadmin) %{_var}/run/cups/certs %config(noreplace) %attr(-,root,sys) %{_sysconfdir}/cups/cupsd.conf @@ -852,9 +625,7 @@ rm -rf %{buildroot} %config(noreplace) %attr(-,root,sys) %{_sysconfdir}/cups/ppd %config(noreplace) %attr(-,root,sys) %{_sysconfdir}/cups/ssl %config(noreplace) %attr(-,root,sys) %{_sysconfdir}/cups/snmp.conf -%if %mdkver >= 200700 %config(noreplace) %attr(-,root,sys) %{_sysconfdir}/dbus*/system.d/cups.conf -%endif %{_initrddir}/cups %config(noreplace) %{_sysconfdir}/pam.d/cups %config(noreplace) %{_sysconfdir}/logrotate.d/cups @@ -869,13 +640,15 @@ rm -rf %{buildroot} %dir %{_prefix}/lib/cups/backend %{_prefix}/lib/cups/backend/dnssd %{_prefix}/lib/cups/backend/http +%{_prefix}/lib/cups/backend/https %{_prefix}/lib/cups/backend/ipp +%{_prefix}/lib/cups/backend/ipps %{_prefix}/lib/cups/backend/lpd -%{_prefix}/lib/cups/backend/mdns +#{_prefix}/lib/cups/backend/mdns %{_prefix}/lib/cups/backend/nprint %{_prefix}/lib/cups/backend/pap %{_prefix}/lib/cups/backend/parallel -%{_prefix}/lib/cups/backend/scsi +#%{_prefix}/lib/cups/backend/scsi %{_prefix}/lib/cups/backend/snmp %{_prefix}/lib/cups/backend/socket %{_prefix}/lib/cups/backend/usb @@ -899,18 +672,16 @@ rm -rf %{buildroot} %{_libdir}/cups %endif %if %{_with_systemd} -/lib/systemd/system/cups.service +/lib/systemd/system/cups.* %endif -#####cups-common %files common -#-f %{name}.lang -%defattr(-,root,root) %dir %config(noreplace) %attr(-,lp,sys) %{_sysconfdir}/cups %ghost %config(noreplace) %attr(-,lp,sys) %{_sysconfdir}/cups/client.conf %{_sbindir}/* %{_bindir}/*cups -%{_bindir}/lphelp +%{_bindir}/ipptool +#%{_bindir}/lphelp %{_bindir}/lpoptions %attr(6755,root,sys) %{_bindir}/lppasswd %{_bindir}/photo_print @@ -924,32 +695,10 @@ rm -rf %{buildroot} %{_bindir}/cupstestdsc %{_bindir}/enable %{_bindir}/disable -%lang(da) %{_datadir}/locale/da/cups_da.po -%lang(de) %{_datadir}/locale/de/cups_de.po -%lang(es) %{_datadir}/locale/es/cups_es.po -#%lang(et) %{_datadir}/locale/et/cups_et.po -%lang(eu) %{_datadir}/locale/eu/cups_eu.po -%lang(fi) %{_datadir}/locale/fi/cups_fi.po -%lang(fr) %{_datadir}/locale/fr/cups_fr.po -#%lang(he) %{_datadir}/locale/he/cups_he.po -%lang(id) %{_datadir}/locale/id/cups_id.po -%lang(it) %{_datadir}/locale/it/cups_it.po -%lang(ja) %{_datadir}/locale/ja/cups_ja.po -%lang(ko) %{_datadir}/locale/ko/cups_ko.po -%lang(nl) %{_datadir}/locale/nl/cups_nl.po -%lang(no) %{_datadir}/locale/no/cups_no.po -%lang(pl) %{_datadir}/locale/pl/cups_pl.po -%lang(pt) %{_datadir}/locale/pt/cups_pt.po -%lang(pt_BR) %{_datadir}/locale/pt_BR/cups_pt_BR.po -%lang(ru) %{_datadir}/locale/ru/cups_ru.po -%lang(sv) %{_datadir}/locale/sv/cups_sv.po -%lang(zh) %{_datadir}/locale/zh/cups_zh.po -%lang(zh_TW) %{_datadir}/locale/zh_TW/cups_zh_TW.po +%{_datadir}/locale/*/*.po %{_mandir}/man?/* -#####%{libname} %files -n %{libname} -%defattr(-,root,root) %{_libdir}/libcups.so.* %{_libdir}/libcupsimage.so.* %{_libdir}/libcupscgi.so.1 @@ -957,28 +706,98 @@ rm -rf %{buildroot} %{_libdir}/libcupsmime.so.1 %{_libdir}/libcupsppdc.so.1 -#####%{libname}-devel -%files -n %{libname}-devel -%defattr(-,root,root) +%files -n %{develname} %{_includedir}/cups/* %{multiarch_includedir}/cups/* -%{_libdir}/*.a %{_libdir}/*.so %{_bindir}/cups-config %files serial -%defattr(-,root,root) %{_prefix}/lib/cups/backend/serial %files -n php-cups -%defattr(-,root,root) %doc scripting/php/README %attr(0755,root,root) %{_libdir}/php/extensions/* %config(noreplace) %{_sysconfdir}/php.d/* + %changelog -* Wed Aug 24 2011 Oden Eriksson 1.4.8-2mdv2011.0 +* Tue May 15 2012 Matthew Dawkins 1.5.3-1 ++ Revision: 799051 +- rediff'd p32 from mdv +- sync'd patchset with fedora +- new version 1.5.3 + +* Sat May 12 2012 Matthew Dawkins 1.5.2-1 ++ Revision: 798495 +- new version 1.5.2 +- sync'd patchset with fedora + +* Mon Mar 19 2012 Bernhard Rosenkraenzer 1.5.0-4 ++ Revision: 785746 +- Build for gnutls 3.x +- Fix missing files when building with current systemd +- Fix BuildRequires: line, nothing provides krb-devel these days + +* Wed Feb 01 2012 Bernhard Rosenkraenzer 1.5.0-3 ++ Revision: 770462 +- Adjust build requirements. cups needs libusb 0.x, not 1.x for now + +* Thu Dec 22 2011 Oden Eriksson 1.5.0-2 ++ Revision: 744391 +- rebuilt against libtiff.so.5 + +* Thu Dec 01 2011 Matthew Dawkins 1.5.0-1 ++ Revision: 735848 +- new version 1.5.0 +- sync'd all patches to fedora +- sync'd ubuntu patch do-not-broadcast-with-hostnames.patch +- suse patch dropped by suse cups-1.4.4-str3461-1.4.reverted.patch +- ru lang patch still needs to be rediff'd +- ubuntu/debian patch dropped cups-1.4.3-both-usblp-and-libusb.patch +- Source2 lphelp no longer compiles +- check disabled for now +- more cleanup to spec +- use apply_patches +- converted BRs to pkgconfig provides +- rebuild +- major spec clean (hopefully easier to upgrade now) +- removed long commented out if 0 code +- removed defattr, mkrel, clean section, BuildRoot +- reimplemented find_lang for maintainability +- dropped major from devel pkg +- removed old ldconfig scriptlets +- removed long unused svnsnapshot build options +- simplified debug build, and disabled again +- bracketed systemd build with bootstrap +- disabled static build +- removed old conflicts, provides, & dup requires + +* Wed Nov 09 2011 vsinitsyn 1.4.8-6 ++ Revision: 729306 +- Updated Russian translation + +* Mon Oct 10 2011 Oden Eriksson 1.4.8-5 ++ Revision: 704068 +- sync with MDVSA-2011:147 + +* Thu Sep 29 2011 Tomasz Pawel Gajc 1.4.8-4 ++ Revision: 701851 +- disable bootstrap + +* Mon Sep 12 2011 Tomasz Pawel Gajc 1.4.8-3 ++ Revision: 699575 +- disable check when in boostrap build +- export Mdv's LDFLAGS +- enable relro +- enable bootstrap for poppler +- rebuild for new libpng-1.5 + + + Nicolas Lécureuil + - Rebuild against new libpng + +* Wed Aug 24 2011 Oden Eriksson 1.4.8-2 + Revision: 696366 - rebuilt for php-5.3.8 diff --git a/do-not-broadcast-with-hostnames.patch b/do-not-broadcast-with-hostnames.patch new file mode 100644 index 0000000..be7ebd2 --- /dev/null +++ b/do-not-broadcast-with-hostnames.patch @@ -0,0 +1,24 @@ +Author: till.kamppeter@gmail.com + +--- a/scheduler/client.c ++++ b/scheduler/client.c +@@ -387,7 +387,7 @@ + { + if (httpAddrLocalhost(&temp)) + strlcpy(con->servername, "localhost", sizeof(con->servername)); +- else if (HostNameLookups || RemotePort) ++ else if (HostNameLookups) + httpAddrLookup(&temp, con->servername, sizeof(con->servername)); + else + httpAddrString(&temp, con->servername, sizeof(con->servername)); +--- a/scheduler/conf.c ++++ b/scheduler/conf.c +@@ -755,7 +755,7 @@ + cupsdAddAlias(ServerAlias, temp); + cupsdLogMessage(CUPSD_LOG_DEBUG, "Added auto ServerAlias %s", temp); + +- if (HostNameLookups || RemotePort) ++ if (HostNameLookups) + { + struct hostent *host; /* Host entry to get FQDN */ +