commit 9b122cb3fe39a9da5736d584036b1d27fcfa66dd Author: Rosa Date: Wed Feb 1 14:24:38 2012 +0400 Automatic import for version 1.4.8 diff --git a/.abf.yml b/.abf.yml new file mode 100644 index 0000000..0ed0421 --- /dev/null +++ b/.abf.yml @@ -0,0 +1,4 @@ +sources: + "cups-1.4.8-source.tar.bz2": 9167f556e78e0bc075f1eb2f695d79cc1f334007 + "pap-backend.tar.bz2": 89e1e7eb4258d47069d2a60c383b8bd555a11e63 + "pap-docu.pdf.bz2": 7e7d44bb58532ab2fc4c1ca3581787877f1b5733 diff --git a/cjktexttops b/cjktexttops new file mode 100644 index 0000000..44d9891 --- /dev/null +++ b/cjktexttops @@ -0,0 +1,11 @@ +#!/bin/bash + +INPUT=- +if [ $# == 6 ] +then + INPUT=$6 +fi + +# Extract the papersize +PAPERSIZE=`grep '^\*DefaultPageSize' "$PPD" | cut -d\ -f2` +LC_ALL=ja_JP mpage -b$PAPERSIZE -1 -o -f -m18lr36bt -P- "$INPUT" diff --git a/cleanppd.pl b/cleanppd.pl new file mode 100644 index 0000000..cb91675 --- /dev/null +++ b/cleanppd.pl @@ -0,0 +1,141 @@ +#!/usr/bin/perl -w + +sub treatfile +{ + + my $deletethis; + my $readval; + my $manufacturer; + my $manuflinefound = 0; + my $manufvalid; + my $havemanuf; + my $model; + my $modellinefound; + my $modelvalid; + my $kap; + + $kap = ""; + $manufacturer = ""; + $deletethis = 0; + + print "$_[0] ... "; + + + # + # Read file for the first time to get manufacturer info and to check + # whether it should be deleted + # + + # open file + if (!(open(PPDFILE,"< $_[0]"))) { + print STDERR "Can't open PPD file: $_[0]\n"; + return(0); + } + # read data + $manufvalid = 0; + $manuflinefound = 0; + while (defined($readval = )) { + # Remove "Birmy PowerRIP" PPD files (they are for the commercial + # Birmy Power RIP software PostScript interpreter (Windows/Mac) + if (($readval =~ /birmy/) || + ($readval =~ /Birmy/) || + ($readval =~ /BIRMY/)) {$deletethis = 1;} + # Search for manufacturer tag + if ($readval =~ /^\*Manufacturer:\s*"(.*)"\s*$/) + { + $manufacturer = $1; + $manuflinefound = 1; + $manufvalid = 1; + if (($readval =~ /"Manufacturer"/) || ($readval =~ /"ESP"/)) + {$manufvalid = 0}; + } + } + # close file + close(PPDFILE); + + # delete file and stop if a deletion criteria is fulfilled + if ($deletethis == 1) { + print ("Deleted\n"); + system("rm -f $_[0]"); + return(0); + } + + $havemanuf = $manufvalid; + + # + # Read file for the second time to get model info + # + + if (($havemanuf == 0) && ($manufvalid == 0)) { + # open file + if (!(open(PPDFILE,"< $_[0]"))) { + print STDERR "Can't open PPD file: $_[0]\n"; + return(0); + } + # read data + $modelvalid = 0; + while (defined($readval = )) { + if ($readval =~ /^\*ModelName:\s*"(.*)"\s*$/) + { + $model=$1; + $modelvalid = 1; + if (($model eq "Model") || ($readval eq "model")) {$modelvalid = 0}; + } + } + # close file + close(PPDFILE); + + # Extract manufacturers name + if ($modelvalid == 0) { $manufacturer="UNKNOWN MANUFACTURER" + } else { + @sep = split(/ /,$model); + $manufacturer = $sep[0]; + } + } + + # + # Rewrite file to insert manufacturer info + # + + # open file to read + if (!(open(PPDFILE,"< $_[0]"))) { + print STDERR "Can't open PPD file: $_[0]\n"; + return(0); + } + # open file to write + if (!(open(NPPDFILE,"> $_[0].new"))) { + print STDERR "Can't open new PPD file: $_[0].new\n"; + return(0); + } + # read data + while (defined($readval = )) { + if (substr($readval, 0, 14) eq "*Manufacturer:") { + $manuflinefound = 1; + print NPPDFILE "*Manufacturer: \"$manufacturer\"\n" + } else { + print NPPDFILE $readval; + } + if ((substr($readval, 0, 4) ne "*PPD") && + (substr($readval, 0, 2) ne "*%")){ + if ($manuflinefound == 0) { + $manuflinefound = 1; + print NPPDFILE "*Manufacturer: \"$manufacturer\"\n" + } + } + } + # close files + close(PPDFILE); + close(NPPDFILE); + # move new file onto place of old file + system("mv -f $_[0].new $_[0]"); + # Compress the file + system("gzip $_[0]"); + print("Processed\n"); + return(0); +} + +# main program + +{ + treatfile($ARGV[0]); +} diff --git a/correctcupsconfig b/correctcupsconfig new file mode 100644 index 0000000..0edc626 --- /dev/null +++ b/correctcupsconfig @@ -0,0 +1,107 @@ +#!/usr/bin/perl -w + +# +# Till Kamppeter (till@mandrakesoft.com) +# +# Copyright 2001 +# +# This software may be freely redistributed under the terms of the GNU +# General Public License. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# Some great piece of code taken from +# /usr/lib/perl5/site_perl/5.6.1/MDK/Common/DataStructure.pm +# member( $a, @b ) returns 1 if $a is in @b, 0 otherwise. + +sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }; + +# Do not do any changes when the user chose manual configuration in +# printerdrake + +my $manual = 0; +my $manualconffile = "/etc/sysconfig/printing"; +if (open MANUALCONFFILE, "< $manualconffile") { + @manualconf_content = ; + close MANUALCONFFILE; + ($_ =~ /^\s*CUPS_CONFIG\s*=\s*manual\s*$/ and $manual = 1) foreach @manualconf_content; +} +if ($manual) {exit;} + +# Read CUPS config file or create a new one if necessary. + +my $cups_conf = "/etc/cups/cupsd.conf"; +my @cups_conf_content; +my $config_modified = 0; + +if (!(-f $cups_conf)) { + warn "No CUPS configuration file $cups_conf, creating one ...\n"; + @cups_conf_content = split('\n', +"LogLevel info +TempDir /var/spool/cups/tmp +Port 631 +BrowseAddress \@LOCAL +BrowseDeny All +BrowseAllow 127.0.0.1 +BrowseAllow \@LOCAL +BrowseOrder deny,allow + +Order Deny,Allow +Deny From All +Allow From 127.0.0.1 +Allow From \@LOCAL + + +AuthType Basic +AuthClass System +Order Deny,Allow +Deny From All +Allow From 127.0.0.1 + +"); + ($_ =~ s/$/\n/) foreach @cups_conf_content; + $config_modified = 1; +} else { + open CONF_CUPS, "$cups_conf" or die "Can't open $cups_conf!"; + @cups_conf_content = ; + close CONF_CUPS; +} + +# Check whether LPD/LPRng is installed and turn off creation of an +# /etc/printcap file by CUPS. + +if ((-x "/usr/sbin/lpd") && + !(grep { /^\s*Printcap\s*$/ } @cups_conf_content)) { + + my $oldprintcap = ""; + ($_ =~ /^\s*Printcap\s+(\S*)\s*$/ and $oldprintcap = $1) + foreach @cups_conf_content; + + if (($oldprintcap eq "") || ($oldprintcap eq "/etc/printcap")) { + + print STDERR "WARNING: Inserted \"Printcap\" line in /etc/cups/cupsd.conf\n (to avoid overwriting the /etc/printcap of the installed LPD/LPRng)\n"; + + # Remove all valid "Printcap" lines + ($_ =~ /^\s*Printcap[^:]/ and $_="") foreach @cups_conf_content; + + # Insert the new "Printcap" line + push @cups_conf_content, "Printcap\n"; + + # Remove the /etc/printcap file which the CUPS daemon left during + # shutdown and replace it by an empty file + unlink "/etc/printcap"; + system "touch /etc/printcap"; + + $config_modified = 1; + } +} + +# Write back the modified CUPS config file +if ($config_modified) { + open CONF_CUPS, ">$cups_conf" or die "Can't open $cups_conf"; + print CONF_CUPS @cups_conf_content; + close CONF_CUPS; +} diff --git a/cups-1.3.7-peercred.patch b/cups-1.3.7-peercred.patch new file mode 100644 index 0000000..4e579b4 --- /dev/null +++ b/cups-1.3.7-peercred.patch @@ -0,0 +1,11 @@ +diff -up cups-1.3.5/scheduler/auth.c.peercred cups-1.3.5/scheduler/auth.c +--- cups-1.3.5/scheduler/auth.c.peercred 2008-02-05 16:52:20.000000000 +0000 ++++ cups-1.3.5/scheduler/auth.c 2008-02-05 18:20:06.000000000 +0000 +@@ -54,6 +54,7 @@ + * Include necessary headers... + */ + ++#define _GNU_SOURCE + #include "cupsd.h" + #include + #ifdef HAVE_SHADOW_H diff --git a/cups-1.4-permissions.patch b/cups-1.4-permissions.patch new file mode 100644 index 0000000..13aba3a --- /dev/null +++ b/cups-1.4-permissions.patch @@ -0,0 +1,21 @@ +--- cups-1.4svn-r8684/Makedefs.in~ 2009-05-21 19:20:06.000000000 +0200 ++++ cups-1.4svn-r8684/Makedefs.in 2009-05-26 21:50:03.000000000 +0200 +@@ -40,13 +40,13 @@ + # Installation programs... + # + +-INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@ ++INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@ + INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@ +-INSTALL_DATA = $(INSTALL) -c -m 444 ++INSTALL_DATA = $(INSTALL) -c -m 644 + INSTALL_DIR = $(INSTALL) -d +-INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@ +-INSTALL_MAN = $(INSTALL) -c -m 444 +-INSTALL_SCRIPT = $(INSTALL) -c -m 555 ++INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@ ++INSTALL_MAN = $(INSTALL) -c -m 644 ++INSTALL_SCRIPT = $(INSTALL) -c -m 755 + + # + # Default user, group, and system groups for the scheduler... diff --git a/cups-1.4.0-recommended.patch b/cups-1.4.0-recommended.patch new file mode 100644 index 0000000..41c8f82 --- /dev/null +++ b/cups-1.4.0-recommended.patch @@ -0,0 +1,26 @@ +--- cups-1.4svn-r8703/scheduler/cups-driverd.cxx~ 2009-06-09 20:43:47.000000000 +0200 ++++ cups-1.4svn-r8703/scheduler/cups-driverd.cxx 2009-06-09 21:09:32.000000000 +0200 +@@ -211,7 +211,6 @@ + const char *scheme) /* I - PPD scheme */ + { + ppd_info_t *ppd; /* PPD */ +- char *recommended; /* Foomatic driver string */ + + + /* +@@ -250,15 +249,6 @@ + strlcpy(ppd->record.scheme, scheme, sizeof(ppd->record.scheme)); + + /* +- * Strip confusing (and often wrong) "recommended" suffix added by +- * Foomatic drivers... +- */ +- +- if ((recommended = strstr(ppd->record.make_and_model, +- " (recommended)")) != NULL) +- *recommended = '\0'; +- +- /* + * Add the PPD to the PPD arrays... + */ + diff --git a/cups-1.4.3-both-usblp-and-libusb.patch b/cups-1.4.3-both-usblp-and-libusb.patch new file mode 100644 index 0000000..1db63ae --- /dev/null +++ b/cups-1.4.3-both-usblp-and-libusb.patch @@ -0,0 +1,569 @@ +diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/ieee1284.c cups-1.4.3-both-usblp-and-libusb/backend/ieee1284.c +--- cups-1.4.3/backend/ieee1284.c 2009-12-08 03:13:42.000000000 +0100 ++++ cups-1.4.3-both-usblp-and-libusb/backend/ieee1284.c 2010-03-31 13:53:53.000000000 +0200 +@@ -255,6 +255,7 @@ + cups_option_t *values; /* Keys and values in device ID */ + const char *mfg, /* Manufacturer */ + *mdl, /* Model */ ++ *des, /* Description */ + *sern; /* Serial number */ + char temp[256], /* Temporary manufacturer string */ + *tempptr; /* Pointer into temp string */ +@@ -285,10 +286,20 @@ + } + else + { +- strlcpy(temp, make_model, sizeof(temp)); ++ /* ++ * No manufacturer? Use the model string or description... ++ */ ++ ++ if (mdl) ++ _ppdNormalizeMakeAndModel(mdl, temp, sizeof(temp)); ++ else if ((des = cupsGetOption("DESCRIPTION", num_values, values)) != NULL || ++ (des = cupsGetOption("DES", num_values, values)) != NULL) ++ _ppdNormalizeMakeAndModel(des, temp, sizeof(temp)); ++ else ++ strlcpy(temp, "Unknown", sizeof(temp)); + + if ((tempptr = strchr(temp, ' ')) != NULL) +- *tempptr = '\0'; ++ *tempptr = '\0'; + + mfg = temp; + } +diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/Makefile cups-1.4.3-both-usblp-and-libusb/backend/Makefile +--- cups-1.4.3/backend/Makefile 2009-03-03 20:39:21.000000000 +0100 ++++ cups-1.4.3-both-usblp-and-libusb/backend/Makefile 2010-03-31 13:53:53.000000000 +0200 +@@ -267,7 +267,7 @@ + echo Linking $@... + $(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \ + $(BACKLIBS) $(LIBS) +-usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c ++usb.o: usb.c usb-darwin.c usb-hybrid.c usb-libusb.c usb-unix.c + + + # +diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/usb.c cups-1.4.3-both-usblp-and-libusb/backend/usb.c +--- cups-1.4.3/backend/usb.c 2008-06-24 03:28:36.000000000 +0200 ++++ cups-1.4.3-both-usblp-and-libusb/backend/usb.c 2010-03-31 13:53:53.000000000 +0200 +@@ -56,7 +56,7 @@ + */ + + #ifdef HAVE_USB_H +-# include "usb-libusb.c" ++# include "usb-hybrid.c" + #elif defined(__APPLE__) + # include "usb-darwin.c" + #elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) +diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/usb-hybrid.c cups-1.4.3-both-usblp-and-libusb/backend/usb-hybrid.c +--- cups-1.4.3/backend/usb-hybrid.c 1970-01-01 01:00:00.000000000 +0100 ++++ cups-1.4.3-both-usblp-and-libusb/backend/usb-hybrid.c 2010-03-31 13:53:53.000000000 +0200 +@@ -0,0 +1,87 @@ ++/* ++ * "$Id: usb-hybrid.c 8807 2009-08-31 18:45:43Z mike $" ++ * ++ * USB port backend for the Common UNIX Printing System (CUPS). ++ * ++ * This file is included from "usb.c" when compiled on Linux. ++ * ++ * Copyright 2007-2008 by Apple Inc. ++ * Copyright 1997-2007 by Easy Software Products, all rights reserved. ++ * ++ * These coded instructions, statements, and computer programs are the ++ * property of Apple Inc. and are protected by Federal copyright ++ * law. Distribution and use rights are outlined in the file "LICENSE.txt" ++ * "LICENSE" which should have been included with this file. If this ++ * file is missing or damaged, see the license at "http://www.cups.org/". ++ * ++ * This file is subject to the Apple OS-Developed Software exception. ++ * ++ * Contents: ++ * ++ * print_device() - Print a file to a USB device. ++ * list_devices() - List all USB devices. ++ */ ++ ++/* ++ * Include necessary headers. ++ */ ++ ++#include ++ ++/* ++ * Include the two USB implementations used under Linux ... ++ */ ++ ++#include "usb-libusb.c" ++#include "usb-unix.c" ++ ++/* ++ * 'print_device()' - Print a file to a USB device. ++ */ ++ ++int /* O - Exit status */ ++print_device(const char *uri, /* I - Device URI */ ++ const char *hostname, /* I - Hostname/manufacturer */ ++ const char *resource, /* I - Resource/modelname */ ++ char *options, /* I - Device options/serial number */ ++ int print_fd, /* I - File descriptor to print */ ++ int copies, /* I - Copies to print */ ++ int argc, /* I - Number of command-line arguments (6 or 7) */ ++ char *argv[]) /* I - Command-line arguments */ ++{ ++ int result; ++ for(;;) ++ { ++ result = print_device_unix(uri, hostname, resource, options, print_fd, ++ copies, argc, argv); ++ if (result == -1) ++ { ++ result = print_device_libusb(uri, hostname, resource, options, print_fd, ++ copies, argc, argv); ++ if (result == -1) ++ sleep(5); ++ else ++ return(result); ++ } ++ else ++ return(result); ++ } ++} ++ ++/* ++ * 'list_devices()' - List all USB devices. ++ */ ++ ++void ++list_devices(void) ++{ ++ /* Try both discovery methods, each device will appear only under one ++ of them */ ++ list_devices_libusb(); ++ list_devices_unix(); ++} ++ ++ ++/* ++ * End of "$Id: usb-hybrid.c 8807 2009-08-31 18:45:43Z mike $". ++ */ +diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/usb-libusb.c cups-1.4.3-both-usblp-and-libusb/backend/usb-libusb.c +--- cups-1.4.3/backend/usb-libusb.c 2009-09-11 22:03:31.000000000 +0200 ++++ cups-1.4.3-both-usblp-and-libusb/backend/usb-libusb.c 2010-03-31 13:53:53.000000000 +0200 +@@ -13,16 +13,16 @@ + * + * Contents: + * +- * list_devices() - List the available printers. +- * print_device() - Print a file to a USB device. ++ * list_devices_libusb() - List the available printers. ++ * print_device_libusb() - Print a file to a USB device. + * close_device() - Close the connection to the USB printer. + * find_device() - Find or enumerate USB printers. + * get_device_id() - Get the IEEE-1284 device ID for the printer. + * list_cb() - List USB printers for discovery. + * make_device_uri() - Create a device URI for a USB printer. +- * open_device() - Open a connection to the USB printer. ++ * open_device_libusb() - Open a connection to the USB printer. + * print_cb() - Find a USB printer for printing. +- * side_cb() - Handle side-channel requests. ++ * side_cb_libusb() - Handle side-channel requests. + */ + + /* +@@ -65,30 +65,30 @@ + static char *make_device_uri(usb_printer_t *printer, + const char *device_id, + char *uri, size_t uri_size); +-static int open_device(usb_printer_t *printer, int verbose); ++static int open_device_libusb(usb_printer_t *printer, int verbose); + static int print_cb(usb_printer_t *printer, const char *device_uri, + const char *device_id, const void *data); +-static ssize_t side_cb(usb_printer_t *printer, int print_fd); ++static ssize_t side_cb_libusb(usb_printer_t *printer, int print_fd); + + + /* +- * 'list_devices()' - List the available printers. ++ * 'list_devices_libusb()' - List the available printers. + */ + + void +-list_devices(void) ++list_devices_libusb(void) + { +- fputs("DEBUG: list_devices\n", stderr); ++ fputs("DEBUG: list_devices_libusb\n", stderr); + find_device(list_cb, NULL); + } + + + /* +- * 'print_device()' - Print a file to a USB device. ++ * 'print_device_libusb()' - Print a file to a USB device. + */ + + int /* O - Exit status */ +-print_device(const char *uri, /* I - Device URI */ ++print_device_libusb(const char *uri, /* I - Device URI */ + const char *hostname, /* I - Hostname/manufacturer */ + const char *resource, /* I - Resource/modelname */ + char *options, /* I - Device options/serial number */ +@@ -105,19 +105,23 @@ + struct pollfd pfds[2]; /* Poll descriptors */ + + +- fputs("DEBUG: print_device\n", stderr); ++ fputs("DEBUG: print_device_libusb\n", stderr); + + /* + * Connect to the printer... + */ + ++#if defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) ++ if ((printer = find_device(print_cb, uri)) == NULL) ++ return(-1); ++#else + while ((printer = find_device(print_cb, uri)) == NULL) + { + _cupsLangPuts(stderr, + _("INFO: Waiting for printer to become available...\n")); + sleep(5); + } +- ++#endif + + /* + * If we are printing data from a print driver on stdin, ignore SIGTERM +@@ -189,7 +193,7 @@ + + if (pfds[1].revents & (POLLIN | POLLHUP)) + { +- if ((bytes = side_cb(printer, print_fd)) < 0) ++ if ((bytes = side_cb_libusb(printer, print_fd)) < 0) + pfds[1].events = 0; /* Filter has gone away... */ + else + tbytes += bytes; +@@ -359,7 +363,7 @@ + printer.iface = iface; + printer.handle = NULL; + +- if (!open_device(&printer, data != NULL)) ++ if (!open_device_libusb(&printer, data != NULL)) + { + if (!get_device_id(&printer, device_id, sizeof(device_id))) + { +@@ -583,6 +587,14 @@ + mfg = tempmfg; + } + ++ if (!strncasecmp(mdl, mfg, strlen(mfg))) ++ { ++ mdl += strlen(mfg); ++ ++ while (isspace(*mdl & 255)) ++ mdl ++; ++ } ++ + /* + * Generate the device URI from the manufacturer, model, serial number, + * and interface number... +@@ -611,11 +623,11 @@ + + + /* +- * 'open_device()' - Open a connection to the USB printer. ++ * 'open_device_libusb()' - Open a connection to the USB printer. + */ + + static int /* O - 0 on success, -1 on error */ +-open_device(usb_printer_t *printer, /* I - Printer */ ++open_device_libusb(usb_printer_t *printer, /* I - Printer */ + int verbose) /* I - Update connecting-to-device state? */ + { + int number; /* Configuration/interface/altset numbers */ +@@ -733,16 +745,73 @@ + const char *device_id, /* I - IEEE-1284 device ID */ + const void *data) /* I - User data (make, model, S/N) */ + { +- return (!strcmp((char *)data, device_uri)); ++ char *uri = (char *)data, ++ *str1, ++ *str2, ++ buf[255], ++ requested_uri[1024]; ++ ++ /* Work on a copy of uri */ ++ strncpy(requested_uri, uri, sizeof(requested_uri)); ++ requested_uri[sizeof(requested_uri) - 1] = '\0'; ++ ++ /* ++ * libusb-discovered URIs can have an "interface" specification and this ++ * never happens for usblp-discovered URIs, so remove the "interface" ++ * specification from the URI which we are checking currently. This way a ++ * queue for a usblp-discovered printer can now be accessed via libusb ++ */ ++ if (((str1 = strstr(requested_uri, "interface=")) == NULL) && ++ ((str2 = strstr(device_uri, "interface=")) != NULL)) ++ { ++ *(str2 - 1) = '\0'; ++ } ++ ++ /* ++ * Old URI with "serial=?". Cut this part off and consider this as ++ * an URI without serial number ++ */ ++ if ((str1 = strstr(requested_uri, "serial=?")) != NULL) ++ *(str1 - 1) = '\0'; ++ ++ /* ++ * Old URI without serial number. Match it also with URIs with serial ++ * number ++ */ ++ if (((str1 = strstr(requested_uri, "serial=")) == NULL) && ++ ((str2 = strstr(device_uri, "serial=")) != NULL)) ++ *(str2 - 1) = '\0'; ++ ++ /* ++ * libusb-discovered URIs can have a "serial" specification when the ++ * usblp-discovered URI for the same printer does not have one, as ++ * with libusb we can discover serial numbers also with other methods ++ * than only via the device ID. Therefore we accept also a ++ * usblp-discovered printer without serial number as a match. This we ++ * do by removing the serial number from the queue's (libusb-discovered) ++ * URI before comparing. Also warn the user because of the incapability ++ * of the usblp-based access to distinguish printers by the serial ++ * number. ++ */ ++ if (((str1 = strstr(requested_uri, "serial=")) == NULL) && ++ ((str2 = strstr(device_uri, "serial=")) != NULL)) ++ { ++ *(str2 - 1) = '\0'; ++ if (backendGetMakeModel(device_id, buf, sizeof(buf)) == 0) ++ fprintf(stderr, "WARNING: If you have more than one %s printer connected to this machine, please make sure that the \"usblp\" kernel module is always unloaded (and blacklisted) and re-create the queues for these printers. Otherwise CUPS will not be able to distinguish them.\n", ++ buf); ++ } ++ ++ return (!strcmp(requested_uri, device_uri)); + } + + + /* +- * 'side_cb()' - Handle side-channel requests. ++ * 'side_cb_libusb()' - Handle side-channel requests. + */ + + static ssize_t /* O - Number of bytes written */ +-side_cb(usb_printer_t *printer, /* I - Printer */ ++side_cb_libusb(usb_printer_t *printer, /* I - Printer */ + int print_fd) /* I - File to print */ + { + ssize_t bytes, /* Bytes read/written */ +diff -Naur -x '*~' -x '*.orig' -x '*.rej' cups-1.4.3/backend/usb-unix.c cups-1.4.3-both-usblp-and-libusb/backend/usb-unix.c +--- cups-1.4.3/backend/usb-unix.c 2009-12-08 03:13:42.000000000 +0100 ++++ cups-1.4.3-both-usblp-and-libusb/backend/usb-unix.c 2010-03-31 13:59:05.000000000 +0200 +@@ -18,10 +18,10 @@ + * + * Contents: + * +- * print_device() - Print a file to a USB device. +- * list_devices() - List all USB devices. +- * open_device() - Open a USB device... +- * side_cb() - Handle side-channel requests... ++ * print_device_unix() - Print a file to a USB device. ++ * list_devices_unix() - List all USB devices. ++ * open_device_unix() - Open a USB device... ++ * side_cb_unix() - Handle side-channel requests... + */ + + /* +@@ -35,17 +35,17 @@ + * Local functions... + */ + +-static int open_device(const char *uri, int *use_bc); +-static int side_cb(int print_fd, int device_fd, int snmp_fd, ++static int open_device_unix(const char *uri, int *use_bc); ++static int side_cb_unix(int print_fd, int device_fd, int snmp_fd, + http_addr_t *addr, int use_bc); + + + /* +- * 'print_device()' - Print a file to a USB device. ++ * 'print_device_unix()' - Print a file to a USB device. + */ + + int /* O - Exit status */ +-print_device(const char *uri, /* I - Device URI */ ++print_device_unix(const char *uri, /* I - Device URI */ + const char *hostname, /* I - Hostname/manufacturer */ + const char *resource, /* I - Resource/modelname */ + char *options, /* I - Device options/serial number */ +@@ -102,7 +102,7 @@ + strncasecmp(hostname, "Minolta", 7); + #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ + +- if ((device_fd = open_device(uri, &use_bc)) == -1) ++ if ((device_fd = open_device_unix(uri, &use_bc)) == -1) + { + if (getenv("CLASS") != NULL) + { +@@ -132,6 +132,10 @@ + _("INFO: Printer busy; will retry in 10 seconds...\n")); + sleep(10); + } ++#ifdef HAVE_USB_H ++ else ++ return (-1); ++#else + else if (errno == ENXIO || errno == EIO || errno == ENOENT || + errno == ENODEV) + { +@@ -147,6 +151,7 @@ + resource, strerror(errno)); + return (CUPS_BACKEND_FAILED); + } ++#endif + } + } + while (device_fd < 0); +@@ -190,7 +195,7 @@ + tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, NULL); + + #else +- tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb); ++ tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb_unix); + #endif /* __sun */ + + if (print_fd != 0 && tbytes >= 0) +@@ -214,11 +219,11 @@ + + + /* +- * 'list_devices()' - List all USB devices. ++ * 'list_devices_unix()' - List all USB devices. + */ + + void +-list_devices(void) ++list_devices_unix(void) + { + #ifdef __linux + int i; /* Looping var */ +@@ -320,11 +325,11 @@ + + + /* +- * 'open_device()' - Open a USB device... ++ * 'open_device_unix()' - Open a USB device... + */ + + static int /* O - File descriptor or -1 on error */ +-open_device(const char *uri, /* I - Device URI */ ++open_device_unix(const char *uri, /* I - Device URI */ + int *use_bc) /* O - Set to 0 for unidirectional */ + { + int fd; /* File descriptor */ +@@ -357,9 +362,12 @@ + char device[255], /* Device filename */ + device_id[1024], /* Device ID string */ + make_model[1024], /* Make and model */ +- device_uri[1024]; /* Device URI string */ +- ++ device_uri[1024], /* Device URI string */ ++ requested_uri[1024], /* Device URI string */ ++ *str1, ++ *str2; + ++ + /* + * Find the correct USB device... + */ +@@ -407,7 +415,55 @@ + device_uri[0] = '\0'; + } + +- if (!strcmp(uri, device_uri)) ++ /* Work on a copy of uri */ ++ strncpy(requested_uri, uri, sizeof(requested_uri)); ++ requested_uri[sizeof(requested_uri) - 1] = '\0'; ++ ++ /* ++ * libusb-discovered URIs can have an "interface" specification and this ++ * never happens for usblp-discovered URIs, so remove the "interface" ++ * specification from the URI of the print queue. This way a queue for ++ * a libusb-discovered printer can now be accessed via the usblip kernel ++ * module ++ */ ++ if ((str1 = strstr(requested_uri, "interface=")) != NULL) ++ *(str1 - 1) = '\0'; ++ ++ /* ++ * Old URI with "serial=?". Cut this part off and consider this as ++ * an URI without serial number ++ */ ++ if ((str1 = strstr(requested_uri, "serial=?")) != NULL) ++ *(str1 - 1) = '\0'; ++ ++ /* ++ * Old URI without serial number. Match it also with URIs with serial ++ * number ++ */ ++ if (((str1 = strstr(requested_uri, "serial=")) == NULL) && ++ ((str2 = strstr(device_uri, "serial=")) != NULL)) ++ *(str2 - 1) = '\0'; ++ ++ /* ++ * libusb-discovered URIs can have a "serial" specification when the ++ * usblp-discovered URI for the same printer does not have one, as ++ * with libusb we can discover serial numbers also with other methods ++ * than only via the device ID. Therefore we accept also a ++ * usblp-discovered printer without serial number as a match. This we ++ * do by removing the serial number from the queue's (libusb-discovered) ++ * URI before comparing. Also warn the user because of the incapability ++ * of the usblp-based access to distinguish printers by the serial ++ * number. ++ */ ++ if (((str1 = strstr(requested_uri, "serial=")) != NULL) && ++ ((str2 = strstr(device_uri, "serial=")) == NULL)) ++ { ++ *(str1 - 1) = '\0'; ++ fprintf(stderr, "WARNING: If you have more than one %s printer connected to this machine, please unload (and blacklist) the \"usblp\" kernel module as otherwise CUPS will not be able to distinguish your printers.\n", ++ make_model); ++ } ++ ++ if (!strcmp(requested_uri, device_uri)) + { + /* + * Yes, return this file descriptor... +@@ -433,10 +489,14 @@ + */ + + if (busy) ++ { + _cupsLangPuts(stderr, + _("INFO: Printer busy; will retry in 5 seconds...\n")); + +- sleep(5); ++ sleep(5); ++ } ++ else ++ return -1; + } + } + #elif defined(__sun) && defined(ECPPIOC_GETDEVID) +@@ -557,11 +617,11 @@ + + + /* +- * 'side_cb()' - Handle side-channel requests... ++ * 'side_cb_unix()' - Handle side-channel requests... + */ + +-static int /* O - 0 on success, -1 on error */ +-side_cb(int print_fd, /* I - Print file */ ++static int ++side_cb_unix(int print_fd, /* I - Print file */ + int device_fd, /* I - Device file */ + int snmp_fd, /* I - SNMP socket (unused) */ + http_addr_t *addr, /* I - Device address (unused) */ diff --git a/cups-1.4.4-getpass.patch b/cups-1.4.4-getpass.patch new file mode 100644 index 0000000..930afe2 --- /dev/null +++ b/cups-1.4.4-getpass.patch @@ -0,0 +1,43 @@ +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" + #include + #include ++#include ++#include + #ifdef WIN32 + # include + #else +@@ -406,7 +408,29 @@ + * Use the standard getpass function to get a password from the console. + */ + +- return (getpass(prompt)); ++ static char password[100]; ++ struct termios oldtio, newtio; ++ sigset_t oldset, newset; ++ int nread; ++ sigprocmask (SIG_BLOCK, NULL, &newset); ++ sigaddset (&newset, SIGINT); ++ sigaddset (&newset, SIGTSTP); ++ sigprocmask (SIG_BLOCK, &newset, &oldset); ++ tcgetattr (STDIN_FILENO, &oldtio); ++ newtio = oldtio; ++ newtio.c_lflag &= ~ECHO; ++ tcsetattr (STDIN_FILENO, TCSAFLUSH, &newtio); ++ fputs (prompt, stdout); ++ fflush (stdout); ++ nread = read (STDIN_FILENO, password, sizeof (password)); ++ tcsetattr (STDIN_FILENO, TCSAFLUSH, &oldtio); ++ fputc ('\n', stdout); ++ sigprocmask (SIG_SETMASK, &oldset, NULL); ++ if (nread > 0) ++ password[nread - 1] = '\0'; ++ else ++ password[0] ='\0'; ++ return password; + #endif /* WIN32 */ + } + diff --git a/cups-1.4.4-no-hostname-broadcast.patch b/cups-1.4.4-no-hostname-broadcast.patch new file mode 100644 index 0000000..b4513ba --- /dev/null +++ b/cups-1.4.4-no-hostname-broadcast.patch @@ -0,0 +1,33 @@ +diff -Naurp cups-1.4.8/scheduler/client.c cups-1.4.8.oden/scheduler/client.c +--- cups-1.4.8/scheduler/client.c 2011-01-22 01:07:22.000000000 +0100 ++++ cups-1.4.8.oden/scheduler/client.c 2011-08-23 12:32:14.592896201 +0200 +@@ -430,7 +430,7 @@ cupsdAcceptClient(cupsd_listener_t *lis) + { + if (httpAddrLocalhost(&temp)) + strlcpy(con->servername, "localhost", sizeof(con->servername)); +- else if (HostNameLookups || RemotePort) ++ else if (HostNameLookups) + httpAddrLookup(&temp, con->servername, sizeof(con->servername)); + else + httpAddrString(&temp, con->servername, sizeof(con->servername)); +@@ -443,7 +443,7 @@ cupsdAcceptClient(cupsd_listener_t *lis) + { + if (httpAddrLocalhost(&temp)) + strlcpy(con->servername, "localhost", sizeof(con->servername)); +- else if (HostNameLookups || RemotePort) ++ else if (HostNameLookups) + httpAddrLookup(&temp, con->servername, sizeof(con->servername)); + else + httpAddrString(&temp, con->servername, sizeof(con->servername)); +diff -Naurp cups-1.4.8/scheduler/conf.c cups-1.4.8.oden/scheduler/conf.c +--- cups-1.4.8/scheduler/conf.c 2011-01-11 08:05:58.000000000 +0100 ++++ cups-1.4.8.oden/scheduler/conf.c 2011-08-23 12:32:14.593896179 +0200 +@@ -750,7 +750,7 @@ cupsdReadConfiguration(void) + cupsdAddAlias(ServerAlias, temp); + cupsdLogMessage(CUPSD_LOG_DEBUG, "Added auto ServerAlias %s", temp); + +- if (HostNameLookups || RemotePort) ++ if (HostNameLookups) + { + struct hostent *host; /* Host entry to get FQDN */ + diff --git a/cups-1.4.4-page-label.patch b/cups-1.4.4-page-label.patch new file mode 100644 index 0000000..4e0792c --- /dev/null +++ b/cups-1.4.4-page-label.patch @@ -0,0 +1,91 @@ +--- filter/pstops.c 2010-11-17 20:58:22.000000000 +0100 ++++ filter/pstops.c.oden 2011-01-08 13:01:17.450527001 +0100 +@@ -108,6 +108,7 @@ typedef struct /**** Document informa + int num_options; /* Number of document-wide options */ + cups_option_t *options; /* Document-wide options */ + int normal_landscape, /* Normal rotation for landscape? */ ++ orientation, /* Original orientation of the document */ + saw_eof, /* Saw the %%EOF comment? */ + slow_collate, /* Collate copies by hand? */ + slow_duplex, /* Duplex pages slowly? */ +@@ -2083,7 +2084,7 @@ do_setup(pstops_doc_t *doc, /* I - Docu + * of the pages... + */ + +- if (Orientation & 1) ++ if (doc->orientation & 1) + write_label_prolog(doc, doc->page_label, PageBottom, + PageWidth - PageLength + PageTop, PageLength); + else +@@ -2091,7 +2092,30 @@ do_setup(pstops_doc_t *doc, /* I - Docu + PageLength); + } + else +- write_label_prolog(doc, doc->page_label, PageBottom, PageTop, PageWidth); ++ { ++ switch (doc->orientation) ++ { ++ case 0 : ++ write_label_prolog(doc, doc->page_label, PageBottom, PageTop, ++ PageWidth); ++ break; ++ ++ case 1 : ++ write_label_prolog(doc, doc->page_label, PageLeft, PageRight, ++ PageLength); ++ break; ++ ++ case 2 : ++ write_label_prolog(doc, doc->page_label, PageLength - PageTop, ++ PageLength - PageBottom, PageWidth); ++ break; ++ ++ case 3 : ++ write_label_prolog(doc, doc->page_label, PageWidth - PageRight, ++ PageWidth - PageLeft, PageLength); ++ break; ++ } ++ } + } + + +@@ -2176,7 +2200,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum + case 1 : + if (doc->use_ESPshowpage) + { +- write_labels(doc, Orientation); ++ write_labels(doc, doc->orientation); + doc_puts(doc, "ESPshowpage\n"); + } + break; +@@ -2191,7 +2215,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum + * Rotate the labels back to portrait... + */ + +- write_labels(doc, Orientation - 1); ++ write_labels(doc, doc->orientation - 1); + } + else if (Orientation == 0) + { +@@ -2217,7 +2241,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum + default : + if (is_last_page(number) && doc->use_ESPshowpage) + { +- write_labels(doc, Orientation); ++ write_labels(doc, doc->orientation); + doc_puts(doc, "ESPshowpage\n"); + } + break; +@@ -2421,6 +2445,12 @@ set_pstops_options( + doc->new_bounding_box[3] = INT_MIN; + + /* ++ * Save original orientation of the document ++ */ ++ ++ doc->orientation = Orientation; ++ ++ /* + * AP_FIRSTPAGE_* and the corresponding non-first-page options. + */ + diff --git a/cups-1.4.4-str3461-1.4.reverted.patch b/cups-1.4.4-str3461-1.4.reverted.patch new file mode 100644 index 0000000..92ddec5 --- /dev/null +++ b/cups-1.4.4-str3461-1.4.reverted.patch @@ -0,0 +1,250 @@ +diff -rup cups-1.4.4/cups/http.c cups-1.4.4-str3461-1.4.patch.reverted/cups/http.c +--- cups-1.4.4/cups/http.c 2010-06-16 07:27:41.000000000 +0200 ++++ cups-1.4.4-str3461-1.4.patch.reverted/cups/http.c 2010-06-25 11:02:31.000000000 +0200 +@@ -83,12 +83,10 @@ + * http_debug_hex() - Do a hex dump of a buffer. + * http_field() - Return the field index for a field name. + * http_read_ssl() - Read from a SSL/TLS connection. +- * http_locking_cb() - Lock/unlock a thread's mutex. + * http_send() - Send a request with all fields and the trailing + * blank line. + * http_setup_ssl() - Set up SSL/TLS support on a connection. + * http_shutdown_ssl() - Shut down SSL/TLS on a connection. +- * http_threadid_cb() - Return the current thread ID. + * http_upgrade() - Force upgrade to TLS encryption. + * http_write() - Write a buffer to a HTTP connection. + * http_write_chunk() - Write a chunked buffer. +@@ -146,19 +144,6 @@ static int http_setup_ssl(http_t *http) + static void http_shutdown_ssl(http_t *http); + static int http_upgrade(http_t *http); + static int http_write_ssl(http_t *http, const char *buf, int len); +- +-# ifdef HAVE_GNUTLS +-# ifdef HAVE_PTHREAD_H +-GCRY_THREAD_OPTION_PTHREAD_IMPL; +-# endif /* HAVE_PTHREAD_H */ +- +-# elif defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H) +-static pthread_mutex_t *http_locks; /* OpenSSL lock mutexes */ +- +-static void http_locking_cb(int mode, int type, const char *file, +- int line); +-static unsigned long http_threadid_cb(void); +-# endif /* HAVE_GNUTLS */ + #endif /* HAVE_SSL */ + + +@@ -1188,22 +1173,21 @@ httpHead(http_t *http, /* I - Conne + void + httpInitialize(void) + { +- static int initialized = 0; /* Have we been called before? */ +-#ifdef WIN32 +- WSADATA winsockdata; /* WinSock data */ +-#endif /* WIN32 */ + #ifdef HAVE_LIBSSL +- int i; /* Looping var */ +- unsigned char data[1024]; /* Seed data */ ++# ifndef WIN32 ++ struct timeval curtime; /* Current time in microseconds */ ++# endif /* !WIN32 */ ++ int i; /* Looping var */ ++ unsigned char data[1024]; /* Seed data */ + #endif /* HAVE_LIBSSL */ + +- +- if (initialized) +- return; +- + #ifdef WIN32 +- WSAStartup(MAKEWORD(2,2), &winsockdata); ++ WSADATA winsockdata; /* WinSock data */ + ++ ++ static int initialized = 0; /* Has WinSock been initialized? */ ++ if (!initialized) ++ WSAStartup(MAKEWORD(1,1), &winsockdata); + #elif !defined(SO_NOSIGPIPE) + /* + * Ignore SIGPIPE signals... +@@ -1226,56 +1210,29 @@ httpInitialize(void) + #endif /* WIN32 */ + + #ifdef HAVE_GNUTLS +- /* +- * Make sure we handle threading properly... +- */ +- +-# ifdef HAVE_PTHREAD_H +- gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); +-# endif /* HAVE_PTHREAD_H */ +- +- /* +- * Initialize GNU TLS... +- */ +- + gnutls_global_init(); ++#endif /* HAVE_GNUTLS */ + +-#elif defined(HAVE_LIBSSL) +- /* +- * Initialize OpenSSL... +- */ +- ++#ifdef HAVE_LIBSSL + SSL_load_error_strings(); + SSL_library_init(); + + /* +- * Set the threading callbacks... +- */ +- +-# ifdef HAVE_PTHREAD_H +- http_locks = calloc(CRYPTO_num_locks(), sizeof(pthread_mutex_t)); +- +- for (i = 0; i < CRYPTO_num_locks(); i ++) +- pthread_mutex_init(http_locks + i, NULL); +- +- CRYPTO_set_id_callback(http_threadid_cb); +- CRYPTO_set_locking_callback(http_locking_cb); +-# endif /* HAVE_PTHREAD_H */ +- +- /* + * Using the current time is a dubious random seed, but on some systems + * it is the best we can do (on others, this seed isn't even used...) + */ + +- CUPS_SRAND(time(NULL)); ++# ifdef WIN32 ++# else ++ gettimeofday(&curtime, NULL); ++ srand(curtime.tv_sec + curtime.tv_usec); ++# endif /* WIN32 */ + + for (i = 0; i < sizeof(data); i ++) +- data[i] = CUPS_RAND(); ++ data[i] = rand(); + + RAND_seed(data, sizeof(data)); +-#endif /* HAVE_GNUTLS */ +- +- initialized = 1; ++#endif /* HAVE_LIBSSL */ + } + + +@@ -2834,25 +2791,6 @@ http_read_ssl(http_t *http, /* I - Conn + #endif /* HAVE_SSL */ + + +-#if defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H) +-/* +- * 'http_locking_cb()' - Lock/unlock a thread's mutex. +- */ +- +-static void +-http_locking_cb(int mode, /* I - Lock mode */ +- int type, /* I - Lock type */ +- const char *file, /* I - Source file */ +- int line) /* I - Line number */ +-{ +- if (mode & CRYPTO_LOCK) +- pthread_mutex_lock(http_locks + type); +- else +- pthread_mutex_unlock(http_locks + type); +-} +-#endif /* HAVE_LIBSSL && HAVE_PTHREAD_H */ +- +- + /* + * 'http_send()' - Send a request with all fields and the trailing blank line. + */ +@@ -3224,19 +3162,6 @@ http_shutdown_ssl(http_t *http) /* I - + #endif /* HAVE_SSL */ + + +-#if defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H) +-/* +- * 'http_threadid_cb()' - Return the current thread ID. +- */ +- +-static unsigned long /* O - Thread ID */ +-http_threadid_cb(void) +-{ +- return ((unsigned long)pthread_self()); +-} +-#endif /* HAVE_LIBSSL && HAVE_PTHREAD_H */ +- +- + #ifdef HAVE_SSL + /* + * 'http_upgrade()' - Force upgrade to TLS encryption. +diff -rup cups-1.4.4/cups/http-private.h cups-1.4.4-str3461-1.4.patch.reverted/cups/http-private.h +--- cups-1.4.4/cups/http-private.h 2010-04-12 06:03:53.000000000 +0200 ++++ cups-1.4.4-str3461-1.4.patch.reverted/cups/http-private.h 2010-06-25 11:03:34.000000000 +0200 +@@ -98,7 +98,6 @@ extern BIO_METHOD *_httpBIOMethods(void) + * The GNU TLS library is more of a "bare metal" SSL/TLS library... + */ + # include +-# include + + typedef struct + { +diff -rup cups-1.4.4/scheduler/main.c cups-1.4.4-str3461-1.4.patch.reverted/scheduler/main.c +--- cups-1.4.4/scheduler/main.c 2010-04-23 20:56:34.000000000 +0200 ++++ cups-1.4.4-str3461-1.4.patch.reverted/scheduler/main.c 2010-06-25 11:14:07.000000000 +0200 +@@ -549,8 +549,6 @@ main(int argc, /* I - Number of comm + * Startup the server... + */ + +- httpInitialize(); +- + cupsdStartServer(); + + /* +diff -rup cups-1.4.4/scheduler/server.c cups-1.4.4-str3461-1.4.patch.reverted/scheduler/server.c +--- cups-1.4.4/scheduler/server.c 2010-04-12 06:03:53.000000000 +0200 ++++ cups-1.4.4-str3461-1.4.patch.reverted/scheduler/server.c 2010-06-25 11:12:52.000000000 +0200 +@@ -44,6 +44,42 @@ static int started = 0; + void + cupsdStartServer(void) + { ++#ifdef HAVE_LIBSSL ++ int i; /* Looping var */ ++ struct timeval curtime; /* Current time in microseconds */ ++ unsigned char data[1024]; /* Seed data */ ++#endif /* HAVE_LIBSSL */ ++ ++ ++#ifdef HAVE_LIBSSL ++ /* ++ * Initialize the encryption libraries... ++ */ ++ ++ SSL_library_init(); ++ SSL_load_error_strings(); ++ ++ /* ++ * Using the current time is a dubious random seed, but on some systems ++ * it is the best we can do (on others, this seed isn't even used...) ++ */ ++ ++ gettimeofday(&curtime, NULL); ++ srand(curtime.tv_sec + curtime.tv_usec); ++ ++ for (i = 0; i < sizeof(data); i ++) ++ data[i] = rand(); /* Yes, this is a poor source of random data... */ ++ ++ RAND_seed(&data, sizeof(data)); ++#elif defined(HAVE_GNUTLS) ++ /* ++ * Initialize the encryption libraries... ++ */ ++ ++ gnutls_global_init(); ++#endif /* HAVE_LIBSSL */ ++ ++ + /* + * Create the default security profile... + */ diff --git a/cups-avahi.patch b/cups-avahi.patch new file mode 100644 index 0000000..a1d3f80 --- /dev/null +++ b/cups-avahi.patch @@ -0,0 +1,1098 @@ +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 @@ + * exec_backend() - Execute the backend that corresponds to the + * resolved service name. + * get_device() - Create or update a device. ++* find_device() + * query_callback() - Process query data. + * sigterm_handler() - Handle termination signals... + * unquote() - Unquote a name string. +@@ -33,7 +34,18 @@ + + #include "backend-private.h" + #include +-#include ++#ifdef HAVE_DNSSD ++# include ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++# include ++# include ++# include ++# include ++# include ++# include ++#define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX ++#endif /* HAVE_AVAHI */ + + + /* +@@ -52,7 +64,12 @@ typedef enum + + typedef struct + { ++#ifdef HAVE_DNSSD + DNSServiceRef ref; /* Service reference for resolve */ ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ int resolved; /* Did we resolve the device? */ ++#endif /* HAVE_AVAHI */ + char *name, /* Service name */ + *domain, /* Domain name */ + *fullName, /* Full name */ +@@ -64,6 +81,20 @@ typedef struct + sent; /* Did we list the device? */ + } cups_device_t; + ++typedef struct ++{ ++ char key[256]; ++ char value[256]; ++ ++#ifdef HAVE_DNSSD ++ const uint8_t *data; ++ const uint8_t *datanext; ++ const uint8_t *dataend; ++#else /* HAVE_AVAHI */ ++ AvahiStringList *txt; ++#endif /* HAVE_DNSSD */ ++} cups_txt_records_t; ++ + + /* + * Local globals... +@@ -77,6 +108,7 @@ static int job_canceled = 0; + * Local functions... + */ + ++#ifdef HAVE_DNSSD + static void browse_callback(DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, +@@ -92,12 +124,6 @@ static void browse_local_callback(DNSSe + const char *regtype, + const char *replyDomain, + void *context); +-static int compare_devices(cups_device_t *a, cups_device_t *b); +-static void exec_backend(char **argv); +-static cups_device_t *get_device(cups_array_t *devices, +- const char *serviceName, +- const char *regtype, +- const char *replyDomain); + static void query_callback(DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, +@@ -106,9 +132,111 @@ static void query_callback(DNSServiceRe + uint16_t rrclass, uint16_t rdlen, + const void *rdata, uint32_t ttl, + void *context); ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++static void avahi_client_callback (AvahiClient *client, ++ AvahiClientState state, ++ void *context); ++static void avahi_browse_callback (AvahiServiceBrowser *browser, ++ AvahiIfIndex interface, ++ AvahiProtocol protocol, ++ AvahiBrowserEvent event, ++ const char *serviceName, ++ const char *regtype, ++ const char *replyDomain, ++ AvahiLookupResultFlags flags, ++ void *context); ++#endif /* HAVE_AVAHI */ ++ ++static cups_device_t * find_device (cups_array_t *devices, ++ cups_txt_records_t *txt, ++ cups_device_t *dkey); ++static int compare_devices(cups_device_t *a, cups_device_t *b); ++static void exec_backend(char **argv); ++static cups_device_t *get_device(cups_array_t *devices, ++ const char *serviceName, ++ const char *regtype, ++ const char *replyDomain); + static void sigterm_handler(int sig); + static void unquote(char *dst, const char *src, size_t dstsize); + ++#ifdef HAVE_AVAHI ++static AvahiSimplePoll *simple_poll = NULL; ++static int avahi_got_callback; ++#endif /* HAVE_AVAHI */ ++ ++ ++/* ++ * cups_txt_records_t access functions ++ */ ++static cups_txt_records_t * ++next_txt_record (cups_txt_records_t *txt) ++{ ++#ifdef HAVE_DNSSD ++ txt->data = txt->datanext; ++#else /* HAVE_AVAHI */ ++ txt->txt = avahi_string_list_get_next (txt->txt); ++ if (txt->txt == NULL) ++ return NULL; ++#endif /* HAVE_DNSSD */ ++ ++ return txt; ++} ++ ++static int ++parse_txt_record_pair (cups_txt_records_t *txt) ++{ ++#ifdef HAVE_DNSSD ++ uint8_t datalen; ++ uint8_t *data = txt->data; ++ char *ptr; ++ ++ /* ++ * Read a key/value pair starting with an 8-bit length. Since the ++ * length is 8 bits and the size of the key/value buffers is 256, we ++ * don't need to check for overflow... ++ */ ++ ++ datalen = *data++; ++ if (!datalen || (data + datalen) >= txt->dataend) ++ return NULL; ++ txt->datanext = data + datalen; ++ ++ for (ptr = txt->key; data < txt->datanext && *data != '='; data ++) ++ *ptr++ = *data; ++ *ptr = '\0'; ++ ++ if (data < txt->datanext && *data == '=') ++ { ++ data++; ++ ++ if (data < datanext) ++ memcpy (txt->value, data, txt->datanext - data); ++ value[txt->datanext - data] = '\0'; ++ } ++ else ++ return 1; ++#else /* HAVE_AVAHI */ ++ char *key, *value; ++ size_t len; ++ avahi_string_list_get_pair (txt->txt, &key, &value, &len); ++ if (len > sizeof (txt->value) - 1) ++ len = sizeof (txt->value) - 1; ++ ++ memcpy (txt->value, value, len); ++ txt->value[len] = '\0'; ++ len = strlen (key); ++ if (len > sizeof (txt->key) - 1) ++ len = sizeof (txt->key) - 1; ++ ++ memcpy (txt->key, key, len); ++ txt->key[len] = '\0'; ++ avahi_free (key); ++ avahi_free (value); ++#endif /* HAVE_AVAHI */ ++ ++ return 0; ++} + + /* + * 'main()' - Browse for printers. +@@ -119,6 +247,13 @@ main(int argc, /* I - Number of comm + char *argv[]) /* I - Command-line arguments */ + { + const char *name; /* Backend name */ ++ cups_array_t *devices; /* Device array */ ++ cups_device_t *device; /* Current device */ ++ char uriName[1024]; /* Unquoted fullName for URI */ ++#ifdef HAVE_DNSSD ++ int fd; /* Main file descriptor */ ++ fd_set input; /* Input set for select() */ ++ struct timeval timeout; /* Timeout for select() */ + 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 + pdl_datastream_ref, /* AppSocket service reference */ + printer_ref, /* LPD service reference */ + riousbprint_ref; /* Remote IO service reference */ +- int fd; /* Main file descriptor */ +- fd_set input; /* Input set for select() */ +- struct timeval timeout; /* Timeout for select() */ +- cups_array_t *devices; /* Device array */ +- cups_device_t *device; /* Current device */ +- char uriName[1024]; /* Unquoted fullName for URI */ ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ AvahiClient *client; ++ int error; ++#endif /* HAVE_AVAHI */ + #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 + * Browse for different kinds of printers... + */ + ++#ifdef HAVE_AVAHI ++ if ((simple_poll = avahi_simple_poll_new ()) == NULL) ++ { ++ perror ("ERROR: Unable to create avahi simple poll object"); ++ return (1); ++ } ++ ++ client = avahi_client_new (avahi_simple_poll_get (simple_poll), ++ 0, avahi_client_callback, NULL, &error); ++ if (!client) ++ { ++ perror ("DEBUG: Unable to create avahi client"); ++ return (0); ++ } ++ ++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ "_fax-ipp._tcp", NULL, 0, ++ avahi_browse_callback, devices); ++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ "_ipp._tcp", NULL, 0, ++ avahi_browse_callback, devices); ++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ "_ipp-tls._tcp", NULL, 0, ++ avahi_browse_callback, devices); ++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ "_pdl-datastream._tcp", ++ NULL, 0, ++ avahi_browse_callback, ++ devices); ++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ "_printer._tcp", NULL, 0, ++ avahi_browse_callback, devices); ++ avahi_service_browser_new (client, AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ "_riousbprint._tcp", NULL, 0, ++ avahi_browse_callback, devices); ++#endif /* HAVE_AVAHI */ ++#ifdef HAVE_DNSSD + if (DNSServiceCreateConnection(&main_ref) != kDNSServiceErr_NoError) + { + perror("ERROR: Unable to create service connection"); +@@ -245,6 +422,7 @@ main(int argc, /* I - Number of comm + riousbprint_ref = main_ref; + DNSServiceBrowse(&riousbprint_ref, kDNSServiceFlagsShareConnection, 0, + "_riousbprint._tcp", NULL, browse_callback, devices); ++#endif /* HAVE_DNSSD */ + + /* + * Loop until we are killed... +@@ -252,6 +430,9 @@ main(int argc, /* I - Number of comm + + while (!job_canceled) + { ++ int announce = 0; ++ ++#ifdef HAVE_DNSSD + FD_ZERO(&input); + FD_SET(fd, &input); + +@@ -271,11 +452,35 @@ main(int argc, /* I - Number of comm + } + else + { ++ announce = 1; ++ } ++#else /* HAVE_AVAHI */ ++ int r; ++ avahi_got_callback = 0; ++ r = avahi_simple_poll_iterate (simple_poll, 1); ++ if (r != 0 && r != EINTR) ++ { ++ /* ++ * We've been told to exit the loop. Perhaps the connection to ++ * avahi failed. ++ */ ++ ++ break; ++ } ++ ++ if (avahi_got_callback) ++ announce = 1; ++#endif /* HAVE_DNSSD */ ++ ++ if (announce) ++ { + /* + * Announce any devices we've found... + */ + ++#ifdef HAVE_DNSSD + DNSServiceErrorType status; /* DNS query status */ ++#endif /* HAVE_DNSSD */ + 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)) ++#ifdef HAVE_DNSSD + if (!device->ref && !device->sent) + { + /* +@@ -313,14 +519,23 @@ main(int argc, /* I - Number of comm + count ++; + } + } +- else if (!device->sent) ++ else ++#endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++ if (!device->resolved) ++ continue; ++ else ++#endif /* HAVE_AVAHI */ ++ if (!device->sent) + { ++#ifdef HAVE_DNSSD + /* + * Got the TXT records, now report the device... + */ + + DNSServiceRefDeallocate(device->ref); + device->ref = 0; ++#endif /* HAVE_DNSSD */ + + if (!best) + best = device; +@@ -372,6 +587,7 @@ main(int argc, /* I - Number of comm + * '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( + device->fullName); + device->sent = 1; + } ++#endif /* HAVE_DNSSD */ + + + /* +@@ -528,6 +747,32 @@ exec_backend(char **argv) /* I - Comman + exit(CUPS_BACKEND_STOP); + } + ++static int ++device_type (const char *regtype) ++{ ++#ifdef HAVE_AVAHI ++ if (!strcmp(regtype, "_ipp._tcp") || ++ !strcmp(regtype, "_ipp-tls._tcp")) ++ return (CUPS_DEVICE_IPP); ++ 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.")) ++ return (CUPS_DEVICE_IPP); ++ else if (!strcmp(regtype, "_fax-ipp._tcp.")) ++ return (CUPS_DEVICE_FAX_IPP); ++ else if (!strcmp(regtype, "_printer._tcp.")) ++ return (CUPS_DEVICE_PRINTER); ++ else if (!strcmp(regtype, "_pdl-datastream._tcp.")) ++ return (CUPS_DEVICE_PDL_DATASTREAM); ++#endif /* HAVE_AVAHI */ ++ ++ return (CUPS_DEVICE_RIOUSBPRINT); ++} ++ + + /* + * 'get_device()' - Create or update a device. +@@ -550,18 +795,7 @@ get_device(cups_array_t *devices, /* I - + */ + + key.name = (char *)serviceName; +- +- if (!strcmp(regtype, "_ipp._tcp.") || +- !strcmp(regtype, "_ipp-tls._tcp.")) +- key.type = CUPS_DEVICE_IPP; +- else if (!strcmp(regtype, "_fax-ipp._tcp.")) +- key.type = CUPS_DEVICE_FAX_IPP; +- else if (!strcmp(regtype, "_printer._tcp.")) +- key.type = CUPS_DEVICE_PRINTER; +- else if (!strcmp(regtype, "_pdl-datastream._tcp.")) +- key.type = CUPS_DEVICE_PDL_DATASTREAM; +- else +- key.type = CUPS_DEVICE_RIOUSBPRINT; ++ key.type = device_type (regtype); + + for (device = cupsArrayFind(devices, &key); + device; +@@ -581,8 +815,14 @@ get_device(cups_array_t *devices, /* I - + free(device->domain); + device->domain = strdup(replyDomain); + ++#ifdef HAVE_DNSSD + DNSServiceConstructFullName(fullName, device->name, regtype, + replyDomain); ++#else /* HAVE_AVAHI */ ++ avahi_service_name_join (fullName, kDNSServiceMaxDomainName, ++ serviceName, regtype, replyDomain); ++#endif /* HAVE_DNSSD */ ++ + free(device->fullName); + device->fullName = strdup(fullName); + } +@@ -602,6 +842,9 @@ get_device(cups_array_t *devices, /* I - + device->domain = strdup(replyDomain); + device->type = key.type; + device->priority = 50; ++#ifdef HAVE_AVAHI ++ device->resolved = 0; ++#endif /* HAVE_AVAHI */ + + cupsArrayAdd(devices, device); + +@@ -609,7 +852,13 @@ get_device(cups_array_t *devices, /* I - + * Set the "full name" of this service, which is used for queries... + */ + ++#ifdef HAVE_DNSSD + DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain); ++#else /* HAVE_AVAHI */ ++ avahi_service_name_join (fullName, kDNSServiceMaxDomainName, ++ serviceName, regtype, replyDomain); ++#endif /* HAVE_DNSSD */ ++ + 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( + *ptr; /* Pointer into string */ + cups_device_t dkey, /* Search key */ + *device; /* Device */ +- ++ cups_txt_records_t txt; + + fprintf(stderr, "DEBUG2: query_callback(sdRef=%p, flags=%x, " + "interfaceIndex=%d, errorCode=%d, fullName=\"%s\", " +@@ -673,84 +923,212 @@ query_callback( + if ((ptr = strstr(name, "._")) != NULL) + *ptr = '\0'; + +- if (strstr(fullName, "_ipp._tcp.") || +- strstr(fullName, "_ipp-tls._tcp.")) +- dkey.type = CUPS_DEVICE_IPP; +- else if (strstr(fullName, "_fax-ipp._tcp.")) +- dkey.type = CUPS_DEVICE_FAX_IPP; +- else if (strstr(fullName, "_printer._tcp.")) +- dkey.type = CUPS_DEVICE_PRINTER; +- else if (strstr(fullName, "_pdl-datastream._tcp.")) +- dkey.type = CUPS_DEVICE_PDL_DATASTREAM; ++ dkey.type = device_type (fullName); ++ ++ txt.data = rdata; ++ txt.dataend = rdata + rdlen; ++ device = find_device ((cups_array_t *) context, &txt, &dkey); ++ if (!device) ++ fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName); ++} ++#endif /* HAVE_DNSSD */ ++ ++#ifdef HAVE_AVAHI ++static void ++avahi_client_callback(AvahiClient *client, ++ AvahiClientState state, ++ void *context) ++{ ++ /* ++ * If the connection drops, quit. ++ */ ++ ++ if (state == AVAHI_CLIENT_FAILURE) ++ { ++ fprintf (stderr, "ERROR: Avahi connection failed\n"); ++ avahi_simple_poll_quit (simple_poll); ++ } ++} ++ ++static void ++avahi_query_callback(AvahiServiceResolver *resolver, ++ AvahiIfIndex interface, ++ AvahiProtocol protocol, ++ AvahiResolverEvent event, ++ const char *name, ++ const char *type, ++ const char *domain, ++ const char *host_name, ++ const AvahiAddress *address, ++ uint16_t port, ++ AvahiStringList *txt, ++ AvahiLookupResultFlags flags, ++ void *context) ++{ ++ AvahiClient *client; ++ cups_device_t key, ++ *device; ++ char uqname[1024], ++ *ptr; ++ cups_txt_records_t txtr; ++ ++ client = avahi_service_resolver_get_client (resolver); ++ if (event != AVAHI_RESOLVER_FOUND) ++ { ++ if (event == AVAHI_RESOLVER_FAILURE) ++ { ++ fprintf (stderr, "ERROR: %s\n", ++ avahi_strerror (avahi_client_errno (client))); ++ } ++ ++ avahi_service_resolver_free (resolver); ++ return; ++ } ++ ++ /* ++ * Set search key for device. ++ */ ++ ++ key.name = uqname; ++ unquote (uqname, name, sizeof (uqname)); ++ if ((ptr = strstr(name, "._")) != NULL) ++ *ptr = '\0'; ++ ++ key.domain = (char *) domain; ++ key.type = device_type (type); ++ ++ /* ++ * Find the device and the the TXT information. ++ */ ++ ++ txtr.txt = txt; ++ device = find_device ((cups_array_t *) context, &txtr, &key); ++ if (device) ++ { ++ /* ++ * Let the main loop know to announce the device. ++ */ ++ ++ device->resolved = 1; ++ avahi_got_callback = 1; ++ } + else +- dkey.type = CUPS_DEVICE_RIOUSBPRINT; ++ fprintf (stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", name); ++ ++ avahi_service_resolver_free (resolver); ++} ++ ++static void ++avahi_browse_callback(AvahiServiceBrowser *browser, ++ AvahiIfIndex interface, ++ AvahiProtocol protocol, ++ AvahiBrowserEvent event, ++ const char *name, ++ const char *type, ++ const char *domain, ++ AvahiLookupResultFlags flags, ++ void *context) ++{ ++ AvahiClient *client = avahi_service_browser_get_client (browser); ++ ++ switch (event) ++ { ++ case AVAHI_BROWSER_FAILURE: ++ fprintf (stderr, "ERROR: %s\n", ++ avahi_strerror (avahi_client_errno (client))); ++ avahi_simple_poll_quit (simple_poll); ++ return; ++ ++ case AVAHI_BROWSER_NEW: ++ /* ++ * This object is new on the network. ++ */ ++ ++ if (flags & AVAHI_LOOKUP_RESULT_LOCAL) ++ { ++ /* ++ * This comes from the local machine so ignore it. ++ */ ++ ++ fprintf (stderr, "DEBUG: ignoring local service %s\n", name); ++ } ++ else ++ { ++ /* ++ * Create a device entry for it if it doesn't yet exist. ++ */ ++ ++ get_device ((cups_array_t *)context, name, type, domain); ++ ++ /* ++ * Now look for a TXT entry. ++ */ ++ ++ if (avahi_service_resolver_new (client, interface, protocol, ++ name, type, domain, ++ AVAHI_PROTO_UNSPEC, 0, ++ avahi_query_callback, context) == NULL) ++ { ++ fprintf (stderr, "ERROR: failed to resolve service %s: %s\n", ++ name, avahi_strerror (avahi_client_errno (client))); ++ } ++ } ++ ++ 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 */ ++ ++static cups_device_t * ++find_device (cups_array_t *devices, ++ cups_txt_records_t *txt, ++ cups_device_t *dkey) ++{ ++ cups_device_t *device; ++ char *ptr; ++ ++ for (device = cupsArrayFind(devices, dkey); + 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)) + { + device = NULL; + break; + } +- else if (device->type == dkey.type) ++ else if (device->type == dkey->type) + { + /* + * Found it, pull out the priority and make and model from the TXT + * record and save it... + */ + +- const uint8_t *data, /* Pointer into data */ +- *datanext, /* Next key/value pair */ +- *dataend; /* End of entire TXT record */ +- uint8_t datalen; /* Length of current key/value pair */ +- char key[256], /* Key string */ +- value[256], /* Value string */ +- make_and_model[512], ++ char make_and_model[512], + /* Manufacturer and model */ + model[256], /* Model */ +- device_id[2048];/* 1284 device ID */ +- ++ device_id[2048]; /* 1284 device ID */ + + device_id[0] = '\0'; + make_and_model[0] = '\0'; + + strcpy(model, "Unknown"); + +- for (data = rdata, dataend = data + rdlen; +- data < dataend; +- data = datanext) ++ for (;;) + { +- /* +- * Read a key/value pair starting with an 8-bit length. Since the +- * length is 8 bits and the size of the key/value buffers is 256, we +- * don't need to check for overflow... +- */ +- +- datalen = *data++; +- +- if (!datalen || (data + datalen) >= dataend) +- break; +- +- datanext = data + datalen; ++ char *key; ++ char *value; + +- for (ptr = key; data < datanext && *data != '='; data ++) +- *ptr++ = *data; +- *ptr = '\0'; +- +- if (data < datanext && *data == '=') +- { +- data ++; +- +- if (data < datanext) +- memcpy(value, data, datanext - data); +- value[datanext - data] = '\0'; +- } +- else +- continue; ++ if (parse_txt_record_pair (txt)) ++ goto next; + ++ key = txt->key; ++ value = txt->value; + if (!strncasecmp(key, "usb_", 4)) + { + /* +@@ -805,6 +1183,10 @@ query_callback( + if (device->type == CUPS_DEVICE_PRINTER) + device->sent = 1; + } ++ ++ next: ++ if (next_txt_record (txt) == NULL) ++ break; + } + + if (device->device_id) +@@ -854,11 +1236,9 @@ query_callback( + } + } + +- if (!device) +- fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName); ++ return device; + } + +- + /* + * 'sigterm_handler()' - Handle termination signals... + */ +diff -Naurp cups-1.4.5/config.h.in cups-1.4.5.oden/config.h.in +--- cups-1.4.5/config.h.in 2010-08-13 06:11:46.000000000 +0200 ++++ cups-1.4.5.oden/config.h.in 2010-11-13 12:35:53.207594044 +0100 +@@ -344,6 +344,13 @@ + + + /* ++ * Do we have Avahi for DNS Service Discovery? ++ */ ++ ++#undef HAVE_AVAHI ++ ++ ++/* + * Do we have ? + */ + +diff -Naurp cups-1.4.5/config-scripts/cups-dnssd.m4 cups-1.4.5.oden/config-scripts/cups-dnssd.m4 +--- cups-1.4.5/config-scripts/cups-dnssd.m4 2009-08-29 00:54:34.000000000 +0200 ++++ cups-1.4.5.oden/config-scripts/cups-dnssd.m4 2010-11-13 12:35:53.208594023 +0100 +@@ -27,6 +27,21 @@ AC_ARG_WITH(dnssd-includes, [ --with-dn + DNSSDLIBS="" + DNSSD_BACKEND="" + ++AC_ARG_ENABLE(avahi, [ --enable-avahi turn on DNS Service Discovery support, default=no], ++ [if test x$enable_avahi = xyes; then ++ AC_MSG_CHECKING(for Avahi) ++ if $PKGCONFIG --exists avahi-client; then ++ AC_MSG_RESULT(yes) ++ CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`" ++ DNSSDLIBS="`$PKGCONFIG --libs avahi-client`" ++ DNSSD_BACKEND="dnssd" ++ AC_DEFINE(HAVE_AVAHI) ++ enable_dnssd=no ++ else ++ AC_MSG_RESULT(no) ++ fi ++ fi]) ++ + if test x$enable_dnssd != xno; then + AC_CHECK_HEADER(dns_sd.h, [ + case "$uname" in +diff -Naurp cups-1.4.5/cups/http-support.c cups-1.4.5.oden/cups/http-support.c +--- cups-1.4.5/cups/http-support.c 2010-10-02 00:40:38.000000000 +0200 ++++ cups-1.4.5.oden/cups/http-support.c 2010-11-13 12:40:27.275112586 +0100 +@@ -55,6 +55,11 @@ + # include + # include + #endif /* HAVE_DNSSD */ ++#ifdef HAVE_AVAHI ++# include ++# include ++# include ++#endif /* HAVE_AVAHI */ + + + /* +@@ -121,6 +126,24 @@ static void resolve_callback(DNSService + void *context); + #endif /* HAVE_DNSSD */ + ++#ifdef HAVE_AVAHI ++static void avahi_resolve_uri_client_cb(AvahiClient *client, ++ AvahiClientState state, ++ void *simple_poll); ++static void avahi_resolve_uri_resolver_cb(AvahiServiceResolver *resolver, ++ AvahiIfIndex interface, ++ AvahiProtocol protocol, ++ AvahiResolverEvent event, ++ const char *name, ++ const char *type, ++ const char *domain, ++ const char *host_name, ++ const AvahiAddress *address, ++ uint16_t port, ++ AvahiStringList *txt, ++ AvahiLookupResultFlags flags, ++ void *context); ++#endif /* HAVE_AVAHI */ + + /* + * 'httpAssembleURI()' - Assemble a uniform resource identifier from its +@@ -1351,17 +1374,27 @@ _httpResolveURI( + + if (strstr(hostname, "._tcp")) + { ++#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI) ++ 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 */ +- ++#else /* HAVE_AVAHI */ ++ AvahiSimplePoll *simple_poll; ++ AvahiClient *client; ++ int error; ++ struct ++ { ++ AvahiSimplePoll *poll; ++ _http_uribuf_t uribuf; ++ } user_data; ++#endif /* HAVE_DNSSD */ + + if (logit) + 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( + if (domain) + *domain++ = '\0'; + ++#ifdef HAVE_DNSSD + uribuf.buffer = resolved_uri; + uribuf.bufsize = resolved_size; ++#else ++ user_data.uribuf.buffer = resolved_uri; ++ user_data.uribuf.bufsize = resolved_size; ++#endif + + resolved_uri[0] = '\0'; + +@@ -1414,6 +1451,7 @@ _httpResolveURI( + + uri = NULL; + ++#ifdef HAVE_DNSSD + if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError) + { + localref = ref; +@@ -1500,6 +1538,36 @@ _httpResolveURI( + + DNSServiceRefDeallocate(ref); + } ++#else /* HAVE_AVAHI */ ++ if ((simple_poll = avahi_simple_poll_new ()) != NULL) ++ { ++ if ((client = avahi_client_new (avahi_simple_poll_get (simple_poll), ++ 0, avahi_resolve_uri_client_cb, ++ &simple_poll, &error)) != NULL) ++ { ++ user_data.poll = simple_poll; ++ if (avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, hostname, ++ regtype, domain, AVAHI_PROTO_UNSPEC, 0, ++ avahi_resolve_uri_resolver_cb, ++ &user_data) != NULL) ++ { ++ avahi_simple_poll_loop (simple_poll); ++ ++ /* ++ * Collect the result. ++ */ ++ ++ if (resolved_uri[0]) ++ uri = resolved_uri; ++ } ++ ++ avahi_client_free (client); ++ } ++ ++ avahi_simple_poll_free (simple_poll); ++ } ++#endif /* HAVE_DNSSD */ + + if (logit) + { +@@ -1511,13 +1579,13 @@ _httpResolveURI( + fputs("STATE: -connecting-to-device,offline-report\n", stderr); + } + +-#else ++#else /* HAVE_DNSSD || HAVE_AVAHI */ + /* + * No DNS-SD support... + */ + + uri = NULL; +-#endif /* HAVE_DNSSD */ ++#endif /* HAVE_DNSSD || HAVE_AVAHI */ + + if (logit && !uri) + _cupsLangPuts(stderr, _("Unable to find printer!\n")); +@@ -1722,6 +1790,105 @@ resolve_callback( + } + #endif /* HAVE_DNSSD */ + ++#ifdef HAVE_AVAHI ++static void ++avahi_resolve_uri_client_cb (AvahiClient *client, ++ AvahiClientState state, ++ void *simple_poll) ++{ ++ DEBUG_printf(("avahi_resolve_uri_client_callback(client=%p, state=%d, " ++ "simple_poll=%p)\n", client, state, simple_poll)); ++ ++ /* ++ * If the connection drops, quit. ++ */ ++ ++ if (state == AVAHI_CLIENT_FAILURE) ++ avahi_simple_poll_quit (simple_poll); ++} ++ ++static void ++avahi_resolve_uri_resolver_cb (AvahiServiceResolver *resolver, ++ AvahiIfIndex interface, ++ AvahiProtocol protocol, ++ AvahiResolverEvent event, ++ const char *name, ++ const char *type, ++ const char *domain, ++ const char *host_name, ++ const AvahiAddress *address, ++ uint16_t port, ++ AvahiStringList *txt, ++ AvahiLookupResultFlags flags, ++ void *context) ++{ ++ const char *scheme; /* URI scheme */ ++ char rp[256]; /* Remote printer */ ++ AvahiStringList *pair; ++ char *value; ++ size_t valueLen = 0; ++ char addr[AVAHI_ADDRESS_STR_MAX]; ++ struct ++ { ++ AvahiSimplePoll *poll; ++ _http_uribuf_t uribuf; ++ } *poll_uribuf = context; ++ ++ DEBUG_printf(("avahi_resolve_uri_resolver_callback(resolver=%p, " ++ "interface=%d, protocol=%d, event=%d, name=\"%s\", " ++ "type=\"%s\", domain=\"%s\", host_name=\"%s\", address=%p, " ++ "port=%d, txt=%p, flags=%d, context=%p)\n", ++ resolver, interface, protocol, event, name, type, domain, ++ host_name, address, port, txt, flags, context)); ++ ++ if (event != AVAHI_RESOLVER_FOUND) ++ { ++ avahi_service_resolver_free (resolver); ++ avahi_simple_poll_quit (poll_uribuf->poll); ++ return; ++ } ++ ++ /* ++ * Figure out the scheme from the full name... ++ */ ++ ++ if (strstr(type, "_ipp.")) ++ scheme = "ipp"; ++ else if (strstr(type, "_printer.")) ++ scheme = "lpd"; ++ else if (strstr(type, "_pdl-datastream.")) ++ scheme = "socket"; ++ else ++ scheme = "riousbprint"; ++ ++ /* ++ * Extract the "remote printer key from the TXT record... ++ */ ++ ++ if ((pair = avahi_string_list_find (txt, "rp")) != NULL) ++ { ++ avahi_string_list_get_pair (pair, NULL, &value, &valueLen); ++ rp[0] = '/'; ++ memcpy (rp + 1, value, valueLen); ++ rp[valueLen + 1] = '\0'; ++ } ++ else ++ rp[0] = '\0'; ++ ++ /* ++ * Assemble the final device URI... ++ */ ++ ++ avahi_address_snprint (addr, AVAHI_ADDRESS_STR_MAX, address); ++ httpAssembleURI(HTTP_URI_CODING_ALL, poll_uribuf->uribuf.buffer, ++ poll_uribuf->uribuf.bufsize, scheme, NULL, ++ addr, port, rp); ++ DEBUG_printf(("avahi_resolve_uri_resolver_callback: Resolved URI is \"%s\"\n", ++ poll_uribuf->uribuf.buffer)); ++ avahi_simple_poll_quit (poll_uribuf->poll); ++} ++#endif /* HAVE_AVAHI */ ++ + + /* + * End of "$Id: http-support.c 9322 2010-10-01 22:40:38Z mike $". diff --git a/cups-banners.patch b/cups-banners.patch new file mode 100644 index 0000000..6907c91 --- /dev/null +++ b/cups-banners.patch @@ -0,0 +1,11 @@ +--- 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 @@ + if ((ext = strrchr(dent->filename, '.')) != NULL) + if (!strcmp(ext, ".bck") || + !strcmp(ext, ".bak") || ++ !strcmp(ext, ".rpmnew") || ++ !strcmp(ext, ".rpmsave") || + !strcmp(ext, ".sav")) + continue; + diff --git a/cups-cups-get-classes.patch b/cups-cups-get-classes.patch new file mode 100644 index 0000000..196f5f1 --- /dev/null +++ b/cups-cups-get-classes.patch @@ -0,0 +1,90 @@ +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 + char uri[1024]; /* printer-uri value */ + int num_options; /* Number of options */ + cups_option_t *options; /* Options */ ++ int get_classes; /* Whether we need to fetch class */ + #ifdef __APPLE__ + char media_default[41]; /* Default paper size */ + #endif /* __APPLE__ */ +@@ -1791,6 +1792,8 @@ cups_get_sdests(http_t *http, /* I + * printer-uri [for IPP_GET_PRINTER_ATTRIBUTES] + */ + ++ get_classes = (op == CUPS_GET_PRINTERS); ++ + request = ippNewRequest(op); + + ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, +@@ -1848,6 +1851,23 @@ cups_get_sdests(http_t *http, /* I + attr->value_tag != IPP_TAG_URI) + continue; + ++ if (get_classes && ++ ++ /* Is this a class? */ ++ ((attr->value_tag == IPP_TAG_ENUM && ++ !strcmp(attr->name, "printer-type") && ++ (attr->values[0].integer & CUPS_PRINTER_CLASS)) || ++ ++ /* Or, is this an attribute from CUPS 1.2 or later? */ ++ !strcmp(attr->name, "auth-info-required") || ++ !strncmp(attr->name, "marker-", 7) || ++ !strcmp(attr->name, "printer-commands") || ++ !strcmp(attr->name, "printer-is-shared"))) ++ /* We are talking to a recent enough CUPS server that ++ * CUPS_GET_PRINTERS returns classes as well. ++ */ ++ get_classes = 0; ++ + 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 + continue; + } + ++ /* ++ * If we sent a CUPS_GET_CLASSES request, check whether ++ * CUPS_GET_PRINTERS already gave us this destination and exit ++ * early if so. ++ */ ++ ++ if (op == CUPS_GET_CLASSES) ++ { ++ int diff; ++ cups_find_dest (printer_name, NULL, num_dests, *dests, 0, &diff); ++ if (diff == 0) ++ { ++ /* ++ * Found it. The CUPS server already gave us the classes in ++ * its CUPS_GET_PRINTERS response. ++ */ ++ ++ cupsFreeOptions(num_options, options); ++ break; ++ } ++ } ++ + 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 + } + + /* ++ * If this is a CUPS_GET_PRINTERS request but we didn't see any ++ * classes we might be talking to an older CUPS server that requires ++ * CUPS_GET_CLASSES as well. ++ */ ++ ++ if (get_classes) ++ num_dests = cups_get_sdests (http, CUPS_GET_CLASSES, name, ++ num_dests, dests); ++ ++ /* + * Return the count... + */ + diff --git a/cups-driverd-timeout.patch b/cups-driverd-timeout.patch new file mode 100644 index 0000000..222fb09 --- /dev/null +++ b/cups-driverd-timeout.patch @@ -0,0 +1,21 @@ +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 - + close(temppipe[1]); + + /* +- * Wait up to 30 seconds for the PPD file to be copied... ++ * Wait up to 70 seconds for the PPD file to be copied... + */ + + total = 0; +@@ -4315,7 +4315,7 @@ copy_model(cupsd_client_t *con, /* I - + FD_SET(temppipe[0], &input); + FD_SET(CGIPipes[0], &input); + +- timeout.tv_sec = 30; ++ timeout.tv_sec = 70; + timeout.tv_usec = 0; + + if ((i = select(maxfd, &input, NULL, NULL, &timeout)) < 0) diff --git a/cups-eggcups.patch b/cups-eggcups.patch new file mode 100644 index 0000000..fde1e07 --- /dev/null +++ b/cups-eggcups.patch @@ -0,0 +1,130 @@ +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? */ + ++#if HAVE_DBUS ++#include ++ ++static DBusConnection *dbus_connection = NULL; ++ ++static int ++init_dbus (void) ++{ ++ DBusConnection *connection; ++ DBusError error; ++ ++ if (dbus_connection && ++ !dbus_connection_get_is_connected (dbus_connection)) { ++ dbus_connection_unref (dbus_connection); ++ dbus_connection = NULL; ++ } ++ ++ dbus_error_init (&error); ++ connection = dbus_bus_get (getuid () ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error); ++ if (connection == NULL) { ++ dbus_error_free (&error); ++ return -1; ++ } ++ ++ dbus_connection = connection; ++ return 0; ++} ++ ++int ++dbus_broadcast_queued_remote (const char *printer_uri, ++ ipp_status_t status, ++ unsigned int local_job_id, ++ unsigned int remote_job_id, ++ const char *username, ++ const char *printer_name) ++{ ++ DBusMessage *message; ++ DBusMessageIter iter; ++ const char *errstr; ++ ++ if (!dbus_connection || !dbus_connection_get_is_connected (dbus_connection)) { ++ if (init_dbus () || !dbus_connection) ++ return -1; ++ } ++ ++ errstr = ippErrorString (status); ++ message = dbus_message_new_signal ("/com/redhat/PrinterSpooler", ++ "com.redhat.PrinterSpooler", ++ "JobQueuedRemote"); ++ dbus_message_iter_init_append (message, &iter); ++ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_uri); ++ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &errstr); ++ dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &local_job_id); ++ dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &remote_job_id); ++ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &username); ++ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_name); ++ ++ dbus_connection_send (dbus_connection, message, NULL); ++ dbus_connection_flush (dbus_connection); ++ dbus_message_unref (message); ++ ++ return 0; ++} ++#endif /* HAVE_DBUS */ + + /* + * Local functions... +@@ -1058,6 +1122,15 @@ main(int argc, /* I - Number of comm + job_id); + } + ++#if HAVE_DBUS ++ dbus_broadcast_queued_remote (argv[0], ++ ipp_status, ++ atoi (argv[1]), ++ job_id, ++ argv[2], ++ getenv ("PRINTER")); ++#endif /* HAVE_DBUS */ ++ + 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 + + 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) + $(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, + what = "PrinterAdded"; + else if (event & CUPSD_EVENT_PRINTER_DELETED) + what = "PrinterRemoved"; +- else if (event & CUPSD_EVENT_PRINTER_CHANGED) +- what = "QueueChanged"; + else if (event & CUPSD_EVENT_JOB_CREATED) + what = "JobQueuedLocal"; + else if ((event & CUPSD_EVENT_JOB_STATE) && job && + job->state_value == IPP_JOB_PROCESSING) + what = "JobStartedLocal"; ++ else if (event & (CUPSD_EVENT_PRINTER_CHANGED|CUPSD_EVENT_JOB_STATE_CHANGED|CUPSD_EVENT_PRINTER_STATE_CHANGED)) ++ what = "QueueChanged"; + else + return; + +@@ -1344,7 +1344,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); +- if (job) ++ if (job && strcmp (what, "QueueChanged") != 0) + { + dbus_message_iter_append_uint32(&iter, job->id); + dbus_message_iter_append_string(&iter, job->username); diff --git a/cups-logrotate.patch b/cups-logrotate.patch new file mode 100644 index 0000000..559cbdc --- /dev/null +++ b/cups-logrotate.patch @@ -0,0 +1,63 @@ +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 @@ + #include "cupsd.h" + #include + #include ++#include ++#include ++#include + + + /* +@@ -467,12 +470,10 @@ check_log_file(cups_file_t **lf, /* IO - + return (1); + + /* +- * Format the filename as needed... ++ * Format the filename... + */ + +- if (!*lf || +- (strncmp(logname, "/dev/", 5) && cupsFileTell(*lf) > MaxLogSize && +- MaxLogSize > 0)) ++ if (strncmp(logname, "/dev/", 5)) + { + /* + * Handle format strings... +@@ -565,6 +566,34 @@ check_log_file(cups_file_t **lf, /* IO - + } + + /* ++ * Has someone else (i.e. logrotate) already rotated the log for us? ++ */ ++ else if (strncmp(filename, "/dev/", 5)) ++ { ++ struct stat st; ++ if (stat(filename, &st) || st.st_size == 0) ++ { ++ /* File is either missing or has zero size. */ ++ ++ cupsFileClose(*lf); ++ if ((*lf = cupsFileOpen(filename, "a")) == NULL) ++ { ++ syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename, ++ strerror(errno)); ++ ++ return (0); ++ } ++ ++ /* ++ * Change ownership and permissions of non-device logs... ++ */ ++ ++ fchown(cupsFileNumber(*lf), RunUser, Group); ++ fchmod(cupsFileNumber(*lf), LogFilePerm); ++ } ++ } ++ ++ /* + * Do we need to rotate the log? + */ + diff --git a/cups-lpr-help.patch b/cups-lpr-help.patch new file mode 100644 index 0000000..1a68297 --- /dev/null +++ b/cups-lpr-help.patch @@ -0,0 +1,56 @@ +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 + + ++static void ++usage (const char *name) ++{ ++ _cupsLangPrintf(stdout, ++"Usage: %s [OPTION] [ file(s) ]\n" ++"Print files.\n\n" ++" -E force encryption\n" ++" -H server[:port] specify alternate server\n" ++" -C title, -J title, -T title\n" ++" set the job name\n\n" ++" -P destination/instance print to named printer\n" ++" -U username specify alternate username\n" ++" -# num-copies set number of copies\n" ++" -h disable banner printing\n" ++" -l print without filtering\n" ++" -m send email on completion\n" ++" -o option[=value] set a job option\n" ++" -p format text file with header\n" ++" -q hold job for printing\n" ++" -r delete files after printing\n" ++"\nWith no file given, read standard input.\n" ++, name); ++} ++ ++ + /* + * '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 + break; + + default : ++ if (!strcmp (argv[i], "--help")) ++ { ++ usage (argv[0]); ++ return (0); ++ } ++ + _cupsLangPrintf(stderr, + _("%s: Error - unknown option \'%c\'!\n"), + argv[0], argv[i][1]); diff --git a/cups-multilib.patch b/cups-multilib.patch new file mode 100644 index 0000000..21db4cb --- /dev/null +++ b/cups-multilib.patch @@ -0,0 +1,15 @@ +--- 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 @@ + exec_prefix=@exec_prefix@ + bindir=@bindir@ + includedir=@includedir@ +-libdir=@libdir@ +-imagelibdir=@libdir@ ++# Fetch libdir from gnutls's pkg-config script. This is a bit ++# of a cheat, but the cups-devel package requires gnutls-devel anyway. ++libdir=`pkg-config --variable=libdir gnutls` ++imagelibdir=`pkg-config --variable=libdir gnutls` + datarootdir=@datadir@ + datadir=@datadir@ + sysconfdir=@sysconfdir@ diff --git a/cups-no-export-ssllibs.patch b/cups-no-export-ssllibs.patch new file mode 100644 index 0000000..9effc8e --- /dev/null +++ b/cups-no-export-ssllibs.patch @@ -0,0 +1,12 @@ +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 + AC_SUBST(SSLFLAGS) + AC_SUBST(SSLLIBS) + +-EXPORT_SSLLIBS="$SSLLIBS" ++EXPORT_SSLLIBS="" + AC_SUBST(EXPORT_SSLLIBS) + + diff --git a/cups-no-gzip-man.patch b/cups-no-gzip-man.patch new file mode 100644 index 0000000..4a08503 --- /dev/null +++ b/cups-no-gzip-man.patch @@ -0,0 +1,18 @@ +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 +@@ -69,10 +69,10 @@ case "$uname" in + ;; + Linux* | GNU* | Darwin*) + # Linux, GNU Hurd, and Mac OS X +- MAN1EXT=1.gz +- MAN5EXT=5.gz +- MAN7EXT=7.gz +- MAN8EXT=8.gz ++ MAN1EXT=1 ++ MAN5EXT=5 ++ MAN7EXT=7 ++ MAN8EXT=8 + MAN8DIR=8 + ;; + *) diff --git a/cups-pid.patch b/cups-pid.patch new file mode 100644 index 0000000..ab4ff84 --- /dev/null +++ b/cups-pid.patch @@ -0,0 +1,36 @@ +--- 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 @@ + * Setup signal handlers for the parent... + */ + ++ pid_t pid; ++ + #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */ + sigset(SIGUSR1, parent_handler); + sigset(SIGCHLD, parent_handler); +@@ -372,7 +374,7 @@ + signal(SIGHUP, SIG_IGN); + #endif /* HAVE_SIGSET */ + +- if (fork() > 0) ++ if ((pid = fork()) > 0) + { + /* + * OK, wait for the child to startup and send us SIGUSR1 or to crash +@@ -384,7 +386,15 @@ + sleep(1); + + if (parent_signal == SIGUSR1) ++ { ++ FILE *f = fopen ("/var/run/cupsd.pid", "w"); ++ if (f) ++ { ++ fprintf (f, "%d\n", pid); ++ fclose (f); ++ } + return (0); ++ } + + if (wait(&i) < 0) + { diff --git a/cups-res_init.patch b/cups-res_init.patch new file mode 100644 index 0000000..1660f07 --- /dev/null +++ b/cups-res_init.patch @@ -0,0 +1,12 @@ +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, /* + + freeaddrinfo(results); + } +- else if (error == EAI_FAIL) ++ else if (error == EAI_FAIL || error == EAI_AGAIN) + cg->need_res_init = 1; + + #else diff --git a/cups-serverbin-compat.patch b/cups-serverbin-compat.patch new file mode 100644 index 0000000..0d1ab10 --- /dev/null +++ b/cups-serverbin-compat.patch @@ -0,0 +1,192 @@ +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) + cupsdClearString(&ServerName); + cupsdClearString(&ServerAdmin); + cupsdSetString(&ServerBin, CUPS_SERVERBIN); ++#ifdef __x86_64__ ++ cupsdSetString(&ServerBin_compat, "/usr/lib64/cups"); ++#endif /* __x86_64__ */ + cupsdSetString(&RequestRoot, CUPS_REQUESTS); + cupsdSetString(&CacheDir, CUPS_CACHEDIR); + cupsdSetString(&DataDir, CUPS_DATADIR); +@@ -1320,7 +1323,12 @@ cupsdReadConfiguration(void) + * Read the MIME type and conversion database... + */ + ++#ifdef __x86_64__ ++ snprintf(temp, sizeof(temp), "%s/filter:%s/filter", ServerBin, ++ ServerBin_compat); ++#else + snprintf(temp, sizeof(temp), "%s/filter", ServerBin); ++#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) + /* Root directory for scheduler */ + *ServerBin VALUE(NULL), + /* Root directory for binaries */ ++#ifdef __x86_64__ ++ *ServerBin_compat VALUE(NULL), ++ /* Compat directory for binaries */ ++#endif /* __x86_64__ */ + *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); ++#ifdef __x86_64__ ++ 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); ++#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 - + * Could not find device in list! + */ + ++#ifdef __x86_64__ ++ snprintf(srcfile, sizeof(srcfile), "%s/backend/%s", ServerBin_compat, ++ scheme); ++ if (access(srcfile, X_OK)) ++ { ++#endif /* __x86_64__ */ + send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri scheme \"%s\"!"), + scheme); + return; ++#ifdef __x86_64__ ++ } ++#endif /* __x86_64__ */ + } + } + +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 + i ++, filter = (mime_filter_t *)cupsArrayNext(filters)) + { + if (filter->filter[0] != '/') +- snprintf(command, sizeof(command), "%s/filter/%s", ServerBin, +- filter->filter); ++ { ++ snprintf(command, sizeof(command), "%s/filter/%s", ServerBin, ++ filter->filter); ++#ifdef __x86_64__ ++ if (access(command, F_OK)) ++ { ++ snprintf(command, sizeof(command), "%s/filter/%s", ++ ServerBin_compat, filter->filter); ++ if (!access(command, F_OK)) ++ { ++ /* Not in the correct directory, but found it in the compat ++ * directory. Issue a warning. */ ++ cupsdLogMessage(CUPSD_LOG_INFO, ++ "Filter '%s' not in %s/filter!", ++ filter->filter, ServerBin); ++ } ++ else ++ { ++ /* Not in the compat directory either; make any error ++ * messages use the correct directory name then. */ ++ snprintf(command, sizeof(command), "%s/filter/%s", ServerBin, ++ filter->filter); ++ } ++ } ++#endif /* __x86_64__ */ ++ } + else + strlcpy(command, filter->filter, sizeof(command)); + +@@ -1119,6 +1143,28 @@ cupsdContinueJob(cupsd_job_t *job) /* I + cupsdClosePipe(job->print_pipes); + 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); ++ 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, ++ ServerBin); ++ } ++ else ++ { ++ /* 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); ++ } ++ } ++#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) + * Backend does not exist, stop printer... + */ + ++#ifdef __x86_64__ ++ snprintf(line, sizeof(line), "%s/backend/%s", ServerBin_compat, ++ p->device_uri); ++ if (access(line, 0)) ++ { ++#endif /* __x86_64__ */ ++ + p->state = IPP_PRINTER_STOPPED; + snprintf(p->state_message, sizeof(p->state_message), + "Backend %s does not exist!", line); ++#ifdef __x86_64__ ++ } ++#endif /* __x86_64__ */ + } + } + +@@ -3549,6 +3559,12 @@ add_printer_filter( + + if (stat(filename, &fileinfo)) + { ++#ifdef __x86_64__ ++ snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin_compat, ++ program); ++ if (stat(filename, &fileinfo)) ++ { ++#endif /* __x86_64__ */ + memset(&fileinfo, 0, sizeof(fileinfo)); + + snprintf(p->state_message, sizeof(p->state_message), +@@ -3557,6 +3573,9 @@ add_printer_filter( + cupsdSetPrinterReasons(p, "+cups-missing-filter-warning"); + + cupsdLogMessage(CUPSD_LOG_ERROR, "%s", p->state_message); ++#ifdef __x86_64__ ++ } ++#endif /* __x86_64__ */ + } + + /* diff --git a/cups.logrotate b/cups.logrotate new file mode 100644 index 0000000..773c70f --- /dev/null +++ b/cups.logrotate @@ -0,0 +1,5 @@ +/var/log/cups/*_log { + missingok + notifempty + sharedscripts +} diff --git a/cups.service b/cups.service new file mode 100644 index 0000000..00d40bc --- /dev/null +++ b/cups.service @@ -0,0 +1,14 @@ +[Unit] +Description=CUPS printing server daemon +After=syslog.target oki4daemon.service +Requires=network.target + +[Service] +Type=forking +EnvironmentFile=-/etc/sysconfig/cups +ExecStartPre=/sbin/portrelease cups +ExecStart=/usr/sbin/cupsd + +[Install] +WantedBy=multi-user.target + diff --git a/cups.spec b/cups.spec new file mode 100644 index 0000000..a0cf21d --- /dev/null +++ b/cups.spec @@ -0,0 +1,1849 @@ +%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} + +# 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 + +%define bootstrap 0 +%{?_without_bootstrap: %global bootstrap 0} +%{?_with_bootstrap: %global bootstrap 1} + +%define _with_systemd 1 + + +##### GENERAL STUFF ##### + +Summary: Common Unix Printing System - Server package +Name: %{cupsbasename}%{cupsnameext} +Version: %{cupsversion}%{cupsminorversion} +Release: %{release} +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 + +# 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 +Source2: lphelp.c +# Complete replacement for startup script to have it the +# Mandriva Linux way +Source5: cups.startup +# Script for cleaning up the PPD files +Source6: cleanppd.pl +# Perl script for automatic configuration of CUPS, especially access +# restrictions and broadcasting +Source7: correctcupsconfig +Source9: cups.logrotate +# Backend filter for nprint (Novell client) from Mark Horn +# (mark@hornclan.com) +Source11: http://www.hornclan.com/~mark/cups/nprint.2002011801 +# AppleTalk/netatalk backend for CUPS +Source12: http://www.oeh.uni-linz.ac.at/~rupi/pap/pap-backend.tar.bz2 +Source13: http://www.oeh.uni-linz.ac.at/~rupi/pap/pap-docu.pdf.bz2 +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 +# Ubuntu patch, Launchpad #449586: Do not use host +# names for broadcasting print queues and managing print queues broadcasted +# from other servers by default. Many networks do not have valid host names +# for all machines +Patch35: cups-1.4.4-no-hostname-broadcast.patch +# Suse patch, Novell bug #617026, Mandriva bug #61009 +# reverts changes by CUPS STR #3461 as band-aid workaround +# to avoid https://bugzilla.novell.com/show_bug.cgi?id=617026 for now +Patch36: cups-1.4.4-str3461-1.4.reverted.patch + +# Fedora patches: +# don't gzip man pages +Patch1001: cups-no-gzip-man.patch +# use correct libdir +Patch1003: cups-multilib.patch +# Ignore .rpmnew and .rpmsave banner files. +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). +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). +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 + +##### ADDITIONAL DEFINITIONS ##### + +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: acl-devel +Buildrequires: xinetd +BuildRequires: avahi-compat-libdns_sd-devel +BuildRequires: libusb-devel +BuildRequires: krb-devel +%if %{_with_systemd} +BuildRequires: systemd-units +%endif +Requires: portreserve +Provides: cupsddk-drivers +Obsoletes: cupsddk-drivers < 1.2.3-5 +Obsoletes: cupsddk < 1.4.0 + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot + + + +##### SUB-PACKAGES ##### + +%description +The Common Unix Printing System provides a portable printing layer for +UNIX(TM) operating systems. It has been developed by Easy Software Products +to promote a standard printing solution for all UNIX vendors and users. +CUPS provides the System V and Berkeley command-line interfaces. +This is the main package needed for CUPS servers (machines where a +printer is connected to or which host a queue for a network +printer). It can also be used on CUPS clients so that they simply pick +up broadcasted printer information from other CUPS servers and do not +need to be assigned to a specific CUPS server by an +%{_sysconfdir}/cups/client.conf file. + +%package common +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 +# To satisfy LSB/FHS +Provides: lpddaemon + +%description common +CUPS 1.4 is fully compatible with CUPS-1.1 machines in the network and +with software built against CUPS-1.1 libraries. + +The Common Unix Printing System provides a portable printing layer for +UNIX(TM) operating systems. It contains the command line utilities for +printing and administration (lpr, lpq, lprm, lpadmin, lpc, ...), man +pages, locales, and a sample configuration file for daemon-less CUPS +clients (%{_sysconfdir}/cups/client.conf). + +This package you need for both CUPS clients and servers. + +%package -n %{libname} +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 +with software built against CUPS-1.1 libraries. + +The Common Unix Printing System provides a portable printing layer for +UNIX(TM) operating systems. This package contains the CUPS API library +which contains common functions used by both the CUPS daemon and all +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 +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 + +%description -n %{libname}-devel +CUPS 1.4 is fully compatible with CUPS-1.1 machines in the network and +with software built against CUPS-1.1 libraries. + +The Common Unix Printing System provides a portable printing layer for +UNIX(TM) operating systems. This is the development package for +creating additional printer drivers, printing software, and other CUPS +services using the main CUPS library "libcups". + +%package serial +Summary: Common Unix Printing System - Backend for serial port printers +License: GPLv2 +Group: System/Printing +Requires: %{name} >= %{version}-%{release} + +%description serial +CUPS 1.4 is fully compatible with CUPS-1.1 machines in the network and +with software built against CUPS-1.1 libraries. + +The Common Unix Printing System provides a portable printing layer for +UNIX(TM) operating systems. This package contains the backend filter +for printers on the serial ports. The auto-detection on the serial +ports takes several seconds (and so the startup time of the CUPS +daemon with this backend present) and therefore it is not recommended +to install this package when one has no serial port printer. + +%package -n php-cups +Summary: PHP bindings for the libcups library +License: GPLv2 +Group: Development/PHP +Obsoletes: php4-cups +Provides: php4-cups + +%description -n php-cups +Provides bindings to the functions of libcups, to give direct access +to the CUPS printing environment from PHP programs. + +##### PREP ##### + +%prep + + +%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 + +# Let local printers be broadcasted in the local network(s) +perl -p -i -e 's:(Listen\s+)localhost:$1*:' conf/cupsd.conf.in +perl -p -i -e 's:(Browsing\s+On):$1\nBrowseAddress \@LOCAL:' conf/cupsd.conf.in +perl -p -i -e 's:():$1\n Allow \@LOCAL:' conf/cupsd.conf.in + +# Allow remote administration in local network (connections are encrypted, +# so no security problem) +perl -p -i -e 's:():$1\n Allow \@LOCAL:' conf/cupsd.conf.in + +%if %mdkver >= 200700 +# Replace the PAM configuration file +cat << EOF > scheduler/cups.pam +auth include system-auth +account include system-auth +EOF +cp -f scheduler/cups.pam conf/pam.std.in +%else +# Adapt PAM configuration to Mandriva Linux (former patch #6) +perl -p -i -e 's:(auth\s+required\s+?).*$:${1}pam_stack.so service=system-auth:' scheduler/cups.pam conf/pam.std.in +perl -p -i -e 's:(account\s+required\s+?).*$:${1}pam_stack.so service=system-auth:' scheduler/cups.pam conf/pam.std.in +%endif + +# Let the Makefiles not trying to set file ownerships +perl -p -i -e "s/ -o \\$.CUPS_USER.//" scheduler/Makefile +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 + +# 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} +# Load the "pap" documentation +bzcat %{SOURCE13} > pap-docu.pdf +# Load the "photo_print" utility +cp %{SOURCE14} photo_print +# Load the "pdfdistiller" utility +cp %{SOURCE15} pdf +# Load the "cjktexttops" filter +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 +aclocal +autoconf +# Debug mode +%if %debug +export DONT_STRIP=1 +export CFLAGS="-g" +export CXXFLAGS="-g" +./configure \ + --enable-avahi \ + --enable-debug=yes \ + --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 + +# Let Makefiles not execute the /usr/bin/strip command +export STRIP=":" +# 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 + +# 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 + +%check +export LC_ALL=C +export LC_MESSAGES=C +export LANG=C +export LANGUAGE=C +make test << EOF + +EOF + + +##### INSTALL ##### + +%install +rm -rf %{buildroot} +# Debug mode +%if %debug +export DONT_STRIP=1 +%endif + +make install BUILDROOT=%{buildroot} \ + DOCDIR=%{buildroot}%{_datadir}/cups/doc \ + CHOWN=":" CHGRP=":" STRIP="$STRIP" \ + LOGDIR=%{buildroot}%{_var}/log/cups \ + 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 + +# Make a directory for PPD generators +mkdir -p %{buildroot}%{_prefix}/lib/cups/driver + +# Make a directory for the SSL files +mkdir -p %{buildroot}%{_sysconfdir}/cups/ssl + +# Make a directory for authentication certificates +mkdir -p %{buildroot}%{_var}/run/cups/certs + +# Make a directory for logrotate configuration +mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d + +# Install additional tools +install -m 755 poll_ppd_base %{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 "photo_print" +install -m 755 photo_print %{buildroot}%{_bindir} + +# Install "pdfdistiller" +install -m 755 pdf %{buildroot}%{_prefix}/lib/cups/backend/ + +# Install "cjktexttops" +install -m 755 cjktexttops %{buildroot}%{_prefix}/lib/cups/filter/ + +# Install logrotate configuration +install -c -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/logrotate.d/cups + +%if %{_with_systemd} +# systemd +mkdir -p %{buildroot}/lib/systemd/system +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 +install -d %{buildroot}%{_initrddir} +install -m 755 %{SOURCE5} %{buildroot}%{_initrddir}/cups +install -d %{buildroot}%{_sysconfdir}/sysconfig +install -m 644 %{SOURCE18} %{buildroot}%{_sysconfdir}/sysconfig/cups +rm -f %{buildroot}%{_sysconfdir}/init.d/cups + +# https://qa.mandriva.com/show_bug.cgi?id=23846 +install -d %{buildroot}%{_sysconfdir}/portreserve +echo "ipp" > %{buildroot}%{_sysconfdir}/portreserve/cups + +# Install script for automatic CUPS configuration +cp %{SOURCE7} %{buildroot}%{_sbindir}/correctcupsconfig +chmod a+rx %{buildroot}%{_sbindir}/correctcupsconfig + +# Install PPDs +mkdir -p %{buildroot}%{_datadir}/cups/model +#install -m 755 ppd/*.ppd %{buildroot}%{_datadir}/cups/model + +# Uncompress Perl script for cleaning up manufacturer entries in PPD files +cp %{SOURCE6} ./cleanppd.pl +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 +# modified appropriately +ln -s %{_prefix}/lib/cups %{buildroot}%{_libdir}/cups +%endif + +# prepare the commands conflicting with LPD for the update-alternatives +# treatment +( cd %{buildroot}%{_bindir} + mv lpr lpr-cups + mv lpq lpq-cups + mv lprm lprm-cups + mv lp lp-cups + mv cancel cancel-cups + mv lpstat lpstat-cups +) +( cd %{buildroot}%{_sbindir} + mv accept accept-cups + mv disable disable-cups + mv enable enable-cups + mv lpc lpc-cups + mv lpmove lpmove-cups + mv reject reject-cups +) +( cd %{buildroot}%{_mandir}/man1 + mv lpr.1 lpr-cups.1 + mv lpq.1 lpq-cups.1 + mv lprm.1 lprm-cups.1 + mv lp.1 lp-cups.1 + mv cancel.1 cancel-cups.1 + mv lpstat.1 lpstat-cups.1 +) +( cd %{buildroot}%{_mandir}/man8 + mv accept.8 accept-cups.8 + mv disable.8 disable-cups.8 + mv enable.8 enable-cups.8 + mv lpc.8 lpc-cups.8 + mv lpmove.8 lpmove-cups.8 + mv reject.8 reject-cups.8 +) +ln -sf %{_sbindir}/accept-cups %{buildroot}%{_sbindir}/reject-cups +ln -sf %{_sbindir}/accept-cups %{buildroot}%{_sbindir}/cupsdisable +ln -sf %{_sbindir}/accept-cups %{buildroot}%{_sbindir}/cupsenable + +# Remove links to the startup script, we make our own ones with chkconfig +rm -rf %{buildroot}%{_sysconfdir}/rc?.d/[SK]* +# Remove superflouus man page stuff +rm -rf %{buildroot}%{_mandir}/cat +rm -rf %{buildroot}%{_mandir}/cat? +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 config.h %{buildroot}%{_includedir}/cups/ + +# Multiarch fixes +%multiarch_includes %{buildroot}%{_includedir}/cups/config.h + +# Create dummy config files /etc/cups/printers.conf, +# /etc/cups/classes.conf, and /etc/cups/client.conf +touch %{buildroot}%{_sysconfdir}/cups/printers.conf +touch %{buildroot}%{_sysconfdir}/cups/classes.conf +touch %{buildroot}%{_sysconfdir}/cups/client.conf + +# Create .ini file for the PHP bindings +install -d %{buildroot}%{_sysconfdir}/php.d +cat > %{buildroot}%{_sysconfdir}/php.d/A20_cups.ini << EOF +extension = phpcups.so +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 + +# Make CUPS know them +ln -s /usr/local/share/ppd %{buildroot}%{_datadir}/cups/model/1-local-admin +ln -s /opt/share/ppd %{buildroot}%{_datadir}/cups/model/2-third-party +ln -s %{_datadir}/ppd %{buildroot}%{_datadir}/cups/model/3-distribution + +# Common printer driver dirs +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 +if [ -d %{_libdir}/cups ] && ! [ -h %{_libdir}/cups ]; then + if [ -h %{_prefix}/lib/cups ]; then + rm -f %{_prefix}/lib/cups + mv %{_libdir}/cups %{_prefix}/lib/cups + else + mv %{_libdir}/cups %{_libdir}/cups.rpmsave + #echo 'Moved %{_libdir}/cups to %{_libdir}/cups.rpmsave' 1>&2 + fi +fi +%endif +%_pre_groupadd lpadmin + +%post +# Make sure group ownerships are correct +chgrp -R sys %{_sysconfdir}/cups %{_var}/*/cups + +# We can't enforce this. Bug #35993 +for d in /opt/share/ppd /opt/lib/printdriver /usr/local/share/ppd /usr/local/lib/printdriver +do + [ ! -e $d ] && mkdir -p $d || : +done +# End of 28383 + +# Let CUPS daemon be automatically started at boot time +%_post_service cups + +%post common +# The lpc updates-alternative links were not correctly set in older CUPS +# packages, therefore remove the entry before making a new one when updating +%{_sbindir}/update-alternatives --remove lpc %{_sbindir}/lpc-cups || : +# Set up update-alternatives entries +%{_sbindir}/update-alternatives --install %{_bindir}/lpr lpr %{_bindir}/lpr-cups 10 --slave %{_mandir}/man1/lpr.1%{_extension} lpr.1%{_extension} %{_mandir}/man1/lpr-cups.1%{_extension} +%{_sbindir}/update-alternatives --install %{_bindir}/lpq lpq %{_bindir}/lpq-cups 10 --slave %{_mandir}/man1/lpq.1%{_extension} lpq.1%{_extension} %{_mandir}/man1/lpq-cups.1%{_extension} +%{_sbindir}/update-alternatives --install %{_bindir}/lprm lprm %{_bindir}/lprm-cups 10 --slave %{_mandir}/man1/lprm.1%{_extension} lprm.1%{_extension} %{_mandir}/man1/lprm-cups.1%{_extension} +%{_sbindir}/update-alternatives --install %{_bindir}/lp lp %{_bindir}/lp-cups 10 --slave %{_mandir}/man1/lp.1%{_extension} lp.1%{_extension} %{_mandir}/man1/lp-cups.1%{_extension} +%{_sbindir}/update-alternatives --install %{_bindir}/cancel cancel %{_bindir}/cancel-cups 10 --slave %{_mandir}/man1/cancel.1%{_extension} cancel.1%{_extension} %{_mandir}/man1/cancel-cups.1%{_extension} +%{_sbindir}/update-alternatives --install %{_bindir}/lpstat lpstat %{_bindir}/lpstat-cups 10 --slave %{_mandir}/man1/lpstat.1%{_extension} lpstat.1%{_extension} %{_mandir}/man1/lpstat-cups.1%{_extension} +%{_sbindir}/update-alternatives --install %{_sbindir}/accept accept %{_sbindir}/accept-cups 10 --slave %{_mandir}/man8/accept.8%{_extension} accept.8%{_extension} %{_mandir}/man8/accept-cups.8%{_extension} +%{_sbindir}/update-alternatives --install %{_sbindir}/disable disable %{_sbindir}/disable-cups 10 --slave %{_mandir}/man8/disable.8%{_extension} disable.8%{_extension} %{_mandir}/man8/disable-cups.8%{_extension} +%{_sbindir}/update-alternatives --install %{_sbindir}/enable enable %{_sbindir}/enable-cups 10 --slave %{_mandir}/man8/enable.8%{_extension} enable.8%{_extension} %{_mandir}/man8/enable-cups.8%{_extension} +%{_sbindir}/update-alternatives --install %{_sbindir}/lpc lpc %{_sbindir}/lpc-cups 10 --slave %{_mandir}/man8/lpc.8%{_extension} lpc.8%{_extension} %{_mandir}/man8/lpc-cups.8%{_extension} +%{_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 + +%preun common +if [ "$1" = 0 ]; then + # Remove update-alternatives entries + %{_sbindir}/update-alternatives --remove lpr %{_bindir}/lpr-cups + %{_sbindir}/update-alternatives --remove lpq %{_bindir}/lpq-cups + %{_sbindir}/update-alternatives --remove lprm %{_bindir}/lprm-cups + %{_sbindir}/update-alternatives --remove lp %{_bindir}/lp-cups + %{_sbindir}/update-alternatives --remove cancel %{_bindir}/cancel-cups + %{_sbindir}/update-alternatives --remove lpstat %{_bindir}/lpstat-cups + %{_sbindir}/update-alternatives --remove accept %{_sbindir}/accept-cups + %{_sbindir}/update-alternatives --remove disable %{_sbindir}/disable-cups + %{_sbindir}/update-alternatives --remove enable %{_sbindir}/enable-cups + %{_sbindir}/update-alternatives --remove lpc %{_sbindir}/lpc-cups + %{_sbindir}/update-alternatives --remove lpmove %{_sbindir}/lpmove-cups + %{_sbindir}/update-alternatives --remove reject %{_sbindir}/reject-cups +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 +%config(noreplace) %attr(-,root,root) %{_sysconfdir}/sysconfig/cups +%ghost %config(noreplace) %{_sysconfdir}/cups/printers.conf +%ghost %config(noreplace) %{_sysconfdir}/cups/classes.conf +%attr(-,root,sys) %{_sysconfdir}/cups/cupsd.conf.default +%config(noreplace) %attr(-,root,sys) %{_sysconfdir}/cups/interfaces +#%config(noreplace) %attr(644,root,sys) %{_sysconfdir}/cups/mime.convs +#%config(noreplace) %attr(644,root,sys) %{_sysconfdir}/cups/mime.types +%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 +%attr(644,root,root) %config(noreplace) %{_sysconfdir}/xinetd.d/cups-lpd +%attr(644,root,root) %config(noreplace) %{_sysconfdir}/portreserve/cups +%dir %{_prefix}/lib/cups +%{_prefix}/lib/cups/cgi-bin +%{_prefix}/lib/cups/daemon +%{_prefix}/lib/cups/notifier +%{_prefix}/lib/cups/filter +%{_prefix}/lib/cups/monitor +%dir %{_prefix}/lib/cups/backend +%{_prefix}/lib/cups/backend/dnssd +%{_prefix}/lib/cups/backend/http +%{_prefix}/lib/cups/backend/ipp +%{_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/snmp +%{_prefix}/lib/cups/backend/socket +%{_prefix}/lib/cups/backend/usb +%{_prefix}/lib/cups/backend/pdf +%dir %{_prefix}/lib/cups/driver +%{_datadir}/cups +%attr(0755,root,sys) %{_var}/log/cups +# Set ownerships of spool directory which is normally done by 'make install' +# Because RPM does 'make install' as normal user, this has to be done here +%dir %attr(0710,root,sys) %{_var}/spool/cups +%dir %attr(01770,root,sys) %{_var}/spool/cups/tmp +%dir %attr(775,root,sys) %{_var}/cache/cups +# Bug #28383 dirs +%dir %{_datadir}/ppd +%dir %{_libdir}/printdriver +# Desktop icons +%{_datadir}/applications/* +%{_datadir}/icons/hicolor/*/apps/cups.png +%ifarch x86_64 +# Compatibility link, will be removed soon +%{_libdir}/cups +%endif +%if %{_with_systemd} +/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}/lpoptions +%attr(6755,root,sys) %{_bindir}/lppasswd +%{_bindir}/photo_print +%{_bindir}/poll_ppd_base +%{_bindir}/ppdc +%{_bindir}/ppdhtml +%{_bindir}/ppdi +%{_bindir}/ppdmerge +%{_bindir}/ppdpo +%{_bindir}/cupstestppd +%{_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 +%{_mandir}/man?/* + +#####%{libname} +%files -n %{libname} +%defattr(-,root,root) +%{_libdir}/libcups.so.* +%{_libdir}/libcupsimage.so.* +%{_libdir}/libcupscgi.so.1 +%{_libdir}/libcupsdriver.so.1 +%{_libdir}/libcupsmime.so.1 +%{_libdir}/libcupsppdc.so.1 + +#####%{libname}-devel +%files -n %{libname}-devel +%defattr(-,root,root) +%{_includedir}/cups/* +%{multiarch_includedir}/cups/* +%{_libdir}/*.a +%{_libdir}/*.so +%{_bindir}/cups-config + +%files serial +%defattr(-,root,root) +%{_prefix}/lib/cups/backend/serial + +%files -n php-cups +%defattr(-,root,root) +%doc scripting/php/README +%attr(0755,root,root) %{_libdir}/php/extensions/* +%config(noreplace) %{_sysconfdir}/php.d/* + + +%changelog +* Wed Aug 24 2011 Oden Eriksson 1.4.8-2mdv2011.0 ++ Revision: 696366 +- rebuilt for php-5.3.8 + +* Tue Aug 23 2011 Oden Eriksson 1.4.8-1 ++ Revision: 696273 +- 1.4.8 + +* Mon Aug 22 2011 Oden Eriksson 1.4.6-6 ++ Revision: 696094 +- rebuilt for php-5.3.7 + +* Sat May 14 2011 Eugeni Dodonov 1.4.6-5 ++ Revision: 674598 +- Fix always failing message, thanks to J.A.Magall?\195?\179n message on cooker. + +* Sat May 14 2011 Eugeni Dodonov 1.4.6-4 ++ Revision: 674386 +- Cups-devel requires gnutls-devel, otherwise cups-config fails + +* Fri May 06 2011 Eugeni Dodonov 1.4.6-3 ++ Revision: 670658 +- Properly build systemd support + +* Mon May 02 2011 Oden Eriksson 1.4.6-2 ++ Revision: 661647 +- multiarch fixes + + + Eugeni Dodonov + - Added initial draft of cups systemd unit. + - Remove dead and prehistoric code. + +* Sat Jan 08 2011 Oden Eriksson 1.4.6-1mdv2011.0 ++ Revision: 630336 +- 1.4.6 + +* Sat Nov 13 2010 Oden Eriksson 1.4.5-1mdv2011.0 ++ Revision: 597089 +- 1.4.5 +- rediffed P1012 (the avahi patch) + +* Tue Oct 26 2010 Claudio Matsuoka 1.4.4-4mdv2011.0 ++ Revision: 589545 +- Apply SUSE patch to revert CUPS STR #3461 (fixes bug #61009) + +* Thu Oct 21 2010 Guillaume Rousse 1.4.4-3mdv2011.0 ++ Revision: 587086 +- rebuild for latest openssl +- use standard macro to allow automatic update +- renumber the patches to match fedora, so as to make comparaison easier + +* Fri Sep 10 2010 Guillaume Rousse 1.4.4-2mdv2011.0 ++ Revision: 577108 +- ensure build with debug symbols by default + +* Thu Sep 09 2010 Guillaume Rousse 1.4.4-1mdv2011.0 ++ Revision: 577003 +- new version +- rediff patches 35, 1015, 1017 +- drop patches 1038, 1039, 1040, 1041 (merged upstream) + +* Fri Jun 18 2010 Oden Eriksson 1.4.3-3mdv2010.1 ++ Revision: 548314 +- added some upstream security patches + +* Thu Jun 17 2010 Guillaume Rousse 1.4.3-2mdv2010.1 ++ Revision: 548231 +- add krb5-devel build dependency + +* Thu Apr 01 2010 Tiago Salem 1.4.3-1mdv2010.1 ++ Revision: 530727 +- reenable the id po file + + + Guillaume Rousse + - new version + - rediff usb patch + - fix some tests + +* Fri Mar 26 2010 Tiago Salem 1.4.2-6mdv2010.1 ++ Revision: 527859 +- oops, forgot to remove some lines concerning the last commit +- move udev patch to system-config-printer-dev package, as we need the right permission on devices even when cups is not installed yet +- bump release + +* Fri Mar 26 2010 Tiago Salem 1.4.2-5mdv2010.1 ++ Revision: 527675 +- fix udev rule number 69 to properly match usb printers (fix #56298) +- bump release + +* Mon Jan 11 2010 Funda Wang 1.4.2-4mdv2010.1 ++ Revision: 489461 +- rebuild for new libjpegv8 + +* Wed Dec 09 2009 Tiago Salem 1.4.2-3mdv2010.1 ++ Revision: 475699 +- re-add patch to keep compatibility with previously configured printers. +- bump relase + +* Wed Dec 09 2009 Tiago Salem 1.4.2-2mdv2010.1 ++ Revision: 475605 +- disable the usblp load in the initscript, as this modules does not exist aymore +- disable usblp + libusb patch +- bump release + +* Tue Nov 10 2009 Tiago Salem 1.4.2-1mdv2010.1 ++ Revision: 464296 +- cups 1.4.2 + +* Fri Oct 30 2009 Gustavo De Nardin 1.4.1-12mdv2010.0 ++ Revision: 460224 +- fixed "lp user fix" udev rules so they do not apply to every plugged device + +* Tue Oct 27 2009 Gustavo De Nardin 1.4.1-11mdv2010.0 ++ Revision: 459603 +- only run setfacl when the device is added + +* Mon Oct 26 2009 Gustavo De Nardin 1.4.1-10mdv2010.0 ++ Revision: 459433 +- Let printers have an ACL allowing rw for user lp, as our CUPS runs + backends as lp:sys (bug 49407). + +* Mon Oct 19 2009 Gustavo De Nardin 1.4.1-9mdv2010.0 ++ Revision: 458294 +- stop using libpaper, Fedora also doesn't use it, seems unneeded anymore + +* Sat Oct 17 2009 Frederik Himpe 1.4.1-8mdv2010.0 ++ Revision: 457996 +- Add no-hostname-broadcast patch from Ubuntu, Launchpad #449586: Do not + use hostnames 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 +- Update usblp-libusp patch from Ubuntu: Fixed a bug of modifying the + URI of the current print queue when comparing it with discovered + URIs. Made the USB backend also compatible with URIS generated by old + versions of CUPS, without serial number or with "serial=?" + (Launchpad #450513) +- Enable avahi support; lower error to warning in avahi patch when avahi + is not running, in order to make the test suite succeed without + running avahi (from Debian/Ubuntu) + +* Wed Oct 14 2009 Frederik Himpe 1.4.1-7mdv2010.0 ++ Revision: 457453 +- Sync with Fedora: + * Fixed orientation of page labels when printing text in landscape + mode (RH bug #520141, STR #3334). + * Replace str3356 patch by new patch approved by upstream + +* Mon Oct 05 2009 Frederic Crozat 1.4.1-6mdv2010.0 ++ Revision: 454122 +- No longer depends on dynamic + +* Sun Oct 04 2009 Funda Wang 1.4.1-5mdv2010.0 ++ Revision: 453332 +- obsoletes cupsddk also + +* Sun Oct 04 2009 Funda Wang 1.4.1-4mdv2010.0 ++ Revision: 453318 +- rebuild + +* Sat Oct 03 2009 Frederik Himpe 1.4.1-3mdv2010.0 ++ Revision: 452766 +- Fix BuildRequires, fixing build with usblp compatibility patch +- Remove build fix patch: included in usblp compatibility patch +- Add Fedora patch: Don't use cached PPD for raw queue (RH bug #526405) +- Add Debian patch: Use both usblp and libusb, to prevent trouble if + kernel usblp module is loaded. Disabled for now because of build + problems on x86_64 + +* Thu Sep 24 2009 Olivier Blin 1.4.1-2mdv2010.0 ++ Revision: 448232 +- allow to bootstrap build by breaking build dep loop + gtk->cups->poppler->gtk (from Arnaud Patard) + +* Mon Sep 14 2009 Frederik Himpe 1.4.1-1mdv2010.0 ++ Revision: 440972 +- Add patch to fix build on x86_64 due to conflicting declarations +- Dont't run cups with nice level 14 by default: makes no sense on + servers, no proof that it helps interactivity on desktops, and should + not be needed with recent kernels anyway +- Update avahi patch from Fedora: Fixes the dnssd backend so that it + only reports devices once avahi resolution has completed. This + makes it report Device IDs +- Install logrotate configuration +- Update to new version 1.4.1 +- Remove patches for issues fixed upstream +- Test-suite is now working again + +* Wed Sep 02 2009 Frederik Himpe 1.4.0-2mdv2010.0 ++ Revision: 426016 +- Merge with cups from testing branch: + * Update to cups 1.4 + * Add patch fixing permisions of installed files + * Add Fedora patches + * Rediff recommended patch + * Remove old, unneeded patches + +* Sat Aug 15 2009 Oden Eriksson 1.3.10-4mdv2010.0 ++ Revision: 416592 +- rebuilt against libjpeg v7 + +* Sat May 30 2009 Funda Wang 1.3.10-3mdv2010.0 ++ Revision: 381443 +- build with latest gnutls 2.8 + +* Wed Apr 22 2009 Gustavo De Nardin 1.3.10-2mdv2009.1 ++ Revision: 368615 +- Make cups run usb backend as root to workaround device permissions issues (bug #49407) + +* Fri Apr 17 2009 Oden Eriksson 1.3.10-1mdv2009.1 ++ Revision: 367896 +- use poppler as the backend and fix deps +- enable acl support +- disable "make test" for now due to unknown problems in the test suite +- fix build deps (poppler + ghostscript) +- added P31 from debian in an attempt to make the tests pass +- 1.3.10 + +* Wed Jan 21 2009 Eugeni Dodonov 1.3.9-4mdv2009.1 ++ Revision: 332230 +- Patched pdfdistiller to prevent CVE-2008-5377 (arbitrary local file overwrite + via symlinks). + +* Tue Dec 23 2008 Oden Eriksson 1.3.9-3mdv2009.1 ++ Revision: 318064 +- drop the CVE-2008-1373 patch (P19), it's fixed since 1.3.7, + spotted by fhimpe + +* Tue Dec 23 2008 Oden Eriksson 1.3.9-2mdv2009.1 ++ Revision: 318055 +- rediffed one fuzzy patch + +* Fri Oct 10 2008 Frederik Himpe 1.3.9-1mdv2009.0 ++ Revision: 291529 +- Update to new version 1.3.9 (fixes 3 integer overflow security + bugs) + +* Wed Jul 30 2008 Frederik Himpe 1.3.8-1mdv2009.0 ++ Revision: 256478 +- New upstream version 1.3.8 +- Remove str2086, str2865 and CVE-2008-1722 patches: all of them + were integrated upstream +- Add new Indonesian translation to file list + + + Tiago Salem + - fix bug #41073 by using an upstream patch. + - bump release + - fix for crash when enabling printers with missing backends. (#41073) + + + Pixel + - do not call ldconfig in %%post/%%postun, it is now handled by filetriggers + - drop useless ldconfig in %%preun (it is already correctly done in %%postun) + +* Thu May 22 2008 Frederik Himpe 1.3.7-2mdv2009.0 ++ Revision: 210108 +- Add peercred.patch from Fedora to fix build with gcc 4.3 +- Do the lib64 substitution also on the configure script, because the + one done in the m4 file has no effect if configure is not regenerated + (which is currently the case) + +* Sun May 18 2008 Frederik Himpe 1.3.7-1mdv2009.0 ++ Revision: 208559 +- Add patch from Fedora to fix security problem CVE-2008-1722 +- Try to get the licenses right +- Enable test suite, add upstream patch to fix test suite failure + (http://www.cups.org/str.php?L2806) +- Remove CVE-2008-0047.patch, cups 1.3.7 already includes it +- Remove cups-1.3.6-disconnected-usb-increases-cpu-usage.patch, an + equivalent fix was integrated in Cups 1.3.7 +- Update to version 1.3.7 + +* Mon Apr 21 2008 Oden Eriksson 1.3.6-6mdv2009.0 ++ Revision: 196241 +- really attempt to fix #23846 (portmap randomly bind ports used by other application) + +* Tue Apr 01 2008 Tiago Salem 1.3.6-5mdv2008.1 ++ Revision: 191434 +- Patch for CVE-2008-1373. + +* Wed Mar 26 2008 Frederik Himpe 1.3.6-4mdv2008.1 ++ Revision: 190239 +- Patch for CVE-2008-0047 (remotely exploitable buffer overflow), + taken from Debian + +* Tue Mar 25 2008 Tiago Salem 1.3.6-3mdv2008.1 ++ Revision: 190046 +- fix for bug #38820 +- bump release + +* Sun Mar 16 2008 Funda Wang 1.3.6-2mdv2008.1 ++ Revision: 188140 +- locales should not be installed at every case + +* Mon Feb 25 2008 Marcelo Ricardo Leitner 1.3.6-1mdv2008.1 ++ Revision: 174766 +- Remove unapplied patches and make rpmlint happy. +- New upstream: 1.3.6. Closes: #38032 +- Added patch str2703. + +* Wed Jan 30 2008 Marcelo Ricardo Leitner 1.3.5-5mdv2008.1 ++ Revision: 160417 +- Really don't put /usr/local dirs under %%files section. + +* Wed Jan 23 2008 Thierry Vignaud 1.3.5-4mdv2008.1 ++ Revision: 157242 +- rebuild with fixed %%serverbuild macro + + + Marcelo Ricardo Leitner + - Bunzip text sources. + - Match owners according to cupsd. Closes: #32330 + +* Sun Jan 13 2008 Funda Wang 1.3.5-3mdv2008.1 ++ Revision: 150450 +- rebuild against latest gnutls + +* Mon Dec 24 2007 Oden Eriksson 1.3.5-2mdv2008.1 ++ Revision: 137455 +- rebuilt against openldap-2.4.7 libs + + + Olivier Blin + - restore BuildRoot + +* Wed Dec 19 2007 Marcelo Ricardo Leitner 1.3.5-1mdv2008.1 ++ Revision: 134898 +- New upstream: 1.3.5 +- Removed patch CVE-2007-4352-5392-5393: already applied. + + + Thierry Vignaud + - kill re-definition of %%buildroot on Pixel's request + +* Mon Dec 10 2007 Marcelo Ricardo Leitner 1.3.4-4mdv2008.1 ++ Revision: 116986 +- Do not check for errors while creating /usr/local/lib/printdriver + Closes: #35993 + +* Tue Nov 20 2007 Marcelo Ricardo Leitner 1.3.4-3mdv2008.1 ++ Revision: 110713 +- Added patch for cups-1.3.0-CVE-2007-{4352,5392,5393} + +* Sat Nov 17 2007 Funda Wang 1.3.4-2mdv2008.1 ++ Revision: 109291 +- rebuild for new lzma + +* Thu Nov 01 2007 Marcelo Ricardo Leitner 1.3.4-1mdv2008.1 ++ Revision: 104391 +- New upstream: 1.3.4 +- Fix the enable of raw printing by default. Closes: #34614 + +* Wed Oct 10 2007 Marcelo Ricardo Leitner 1.3.3-1mdv2008.1 ++ Revision: 96910 +- Only rebuild autotools if we are using a snapshot. +- Removed patch str2472: It's already applied on this version. +- New upstream: 1.3.3 + +* Wed Sep 26 2007 Marcelo Ricardo Leitner 1.3.0-3mdv2008.0 ++ Revision: 93180 +- Fix icondir on configure. +- Replay svn_corrupted commit 150560: + - Added support for LSB 3.2. Closes: #28383 + +* Thu Sep 13 2007 Marcelo Ricardo Leitner 1.3.0-2mdv2008.0 ++ Revision: 85025 +- Do not force requires on xinetd, as it's not used by default. + +* Thu Aug 23 2007 Thierry Vignaud 1.3.0-1mdv2008.0 ++ Revision: 69816 +- fix build +- kill file require on update-alternatives + + + Oden Eriksson + - fix RPM GROUPS + + + Marcelo Ricardo Leitner + - Added patch str2472: adds fallbacks in case browser-supplied languages are + not found. + - New upstream: 1.3.0 + - Rediffed recommended patch. + +* Fri Aug 10 2007 David Walluck 1.2.12-6mdv2008.0 ++ Revision: 61627 +- remove newline from beginning of %%description tags (shows up in, e.g., `rpm -qi') + +* Fri Aug 10 2007 Funda Wang 1.2.12-5mdv2008.0 ++ Revision: 61565 +- no hplip service any more +- use %%_extension for man pages +- man-pages are lzma-ed + +* Wed Jul 25 2007 Marcelo Ricardo Leitner 1.2.12-4mdv2008.0 ++ Revision: 55266 +- Move cups-config back to the lib-devel package. + http://bugzilla.gnome.org/show_bug.cgi?id=459732 + +* Tue Jul 24 2007 David Walluck 1.2.12-3mdv2008.0 ++ Revision: 55055 +- fix a few instances of /etc and /var that were not macros +- fix changing of perms in scriptlets which should be done in %%files (and causes rpm -V to fail) +- remove echo in %%post which should not be done + +* Fri Jul 13 2007 Funda Wang 1.2.12-2mdv2008.0 ++ Revision: 51851 +- New version + +* Wed Jun 27 2007 Andreas Hasenack 1.2.11-2mdv2008.0 ++ Revision: 45162 +- using new serverbuild macro (-fstack-protector-all) + + + Marcelo Ricardo Leitner + - Do not overwrite snmp backend anymore: the new upstream one is newer than + ours and also fixes the related bug. + +* Tue May 15 2007 Marcelo Ricardo Leitner 1.2.11-1mdv2008.0 ++ Revision: 26962 +- New upstream: 1.2.11 + + +* Tue Apr 03 2007 Marcelo Ricardo Leitner 1.2.10-2mdv2007.1 ++ Revision: 150418 +- Added patch recommended: patch away the removal of the Recommended tag. + +* Wed Mar 21 2007 Marcelo Ricardo Leitner 1.2.10-1mdv2007.1 ++ Revision: 147258 +- New bugfixes upstream: 1.2.10 + +* Sat Mar 17 2007 Marcelo Ricardo Leitner 1.2.9-1mdv2007.1 ++ Revision: 145647 +- New upstream 1.2.9 which contains security fixes. + +* Mon Mar 12 2007 Marcelo Ricardo Leitner 1.2.7-2mdv2007.1 ++ Revision: 141961 +- Release bump. +- Prefer xdg-open (xdg-utils) than html-view (kde only) for desktop menus. + Closes: #29202 +- Added /etc/sysconfig/cups to files section. +- Nice cups daemon. Closes: #16387 +- Bunzip startup script. + +* Fri Nov 24 2006 Marcelo Ricardo Leitner 1.2.7-1mdv2007.1 ++ Revision: 86921 +- New upstream: 1.2.7 +- Removed all unused and commented patches. +- Removed patch 'r5958-bugfixes': already applied. +- Import cups + +* Thu Sep 14 2006 Till Kamppeter 1.2.3-5mdv2007.0 +- Overtaken upstream bug fix patch from Debian (Patch 38: "All + Documents" link in on-line help was missing a trailing slash, job + history with Polish web interface, "Reprint job" button did not + work, daemon did not always report printer or job events properly, + daemon did not respect backend error codes, problems with UTF-8 in + job names and on the command line, custom page size problem). +- Removed patch 36 and 37 (part of patch 38 now). + +* Thu Sep 14 2006 Till Kamppeter 1.2.3-4mdv2007.0 +- Added missing BuildRequires for image and directory service support. + +* Thu Sep 14 2006 Till Kamppeter 1.2.3-3mdv2007.0 +- It sometimes happens that lpstat lets the CUPS daemon fall into an + infinite loop. Patch 36 and 37, proposed by Mike Sweet on + http://www.cups.org/str.php?L1968 should fix the problem (should fix bug + 25186). +- If there is a directory named /usr/lib64/cups, rename it to + /usr/lib/cups and let /usr/lib64/cups be a symlink (bug 25517). + +* Wed Sep 06 2006 Till Kamppeter 1.2.3-2mdv2007.0 +- Added "Requires: cups-common" to the libcups-devel subpackage to + assure that cups-config is present. + +* Thu Aug 31 2006 Till Kamppeter 1.2.3-1mdv2007.0 +- Updated to CUPS 1.2.3 (Tons of bug fixes, see + http://www.cups.org/articles.php?L407). +- Simplified conditional build for MDV 2006/Corporate 4 and MDV 2007 + (Thanks to Olivier Thauvin). + +* Wed Aug 09 2006 Till Kamppeter 1.2.2-4mdv2007.0 +- Updated PAM configuration file (bug 24199). + +* Sat Aug 05 2006 Till Kamppeter 1.2.2-3mdv2007.0 +- Several fixes on the "snmp" network printer autodiscovery backend. + +* Thu Aug 03 2006 Frederic Crozat 1.2.2-2mdv2007.0 +- Rebuild with latest dbus + +* Thu Jul 20 2006 Till Kamppeter 1.2.2-1mdv2007.0 +- Updated to CUPS 1.2.2 (Tons of bug fixes, see + http://www.cups.org/articles.php?L397). + +* Wed Jul 05 2006 Till Kamppeter 1.2.1-4mdv2007.0 +- Uncompressed patches. + +* Wed Jul 05 2006 Till Kamppeter 1.2.1-3mdv2007.0 +- Removed absolute paths from /etc/pam.d/cups (bug 22960). + +* Thu Jun 22 2006 Laurent MONTEL 1.2.1-2 +- Rebuild + +* Tue May 23 2006 Till Kamppeter 1.2.1-1mdk +- Updated to CUPS 1.2.1 (The most important "dot-zero" version + bugs are fixed now). +- Removed patch 35 (merged upstream). +- Do not build in debug mode any more, + +* Fri May 19 2006 Till Kamppeter 1.2.0-4mdk +- Delete broken update-alternatives links when updating to this + version of CUPS (containing the correct links). + +* Thu May 18 2006 Till Kamppeter 1.2.0-3mdk +- Expanded use of update-alternatives to not conflict with + papi-commands package. +- Fixed update-alternatives mechanism for the man pages. +- Set some links to find man pages more easily. + +* Wed May 17 2006 Till Kamppeter 1.2.0-2mdk +- Fixes raw data files not being accepted when + "application/octet-stream ..." rules in /etc/cups/mime.* files are active + (bug 21814, STR 1667). + +* Thu May 11 2006 Till Kamppeter 1.2.0-1mdk +- Updated to CUPS 1.2.0 official release. +- Fixed alternatives setup for the man pages. + +* Mon May 08 2006 Till Kamppeter 1.2.0-0.5497.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5497. + +* Fri Apr 28 2006 Till Kamppeter 1.2.0-0.5470.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5470 (Fix in web + interface: Once you are in SSL mode, you stay there when navigating + through the web interface). +- Allow remote administration via web interface from the local network + by default (admin connections are always SSL-encryoted, so no security + problem). + +* Thu Apr 27 2006 Till Kamppeter 1.2.0-0.5464.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5464 (Shortly after + CUPS 1.2rc3 release). + +* Tue Apr 25 2006 Till Kamppeter 1.2.0-0.5454.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5454 (Added "Encryption + Required" to "/admin" location in /etc/cups/cupsd.conf, so that all + administration transactions are done via SSL and input into the web + interface cannot get lost when the web interface switches from http + to https in the end of the add printer wizard). +- Added IEEE-1284 device ID support to "poll_ppd_base". + +* Mon Apr 24 2006 Till Kamppeter 1.2.0-0.5453.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5441 (SNMP + auto-discovery not hanging any more on IPP device which requests a + password, many other bug fixes, Polish translation). + +* Fri Apr 21 2006 Till Kamppeter 1.2.0-0.5441.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5441 (Fixes on SNMP + auto-discovery). +- Moved cups-config from the libcups2-devel to the cups-common package, + for easy checking of currently installed CUPS version. + +* Thu Apr 20 2006 Till Kamppeter 1.2.0-0.5431.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5431 (SNMP auto-discovery + for network printers, as suggested on the OSDL Printing Summit in Atlanta). + +* Thu Apr 13 2006 Till Kamppeter 1.2.0-0.5390.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5390. +- Added "BuildRequires: libgnutls-devel", GNU TLS is needed for automatic + certificate generation for SSL-encrypted access. +- Added /usr/lib/cups/driver directory for PPD file generators. + +* Tue Apr 11 2006 Till Kamppeter 1.2.0-0.5389.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5389. + +* Tue Apr 11 2006 Till Kamppeter 1.2.0-0.5388.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5388 (Somewhat after + the 1.2rc2 release). + +* Tue Apr 04 2006 Till Kamppeter 1.2.0-0.5368.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5368. +- When building for the Mandriva Linux Corporate 4 products, do not + require DBUS for building, as CUPS 1.2 uses a new DBUS generation + which is not available in the Mandriva-2006-based Corporate products. + +* Sat Apr 01 2006 Till Kamppeter 1.2.0-0.5361.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5361. + +* Fri Mar 31 2006 Till Kamppeter 1.2.0-0.5357.3mdk +- Fixed 64-bit issue with /usr/lib/cups correctly. It must stay + /usr/lib/cups to be compatible with third-party filter/backend + installations (See http://www.cups.org/str.php?L1524). +- Added compatibility link from /usr/lib/cups to /usr/lib64/cups on x86_64 + systems (will be removed when all other Mandriva packages with CUPS + backends/filters are updated). +- Worked around bug on Mandriva compilation cluster (32-bit machine has + /usr/lib64 directory). + +* Fri Mar 31 2006 Till Kamppeter 1.2.0-0.5357.2mdk +- Corrected hard-coded /usr/lib/cups. + +* Fri Mar 31 2006 Till Kamppeter 1.2.0-0.5357.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5357. +- Added "Requires: udev dynamic" to assure that device files (like + /dev/usb/lp0) are created and their ownerships/permissions are set + correctly (bug 21461). + +* Wed Mar 29 2006 Till Kamppeter 1.2.0-0.5344.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5344 (Somewhat after + the 1.2rc1 release). + +* Sun Mar 19 2006 Till Kamppeter 1.2.0-0.5312.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5312 (Somewhat after + the 1.2b2 release). + +* Thu Mar 09 2006 Till Kamppeter 1.2.0-0.5257.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5257 (SHOWSTOPPPER + FIX! The original CUPS 1.2beta1 did not print at all!). + +* Thu Mar 09 2006 Till Kamppeter 1.2.0-0.5256.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5256 (This is the + CUPS 1.2beta1 release). + +* Tue Mar 07 2006 Till Kamppeter 1.2.0-0.5239.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5239. +- Made the no non-existing /etc/cups/client.conf a %%ghost. + +* Tue Feb 28 2006 Till Kamppeter 1.2.0-0.5205.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5205 (Fixed margins + for N-up printing). + +* Tue Feb 28 2006 Till Kamppeter 1.2.0-0.5201.2mdk +- Added "BuildRequires: php-cli" so that "./configure" recognizes the + presence of PHP. + +* Tue Feb 28 2006 Till Kamppeter 1.2.0-0.5201.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5201. +- Added non-existing files /etc/cups/printers.conf and + /etc/cups/classes.conf as %%ghost and %%config(noreplace) so that the + old files of CUPS 1.1 do not get renamed when updating to CUPS 1.2. + +* Mon Feb 27 2006 Till Kamppeter 1.2.0-0.5186.2mdk +- Obsoleted out old "php4-cups" package from contrib. +- Named file in /etc/php.d/ as in the old "php4-cups" package. + +* Sun Feb 26 2006 Till Kamppeter 1.2.0-0.5186.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5186. + +* Sun Feb 26 2006 Till Kamppeter 1.2.0-0.5183.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5183. +- Added new sub package "php-cups" with PHP bindings for the CUPS library. + +* Fri Feb 24 2006 Till Kamppeter 1.2.0-0.5168.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5168 (Do not accept + invalid directories for temporary files). + +* Fri Feb 24 2006 Till Kamppeter 1.2.0-0.5165.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5165 (This is probably + really the fix for bug 21094). + +* Fri Feb 24 2006 Till Kamppeter 1.2.0-0.5162.2mdk +- Added backward compatibility links for "enable" and "disable" commands. + +* Fri Feb 24 2006 Till Kamppeter 1.2.0-0.5162.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5162. + +* Thu Feb 23 2006 Till Kamppeter 1.2.0-0.5130.2mdk +- Added "--with-system-groups=lpadmin root" to the "./configure" command + line and added/removed the "lpadmin" in the pre-install/post-uninstall + scripts. This way the group "sys" can stay the standard CUPS group. This + is the way as it is also done in Debian GNU/Linux (see CUPS STR 1434). + +* Fri Feb 17 2006 Till Kamppeter 1.2.0-0.5130.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5130. + +* Thu Feb 16 2006 Till Kamppeter 1.2.0-0.5120.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5120. +- Removed hardcoded "chgrp" from Makefiles, set group ownerships in + %%files section. +- Set permissions of /etc/cups/mime.convs and /etc/cups/mime.types to + 644 (world-readable) so that HP's hp-sendfax utility works for normal + users. +- Added "unset TMPDIR" to the start-up script of CUPS (cups.startup). + +* Mon Feb 06 2006 Till Kamppeter 1.2.0-0.5083.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5083. + +* Wed Feb 01 2006 Till Kamppeter 1.2.0-0.5046.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 5046 (Add system + management interface for power management/sleep, network changes, hostname + changes, etc. to cupsd, updated man pages, added whitespace and line + ending checks to cupstestppd, fixed many file permission issues. tons + of bug fixes and polishing). + +* Mon Jan 23 2006 Till Kamppeter 1.2.0-0.4964.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 4964 (mailto: notifier + added). +- Removed patch 34 (merged upstream). + +* Thu Jan 19 2006 Till Kamppeter 1.2.0-0.4951.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 4951 (Bug 20504: + Fixed last missing problem, bad7.pdf from Chris Evans, updated all + command-line programs to support "-h" and "-U", small fixes). + +* Wed Jan 18 2006 Till Kamppeter 1.2.0-0.4945.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 4945 (Bug 20504: + Security update for CVE-2005-3191,3192,3193, overflows in goo/gmem.c, + additional overflow issues discovered by Chris Evans, CVE-2005-3624, + 3625,3626,3627, fixed also print queue set up of auto-detected printers + with the web interface). + +* Wed Jan 18 2006 Till Kamppeter 1.2.0-0.4929.2mdk +- Added libpaper support. + +* Sat Jan 14 2006 Till Kamppeter 1.2.0-0.4929.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 4929. +- Removed correction of path for pam_appl.h (fixed upstream). +- Rediffed patch 34. +- Re-introduced %%{_datadir}/locale in %%files section. + +* Mon Jan 09 2006 Till Kamppeter 1.2.0-0.4892.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 4892. +- Added htmldoc to "BuildRequires:". +- Corrected path for pam_appl.h. +- Removed %%{_datadir}/locale from %%files section. +- Reverted the use of the %%configure2_5x macro back to the direct + ./configure call, as the use of the macro broke CUPS totally (bug 20511). +- Added STATEDIR definition to "make" and "make install" calls + (/var/run/cups/). + +* Mon Jan 09 2006 Olivier Blin 1.2.0-0.4876.5mdk +- convert parallel init to LSB + +* Wed Jan 04 2006 Thierry Vignaud 1.2.0-0.4876.3mdk +- fix build on x86_64 +- patch 34: fix build on x86_64 (-fpie overided -fPIC) + +* Sat Dec 31 2005 Couriousous 1.2.0-0.4876.2mdk +- Add parallel init stuff + +* Fri Dec 16 2005 Till Kamppeter 1.2.0-0.4876.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 4876. + +* Wed Dec 07 2005 Till Kamppeter 1.2.0-0.4865.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 4865. + +* Thu Nov 24 2005 Till Kamppeter 1.2.0-0.4843.1mdk +- Updated to CUPS 1.2 development snapshot SVN rev 4843. +- Temporarily deactivated patches 2, 3, 22, 27, 33. + +* Sun Nov 13 2005 Oden Eriksson 1.1.23-19mdk +- rebuilt against openssl-0.9.8a + +* Sat Oct 29 2005 Till Kamppeter 1.1.23-18mdk +- Introduced a timeout when waiting for CUPS daemon listening (bug + 19255). +- Replaced dbus patch by newer one from Red Hat (current one did not build + any more). + +* Fri Aug 19 2005 Till Kamppeter 1.1.23-17mdk +- Removed facility to automatically set up print queues when starting CUPS. + This can cause problems during installation. + +* Thu Aug 18 2005 Gwenole Beauchesne 1.1.23-16mdk +- 64-bit fixes + +* Thu Aug 18 2005 Till Kamppeter 1.1.23-15mdk +- Moved comment away from "%%postun". + +* Wed Aug 17 2005 Till Kamppeter 1.1.23-14mdk +- Turned off automatic re-enabling of print queues on CUPS start-up + because we have the new CUPS backend wrapper no which prevents queues + from being disabled automatically. + +* Sun Aug 14 2005 Till Kamppeter 1.1.23-13mdk +- SECURITY FIX: Fixes CAN-2005-2097: Vulnerability on PDF processing + (patch 35). +- Added "Requires: xinetd" to "cups" packages. It is needed for the + "cups-lpd" mini daemon. + +* Thu Jul 28 2005 Till Kamppeter 1.1.23-12mdk +- Added automatic re-enabling of print queues and automatic + print queue setup (both configurable) to /etc/init.d/cups. + +* Tue Apr 12 2005 Till Kamppeter 1.1.23-11mdk +- Fixed bug 15376: "!(" -> "! (" in /etc/init.d/cups. + +* Tue Mar 22 2005 Till Kamppeter 1.1.23-10mdk +- Updated Pierre Jarillon's I18n patch, especially there are "Set as + default" buttons in all languages now. + +* Fri Mar 18 2005 Till Kamppeter 1.1.23-9mdk +- Revert change of lock file name to have /var/lock/subsys/cups again. + Handling services with different service name and daemon name is a + general problem (also with Samba and MySQL) which has to be addressed + later. Renaming the service to "cupsd" would break other stuff + (printerdrake, KDE Printing Manager, ...). The bugs 11715, 14727, and + 14545 cannot be fixed all at once. + +* Wed Mar 16 2005 Till Kamppeter 1.1.23-8mdk +- Fixed I18n of the CUPS web interface and online help (bug 10598, thanks + to Pierre Jarillon, jarillon at abul dot org, for the big patch). +- Let online help go into /usr/share/cups/doc and not into /usr/share/doc, + so that it gets also installed in a minimum installation without + documentation, otherwise the web interface would be broken in this case + (Thanks to Raul Dias, raul at dias dot com dot br, for reporting this). + +* Wed Mar 02 2005 Till Kamppeter 1.1.23-7mdk +- Recode all translations to UTF-8 so that the web interface of CUPS is + shown correctly, especially with Mozilla. + +* Tue Mar 01 2005 Till Kamppeter 1.1.23-6mdk +- Removed menu entry for CUPS web interface. + +* Fri Feb 18 2005 Till Kamppeter 1.1.23-5mdk +- Use /var/lock/subsys/cupsd instead of /var/lock/subsys/cups + in startup script, to fix bug 11715. +- SECURITY FIX: Fixes CAN-2005-0064/MDKSA-2005:041/Bug 13751: See + http://www.mandrakesoft.com/security/advisories?name=MDKSA-2005:041 + +* Fri Feb 11 2005 Till Kamppeter 1.1.23-4mdk +- SECURITY FIX: Fixes CAN-2005-0064/MDKSA-2005:018/Bug 13580: See + http://www.mandrakesoft.com/security/advisories?name=MDKSA-2005:018 + +* Fri Feb 11 2005 Till Kamppeter 1.1.23-3mdk +- Updated CUPS startup script to also check HPLIP. + +* Wed Feb 09 2005 Gwenole Beauchesne 1.1.23-2mdk +- multiarch + +* Tue Jan 04 2005 Till Kamppeter 1.1.23-1mdk +- Updated to CUPS 1.1.23 final (Tons of bug fixes: "Media tray empty" on + USB backend, possible DoS in CUPS daemon, buffer overflow on "hpgltops" + filter, ...). +- Set "lppasswd" SUID root again, otherwise it does not work. +- Removed support for Mandrakelinux 7.2. +- Fixed icon stuff. + +* Tue Nov 30 2004 Till Kamppeter 1.1.22-2mdk +- Added Red Hat's DBUS support (Patch 27). + +* Tue Nov 09 2004 Till Kamppeter 1.1.22-1mdk +- Updated to CUPS 1.1.22 final. +- Removed Patch 26, it is already applied upstream. + +* Tue Oct 12 2004 Till Kamppeter 1.1.21-1mdk +- Updated to CUPS 1.1.21 final. +- Removed Patch 24 and Patch 25, they are already applied upstream. +- Improved debug mode, now the RPM built in debug mode has really + unstripped executables. +- Fix the CUPS daemon dieing on "killall -HUP cupsd" (Patch 26, Thanks to + Tim Waugh from Red Hat, CUPS STR 865 and 928). + +* Sat Oct 09 2004 Vincent Danen 1.1.21-0.rc1.7mdk +- P25: security fix for CAN-2004-0558 + +* Tue Sep 21 2004 Frederic Lepied 1.1.21-0.rc1.6mdk +- start cups at level 15 to avoid conflicts with RPC programs like + ypbind (bug #9951) + +* Tue Aug 31 2004 Till Kamppeter 1.1.21-0.rc1.5mdk +- Added switchable debug mode. +- Moved "Provides: lpddaemon" from "cups" to "cups-common" package as we + support daemon-less CUPS client mode with printerdrake now. + +* Sat Aug 21 2004 Till Kamppeter 1.1.21-0.rc1.4mdk +- If there is no USB printer connected, let the "usb" backend put out + /dev/usb/lpX as default device file names and not /dev/usblpX. + +* Tue Aug 10 2004 Till Kamppeter 1.1.21-0.rc1.3mdk +- Set temporary directory and other parameters in /etc/xinetd.d/cups-lpd, + sp that cups-lpd uses the correct temporary directory and + permissions/ownerships (Anthill bug 879). + +* Fri Aug 06 2004 Thierry Vignaud 1.1.21-0.rc1.2mdk +- use -fPIC too on ix86 + +* Thu Jun 10 2004 Till Kamppeter 1.1.21-0.rc1.1mdk +- Updated to CUPS 1.1.21rc1. +- Perlified patch 6. + +* Sat Jun 05 2004 1.1.20-6mdk +- Rebuild + diff --git a/cups.startup b/cups.startup new file mode 100644 index 0000000..eaf40ad --- /dev/null +++ b/cups.startup @@ -0,0 +1,200 @@ +#!/bin/bash + +# Init file for the CUPS server daemon +# +# chkconfig: 2345 15 60 +# description: The Common UNIX Printing System (CUPS), an \ +# advanced printer spooling system which \ +# allows setting of printer options and \ +# automatic availability of a printer \ +# configured on one server in the whole \ +# network. Default printing system of Mandriva \ +# Linux. +# +# processname: cupsd +# config: /etc/cups/cupsd.conf +# config: /etc/cups/client.conf +# config: /etc/cups/classes.conf +# config: /etc/cups/printers.conf +# config: /etc/cups/mime.types +# config: /etc/cups/mime.convs +# config: /etc/cups/ppds.dat +# +### BEGIN INIT INFO +# Provides: cups +# Should-Start: $network +# Should-Stop: $network +# Default-Start: 2 3 4 5 +# Short-Description: CUPS printing server daemon +# Description: The Common UNIX Printing System (CUPS), an +# advanced printer spooling system which +# allows setting of printer options and +# automatic availability of a printer +# configured on one server in the whole +# network. Default printing system of Mandriva +# Linux. +### END INIT INFO + +# source function library +. /etc/rc.d/init.d/functions + +# default printing auto admin settings +ENABLE_QUEUES_ON_SPOOLER_START=no + +# source printing auto admin configuration +if [ -r /etc/sysconfig/printing ]; then + . /etc/sysconfig/printing +fi + +# Source an auxiliary options file if we have one, and pick up OPTIONS +# CUPS can now play nice (use NICELEVEL= in /etc/sysconfig/cups) +if [ -r /etc/sysconfig/cups ] ; then + . /etc/sysconfig/cups +fi + +# Don't use TMPDIR environment variable from init script, as that can +# cause cupsd to set TempDir to a user's temporary directory instead +# of the default... +# + +unset TMPDIR + +RETVAL=0 + +case "$1" in + start) + # Turn off the CUPS-LPD mini-daemon when LPD is running + if [ -x /etc/rc.d/init.d/lpd ]; then + if (export LC_ALL=C; /sbin/service lpd status | /bin/egrep "running" > /dev/null 2>&1); then + if (export LC_ALL=C; /sbin/chkconfig --list cups-lpd | /bin/egrep "on$" > /dev/null 2>&1); then + echo "Turning off CUPS-LPD mini daemon ..." + /sbin/chkconfig --del cups-lpd + if [ -x /usr/sbin/xinetd ]; then + /sbin/service xinetd condrestart + fi + fi + fi + fi + # Check whether a parallel printer is configured and if + # so, but if the parallel printer kernel module not being + # loaded, load the module. + if (/bin/egrep "^[^#]*/dev/lp" /etc/cups/printers.conf > /dev/null 2>&1); then + if (! (export LC_ALL=C; /sbin/lsmod | /bin/egrep "^lp +" > /dev/null 2>&1) || \ + ! (export LC_ALL=C; /sbin/lsmod | /bin/egrep "^parport_pc +" > /dev/null 2>&1)); then + echo "Loading parallel port printer kernel modules ..." + modprobe parport_pc > /dev/null 2>&1; + RET=$? + if [ $RET -eq 0 ]; then + modprobe lp > /dev/null 2>&1; + RET=$? + fi + if [ $RET -ne 0 ]; then + echo + echo "WARNING: Parallel printer kernel modules could not be loaded, your parallel" + echo " printer may not work." + echo + fi + fi + fi + # Check whether an OKI winprinter is configured with and if so, + # but if the oki4daemon not being running, start the oki4daemon. + if (/bin/egrep "^[^#]*/dev/oki4drv" /etc/cups/printers.conf > /dev/null 2>&1); then + if ! (/bin/ps auxwww | /bin/grep -v "grep" | /bin/grep "oki4daemon" > /dev/null 2>&1); then + echo "Starting oki4daemon ..." + chkconfig --add oki4daemon + /sbin/service oki4daemon start + fi + fi + + # Do automatic correction of CUPS configuration to avoid + # /etc/printcap from LPD/LPRng being overwritten and also + # to avoid printer info with hostname "localhost" being + # broadcasted. Can be turned off in printerdrake + if [ -x /usr/sbin/correctcupsconfig ]; then + /usr/sbin/correctcupsconfig + fi + echo -n "Starting CUPS printing system: " + portrelease cups + daemon cupsd + RETVAL=$? + + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cups + + # CUPS daemon must be listening for the following steps + if (ps auxwww | grep cupsd | grep -v grep > /dev/null 2>&1); then + if ! (lpstat -r > /dev/null 2>&1); then + echo -en "Waiting for the CUPS daemon getting ready" + for ((i=0; i < 30; i ++)); do + if (lpstat -r > /dev/null 2>&1); then + break; + fi; + sleep 1; + echo -en "."; + done; + echo "" + fi + if ! (lpstat -r > /dev/null 2>&1); then + echo "WARNING: CUPS daemon still not listening after 30 sec, aborting auto-admin tasks." + exit $RETVAL + fi; + fi + + if [ "$ENABLE_QUEUES_ON_SPOOLER_START" == "yes" ]; then + # Re-enable disabled print queues + gprintf "Re-enabling disabled print queues:\n" + for printer in `lpstat -p | grep disabled | cut -d ' ' -f 2`; do + if cat /etc/cups/printers.conf | egrep -q "<(Default|)Printer $printer>"; then + #if (( ! `lpstat -p $printer | grep -c Paused` )); then + gprintf " Printer: $printer\n"; + /usr/bin/enable $printer + #fi + fi + done + fi + + if [ $RETVAL = 0 ]; then + echo_success + echo + else + echo_failure + echo + fi + ;; + stop) + echo -n "Stopping CUPS printing system: " + killproc cupsd + RETVAL=$? + + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cups + ;; + restart) + $0 stop + $0 start + RETVAL=$? + ;; + status) + status cupsd + RETVAL=$? + ;; + condrestart) + if [ -f /var/lock/subsys/cups ]; then + $0 stop + $0 start + RETVAL=$? + fi + ;; + reload) + echo -n "Reinitializing CUPS printing system: " + killproc cupsd -HUP + RETVAL=$? + + echo + ;; + *) + echo "Usage: cups {start|stop|restart|reload|status|condrestart}" + exit 1 +esac + +exit $RETVAL diff --git a/cups.sysconfig b/cups.sysconfig new file mode 100644 index 0000000..8ac839d --- /dev/null +++ b/cups.sysconfig @@ -0,0 +1,2 @@ +# nice level for cupsd +NICELEVEL=0 diff --git a/lphelp.c b/lphelp.c new file mode 100644 index 0000000..99385ba --- /dev/null +++ b/lphelp.c @@ -0,0 +1,362 @@ +/* + * + * lphelp + * ------ + # + # A simple tool for getting information about an installed printer or a + # PPD file. Especially the printer-specific options defined in the PPD + # file are listed, so that one can make use of them with the "lp", "lpr", + # and "lpoptions" commands. The programm can also be used by installation/ + # configuration scripts to give a "preview" to a PPD file. + # + # ONLY WORKS WITH CUPS DAEMON RUNNING! + # The CUPS library (libcups.so.*) must be installed! + # + # Compile with: gcc -olphelp -lcups lphelp.c + # + * Copyright 2000 by Till Kamppeter + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA + * + */ + +/* + * Include necessary headers... + */ + +#include +#include +#include +#include + +/* + * 'main()' - Main entry for test program. + */ + +int /* O - Exit status */ +main(int argc, /* I - Number of command-line arguments */ + char *argv[]) /* I - Command-line arguments */ +{ + int i, j, k, m; /* Looping vars */ + const char *filename; /* File to load */ + FILE *ppdfile; + + // Temporary file name (for reading from stdin) + char tmpfile[19] = "/tmp/lphelp.XXXXXX"; + const int blocksize = 1024; + char buffer[blocksize]; + int bytesread; + + // variables for parsing PPD file for usual options (boolean, enumerated) + ppd_file_t *ppd; /* PPD file record */ + ppd_size_t *size; /* Size record */ + ppd_group_t *group; /* UI group */ + ppd_option_t *option; /* Standard UI option */ + ppd_choice_t *choice; /* Standard UI option choice */ + static char *uis[] = { "BOOLEAN", "PICKONE", "PICKMANY" }; + static char *sections[] = { "ANY", "DOCUMENT", "EXIT", + "JCL", "PAGE", "PROLOG" }; + + // variables for parsing CUPS-O-MATIC info for numerical options (float, int) + char line[1024], /* buffer for reading PPD file line by + line to search numerical options */ + item[1024], /* item to be defined (left of "=>") */ + value[1024], /* value for item (right of "=>") */ + argname[1024], /* name of the current argument */ + comment[1024]; /* human-readable argument name */ + const char *line_contents; /* contents of line */ + const char *scan; /* pointer scanning the line */ + char *writepointer; + double min, max, defvalue; /* Range of numerical + CUPS-O-MATIC option */ + int opttype; /* 0 = other, 1 = int, 2 = float */ + int openbrackets; /* How many curled brackets are open? */ + int inquotes; /* are we in quotes now? */ + int inargspart; /* are we in the arguments part now? */ + + /* + * Display PPD files for each file listed on the command-line... + */ + + if (argc == 1) { + fputs("Usage: lphelp .ppd [.ppd ...]\n lphelp [ ...]\n lphelp -\n", stderr); + return (1); + } + + for (i = 1; i < argc; i ++) { + if ((strstr(argv[i], ".ppd")) || (strstr(argv[i], "-"))) + filename = argv[i]; + else + filename = cupsGetPPD(argv[i]); + if (strcmp(filename,"-") == 0) { + if ((ppdfile = fdopen(mkstemp(tmpfile), "w")) == NULL) { + fprintf(stderr, "Unable to generate temporary file!\n"); + } + while ((bytesread = fread(buffer, 1, blocksize, stdin)) > 0) { + fwrite(buffer, 1, bytesread, ppdfile); + } + fclose(ppdfile); + filename = tmpfile; + } + if ((ppd = ppdOpenFile(filename)) == NULL) { + fprintf(stderr, "Unable to open \'%s\' as a PPD file!\n", filename); + continue; + } + + printf("==============================================================================\n\n"); + printf("%s\n\n", ppd->modelname); + printf("==============================================================================\n\n"); + printf(" %s printer\n\n", ppd->color_device ? "Colour" : "Black & white"); + printf(" Printer-specific options\n"); + printf(" ------------------------\n\n"); + printf(" Besides the options described in the CUPS software users manual\n"); + printf(" (http://localhost:631/sum.html) you can use also the following options\n"); + printf(" when you print on this printer with the \"lp\" or \"lpr\" command (a choice\n"); + printf(" with the \"default\" mark represents the behaviour of the printer when the\n"); + printf(" appropriate option is not given on the command line):\n\n"); + + for (j = 0, group = ppd->groups; j < ppd->num_groups; j ++, group ++) { + for (k = 0, option = group->options; k < group->num_options; + k ++, option ++) { + if (strcmp(option->keyword, "PageRegion") != 0) { + if ((strcmp(uis[option->ui],"BOOLEAN") == 0) || + (strcmp(uis[option->ui],"PICKONE") == 0)) { + printf(" %s: -o %s=\n\n", + option->text, option->keyword); + printf(" can be one of the following:\n\n"); + } else { + printf(" %s: -o %s=,,...\n\n", + option->text, option->keyword); + printf(" , , and so on can be out of the following:\n\n"); + } + if (strcmp(option->keyword, "PageSize") == 0) { + for (m = option->num_choices, choice = option->choices; + m > 0; + m --, choice ++) { + size = ppdPageSize(ppd, choice->choice); + + if (size == NULL) + printf(" %s (%s, size unknown", choice->choice, choice->text); + else + printf(" %s (%s, size: %.2fx%.2fin", choice->choice, + choice->text, size->width / 72.0, size->length / 72.0); + if (strcmp(option->defchoice, choice->choice) == 0) + puts(", default)"); + else + puts(")"); + } + } else { + for (m = option->num_choices, choice = option->choices; + m > 0; + m --, choice ++) { + printf(" %s (%s", choice->choice, choice->text); + if (strcmp(option->defchoice, choice->choice) == 0) + puts(", default)"); + else + puts(")"); + } + } + printf("\n"); + } + } + } + ppdClose(ppd); + + // Search for numerical options of CUPS-O-MATIC + if ((ppdfile = fopen(filename,"r")) == NULL) { + fprintf(stderr, "Unable to open \'%s\' as a PPD file!\n", filename); + continue; + } + // Reset all variables + opttype = 0; + min = 0.0; max = 0.0; defvalue = 0.0; + openbrackets = 0; + inquotes = 0; + writepointer = item; + inargspart = 0; + // Read the PPD file again, line by line. + while (fgets(line,sizeof(line),ppdfile)) { + // evaluate only lines with CUPS-O-MATIC info + if (line_contents = strstr(line,"*% COMDATA #")) { + line_contents += 12; // Go to the text after + // "*% COMDATA #" + for (scan = line_contents; + (*scan != '\n') && (*scan != '\0'); + scan ++) { + switch(*scan) { + case '[': // open square bracket + case '{': // open curled bracket + if (!inquotes) { + openbrackets ++; + // we are on the left hand side now + *writepointer = '\0'; + writepointer = item; + // in which type of block are we now? + if ((openbrackets == 2) && + (strncasecmp(item,"args",4) == 0)) { + // we are entering the arguments section now + inargspart = 1; + } + if ((openbrackets == 3) && + (inargspart == 1)) { + // new argument, get its name + strcpy(argname,item); + } + // item already evaluated now + item[0] = '\0'; + } else {*writepointer = *scan; writepointer ++;} + break; + case ',': // end of logical line + case ']': // close square bracket + case '}': // close curled bracket + if (!inquotes) { + // right hand side completed, go to left hand side + *writepointer = '\0'; + writepointer = item; + // evaluate logical line + if (item[0]) { + // Machine-readable argument name + if ((openbrackets == 3) && + (inargspart == 1) && + (strcasecmp(item,"name") == 0)) { + strcpy(argname,value); + } + // Human-readable argument name + if ((openbrackets == 3) && + (inargspart == 1) && + (strcasecmp(item,"comment") == 0)) { + strcpy(comment,value); + } + // argument type + if ((openbrackets == 3) && + (inargspart == 1) && + (strcasecmp(item,"type") == 0)) { + if (strcasecmp(value,"int") == 0) opttype = 1; + if (strcasecmp(value,"float") == 0) opttype = 2; + } + // minimum value + if ((openbrackets == 3) && + (inargspart == 1) && + (strcasecmp(item,"min") == 0)) { + min = atof(value); + } + // maximum value + if ((openbrackets == 3) && + (inargspart == 1) && + (strcasecmp(item,"max") == 0)) { + max = atof(value); + } + // default value + if ((openbrackets == 3) && + (inargspart == 1) && + (strcasecmp(item,"default") == 0)) { + defvalue = atof(value); + } + // item already evaluated now + item[0] = '\0'; + } + // close bracket + if ((*scan == '}') || (*scan == ']')) { + // which block did we complete now? + if ((openbrackets == 2) && + (inargspart == 1)) { + // We are leaving the arguments part now + inargspart = 0; + } + if ((openbrackets == 3) && + (inargspart == 1)) { + // The current option is completely parsed + // Is the option a valid numerical option? + if ((opttype > 0) && + (min != max) && + (argname[0])) { + // Correct the default value, if necessary + if (min < max) { + if (defvalue < min) defvalue = min; + if (defvalue > max) defvalue = max; + } else { + if (defvalue < max) defvalue = max; + if (defvalue > min) defvalue = min; + } + // Show the found argument + printf(" %s: -o %s=\n\n", + comment, argname); + if (opttype == 1) { + printf( + " must be an integer number in the range %d..%d\n", + (int)(min),(int)(max)); + printf( + " The default value is %d\n\n", + (int)(defvalue)); + } else { + printf( + " must be a decimal number in the range %.2f..%.2f\n", + min,max); + printf( + " The default value is %.2f\n\n", + defvalue); + } + } + // reset the values + argname[0] = '\0'; + opttype = 0; + min = 0.0; max = 0.0; defvalue = 0.0; + } + openbrackets --; + } + } else {*writepointer = *scan; writepointer ++;} + break; + case '\'': // quote + if (!inquotes) { // open quote pair + inquotes = 1; + } else { // close quote pair + inquotes = 0; + } + break; + case '=': // "=>" + if ((!inquotes) && (*(scan + 1) == '>')) { + scan ++; + // left hand side completed, go to right hand side + *writepointer = '\0'; + writepointer = value; + } else {*writepointer = *scan; writepointer ++;} + break; + case ' ': // white space + case '\t': + if (!inquotes) { + // ignore white space outside quotes + } else {*writepointer = *scan; writepointer ++;} + break; + default: + // write all other characters + *writepointer = *scan; writepointer ++; + break; + } + } + inquotes = 0; // quote pairs cannot enclose more + // than one line + } + } + fclose(ppdfile); + printf("\n\n\n"); + } + + if (!(strstr(tmpfile, "XXXXXX"))) { + unlink(tmpfile); + } + + return (0); +} diff --git a/nprint.2002011801 b/nprint.2002011801 new file mode 100644 index 0000000..ca5b31d --- /dev/null +++ b/nprint.2002011801 @@ -0,0 +1,125 @@ +#!/bin/bash + +VERSION=2002011801 + +### NPRINT CUPS backend +### Copyright (C) 2001 Mark J. Horn +### +### This program is free software; you can redistribute it and/or +### modify it under the terms of the GNU General Public License +### as published by the Free Software Foundation; either version 2 +### of the License, or (at your option) any later version. +### +### This program is distributed in the hope that it will be useful, +### but WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with this program; if not, write to the Free Software +### Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +### +### A copy of the GNU General Public License is available at: +### http://www.gnu.org/licenses/gpl.txt + +### INSTALLATION +### ------------ +### To use this script, copy it into your CUPS backends directory, which +### might be in /usr/lib/cups/backends or /usr/local/lib/cups/backends. +### Make sure that the script is executable by whatever id cupsd runs +### with, and then restart CUPS. +### +### In order for CUPS to detect your novell printers at boot time you +### will have to have correctly configured ipx in your kernel, and CUPS +### must start *after* your network interface card is up. +### +### As root, you must be able run "pqlist" and get a list of the +### printers on your server. The "pqlist" program uses ~root/.nwclient +### as a mechinism for determining the default novell server to use. +### This file must be properly configured in order for this backend to +### detect and use novell printers. Currently this script will only +### enable printing to print queue's on a single server. If anyone +### has any ideas on how to support more than one server, please let +### me know. +### +### You should then be able to configure printers in CUPS with the +### devices you've configured. I have only been able to configure +### devices with the CUPS web interface. +### +### This single script can be used to support multiple devices. However, +### at this point it can only support access to one print server. +### This is due to the inability of pqlist to enumerate more than a +### single server's printers at a time. If anyone has any ideas on how +### I might make printing to multiple servers function, I'd be glad to +### hear them. +### +### DEPENDANCIES +### ------------ +### This script is dependant upon builtin commands in bash. It has not +### been tested against other non-bash shells. I don't expect that +### it will work with them. You are invited to test other shells. +### Please let me know if you have any success. +### +### This script depends on correctly installed ncpfs software +### available at: ftp://platan.vc.cvut.cz/pub/linux/ncpfs/ +### +### This script depends on the following programs being in the PATH +### pqlist, nprint, basename, cat +### If these commands are not in /bin, /usr/bin, or /usr/local/bin on +### your computer, set PATH below to include where they are located. + +PATH=$PATH:/bin:/usr/bin:/usr/local/bin + +### Set root's home directory here: +#HOME=/root +HOME=~root +export HOME + +### Uncomment for crude debugging output +#DEBUG=true + +if [ ! -z "$DEBUG" ]; then + echo "Args: $0 $*" > /tmp/printargs + echo "Arg1: $1" >> /tmp/printargs + echo "Arg2: $2" >> /tmp/printargs + echo "Arg2: $3" >> /tmp/printargs + echo "Arg2: $4" >> /tmp/printargs + echo "Arg2: $5" >> /tmp/printargs + echo "Arg2: $6" >> /tmp/printargs + echo "Arg2: $7" >> /tmp/printargs + command -V pqlist >> /tmp/printargs 2>&1 + command -V nprint >> /tmp/printargs 2>&1 + command -V basename >> /tmp/printargs 2>&1 + command -V cat >> /tmp/printargs 2>&1 + declare -p >> /tmp/printargs + echo "pqlist\n------" >> /tmp/printargs + pqlist >> /tmp/printargs +fi + +ME=`basename $0` + +if [ -z "$*" ]; then + + pqlist | while read printq qid; do + echo network $ME:/$printq \"$printq\" \"NPRINT $printq\" + done + + exit 0 +fi + +### For raw printing, $6 is the file to print. For driver processed +### printing, $6 is empty and the data to print is in stdin. +FILE=$6 + +### When advertising multiple printers, the script has to be able +### determine where it should send real print jobs. This is done +### through the environment variable $DEVICE_URI +SENDTO=${DEVICE_URI#${ME}:/} + +if [ ! -z "$DEBUG" ]; then + echo "SENDTO: $SENDTO" >> /tmp/printargs + cat $6 > /tmp/printout + cat /tmp/printout | nprint -q $SENDTO - +else + cat $FILE | nprint -q $SENDTO - +fi diff --git a/pdfdistiller b/pdfdistiller new file mode 100644 index 0000000..e0a5bab --- /dev/null +++ b/pdfdistiller @@ -0,0 +1,79 @@ +#!/bin/sh +# +# This script is intended to be used as a CUPS backend, to create +# PDF file on-the-fly. Just create a printer using the device uri +# pdf:/path/to/dir/. When printing to this printer, a PDF file +# will be generated in the directory specified. The file name will +# be either ".pdf" or "unknown.pdf", depending wether the +# jobname is empty or not. +# +# To use it, simply copy this script to your backend directory, and +# create a printer with the correct URI. That's it. +# +# Copyright (C) Michael Goffioul (goffioul@imec.be) 2001 +LOGFILE=/dev/null +PDFBIN=`which ps2pdf` +FILENAME= +# this is borrowed from printpdf script for the filename +PRINTTIME=`date +%b%d-%H%M%S` + +echo "Executable: $PDFBIN" > $LOGFILE +echo "Arguments: |$1|$2|$3|$4|$5|$6|" >> $LOGFILE +echo $# $PRINTTIME >> $LOGFILE + +# case of no argument, prints available URIs +if [ $# -eq 0 ]; then + if [ ! -x "$PDFBIN" ]; then + exit 0 + fi + echo "direct pdf \"Unknown\" \"PDF Writing\"" + exit 0 +fi + +# case of wrong number of arguments +if [ $# -ne 5 -a $# -ne 6 ]; then + echo "Usage: pdf job-id user title copies options [file]" + exit 1 +fi + +# get PDF directory from device URI, and check write status +PDFDIR=${DEVICE_URI#pdf:} +if [ ! -d "$PDFDIR" -o ! -w "$PDFDIR" ]; then + echo "ERROR: directory $PDFDIR not writable" + exit 1 +fi + +echo "PDF directory: $PDFDIR" >> $LOGFILE + +# generate output filename +OUTPUTFILENAME= +if [ "$3" = "" ]; then + OUTPUTFILENAME="$PDFDIR/unknown.pdf" +else + # OUTPUTFILENAME="$PDFDIR/${3//[^[:alnum:]]/_}.pdf" + # I changed this to user name, and the printtime to track down who + # printed the PDF and when, samba printing just uses nobody + + OUTPUTFILENAME="$PDFDIR/$2-$PRINTTIME.pdf" + echo "PDF file: $OUTPUTFILENAME placed in: $PDFDIR" >> $LOGFILE +fi + +echo "Output file name: $OUTPUTFILENAME" >> $LOGFILE + +# run ghostscript +if [ $# -eq 6 ]; then + $PDFBIN $6 "$OUTPUTFILENAME" +#>& /dev/null +else + $PDFBIN - "$OUTPUTFILENAME" >& /dev/null +fi + +# modify ownership and permissions on the file +# - world readable +# - owns to user specified in argument +chmod a+r "$OUTPUTFILENAME" +if [ "$2" != "" ]; then + chown $2 "$OUTPUTFILENAME" +fi + +exit 0 diff --git a/photo_print b/photo_print new file mode 100644 index 0000000..4b754b7 --- /dev/null +++ b/photo_print @@ -0,0 +1,136 @@ +#!/bin/bash +#set -x +# +# Photo Print +# ----------- +# +# Till Kamppeter (http://www.linuxprinting.org/till/) +# +# Derived from a script from Max Barel (max dot barel at wanadoo dot fr) +# +# License: GPL (www.gnu.org) +# +# +# Script for printing several photos/image files on on sheet of paper. +# +# For example for printing 4 postcard-sized photos on one A4/Letter sheet +# (1 A4/Letter sheet of photo paper is much cheaper than 4 postcard-sized +# sheets, and 1 A4/Letter image is printed faster than 4 postcards). +# +# Reqirements: +# +# CUPS printing system (www.cups.org) +# ImageMagick (www.imagemagick.org) +# +# Installation: +# +# Copy this file into the /usr/bin or /usr/local/bin directory and make it +# executable with the command "chmod a+rx photo_print". +# +# This script mounts photos together to one big image using the "montage" +# command of ImageMagick without scaling the images to avoid quality loss. +# It sends the resulting image to the printer and lets the image file filter +# of CUPS scale the image to fit into the page. By default, 4 images are +# printed on one sheet, but the number can be changed with the "-t" option. +# On the command line can be given any number of photos, if necessary more +# than one page is printed. So one can easily print all the photos from one +# directory with one command line: +# +# photo_print -P Epson1290 *.jpg +# +# +# +# Command line parameters and their defaults: +# +# "-t XxY": Matrix size (Number of columns x number of rows) +tile=2x2 +# +# "-s n": Scaling (100 % fills the sheet exactly) +# If parts of the edges of the images get lost due to unprintable borders, +# use a scaling value lower than 100 to shrink the image to fit the printable +# area. With an HP DeskJet 990C you get the best result with a value of 95 when +# using A4 paper and 90 when using Letter paper assuming the width/height ratio +# of the images being 4:3. +scaling=100 +# +# "-p": Preview: when this option is given, from every page a preview is shown +# and the user is asked on the console whether he wants to print the page. +preview=0 +# +# "-P xxx": Printer on which the photos should be printed (leave blank to use +# the default printer) +printer="" +# +# "-o option=value": Driver options ("-o option=value") to give on the command +# line of the "lpr" command of CUPS +options="" +# + +#Get parameters from above from the command line +moreoptions=1; +while [ $moreoptions == 1 ] + do + case $1 in + -t) + shift + tile=$1 + shift + ;; + -s) + shift + scaling=$1 + shift + ;; + -p) + shift + preview=1 + ;; + -o) + shift + options="$options -o $1" + shift + ;; + -P) + shift + printer="-P $1" + shift + ;; + -h) + echo "Usage: $0 -P printer -s Scaling -t COLUMNSxROWS -o option=value ... file1 file2 ..." + exit 0 + ;; + * ) + moreoptions=0; + ;; + esac +done + +l=$(echo $tile |cut -f1 -dx); +L=$(echo $tile |cut -f2 -dx); +nbfich=$[ $l * $L ] +freespaces=0 + +page=1 + +while [ "$#" -gt 0 ] + do + if [ "$nbfich" -gt "$#" ]; then + freespaces=$[ $nbfich - $# ] + nbfich="$#" + fi + images=$( echo $* | cut -f1-$nbfich -d " " ) + shift $nbfich + while [ "$freespaces" -gt 0 ]; do + images="$images NULL:" + freespaces=$[ $freespaces - 1 ] + done + ( [ $preview == 0 ] || + (montage -geometry "128x96+2+2" -tile $tile $images miff:-\ + | display -title "Page $page" & + echo -n "Print this page? "; read in; killall display; [ x$in == xy ] ) ) &&\ + montage -cache 10 -geometry "100%+2+2" -tile $tile $images pro$page.bmp &&\ + lpr $printer -o scaling=$scaling $options pro$page.bmp -r + page=$[page + 1] +done +wait +rm -f pro[0-9]*.bmp diff --git a/poll_ppd_base.c b/poll_ppd_base.c new file mode 100644 index 0000000..2442ac5 --- /dev/null +++ b/poll_ppd_base.c @@ -0,0 +1,253 @@ +/* + * + * poll_ppd_base + * ------------- + # + # A simple tool for getting a list of all installed PPD files + # with printer manufacturer and printer model, polling the database + # of the CUPS daemon. This program is mainly intended to be called + # from installation/configuration scripts for CUPS. + # + # ONLY WORKS WITH CUPS DAEMON RUNNING! + # The CUPS library (libcups.so.*) must be installed! + # + # Compile with: gcc -opoll_ppd_base -lcups poll_ppd_base.c + # + * Copyright 2000 by Till Kamppeter + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA + * + */ + +/* + * Include necessary headers... + */ + +#include +#include +#include +#include +#include +#include +#include + +// IPP Request routines for getting the printer type, stolen from QTCUPS from +// Michael Goffioul (file qtcups/cupshelper.cpp) + +ipp_t* newIppRequest() +{ + ipp_t *request; + cups_lang_t *lang; + request = ippNew(); + request->request.op.request_id = 1; + lang = cupsLangDefault(); + ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_CHARSET,"attributes-charset",NULL,cupsLangEncoding(lang)); + ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_LANGUAGE,"attributes-natural-language",NULL,lang->language); + return request; +} + +ipp_t* processRequest(ipp_t *req, const char *res) +{ + http_t *HTTP; + ipp_t *answer; + HTTP = httpConnect(cupsServer(),ippPort()); + if (!HTTP) { + ippDelete(req); + return 0; + } + answer = cupsDoRequest(HTTP,req,res); + httpClose(HTTP); + if (!answer) return 0; + if (answer->state == IPP_ERROR || answer->state == IPP_IDLE) { + ippDelete(answer); + return 0; + } + return answer; +} + +ipp_t *getPPDList() +{ + ipp_t *request = newIppRequest(); + char str[1024]; + const char* server = cupsServer(); + int port = ippPort(); + + request->request.op.operation_id = CUPS_GET_PPDS; + if ((!server) || (port < 0)) return NULL; + sprintf(str,"ipp://%s:%d/printers/",cupsServer(),ippPort()); + ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,str); + //str.sprintf("/printers/%s",name); + request = processRequest(request,"/"); + return request; +} + +/* + * Main program + */ + +int /* O - exit state */ +main(int argc, /* I - Number of command-line arguments */ + char *argv[]) /* I - Command-line arguments */ +{ + int i,j; /* Looping vars */ + int makelen = 0; /* Length of current manufacturer name */ + int makelist = 0; /* List of manufacturers */ + int makegiven = 0; /* List of models for given manufacturer */ + int all = 0; /* LIst of all models */ + char *make; /* Chosen manufacturer */ + ipp_t *ppdlist; /* List of PPD files resulting from IPP */ + /* request */ + ipp_attribute_t *attr, /* Current attribute */ + *last; /* Last attribute */ + char *currmake, /* current data read from PPD list */ + *currmod, + *currlang, + *currfile, + *currid, + *c; + char buffer[80], + buffer2[256]; + int lineprinted = 1; /* Is the current line already printed to + stdout */ + + // read command line arguments + + for (i = 1; i < argc; i ++) + if (argv[i][0] == '-') { + switch (argv[i][1]) { + case 'm' : /* Manufacturer options */ + if (argv[i][2] != '\0') { + if (strcmp(argv[i],"-ml") == 0) { + makelist = 1; + } else { + make = argv[i] + 2; + makegiven = 1; + } + } else { + i ++; + if (!(make = argv[i])) return 1; + makegiven = 1; + } + break; + case 'a' : /* List all PPD files */ + all = 1; + break; + default : + fprintf(stderr,"Unknown option \'%c\'!\n", argv[i][1]); + fprintf(stderr,"Start program without options for help!\n"); + return(1); + } + } else { + fprintf(stderr,"Unknown option \'%s\'!", argv[i]); + fprintf(stderr,"Start program without options for help!\n"); + return(1); + } + if ((all) || (makegiven)) { // list all PPDs or PPDs of given manufacturer + ppdlist = getPPDList(); + if (!ppdlist) return 1; + for (attr = ppdlist->attrs; // go through all entries + attr != NULL; + attr = attr->next) + if (attr->name) { + // read data items + if (strcmp(attr->name, "ppd-name") == 0) { + currfile = attr->values[0].string.text; + lineprinted = 0; + } else if (strcmp(attr->name, "ppd-make") == 0) { + currmake = attr->values[0].string.text; + } else if (strcmp(attr->name, "ppd-make-and-model") == 0) { + currmod = attr->values[0].string.text; + } else if (strcmp(attr->name, "ppd-natural-language") == 0) { + currlang = attr->values[0].string.text; + } else if (strcmp(attr->name, "ppd-device-id") == 0) { + currid = attr->values[0].string.text; + } + } else { // attr->name = NULL ==> data set completed + lineprinted = 1; + // Fill empty entries with some default stuff + if (!currmod) currmod = "UNKNOWN"; + if (!currmake) currmake = "UNKNOWN"; + if (!currlang) currlang = "en"; + // Put data to stdout when "all" is chosen or when the manufacturer + // matches the given one. + if ((currfile) && ((all) || !strcasecmp(currmake,make))) { + if (currid && (currid[0])) + printf("%s|%s|%s|%s|%s\n",currfile,currmake,currmod,currlang, + currid); + else + printf("%s|%s|%s|%s\n",currfile,currmake,currmod,currlang); + } + currfile = NULL; currmake = NULL; currmod = NULL; + currlang = NULL; currid = NULL; + } + if (!lineprinted) { + // Fill empty entries with some default stuff + if (!currmod) currmod = "UNKNOWN"; + if (!currmake) currmake = "UNKNOWN"; + if (!currlang) currlang = "en"; + // Put data to stdout when "all" is chosen or when the manufacturer + // matches the given one. + if ((currfile) && ((all) || !strcasecmp(currmake,make))) { + if (currid && (currid[0])) + printf("%s|%s|%s|%s|%s\n",currfile,currmake,currmod,currlang, + currid); + else + printf("%s|%s|%s|%s\n",currfile,currmake,currmod,currlang); + } + } + } else if (makelist) { // list all manufacturers + ppdlist = getPPDList(); + if (!ppdlist) return 1; + for (attr = ppdlist->attrs, last = NULL; // go through all entries + attr != NULL; + attr = attr->next) + if (attr->name && strcmp(attr->name, "ppd-make") == 0) + // only search for manufacturerer entriees + if (last == NULL || + strcasecmp(last->values[0].string.text, + attr->values[0].string.text) != 0) + // Do not take the same manufacturer twice + { + // Put found manufacturer to stdout + printf("%s\n",attr->values[0].string.text); + last = attr; + } + } else { // Help! + fprintf(stderr,"Usage:\n"); + fprintf(stderr,"------\n"); + fprintf(stderr,"\n"); + fprintf(stderr," poll_ppd_base\n"); + fprintf(stderr,"\n"); + fprintf(stderr," This help page\n"); + fprintf(stderr,"\n"); + fprintf(stderr," poll_ppd_base -a\n"); + fprintf(stderr,"\n"); + fprintf(stderr," List all PPD files\n"); + fprintf(stderr,"\n"); + fprintf(stderr," poll_ppd_base -ml\n"); + fprintf(stderr,"\n"); + fprintf(stderr," List of all printer manufacturers supported by the PPD files installed\n"); + fprintf(stderr,"\n"); + fprintf(stderr," poll_ppd_base -m \n"); + fprintf(stderr,"\n"); + fprintf(stderr," List of all supported printer models of this manufacturer\n"); + fprintf(stderr,"\n"); + fprintf(stderr,"ONLY WORKS WITH CUPS DAEMON RUNNING!\n"); + fprintf(stderr,"\n"); + return(1); + } + return(0); +}