mirror of
https://abf.rosa.ru/djam/cups.git
synced 2025-02-23 22:02:46 +00:00
Automatic import for version 1.5.0
This commit is contained in:
parent
9b122cb3fe
commit
b56418a103
46 changed files with 4800 additions and 1661 deletions
2
.abf.yml
2
.abf.yml
|
@ -1,4 +1,4 @@
|
|||
sources:
|
||||
"cups-1.4.8-source.tar.bz2": 9167f556e78e0bc075f1eb2f695d79cc1f334007
|
||||
"cups-1.5.0-source.tar.bz2": 628f549867751e373fc20c7558fec422f9eb942b
|
||||
"pap-backend.tar.bz2": 89e1e7eb4258d47069d2a60c383b8bd555a11e63
|
||||
"pap-docu.pdf.bz2": 7e7d44bb58532ab2fc4c1ca3581787877f1b5733
|
||||
|
|
|
@ -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 <grp.h>
|
||||
#ifdef HAVE_SHADOW_H
|
|
@ -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 <sys/select.h>
|
||||
+
|
||||
+/*
|
||||
+ * 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) */
|
|
@ -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 */
|
||||
|
|
@ -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.
|
||||
*/
|
||||
|
|
@ -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 <gnutls/gnutls.h>
|
||||
-# include <gcrypt.h>
|
||||
|
||||
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...
|
||||
*/
|
33
cups-CVE-2011-2896.patch
Normal file
33
cups-CVE-2011-2896.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
diff -up cups-1.4.8/filter/image-gif.c.CVE-2011-2896 cups-1.4.8/filter/image-gif.c
|
||||
--- cups-1.4.8/filter/image-gif.c.CVE-2011-2896 2011-06-20 21:37:51.000000000 +0100
|
||||
+++ cups-1.4.8/filter/image-gif.c 2011-08-19 11:33:37.547911212 +0100
|
||||
@@ -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)
|
||||
{
|
42
cups-avahi-1-config.patch
Normal file
42
cups-avahi-1-config.patch
Normal file
|
@ -0,0 +1,42 @@
|
|||
diff -up cups-1.5.0/config.h.in.avahi-1-config cups-1.5.0/config.h.in
|
||||
--- cups-1.5.0/config.h.in.avahi-1-config 2011-06-16 21:12:16.000000000 +0100
|
||||
+++ cups-1.5.0/config.h.in 2011-08-05 15:04:09.535759988 +0100
|
||||
@@ -390,6 +390,13 @@
|
||||
|
||||
|
||||
/*
|
||||
+ * Do we have Avahi for DNS Service Discovery?
|
||||
+ */
|
||||
+
|
||||
+#undef HAVE_AVAHI
|
||||
+
|
||||
+
|
||||
+/*
|
||||
* Do we have <sys/ioctl.h>?
|
||||
*/
|
||||
|
||||
diff -up cups-1.5.0/config-scripts/cups-dnssd.m4.avahi-1-config cups-1.5.0/config-scripts/cups-dnssd.m4
|
||||
--- cups-1.5.0/config-scripts/cups-dnssd.m4.avahi-1-config 2011-05-12 06:21:56.000000000 +0100
|
||||
+++ cups-1.5.0/config-scripts/cups-dnssd.m4 2011-08-05 15:04:09.525760307 +0100
|
||||
@@ -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
|
|
@ -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.0/backend/dnssd.c.avahi-2-backend cups-1.5.0/backend/dnssd.c
|
||||
--- cups-1.5.0/backend/dnssd.c.avahi-2-backend 2011-08-05 15:04:46.182591844 +0100
|
||||
+++ cups-1.5.0/backend/dnssd.c 2011-08-05 15:05:13.868710181 +0100
|
||||
@@ -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 <cups/array.h>
|
||||
|
@ -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,7 +85,7 @@ 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
|
||||
@@ -93,12 +131,6 @@ static void browse_local_callback(DNSSe
|
||||
const char *regtype,
|
||||
const char *replyDomain,
|
||||
void *context);
|
||||
|
@ -84,7 +98,7 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c
|
|||
static void query_callback(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
@@ -106,9 +132,111 @@ static void query_callback(DNSServiceRe
|
||||
@@ -107,9 +139,118 @@ static void query_callback(DNSServiceRe
|
||||
uint16_t rrclass, uint16_t rdlen,
|
||||
const void *rdata, uint32_t ttl,
|
||||
void *context);
|
||||
|
@ -123,8 +137,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 +154,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)
|
||||
+{
|
||||
|
@ -193,10 +213,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
|
||||
@@ -120,6 +261,13 @@ main(int argc, /* I - Number of comm
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
const char *name; /* Backend name */
|
||||
|
@ -210,7 +231,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
|
||||
@@ -133,12 +281,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 +249,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
|
||||
@@ -198,6 +345,49 @@ main(int argc, /* I - Number of comm
|
||||
* Browse for different kinds of printers...
|
||||
*/
|
||||
|
||||
|
@ -278,7 +299,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
|
||||
@@ -258,6 +448,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 +307,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
|
||||
@@ -265,6 +456,9 @@ main(int argc, /* I - Number of comm
|
||||
|
||||
while (!job_canceled)
|
||||
{
|
||||
|
@ -296,7 +317,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
|
||||
@@ -284,11 +478,35 @@ main(int argc, /* I - Number of comm
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -332,15 +353,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))
|
||||
@@ -302,6 +520,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 ++;
|
||||
|
||||
@@ -333,14 +552,23 @@ main(int argc, /* I - Number of comm
|
||||
count ++;
|
||||
}
|
||||
}
|
||||
|
@ -365,30 +386,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
|
||||
@@ -401,6 +629,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(
|
||||
@@ -489,6 +718,7 @@ browse_local_callback(
|
||||
device->fullName);
|
||||
device->sent = 1;
|
||||
}
|
||||
|
@ -396,25 +402,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);
|
||||
}
|
||||
@@ -569,6 +799,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 +439,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 -
|
||||
*/
|
||||
|
||||
@@ -589,20 +854,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 +466,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 -
|
||||
@@ -622,8 +874,14 @@ get_device(cups_array_t *devices, /* I -
|
||||
free(device->domain);
|
||||
device->domain = strdup(replyDomain);
|
||||
|
||||
|
@ -464,7 +481,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 -
|
||||
@@ -643,6 +901,9 @@ get_device(cups_array_t *devices, /* I -
|
||||
device->domain = strdup(replyDomain);
|
||||
device->type = key.type;
|
||||
device->priority = 50;
|
||||
|
@ -474,7 +491,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 -
|
||||
@@ -650,13 +911,20 @@ get_device(cups_array_t *devices, /* I -
|
||||
* Set the "full name" of this service, which is used for queries...
|
||||
*/
|
||||
|
||||
|
@ -488,15 +505,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.
|
||||
*/
|
||||
@@ -680,7 +948,7 @@ query_callback(
|
||||
*ptr; /* Pointer into string */
|
||||
cups_device_t dkey, /* Search key */
|
||||
*device; /* Device */
|
||||
|
@ -505,13 +521,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(
|
||||
@@ -714,94 +982,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 +546,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 +568,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,
|
||||
|
@ -614,6 +642,11 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c
|
|||
+ avahi_service_resolver_free (resolver);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * 'avahi_browse_callback()' - Avahi browse callback function.
|
||||
+ */
|
||||
+
|
||||
+static void
|
||||
+avahi_browse_callback(AvahiServiceBrowser *browser,
|
||||
+ AvahiIfIndex interface,
|
||||
|
@ -671,16 +704,21 @@ 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 */
|
||||
+
|
||||
|
||||
- for (device = cupsArrayFind(devices, &dkey);
|
||||
+/*
|
||||
+ * '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 +731,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;
|
||||
|
@ -745,13 +783,13 @@ diff -Naurp cups-1.4.5/backend/dnssd.c cups-1.4.5.oden/backend/dnssd.c
|
|||
- 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 +797,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...
|
||||
@@ -856,6 +1263,10 @@ query_callback(
|
||||
if (device->type == CUPS_DEVICE_PRINTER)
|
||||
device->sent = 1;
|
||||
}
|
||||
|
@ -781,7 +828,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(
|
||||
@@ -912,11 +1323,9 @@ query_callback(
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,54 +841,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 <sys/ioctl.h>?
|
||||
diff -up cups-1.5.0/cups/http-support.c.avahi-2-backend cups-1.5.0/cups/http-support.c
|
||||
--- cups-1.5.0/cups/http-support.c.avahi-2-backend 2011-06-10 23:06:26.000000000 +0100
|
||||
+++ cups-1.5.0/cups/http-support.c 2011-08-05 15:05:13.870710117 +0100
|
||||
@@ -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 <dns_sd.h>
|
||||
# include <poll.h>
|
||||
/*
|
||||
@@ -60,6 +64,11 @@
|
||||
# include <sys/select.h>
|
||||
# endif /* WIN32 */
|
||||
#endif /* HAVE_DNSSD */
|
||||
+#ifdef HAVE_AVAHI
|
||||
+# include <avahi-client/client.h>
|
||||
|
@ -851,8 +867,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 +892,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(
|
||||
@@ -1431,6 +1458,9 @@ _httpResolveURI(
|
||||
|
||||
if (strstr(hostname, "._tcp"))
|
||||
{
|
||||
|
@ -884,16 +900,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")
|
||||
@@ -1449,6 +1479,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 +916,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(
|
||||
@@ -1485,9 +1526,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\", "
|
||||
@@ -1501,6 +1549,7 @@ _httpResolveURI(
|
||||
|
||||
uri = NULL;
|
||||
|
||||
|
@ -937,7 +945,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(
|
||||
@@ -1608,6 +1657,36 @@ _httpResolveURI(
|
||||
|
||||
DNSServiceRefDeallocate(ref);
|
||||
}
|
||||
|
@ -972,9 +980,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(
|
||||
@@ -1619,13 +1698,13 @@ _httpResolveURI(
|
||||
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
|
||||
}
|
||||
|
||||
|
@ -988,13 +996,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."));
|
||||
@@ -1895,6 +1974,116 @@ 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 +1023,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,
|
||||
|
@ -1093,6 +1111,7 @@ diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c
|
|||
+}
|
||||
+#endif /* HAVE_AVAHI */
|
||||
+
|
||||
|
||||
+
|
||||
/*
|
||||
* End of "$Id: http-support.c 9322 2010-10-01 22:40:38Z mike $".
|
||||
* End of "$Id: http-support.c 9820 2011-06-10 22:06:26Z mike $".
|
||||
*/
|
381
cups-avahi-3-timeouts.patch
Normal file
381
cups-avahi-3-timeouts.patch
Normal file
|
@ -0,0 +1,381 @@
|
|||
diff -up cups-1.5.0/scheduler/cupsd.h.avahi-3-timeouts cups-1.5.0/scheduler/cupsd.h
|
||||
--- cups-1.5.0/scheduler/cupsd.h.avahi-3-timeouts 2011-05-11 23:17:34.000000000 +0100
|
||||
+++ cups-1.5.0/scheduler/cupsd.h 2011-10-07 13:20:41.522867324 +0100
|
||||
@@ -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.0/scheduler/main.c.avahi-3-timeouts cups-1.5.0/scheduler/main.c
|
||||
--- cups-1.5.0/scheduler/main.c.avahi-3-timeouts 2011-10-07 13:20:36.875954675 +0100
|
||||
+++ cups-1.5.0/scheduler/main.c 2011-10-07 13:20:41.524867282 +0100
|
||||
@@ -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.
|
||||
+ */
|
||||
+
|
||||
+ tmo = cupsdNextTimeout (&tmo_delay);
|
||||
+ if (tmo)
|
||||
+ {
|
||||
+ timeout = tmo_delay;
|
||||
+ why = "run a timed callback";
|
||||
+ }
|
||||
+#endif /* HAVE_AVAHI */
|
||||
+
|
||||
/*
|
||||
* Check whether we are accepting new connections...
|
||||
*/
|
||||
diff -up cups-1.5.0/scheduler/Makefile.avahi-3-timeouts cups-1.5.0/scheduler/Makefile
|
||||
--- cups-1.5.0/scheduler/Makefile.avahi-3-timeouts 2011-10-07 13:20:36.955953170 +0100
|
||||
+++ cups-1.5.0/scheduler/Makefile 2011-10-07 13:20:41.521867343 +0100
|
||||
@@ -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.0/scheduler/timeout.c.avahi-3-timeouts cups-1.5.0/scheduler/timeout.c
|
||||
--- cups-1.5.0/scheduler/timeout.c.avahi-3-timeouts 2011-10-07 13:20:41.525867259 +0100
|
||||
+++ cups-1.5.0/scheduler/timeout.c 2011-10-07 13:20:41.525867259 +0100
|
||||
@@ -0,0 +1,235 @@
|
||||
+/*
|
||||
+ * "$Id$"
|
||||
+ *
|
||||
+ * Timeout functions for the Common UNIX Printing System (CUPS).
|
||||
+ *
|
||||
+ * Copyright (C) 2010, 2011 Red Hat, Inc.
|
||||
+ * Authors:
|
||||
+ * Tim Waugh <twaugh@redhat.com>
|
||||
+ *
|
||||
+ * 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 <config.h>
|
||||
+
|
||||
+#ifdef HAVE_AVAHI /* Applies to entire file... */
|
||||
+
|
||||
+/*
|
||||
+ * Include necessary headers...
|
||||
+ */
|
||||
+
|
||||
+#include "cupsd.h"
|
||||
+
|
||||
+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
|
||||
+# include <malloc.h>
|
||||
+#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
|
||||
+
|
||||
+#ifdef HAVE_AVAHI
|
||||
+# include <avahi-common/timeval.h>
|
||||
+#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$".
|
||||
+ */
|
529
cups-avahi-4-poll.patch
Normal file
529
cups-avahi-4-poll.patch
Normal file
|
@ -0,0 +1,529 @@
|
|||
diff -up cups-1.5.0/scheduler/avahi.c.avahi-4-poll cups-1.5.0/scheduler/avahi.c
|
||||
--- cups-1.5.0/scheduler/avahi.c.avahi-4-poll 2011-10-11 10:56:50.102288037 +0100
|
||||
+++ cups-1.5.0/scheduler/avahi.c 2011-10-11 10:56:50.102288037 +0100
|
||||
@@ -0,0 +1,441 @@
|
||||
+/*
|
||||
+ * "$Id$"
|
||||
+ *
|
||||
+ * Avahi poll implementation for the CUPS scheduler.
|
||||
+ *
|
||||
+ * Copyright (C) 2010, 2011 Red Hat, Inc.
|
||||
+ * Authors:
|
||||
+ * Tim Waugh <twaugh@redhat.com>
|
||||
+ *
|
||||
+ * 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 <config.h>
|
||||
+
|
||||
+#ifdef HAVE_AVAHI /* Applies to entire file... */
|
||||
+
|
||||
+/*
|
||||
+ * Include necessary headers...
|
||||
+ */
|
||||
+
|
||||
+#include "cupsd.h"
|
||||
+
|
||||
+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
|
||||
+# include <malloc.h>
|
||||
+#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
|
||||
+
|
||||
+#ifdef HAVE_AVAHI
|
||||
+# include <avahi-common/timeval.h>
|
||||
+#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.0/scheduler/avahi.h.avahi-4-poll cups-1.5.0/scheduler/avahi.h
|
||||
--- cups-1.5.0/scheduler/avahi.h.avahi-4-poll 2011-10-11 10:56:50.102288037 +0100
|
||||
+++ cups-1.5.0/scheduler/avahi.h 2011-10-11 10:56:50.119287724 +0100
|
||||
@@ -0,0 +1,69 @@
|
||||
+/*
|
||||
+ * "$Id$"
|
||||
+ *
|
||||
+ * Avahi poll implementation for the CUPS scheduler.
|
||||
+ *
|
||||
+ * Copyright (C) 2010, 2011 Red Hat, Inc.
|
||||
+ * Authors:
|
||||
+ * Tim Waugh <twaugh@redhat.com>
|
||||
+ *
|
||||
+ * 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 <config.h>
|
||||
+
|
||||
+#ifdef HAVE_AVAHI
|
||||
+# include <avahi-client/client.h>
|
||||
+# include <avahi-client/publish.h>
|
||||
+#endif /* HAVE_AVAHI */
|
||||
+
|
||||
+#ifdef HAVE_AUTHORIZATION_H
|
||||
+# include <Security/Authorization.h>
|
||||
+#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.0/scheduler/Makefile.avahi-4-poll cups-1.5.0/scheduler/Makefile
|
||||
--- cups-1.5.0/scheduler/Makefile.avahi-4-poll 2011-10-11 10:56:45.868365861 +0100
|
||||
+++ cups-1.5.0/scheduler/Makefile 2011-10-11 10:56:50.101288055 +0100
|
||||
@@ -17,6 +17,7 @@ include ../Makedefs
|
||||
|
||||
CUPSDOBJS = \
|
||||
auth.o \
|
||||
+ avahi.o \
|
||||
banners.o \
|
||||
cert.o \
|
||||
classes.o \
|
1191
cups-avahi-5-services.patch
Normal file
1191
cups-avahi-5-services.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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") ||
|
||||
|
|
42
cups-build.patch
Normal file
42
cups-build.patch
Normal file
|
@ -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,
|
|
@ -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...
|
||||
|
|
27
cups-direct-usb.patch
Normal file
27
cups-direct-usb.patch
Normal file
|
@ -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))
|
||||
{
|
38
cups-dnssd-deviceid.patch
Normal file
38
cups-dnssd-deviceid.patch
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,19 @@
|
|||
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/cups/http.c.driverd-timeout cups-1.5.0/cups/http.c
|
||||
--- cups-1.5.0/cups/http.c.driverd-timeout 2011-10-10 17:03:54.181458460 +0100
|
||||
+++ cups-1.5.0/cups/http.c 2011-10-10 17:04:01.452321912 +0100
|
||||
@@ -1314,7 +1314,7 @@ httpGets(char *line, /* I - Line to
|
||||
* No newline; see if there is more data to be read...
|
||||
*/
|
||||
|
||||
- while (!_httpWait(http, http->blocking ? 30000 : 10000, 1))
|
||||
+ while (!_httpWait(http, http->blocking ? 70000 : 10000, 1))
|
||||
{
|
||||
if (http->timeout_cb && (*http->timeout_cb)(http, http->timeout_data))
|
||||
continue;
|
||||
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 +22,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);
|
||||
|
||||
|
|
|
@ -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.5b1/backend/ipp.c.eggcups cups-1.5b1/backend/ipp.c
|
||||
--- cups-1.5b1/backend/ipp.c.eggcups 2011-05-21 06:02:41.000000000 +0200
|
||||
+++ cups-1.5b1/backend/ipp.c 2011-05-23 18:07:45.000000000 +0200
|
||||
@@ -133,6 +133,70 @@ static cups_array_t *state_reasons; /* A
|
||||
static char tmpfilename[1024] = "";
|
||||
/* Temporary spool file name */
|
||||
|
||||
+#if HAVE_DBUS
|
||||
+#include <dbus/dbus.h>
|
||||
|
@ -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);
|
||||
@@ -1461,6 +1525,15 @@ main(int argc, /* I - Number of comm
|
||||
_("Print file accepted - job ID %d."), job_id);
|
||||
}
|
||||
|
||||
+#if HAVE_DBUS
|
||||
|
@ -87,23 +87,23 @@ diff -up cups-1.4b1/backend/ipp.c.eggcups cups-1.4b1/backend/ipp.c
|
|||
+
|
||||
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
|
||||
if (job_canceled)
|
||||
diff -up cups-1.5b1/backend/Makefile.eggcups cups-1.5b1/backend/Makefile
|
||||
--- cups-1.5b1/backend/Makefile.eggcups 2011-05-04 06:28:00.000000000 +0200
|
||||
+++ cups-1.5b1/backend/Makefile 2011-05-23 18:03:22.000000000 +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.5b1/scheduler/subscriptions.c.eggcups cups-1.5b1/scheduler/subscriptions.c
|
||||
--- cups-1.5b1/scheduler/subscriptions.c.eggcups 2011-05-20 05:49:49.000000000 +0200
|
||||
+++ cups-1.5b1/scheduler/subscriptions.c 2011-05-23 18:03:22.000000000 +0200
|
||||
@@ -1310,13 +1310,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,
|
||||
@@ -1352,7 +1352,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);
|
||||
|
|
32
cups-filter-debug.patch
Normal file
32
cups-filter-debug.patch
Normal file
|
@ -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;
|
||||
|
|
@ -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 <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <termios.h>
|
||||
|
@ -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 <windows.h>
|
||||
#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 */
|
||||
}
|
||||
|
21
cups-hp-deviceid-oid.patch
Normal file
21
cups-hp-deviceid-oid.patch
Normal file
|
@ -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 :
|
1042
cups-icc.patch
Normal file
1042
cups-icc.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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 <stdarg.h>
|
||||
#include <syslog.h>
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 <cups/i18n.h>
|
||||
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 <cups/cups-private.h>
|
||||
|
||||
|
||||
+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]);
|
||||
|
|
|
@ -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@
|
||||
|
|
|
@ -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.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.5b1/config-scripts/cups-ssl.m4
|
||||
--- cups-1.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs 2011-05-11 02:52:08.000000000 +0200
|
||||
+++ cups-1.5b1/config-scripts/cups-ssl.m4 2011-05-23 17:47:27.000000000 +0200
|
||||
@@ -164,7 +164,7 @@ AC_SUBST(IPPALIASES)
|
||||
AC_SUBST(SSLFLAGS)
|
||||
AC_SUBST(SSLLIBS)
|
||||
|
||||
|
|
|
@ -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*)
|
||||
|
|
11
cups-peercred.patch
Normal file
11
cups-peercred.patch
Normal file
|
@ -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 <grp.h>
|
||||
#ifdef HAVE_SHADOW_H
|
|
@ -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)
|
||||
|
|
13
cups-ps-command-filter.patch
Normal file
13
cups-ps-command-filter.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff -up cups-1.5.0/cups/ppd-cache.c.ps-command-filter cups-1.5.0/cups/ppd-cache.c
|
||||
--- cups-1.5.0/cups/ppd-cache.c.ps-command-filter 2011-11-04 13:10:34.405729542 +0000
|
||||
+++ cups-1.5.0/cups/ppd-cache.c 2011-11-04 13:11:58.502184096 +0000
|
||||
@@ -1272,7 +1272,8 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)
|
||||
|
||||
if (filter)
|
||||
cupsArrayAdd(pc->filters,
|
||||
- "application/vnd.cups-command application/postscript 0 -");
|
||||
+ "application/vnd.cups-command application/postscript 100 "
|
||||
+ "commandtops");
|
||||
}
|
||||
|
||||
if ((ppd_attr = ppdFindAttr(ppd, "cupsPreFilter", NULL)) != NULL)
|
|
@ -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
|
||||
|
|
21
cups-ricoh-deviceid-oid.patch
Normal file
21
cups-ricoh-deviceid-oid.patch
Normal file
|
@ -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,
|
11
cups-serial.patch
Normal file
11
cups-serial.patch
Normal file
|
@ -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 <linux/types.h>
|
||||
# include <linux/serial.h>
|
||||
# include <linux/ioctl.h>
|
||||
#endif /* __linux && TIOCGSERIAL */
|
|
@ -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__ */
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
|
|
115
cups-snmp-quirks.patch
Normal file
115
cups-snmp-quirks.patch
Normal file
|
@ -0,0 +1,115 @@
|
|||
diff -up cups-1.5b1/backend/snmp-supplies.c.snmp-quirks cups-1.5b1/backend/snmp-supplies.c
|
||||
--- cups-1.5b1/backend/snmp-supplies.c.snmp-quirks 2011-05-20 05:49:49.000000000 +0200
|
||||
+++ cups-1.5b1/backend/snmp-supplies.c 2011-05-24 17:15:55.000000000 +0200
|
||||
@@ -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)
|
||||
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);
|
||||
|
||||
/*
|
64
cups-str3382.patch
Normal file
64
cups-str3382.patch
Normal file
|
@ -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 <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
+# include <sys/types.h>
|
||||
#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)
|
14
cups-str3921.patch
Normal file
14
cups-str3921.patch
Normal file
|
@ -0,0 +1,14 @@
|
|||
diff -up cups-1.5.0/scheduler/cups-driverd.cxx.str3921 cups-1.5.0/scheduler/cups-driverd.cxx
|
||||
--- cups-1.5.0/scheduler/cups-driverd.cxx.str3921 2011-06-08 22:19:11.000000000 +0100
|
||||
+++ cups-1.5.0/scheduler/cups-driverd.cxx 2011-10-11 12:07:34.979538544 +0100
|
||||
@@ -1411,9 +1411,7 @@ load_drv(const char *filename, /* I -
|
||||
* Add a dummy entry for the file...
|
||||
*/
|
||||
|
||||
- httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "drv", "", "", 0,
|
||||
- "/%s", name);
|
||||
- add_ppd(name, uri, "", "", "", "", "", "", mtime, size, 0,
|
||||
+ add_ppd(name, name, "", "", "", "", "", "", mtime, size, 0,
|
||||
PPD_TYPE_DRV, "drv");
|
||||
ChangedPPD = 1;
|
||||
|
26
cups-str3947.patch
Normal file
26
cups-str3947.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
diff -up cups-1.5.0/notifier/dbus.c.str3947 cups-1.5.0/notifier/dbus.c
|
||||
--- cups-1.5.0/notifier/dbus.c.str3947 2011-03-04 16:55:59.000000000 +0000
|
||||
+++ cups-1.5.0/notifier/dbus.c 2011-09-28 10:42:56.298760622 +0100
|
||||
@@ -4,7 +4,7 @@
|
||||
* D-Bus notifier for CUPS.
|
||||
*
|
||||
* Copyright 2008-2010 by Apple Inc.
|
||||
- * Copyright (C) 2007 Red Hat, Inc.
|
||||
+ * Copyright (C) 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2007 Tim Waugh <twaugh@redhat.com>
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
@@ -423,10 +423,11 @@ main(int argc, /* I - Number of comm
|
||||
p = printer_reasons;
|
||||
for (i = 0; i < attr->num_values; i++)
|
||||
{
|
||||
- strcpy(p, attr->values[i].string.text);
|
||||
- p += strlen(p);
|
||||
if (i)
|
||||
*p++ = ',';
|
||||
+
|
||||
+ strcpy(p, attr->values[i].string.text);
|
||||
+ p += strlen(p);
|
||||
}
|
||||
dbus_message_iter_append_string(&iter, &printer_reasons);
|
||||
}
|
30
cups-strict-ppd-line-length.patch
Normal file
30
cups-strict-ppd-line-length.patch
Normal file
|
@ -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...
|
38
cups-system-auth.patch
Normal file
38
cups-system-auth.patch
Normal file
|
@ -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
|
||||
|
396
cups-systemd-socket.patch
Normal file
396
cups-systemd-socket.patch
Normal file
|
@ -0,0 +1,396 @@
|
|||
diff -up cups-1.5.0/config.h.in.systemd-socket cups-1.5.0/config.h.in
|
||||
--- cups-1.5.0/config.h.in.systemd-socket 2011-10-18 15:32:40.741672460 +0100
|
||||
+++ cups-1.5.0/config.h.in 2011-10-18 15:32:40.843670530 +0100
|
||||
@@ -503,6 +503,13 @@
|
||||
|
||||
|
||||
/*
|
||||
+ * Do we have systemd support?
|
||||
+ */
|
||||
+
|
||||
+#undef HAVE_SYSTEMD
|
||||
+
|
||||
+
|
||||
+/*
|
||||
* Various scripting languages...
|
||||
*/
|
||||
|
||||
diff -up cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket cups-1.5.0/config-scripts/cups-systemd.m4
|
||||
--- cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket 2011-10-18 15:32:40.844670511 +0100
|
||||
+++ cups-1.5.0/config-scripts/cups-systemd.m4 2011-10-18 15:33:16.861989058 +0100
|
||||
@@ -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.0/configure.in.systemd-socket cups-1.5.0/configure.in
|
||||
--- cups-1.5.0/configure.in.systemd-socket 2010-11-20 01:03:46.000000000 +0000
|
||||
+++ cups-1.5.0/configure.in 2011-10-18 15:32:40.844670511 +0100
|
||||
@@ -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.0/cups/usersys.c.systemd-socket cups-1.5.0/cups/usersys.c
|
||||
--- cups-1.5.0/cups/usersys.c.systemd-socket 2011-10-18 15:32:40.645674277 +0100
|
||||
+++ cups-1.5.0/cups/usersys.c 2011-10-18 15:32:40.845670492 +0100
|
||||
@@ -770,7 +770,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.0/data/cups.path.in.systemd-socket cups-1.5.0/data/cups.path.in
|
||||
--- cups-1.5.0/data/cups.path.in.systemd-socket 2011-10-18 15:32:40.846670473 +0100
|
||||
+++ cups-1.5.0/data/cups.path.in 2011-10-18 15:32:40.846670473 +0100
|
||||
@@ -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.0/data/cups.service.in.systemd-socket cups-1.5.0/data/cups.service.in
|
||||
--- cups-1.5.0/data/cups.service.in.systemd-socket 2011-10-18 15:32:40.846670473 +0100
|
||||
+++ cups-1.5.0/data/cups.service.in 2011-10-18 15:32:40.846670473 +0100
|
||||
@@ -0,0 +1,9 @@
|
||||
+[Unit]
|
||||
+Description=CUPS Printing Service
|
||||
+
|
||||
+[Service]
|
||||
+ExecStart=@sbindir@/cupsd -f
|
||||
+
|
||||
+[Install]
|
||||
+Also=cups.socket cups.path
|
||||
+WantedBy=printer.target
|
||||
diff -up cups-1.5.0/data/cups.socket.in.systemd-socket cups-1.5.0/data/cups.socket.in
|
||||
--- cups-1.5.0/data/cups.socket.in.systemd-socket 2011-10-18 15:32:40.847670454 +0100
|
||||
+++ cups-1.5.0/data/cups.socket.in 2011-10-18 15:32:40.847670454 +0100
|
||||
@@ -0,0 +1,10 @@
|
||||
+[Unit]
|
||||
+Description=CUPS Printing Service Sockets
|
||||
+
|
||||
+[Socket]
|
||||
+ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@
|
||||
+ListenStream=631
|
||||
+BindIPv6Only=ipv6-only
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=sockets.target
|
||||
diff -up cups-1.5.0/data/Makefile.systemd-socket cups-1.5.0/data/Makefile
|
||||
--- cups-1.5.0/data/Makefile.systemd-socket 2011-05-12 06:21:56.000000000 +0100
|
||||
+++ cups-1.5.0/data/Makefile 2011-10-18 15:32:40.847670454 +0100
|
||||
@@ -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.0/Makedefs.in.systemd-socket cups-1.5.0/Makedefs.in
|
||||
--- cups-1.5.0/Makedefs.in.systemd-socket 2011-10-18 15:32:40.719672876 +0100
|
||||
+++ cups-1.5.0/Makedefs.in 2011-10-18 15:32:40.848670435 +0100
|
||||
@@ -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.0/scheduler/client.h.systemd-socket cups-1.5.0/scheduler/client.h
|
||||
--- cups-1.5.0/scheduler/client.h.systemd-socket 2011-03-25 21:25:38.000000000 +0000
|
||||
+++ cups-1.5.0/scheduler/client.h 2011-10-18 15:32:40.848670435 +0100
|
||||
@@ -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.0/scheduler/listen.c.systemd-socket cups-1.5.0/scheduler/listen.c
|
||||
--- cups-1.5.0/scheduler/listen.c.systemd-socket 2011-04-16 00:38:13.000000000 +0100
|
||||
+++ cups-1.5.0/scheduler/listen.c 2011-10-18 15:32:40.849670416 +0100
|
||||
@@ -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.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
|
||||
--- cups-1.5.0/scheduler/main.c.systemd-socket 2011-10-18 15:32:40.802671306 +0100
|
||||
+++ cups-1.5.0/scheduler/main.c 2011-10-18 15:32:40.851670379 +0100
|
||||
@@ -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 <systemd/sd-daemon.h>
|
||||
+#endif /* HAVE_SYSTEMD */
|
||||
+
|
||||
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
|
||||
# include <malloc.h>
|
||||
#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,100 @@ 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) {
|
||||
+ 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.0/scheduler/Makefile.systemd-socket cups-1.5.0/scheduler/Makefile
|
||||
--- cups-1.5.0/scheduler/Makefile.systemd-socket 2011-10-18 15:32:40.817671022 +0100
|
||||
+++ cups-1.5.0/scheduler/Makefile 2011-10-18 15:32:40.852670360 +0100
|
||||
@@ -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)
|
||||
|
||||
|
||||
#
|
51
cups-uri-compat.patch
Normal file
51
cups-uri-compat.patch
Normal file
|
@ -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)
|
||||
{
|
52
cups-usb-paperout.patch
Normal file
52
cups-usb-paperout.patch
Normal file
|
@ -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 <sys/select.h>
|
||||
|
||||
+#ifdef __linux
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <linux/lp.h>
|
||||
+#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",
|
569
cups.spec
569
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 2
|
||||
%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.0
|
||||
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,115 +44,107 @@ 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
|
||||
#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
|
||||
Patch35: do-not-broadcast-with-hostnames.patch
|
||||
|
||||
# Fedora patches:
|
||||
# don't gzip man pages
|
||||
#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
|
||||
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
|
||||
Patch1024: 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
|
||||
Patch1037: cups-CVE-2011-2896.patch
|
||||
Patch1038: cups-str3921.patch
|
||||
Patch1039: cups-ps-command-filter.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: jpeg-devel
|
||||
BuildRequires: krb-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)
|
||||
BuildRequires: pkgconfig(libcrypto)
|
||||
BuildRequires: pkgconfig(libpng)
|
||||
BuildRequires: pkgconfig(libssl)
|
||||
BuildRequires: pkgconfig(libusb-1.0)
|
||||
BuildRequires: pkgconfig(zlib)
|
||||
%if !%{bootstrap}
|
||||
BuildRequires: poppler
|
||||
%if %{_with_systemd}
|
||||
BuildRequires: systemd-units
|
||||
%endif
|
||||
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: %{libname} >= %{version}-%{release}
|
||||
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
|
||||
|
@ -198,7 +162,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
|
||||
|
||||
|
@ -218,9 +183,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
|
||||
|
@ -234,20 +196,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.
|
||||
|
||||
|
@ -284,65 +241,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
|
||||
|
||||
%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
|
||||
|
||||
|
@ -355,18 +257,12 @@ perl -p -i -e 's:(<Location\s+/\s*>):$1\n Allow \@LOCAL:' conf/cupsd.conf.in
|
|||
# so no security problem)
|
||||
perl -p -i -e 's:(<Location\s+/admin(|/conf)\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
|
||||
|
@ -374,9 +270,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
|
||||
|
@ -384,29 +277,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
|
||||
|
@ -418,100 +295,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
|
||||
|
@ -520,17 +353,14 @@ export LANGUAGE=C
|
|||
make test << EOF
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
##### INSTALL #####
|
||||
%endif
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
# Debug mode
|
||||
%if %debug
|
||||
%if %{debug}
|
||||
export DONT_STRIP=1
|
||||
%endif
|
||||
|
||||
make install BUILDROOT=%{buildroot} \
|
||||
DOCDIR=%{buildroot}%{_datadir}/cups/doc \
|
||||
CHOWN=":" CHGRP=":" STRIP="$STRIP" \
|
||||
|
@ -538,23 +368,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
|
||||
|
||||
|
@ -569,14 +383,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}
|
||||
|
@ -597,7 +411,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
|
||||
|
@ -625,28 +438,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
|
||||
|
@ -701,8 +505,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
|
||||
|
@ -723,8 +527,6 @@ EOF
|
|||
# Prefer xdg-utils than htmlview (kde one)
|
||||
sed -i s/htmlview/xdg-open/ %{buildroot}%{_datadir}/applications/*.desktop
|
||||
|
||||
#find_lang %{name}
|
||||
|
||||
# http://qa.mandriva.com/show_bug.cgi?id=28383
|
||||
# Common PPD dirs
|
||||
mkdir -p %{buildroot}%{_datadir}/ppd
|
||||
|
@ -738,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
|
||||
|
@ -787,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
|
||||
|
@ -815,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
|
||||
|
@ -845,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
|
||||
|
@ -862,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/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
|
||||
|
@ -895,15 +675,13 @@ rm -rf %{buildroot}
|
|||
/lib/systemd/system/cups.service
|
||||
%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
|
||||
|
@ -917,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
|
||||
|
@ -950,28 +706,77 @@ 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 <oeriksson@mandriva.com> 1.4.8-2mdv2011.0
|
||||
* Thu Dec 22 2011 Oden Eriksson <oeriksson@mandriva.com> 1.5.0-2
|
||||
+ Revision: 744391
|
||||
- rebuilt against libtiff.so.5
|
||||
|
||||
* Thu Dec 01 2011 Matthew Dawkins <mattydaw@mandriva.org> 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 <vsinitsyn> 1.4.8-6
|
||||
+ Revision: 729306
|
||||
- Updated Russian translation
|
||||
|
||||
* Mon Oct 10 2011 Oden Eriksson <oeriksson@mandriva.com> 1.4.8-5
|
||||
+ Revision: 704068
|
||||
- sync with MDVSA-2011:147
|
||||
|
||||
* Thu Sep 29 2011 Tomasz Pawel Gajc <tpg@mandriva.org> 1.4.8-4
|
||||
+ Revision: 701851
|
||||
- disable bootstrap
|
||||
|
||||
* Mon Sep 12 2011 Tomasz Pawel Gajc <tpg@mandriva.org> 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 <nlecureuil@mandriva.com>
|
||||
- Rebuild against new libpng
|
||||
|
||||
* Wed Aug 24 2011 Oden Eriksson <oeriksson@mandriva.com> 1.4.8-2
|
||||
+ Revision: 696366
|
||||
- rebuilt for php-5.3.8
|
||||
|
||||
|
|
24
do-not-broadcast-with-hostnames.patch
Normal file
24
do-not-broadcast-with-hostnames.patch
Normal file
|
@ -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 */
|
||||
|
Loading…
Add table
Reference in a new issue