extra/cups to 2.0.0-2

This commit is contained in:
Kevin Mihelich 2014-10-31 16:40:29 +00:00
parent d8cba01c09
commit 2f5ba1ac31
15 changed files with 148 additions and 729 deletions

View file

@ -6,92 +6,73 @@
pkgbase="cups"
pkgname=('libcups' 'cups')
pkgver=1.7.5
pkgrel=1.1
pkgver=2.0.0
pkgrel=2
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.cups.org/"
makedepends=('libtiff>=4.0.0' 'libpng>=1.5.7' 'acl' 'pam' 'xdg-utils' 'krb5' 'openssl'
makedepends=('libtiff>=4.0.0' 'libpng>=1.5.7' 'acl' 'pam' 'xdg-utils' 'krb5' 'gnutls'
'cups-filters' 'bc' 'colord' 'xinetd' 'gzip' 'autoconf' 'libusb' 'dbus'
'avahi' 'hicolor-icon-theme' 'systemd' 'inetutils' 'libpaper')
source=(#http://mirror.easysw.com/pub/cups/${pkgver}/cups-${pkgver}-source.tar.bz2
http://www.cups.org/software/${pkgver}/cups-${pkgver}-source.tar.bz2{,.sig}
source=(http://www.cups.org/software/${pkgver}/cups-${pkgver}-source.tar.bz2{,.sig}
cups.logrotate cups.pam
# improve build and linking
cups-no-export-ssllibs.patch
cups-no-gcrypt.patch
cups-no-gzip-man.patch
# FC
cups-systemd-socket.patch
cups-res_init.patch
cups-avahi-address.patch
cups-enum-all.patch
cups-final-content-type.patch
# Gentoo
cups-1.6.0-fix-install-perms.patch
cups-1.6.2-statedir.patch
# Debian
cupsd-no-crash-on-avahi-threaded-poll-shutdown.patch
get-ppd-file-for-statically-configured-ipp-shared-queues.patch
ppd-poll-with-client-conf.patch)
md5sums=('5d893edc2957005f78e2b2423fdace2e'
cups-1.6.0-fix-install-perms.patch
# bugfixes
str4497.patch
str4495.patch
str4500.patch # FC
)
md5sums=('2cdd81fea23e9e29555c24bdfd0d7c89'
'SKIP'
'26e9b4e65c0a4d76db5737c9b156fd80'
'fc8286f185e2cc5f7e1f6843bf193e2b'
'96f82c38f3f540b53f3e5144900acf17'
'3ba9e3410df1dc3015463d615ef91b3b'
'cc4101beccb5ed6deb1c92707a575925'
'1beb4896f217bc241bc08a422274ec0c'
'90c30380d4c8cd48a908cfdadae1ea24'
'8162e1d05947bd59fa29ba40ac565fec'
'8fe27d4248cacbc02824e7937cab4088'
'df0c367c0022e3c7d8e01827e8a6c5e7'
'f30c2a161caaf27854581507cde8cac6'
'a31b64ba25a985fbae65d8ddf311b08c'
'5117f65342fcc69c6a506529e4daca9e'
'451609db34f95209d64c38474de27ce1'
'cb58bf4e0b80eaee383712e5c84a1ab4'
'b578bcd17949a7203237ba1e31f78ef9'
'0becd6ab8782b97f19a02c1dc174c75e')
'5117f65342fcc69c6a506529e4daca9e'
'5aab5a160482d89e5d2a4def1f83ef8f'
'84da6459947d4fb62398e9bad7922a11'
'8c0514e41c3b50b2b838b218f683e227')
prepare() {
cd ${pkgbase}-${pkgver}
#return 1
# add systemd socket support - Fedora patch, also used in Gentoo
# modified now to the changes done by Gentoo in their svn ebuild
# http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-print/cups/files/cups-1.5.0-systemd-socket.patch?revision=1.1
patch -Np1 -i ${srcdir}/cups-systemd-socket.patch
# improve build and linking
# Do not export SSL libs in cups-config
patch -Np1 -i "${srcdir}/cups-no-export-ssllibs.patch"
patch -Np1 -i "${srcdir}/cups-no-gcrypt.patch"
patch -Np1 -i ${srcdir}/cups-no-export-ssllibs.patch
# https://www.cups.org/str.php?L4399
patch -Np1 -i ${srcdir}/cups-no-gcrypt.patch
# don't zip man pages in make install, let makepkg do that / Fedora
patch -Np1 -i ${srcdir}/cups-no-gzip-man.patch
# various bugfixes (upstream reports/SVN or Fedora/Debian
# Fixed crash which sometimes happens on shutdown of the CUPS daemon, caused by a wrong shutdown sequence for shutting down the Avahi threaded poll.
# patch -Np1 -i ${srcdir}/cupsd-no-crash-on-avahi-threaded-poll-shutdown.patch
# Applications could not get the PPD file for statically-configured IPP-shared print queues
patch -Np1 -i ${srcdir}/get-ppd-file-for-statically-configured-ipp-shared-queues.patch
# If an external server is used via client.conf and the DNS is inconsistent (ex: DNS gives "noname" for many IPs, reverse DNS gives one of these IPs
# for "noname") local PPDs can get polled for print queues instead of the PPDs of the external server Bug: http://www.cups.org/str.php?L2763
# patch -Np1 -i ${srcdir}/ppd-poll-with-client-conf.patch
# fix permissions on some files - alternative: cups-0755.patch by FC
patch -Np0 -i ${srcdir}/cups-1.6.0-fix-install-perms.patch
# move /var/run -> /run for pid file
patch -Np1 -i ${srcdir}/cups-1.6.2-statedir.patch
# Re-initialise the resolver on failure in httpAddrGetList()
patch -Np1 -i ${srcdir}/cups-res_init.patch
# Use IP address when resolving DNSSD URIs
patch -Np1 -i ${srcdir}/cups-avahi-address.patch
# Return from cupsEnumDests() once all records have been returned.
patch -Np1 -i ${srcdir}/cups-enum-all.patch
# fix permissions on some files (by Gentoo) - alternative: cups-0755.patch by FC
patch -Np0 -i ${srcdir}/cups-1.6.0-fix-install-perms.patch
# bug fixes
# Fix printing to some network printers fails - https://bugs.archlinux.org/task/37605
patch -Np1 -i ${srcdir}/cups-final-content-type.patch
# https://www.cups.org/str.php?L4497 + https://www.cups.org/str.php?L4491
# "Port 631" binds to localhost only (systemd regression)
patch -Np0 -i ${srcdir}/str4497.patch
# https://bugs.archlinux.org/task/40937 - https://www.cups.org/str.php?L4495
# adds a warning to the config file and honors the FatalErrors directive
patch -Np0 -i ${srcdir}/str4495.patch
# https://www.cups.org/str.php?L4500
# /etc/cups/ppd/*.ppd not world-readable, cupsGetPPD() returns symlink
patch -Np1 -i ${srcdir}/str4500.patch
# set MaxLogSize to 0 to prevent using cups internal log rotation
sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in
# Rebuild configure script for not zipping man-pages.
aclocal -I config-scripts
@ -100,11 +81,11 @@ prepare() {
build() {
cd ${pkgbase}-${pkgver}
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--sbindir=/usr/bin \
--libdir=/usr/lib \
--with-systemdsystemunitdir=/usr/lib/systemd/system \
--with-logdir=/var/log/cups \
--with-docdir=/usr/share/cups/doc \
--with-cups-user=daemon \
@ -112,23 +93,23 @@ build() {
--enable-pam=yes \
--enable-raw-printing \
--enable-dbus --with-dbusdir=/etc/dbus-1 \
--enable-ssl=yes --enable-openssl \
--enable-ssl=yes \
--enable-threads \
--enable-avahi\
--enable-libpaper \
--with-php=/usr/bin/php-cgi \
--with-optim="$CFLAGS"
--with-optim="$CFLAGS" #--help
make
}
check() {
cd ${pkgbase}-${pkgver}
make -k check || /bin/true
#make -k check || /bin/true
}
package_libcups() {
pkgdesc="The CUPS Printing System - client libraries and headers"
depends=('openssl' 'libtiff>=4.0.0' 'libpng>=1.5.7' 'krb5' 'avahi')
depends=('gnutls' 'libtiff>=4.0.0' 'libpng>=1.5.7' 'krb5' 'avahi' 'libusb')
backup=(etc/cups/client.conf)
cd ${pkgbase}-${pkgver}
@ -143,7 +124,7 @@ backup=(etc/cups/client.conf)
install -dm755 -g lp ${pkgdir}/etc/cups
touch ${pkgdir}/etc/cups/client.conf
echo "# see 'man client.conf'" >> ${pkgdir}/etc/cups/client.conf
echo "ServerName /var/run/cups/cups.sock # alternative: ServerName hostname-or-ip-address[:port] of a remote server" >> ${pkgdir}/etc/cups/client.conf
echo "ServerName /run/cups/cups.sock # alternative: ServerName hostname-or-ip-address[:port] of a remote server" >> ${pkgdir}/etc/cups/client.conf
chgrp -R lp ${pkgdir}/etc/cups
}
@ -161,7 +142,7 @@ backup=(etc/cups/cupsd.conf
etc/pam.d/cups
etc/xinetd.d/cups-lpd)
depends=('acl' 'pam' "libcups>=${pkgver}" 'cups-filters' 'bc' 'colord'
'libusb' 'dbus' 'systemd' 'libpaper' 'hicolor-icon-theme')
'dbus' 'systemd' 'libpaper' 'hicolor-icon-theme')
optdepends=('xdg-utils: xdg .desktop file support')
cd ${pkgbase}-${pkgver}
@ -207,5 +188,5 @@ optdepends=('xdg-utils: xdg .desktop file support')
perl -p -i -e 's:^(.*\s+bannertops\s*)$:#\1:' $pkgdir/usr/share/cups/mime/mime.convs
# Provide native service for arch-daemons generator
ln -s cups.service "$pkgdir/usr/lib/systemd/system/cupsd.service"
# ln -s org.cups.cupsd.service "$pkgdir/usr/lib/systemd/system/cupsd.service" # still required?
}

View file

@ -1,75 +0,0 @@
diff -up cups-1.6.2/cups/http-support.c.avahi-address cups-1.6.2/cups/http-support.c
--- cups-1.6.2/cups/http-support.c.avahi-address 2013-03-11 18:44:36.000000000 +0000
+++ cups-1.6.2/cups/http-support.c 2013-04-04 15:39:06.651847041 +0100
@@ -2121,7 +2121,7 @@ http_resolve_cb(
const char *type, /* I - Registration type */
const char *domain, /* I - Domain (unused) */
const char *hostTarget, /* I - Hostname */
- const AvahiAddress *address, /* I - Address (unused) */
+ const AvahiAddress *address, /* I - Address */
uint16_t port, /* I - Port number */
AvahiStringList *txt, /* I - TXT record */
AvahiLookupResultFlags flags, /* I - Lookup flags (unused) */
@@ -2253,36 +2253,37 @@ http_resolve_cb(
DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget));
- snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port));
- if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL)
+ int error = getnameinfo(&(address->data),
+ address->proto == AVAHI_PROTO_INET ?
+ sizeof (AvahiIPv4Address) :
+ (address->proto == AVAHI_PROTO_INET6 ?
+ sizeof (AvahiIPv6Address) :
+ sizeof (address->data)),
+ fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
+
+ if (!error)
{
- for (addr = addrlist; addr; addr = addr->next)
+ DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
+
+ if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
+ _cups_strcasecmp(hostptr, ".local"))
{
- int error = getnameinfo(&(addr->addr.addr),
- httpAddrLength(&(addr->addr)),
- fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
-
- if (!error)
- {
- DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
-
- if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
- _cups_strcasecmp(hostptr, ".local"))
- {
- hostTarget = fqdn;
- break;
- }
- }
+ hostTarget = fqdn;
+ }
+ }
#ifdef DEBUG
- else
- DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
- httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
- error));
+ else
+ DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
+ httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
+ error));
#endif /* DEBUG */
- }
+ } else {
+ /*
+ * Use the IP address that responded...
+ */
- httpAddrFreeList(addrlist);
- }
+ avahi_address_snprint (fqdn, sizeof (fqdn), address);
+ hostTarget = fqdn;
}
/*

View file

@ -1,17 +0,0 @@
diff -up cups-1.6.2/cups/dest.c.enum-all cups-1.6.2/cups/dest.c
--- cups-1.6.2/cups/dest.c.enum-all 2013-06-04 10:58:36.169786250 +0100
+++ cups-1.6.2/cups/dest.c 2013-06-04 10:59:02.147900811 +0100
@@ -2724,9 +2724,12 @@ cups_dnssd_browse_cb(
break;
case AVAHI_BROWSER_REMOVE:
- case AVAHI_BROWSER_ALL_FOR_NOW:
case AVAHI_BROWSER_CACHE_EXHAUSTED:
break;
+
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ avahi_simple_poll_quit(data->simple_poll);
+ break;
}
}

View file

@ -1,18 +0,0 @@
diff -up cups-1.6.4/scheduler/job.c.final-content-type cups-1.6.4/scheduler/job.c
--- cups-1.6.4/scheduler/job.c.final-content-type 2013-09-27 16:58:13.934775402 +0100
+++ cups-1.6.4/scheduler/job.c 2013-09-27 17:00:57.716549576 +0100
@@ -692,12 +692,7 @@ cupsdContinueJob(cupsd_job_t *job) /* I
if (!job->printer->remote)
{
- for (filter = (mime_filter_t *)cupsArrayLast(filters);
- filter && filter->dst;
- filter = (mime_filter_t *)cupsArrayPrev(filters))
- if (strcmp(filter->dst->super, "printer") ||
- strcmp(filter->dst->type, job->printer->name))
- break;
+ filter = (mime_filter_t *)cupsArrayLast(filters);
if (filter && filter->dst)
{

View file

@ -1,40 +1,11 @@
diff -ruN cups-1.4.7.orig//config-scripts/cups-ssl.m4 cups-1.4.7/config-scripts/cups-ssl.m4
--- cups-1.5.0.orig//config-scripts/cups-ssl.m4 2011-01-11 08:05:58.000000000 +0100
+++ cups-1.5.0/config-scripts/cups-ssl.m4 2011-08-02 10:44:26.011047900 +0200
@@ -96,7 +96,6 @@
diff -up cups-2.0rc1/config-scripts/cups-ssl.m4.no-gcry cups-2.0rc1/config-scripts/cups-ssl.m4
--- cups-2.0rc1/config-scripts/cups-ssl.m4.no-gcry 2014-09-12 15:41:23.324760213 +0200
+++ cups-2.0rc1/config-scripts/cups-ssl.m4 2014-09-12 15:43:13.124203363 +0200
@@ -60,7 +60,6 @@ if test x$enable_ssl != xno; then
dnl Then look for GNU TLS...
if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
- AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
AC_PATH_TOOL(LIBGNUTLSCONFIG,libgnutls-config)
- AC_PATH_TOOL(LIBGCRYPTCONFIG,libgcrypt-config)
if $PKGCONFIG --exists gnutls; then
have_ssl=1
SSLLIBS=`$PKGCONFIG --libs gnutls`
@@ -108,18 +107,6 @@
AC_DEFINE(HAVE_GNUTLS)
fi
- if test $have_ssl = 1; then
- CUPS_SERVERCERT="ssl/server.crt"
- CUPS_SERVERKEY="ssl/server.key"
-
- if $PKGCONFIG --exists gcrypt; then
- SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
- SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
- elif test "x$LIBGCRYPTCONFIG" != x; then
- SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`"
- SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`"
- fi
- fi
fi
dnl Check for the OpenSSL library last...
--- cups-1.5.0.orig//cups/http-private.h 2011-01-22 01:07:22.000000000 +0100
+++ cups-1.5.0/cups/http-private.h 2011-08-02 10:42:43.341604107 +0200
@@ -93,7 +93,6 @@
# elif defined HAVE_GNUTLS
# include <gnutls/gnutls.h>
# include <gnutls/x509.h>
-# include <gcrypt.h>
# elif defined(HAVE_CDSASSL)
# include <CoreFoundation/CoreFoundation.h>
# include <Security/Security.h>

View file

@ -1,26 +0,0 @@
diff -up cups-1.6b1/cups/http-addr.c.res_init cups-1.6b1/cups/http-addr.c
--- cups-1.6b1/cups/http-addr.c.res_init 2012-05-17 00:57:03.000000000 +0200
+++ cups-1.6b1/cups/http-addr.c 2012-05-25 15:51:51.323916352 +0200
@@ -254,7 +254,8 @@ httpAddrLookup(
if (error)
{
- if (error == EAI_FAIL)
+ if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA ||
+ error == EAI_NONAME)
cg->need_res_init = 1;
return (httpAddrString(addr, name, namelen));
diff -up cups-1.6b1/cups/http-addrlist.c.res_init cups-1.6b1/cups/http-addrlist.c
--- cups-1.6b1/cups/http-addrlist.c.res_init 2012-04-23 19:26:57.000000000 +0200
+++ cups-1.6b1/cups/http-addrlist.c 2012-05-25 16:05:05.930377452 +0200
@@ -540,7 +540,8 @@ httpAddrGetList(const char *hostname, /*
}
else
{
- if (error == EAI_FAIL)
+ if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA ||
+ error == EAI_NONAME)
cg->need_res_init = 1;
_cupsSetError(IPP_INTERNAL_ERROR, gai_strerror(error), 0);

View file

@ -1,404 +0,0 @@
diff -up cups-1.7.2/config.h.in.systemd-socket cups-1.7.2/config.h.in
--- cups-1.7.2/config.h.in.systemd-socket 2014-02-27 16:57:59.000000000 +0100
+++ cups-1.7.2/config.h.in 2014-04-17 14:05:04.104472016 +0200
@@ -451,6 +451,13 @@
/*
+ * Do we have systemd support?
+ */
+
+#undef HAVE_SYSTEMD
+
+
+/*
* Various scripting languages...
*/
diff -up cups-1.7.2/config-scripts/cups-systemd.m4.systemd-socket cups-1.7.2/config-scripts/cups-systemd.m4
--- cups-1.7.2/config-scripts/cups-systemd.m4.systemd-socket 2014-04-17 14:05:04.104472016 +0200
+++ cups-1.7.2/config-scripts/cups-systemd.m4 2014-04-17 14:05:04.104472016 +0200
@@ -0,0 +1,36 @@
+dnl
+dnl "$Id$"
+dnl
+dnl systemd stuff for CUPS.
+
+dnl Find whether systemd is available
+
+SDLIBS=""
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [], [with_systemdsystemunitdir=$($PKGCONFIG --variable=systemdsystemunitdir systemd)])
+if test "x$with_systemdsystemunitdir" != xno; then
+ AC_MSG_CHECKING(for libsystemd-daemon)
+ if $PKGCONFIG --exists libsystemd-daemon; then
+ AC_MSG_RESULT(yes)
+ SDCFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
+ SDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+ AC_DEFINE(HAVE_SYSTEMD)
+ else
+ AC_MSG_RESULT(no)
+ fi
+fi
+
+if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then
+ SYSTEMD_UNITS="cups.service cups.socket cups.path"
+else
+ SYSTEMD_UNITS=""
+fi
+
+AC_SUBST(SYSTEMD_UNITS)
+AC_SUBST(SDLIBS)
+
+dnl
+dnl "$Id$"
+dnl
diff -up cups-1.7.2/configure.in.systemd-socket cups-1.7.2/configure.in
--- cups-1.7.2/configure.in.systemd-socket 2013-07-08 23:15:13.000000000 +0200
+++ cups-1.7.2/configure.in 2014-04-17 14:05:04.104472016 +0200
@@ -33,6 +33,7 @@ sinclude(config-scripts/cups-pam.m4)
sinclude(config-scripts/cups-largefile.m4)
sinclude(config-scripts/cups-dnssd.m4)
sinclude(config-scripts/cups-launchd.m4)
+sinclude(config-scripts/cups-systemd.m4)
sinclude(config-scripts/cups-defaults.m4)
sinclude(config-scripts/cups-scripting.m4)
@@ -67,6 +68,9 @@ AC_OUTPUT(Makedefs
conf/snmp.conf
cups-config
data/testprint
+ data/cups.service
+ data/cups.socket
+ data/cups.path
desktop/cups.desktop
doc/help/ref-cups-files-conf.html
doc/help/ref-cupsd-conf.html
diff -up cups-1.7.2/cups/usersys.c.systemd-socket cups-1.7.2/cups/usersys.c
--- cups-1.7.2/cups/usersys.c.systemd-socket 2014-03-05 22:22:12.000000000 +0100
+++ cups-1.7.2/cups/usersys.c 2014-04-17 14:05:04.105472002 +0200
@@ -1050,7 +1050,7 @@ cups_read_client_conf(
struct stat sockinfo; /* Domain socket information */
if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) &&
- (sockinfo.st_mode & S_IRWXO) == S_IRWXO)
+ (sockinfo.st_mode & (S_IROTH | S_IWOTH)) == (S_IROTH | S_IWOTH))
cups_server = CUPS_DEFAULT_DOMAINSOCKET;
else
#endif /* CUPS_DEFAULT_DOMAINSOCKET */
diff -up cups-1.7.2/data/cups.path.in.systemd-socket cups-1.7.2/data/cups.path.in
--- cups-1.7.2/data/cups.path.in.systemd-socket 2014-04-17 14:05:04.105472002 +0200
+++ cups-1.7.2/data/cups.path.in 2014-04-17 14:05:04.105472002 +0200
@@ -0,0 +1,8 @@
+[Unit]
+Description=CUPS Printer Service Spool
+
+[Path]
+PathExistsGlob=@CUPS_REQUESTS@/d*
+
+[Install]
+WantedBy=multi-user.target
diff -up cups-1.7.2/data/cups.service.in.systemd-socket cups-1.7.2/data/cups.service.in
--- cups-1.7.2/data/cups.service.in.systemd-socket 2014-04-17 14:05:04.105472002 +0200
+++ cups-1.7.2/data/cups.service.in 2014-04-17 14:05:04.105472002 +0200
@@ -0,0 +1,11 @@
+[Unit]
+Description=CUPS Printing Service
+
+[Service]
+Type=notify
+ExecStart=@sbindir@/cupsd -f
+PrivateTmp=true
+
+[Install]
+Also=cups.socket cups.path
+WantedBy=printer.target
diff -up cups-1.7.2/data/cups.socket.in.systemd-socket cups-1.7.2/data/cups.socket.in
--- cups-1.7.2/data/cups.socket.in.systemd-socket 2014-04-17 14:05:04.105472002 +0200
+++ cups-1.7.2/data/cups.socket.in 2014-04-17 14:05:04.105472002 +0200
@@ -0,0 +1,10 @@
+[Unit]
+Description=CUPS Printing Service Sockets
+
+[Socket]
+ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@
+ListenStream=@DEFAULT_IPP_PORT@
+BindIPv6Only=ipv6-only
+
+[Install]
+WantedBy=sockets.target
diff -up cups-1.7.2/data/Makefile.systemd-socket cups-1.7.2/data/Makefile
--- cups-1.7.2/data/Makefile.systemd-socket 2013-05-29 13:51:34.000000000 +0200
+++ cups-1.7.2/data/Makefile 2014-04-17 14:05:04.106471988 +0200
@@ -100,6 +100,12 @@ install-data:
$(INSTALL_DATA) $$file $(DATADIR)/ppdc; \
done
$(INSTALL_DIR) -m 755 $(DATADIR)/profiles
+ if test "x$(SYSTEMD_UNITS)" != "x" ; then \
+ $(INSTALL_DIR) -m 755 $(SYSTEMDUNITDIR); \
+ for file in $(SYSTEMD_UNITS); do \
+ $(INSTALL_DATA) $$file $(SYSTEMDUNITDIR); \
+ done; \
+ fi
#
@@ -143,6 +149,9 @@ uninstall:
-$(RMDIR) $(DATADIR)/data
-$(RMDIR) $(DATADIR)/banners
-$(RMDIR) $(DATADIR)
+ for file in $(SYSTEMD_UNITS); do \
+ $(RM) $(SYSTEMDUNITDIR)/$$file; \
+ done
#
diff -up cups-1.7.2/Makedefs.in.systemd-socket cups-1.7.2/Makedefs.in
--- cups-1.7.2/Makedefs.in.systemd-socket 2014-04-17 14:05:04.092472182 +0200
+++ cups-1.7.2/Makedefs.in 2014-04-17 14:05:04.106471988 +0200
@@ -134,6 +134,7 @@ CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@
CXXLIBS = @CXXLIBS@
DBUS_NOTIFIER = @DBUS_NOTIFIER@
DBUS_NOTIFIERLIBS = @DBUS_NOTIFIERLIBS@
+SYSTEMD_UNITS = @SYSTEMD_UNITS@
DNSSD_BACKEND = @DNSSD_BACKEND@
DSOFLAGS = -L../cups @DSOFLAGS@
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
@@ -141,6 +142,7 @@ DNSSDLIBS = @DNSSDLIBS@
IPPFIND_BIN = @IPPFIND_BIN@
IPPFIND_MAN = @IPPFIND_MAN@
LAUNCHDLIBS = @LAUNCHDLIBS@
+SDLIBS = @SDLIBS@
LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \
-L../scheduler @LDARCHFLAGS@ \
@LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
@@ -232,6 +234,7 @@ PAMFILE = @PAMFILE@
DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@
DBUSDIR = @DBUSDIR@
+SYSTEMDUNITDIR = $(BUILDROOT)@systemdsystemunitdir@
#
diff -up cups-1.7.2/scheduler/client.h.systemd-socket cups-1.7.2/scheduler/client.h
--- cups-1.7.2/scheduler/client.h.systemd-socket 2013-08-02 00:23:18.000000000 +0200
+++ cups-1.7.2/scheduler/client.h 2014-04-17 14:05:04.106471988 +0200
@@ -79,6 +79,9 @@ typedef struct
int fd; /* File descriptor for this server */
http_addr_t address; /* Bind address of socket */
http_encryption_t encryption; /* To encrypt or not to encrypt... */
+#ifdef HAVE_SYSTEMD
+ int is_systemd; /* Is this a systemd socket? */
+#endif /* HAVE_SYSTEMD */
} cupsd_listener_t;
diff -up cups-1.7.2/scheduler/listen.c.systemd-socket cups-1.7.2/scheduler/listen.c
--- cups-1.7.2/scheduler/listen.c.systemd-socket 2013-05-29 13:51:34.000000000 +0200
+++ cups-1.7.2/scheduler/listen.c 2014-04-17 14:05:04.107471974 +0200
@@ -401,7 +401,11 @@ cupsdStopListening(void)
lis;
lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
{
- if (lis->fd != -1)
+ if (lis->fd != -1
+#ifdef HAVE_SYSTEMD
+ && !lis->is_systemd
+#endif /* HAVE_SYSTEMD */
+ )
{
#ifdef WIN32
closesocket(lis->fd);
diff -up cups-1.7.2/scheduler/main.c.systemd-socket cups-1.7.2/scheduler/main.c
--- cups-1.7.2/scheduler/main.c.systemd-socket 2014-04-17 14:05:04.052472738 +0200
+++ cups-1.7.2/scheduler/main.c 2014-04-17 14:09:39.102634667 +0200
@@ -39,6 +39,10 @@
# endif /* !LAUNCH_JOBKEY_SERVICEIPC */
#endif /* HAVE_LAUNCH_H */
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif /* HAVE_SYSTEMD */
+
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
# include <malloc.h>
#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
@@ -64,6 +68,9 @@
static void launchd_checkin(void);
static void launchd_checkout(void);
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+static void systemd_checkin(void);
+#endif /* HAVE_SYSTEMD */
static void parent_handler(int sig);
static void process_children(void);
static void sigchld_handler(int sig);
@@ -563,6 +570,13 @@ main(int argc, /* I - Number of comm
}
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+ /*
+ * If we were started by systemd get the listen sockets file descriptors...
+ */
+ systemd_checkin();
+#endif /* HAVE_SYSTEMD */
+
/*
* Startup the server...
*/
@@ -654,6 +668,12 @@ main(int argc, /* I - Number of comm
"Scheduler started via launchd.");
else
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+ sd_notifyf(0, "READY=1\n"
+ "STATUS=Scheduler is running...\n"
+ "MAINPID=%lu",
+ (unsigned long) getpid());
+#endif /* HAVE_SYSTEMD */
if (fg)
cupsdAddEvent(CUPSD_EVENT_SERVER_STARTED, NULL, NULL,
"Scheduler started in foreground.");
@@ -751,6 +771,15 @@ main(int argc, /* I - Number of comm
}
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+ /*
+ * If we were started by systemd get the listen sockets file
+ * descriptors...
+ */
+
+ systemd_checkin();
+#endif /* HAVE_SYSTEMD */
+
/*
* Startup the server...
*/
@@ -1500,6 +1529,102 @@ launchd_checkout(void)
}
#endif /* HAVE_LAUNCHD */
+#ifdef HAVE_SYSTEMD
+static void
+systemd_checkin(void)
+{
+ int n, fd;
+
+ n = sd_listen_fds(0);
+ if (n < 0)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Failed to acquire sockets from systemd - %s",
+ strerror(-n));
+ exit(EXIT_FAILURE);
+ return;
+ }
+
+ if (n == 0)
+ return;
+
+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++)
+ {
+ http_addr_t addr;
+ socklen_t addrlen = sizeof (addr);
+ int r;
+ cupsd_listener_t *lis;
+ char s[256];
+
+ r = sd_is_socket(fd, AF_UNSPEC, SOCK_STREAM, 1);
+ if (r < 0)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Unable to verify socket type - %s",
+ strerror(-r));
+ continue;
+ }
+
+ if (!r)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Socket not of the right type");
+ continue;
+ }
+
+ if (getsockname(fd, (struct sockaddr*) &addr, &addrlen))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Unable to get local address - %s",
+ strerror(errno));
+ continue;
+ }
+
+ /*
+ * Try to match the systemd socket address to one of the listeners...
+ */
+
+ for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
+ lis;
+ lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
+ if (httpAddrEqual(&lis->address, &addr))
+ break;
+
+ if (lis)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "systemd_checkin: Matched existing listener %s with fd %d...",
+ httpAddrString(&(lis->address), s, sizeof(s)), fd);
+ }
+ else
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "systemd_checkin: Adding new listener %s with fd %d...",
+ httpAddrString(&addr, s, sizeof(s)), fd);
+
+ if ((lis = calloc(1, sizeof(cupsd_listener_t))) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "systemd_checkin: Unable to allocate listener - "
+ "%s.", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ cupsArrayAdd(Listeners, lis);
+
+ memcpy(&lis->address, &addr, sizeof(lis->address));
+ }
+
+ lis->fd = fd;
+ lis->is_systemd = 1;
+
+# ifdef HAVE_SSL
+ if (_httpAddrPort(&(lis->address)) == 443)
+ lis->encryption = HTTP_ENCRYPT_ALWAYS;
+# endif /* HAVE_SSL */
+ }
+}
+#endif /* HAVE_SYSTEMD */
/*
* 'parent_handler()' - Catch USR1/CHLD signals...
diff -up cups-1.7.2/scheduler/Makefile.systemd-socket cups-1.7.2/scheduler/Makefile
--- cups-1.7.2/scheduler/Makefile.systemd-socket 2013-05-29 13:51:34.000000000 +0200
+++ cups-1.7.2/scheduler/Makefile 2014-04-17 14:05:04.108471960 +0200
@@ -381,7 +381,7 @@ cupsd: $(CUPSDOBJS) $(LIBCUPSMIME) ../cu
$(CC) $(LDFLAGS) -o cupsd $(CUPSDOBJS) -L. -lcupsmime \
$(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
$(LIBPAPER) $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBS) \
- $(LIBGSSAPI) $(LIBWRAP)
+ $(LIBGSSAPI) $(LIBWRAP) $(SDLIBS)
cupsd-static: $(CUPSDOBJS) libcupsmime.a ../cups/$(LIBCUPSSTATIC)
echo Linking $@...
@@ -389,7 +389,7 @@ cupsd-static: $(CUPSDOBJS) libcupsmime.a
$(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(LIBPAPER) \
$(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBGSSAPI) \
- $(LIBWRAP)
+ $(LIBWRAP) $(SDLIBS)
tls.o: tls-darwin.c tls-gnutls.c tls-openssl.c

View file

@ -13,18 +13,11 @@ post_upgrade() {
xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
fi
if [ "`vercmp $2 1.6.0`" -lt 0 ]; then
if [ "`vercmp $2 2.0.0-1`" -lt 0 ]; then
# important upgrade notice
echo "* avahi-daemon should now run before you start cupsd for"
echo " printer Browsing support"
echo "* check your config with cupsd -t"
echo " and fix all Browsing related settings"
fi
if [ "`vercmp $2 1.6.1-3`" -lt 0 ]; then
# important upgrade notice
echo "> It's now safe to load usblp kernel module."
echo "> There's no more need to blacklist it."
echo "> systemd unit names have been renamed"
echo "> you should systemctl stop and disable cups.service and"
echo "> systemctl daemon-reload, start and enable org.cups.cupsd.service"
fi
}

View file

@ -1,4 +1,5 @@
/var/log/cups/*_log {
missingok
notifempty
sharedscripts
}

View file

@ -1,19 +0,0 @@
Description: Fixed crash which sometimes happens on shutdown of the CUPS
daemon, caused by a wrong shutdown sequence for shutting down the Avahi
threaded poll.
Author: Till Kamppeter <till.kamppeter@gmail.com>
Bug-Upstream: http://cups.org/str.php?L4180
Bug-Upstream: http://cups.org/str.php?L4213
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1034045
Last-Updated: 2012-10-16
--- a/scheduler/dirsvc.c
+++ b/scheduler/dirsvc.c
@@ -1333,6 +1333,7 @@
DNSSDMaster = NULL;
# else /* HAVE_AVAHI */
+ avahi_threaded_poll_stop(DNSSDMaster);
avahi_client_free(DNSSDClient);
DNSSDClient = NULL;

View file

@ -1,31 +0,0 @@
Description: Applications could not get the PPD file for
statically-configured IPP-shared print queues
Author: Till Kamppeter <till.kamppeter@gmail.com>
Bug-Upstream: http://cups.org/str.php?L4178
Last-Updated: 2012-09-19
--- a/cups/util.c
+++ b/cups/util.c
@@ -1731,6 +1731,22 @@
return (1);
}
+ else if (device_uri &&
+ (!strncmp(device_uri, "ipp:", 4) != NULL ||
+ !strncmp(device_uri, "ipps:", 5) != NULL))
+ {
+ /*
+ * Statically-configured IPP shared printer.
+ */
+
+ httpSeparateURI(HTTP_URI_CODING_ALL,
+ device_uri,
+ scheme, sizeof(scheme), username, sizeof(username),
+ host, hostsize, port, resource, resourcesize);
+ ippDelete(response);
+
+ return (1);
+ }
else if ((attr = ippFindAttribute(response, "member-uris",
IPP_TAG_URI)) != NULL)
{

View file

@ -1,23 +0,0 @@
Description: If an external server is used via client.conf and the DNS is inconsistent (ex: DNS gives "noname" for many IPs, reverse DNS gives one of these IPs for "noname") local PPDs can get polled for print queues instead of the PPDs of the external server
Bug: http://www.cups.org/str.php?L2763
--- a/cups/util.c
+++ b/cups/util.c
@@ -1085,11 +1085,13 @@
http2 = http;
else if ((http2 = httpConnectEncrypt(hostname, port,
cupsEncryption())) == NULL)
- {
- DEBUG_puts("1cupsGetPPD3: Unable to connect to server");
+ if ((http2 = httpConnectEncrypt(http_hostname, http_port,
+ cupsEncryption())) == NULL)
+ {
+ DEBUG_puts("1cupsGetPPD3: Unable to connect to server");
- return (HTTP_SERVICE_UNAVAILABLE);
- }
+ return (HTTP_SERVICE_UNAVAILABLE);
+ }
/*
* Get a temp file...

26
extra/cups/str4495.patch Normal file
View file

@ -0,0 +1,26 @@
Index: conf/cups-files.conf.in
===================================================================
--- conf/cups-files.conf.in (revision 12220)
+++ conf/cups-files.conf.in (working copy)
@@ -15,6 +15,7 @@
#Group @CUPS_GROUP@
# Administrator user group, used to match @SYSTEM in cupsd.conf policy rules...
+# This cannot contain the Group value for security reasons...
SystemGroup @CUPS_SYSTEM_GROUPS@
@CUPS_SYSTEM_AUTHKEY@
Index: scheduler/conf.c
===================================================================
--- scheduler/conf.c (revision 12220)
+++ scheduler/conf.c (working copy)
@@ -995,6 +995,9 @@
cupsdLogMessage(CUPSD_LOG_NOTICE,
"Group and SystemGroup cannot use the same groups.");
+ if (FatalErrors & (CUPSD_FATAL_CONFIG | CUPSD_FATAL_PERMISSIONS))
+ return (0);
+
cupsdLogMessage(CUPSD_LOG_INFO, "Resetting Group to \"nobody\"...");
group = getgrnam("nobody");

43
extra/cups/str4497.patch Normal file
View file

@ -0,0 +1,43 @@
Index: scheduler/main.c
===================================================================
--- scheduler/main.c (revision 12213)
+++ scheduler/main.c (working copy)
@@ -763,6 +763,9 @@
if (timeout == 86400 && OnDemand && IdleExitTimeout &&
!cupsArrayCount(ActiveJobs) &&
+# ifdef HAVE_SYSTEMD
+ !WebInterface &&
+# endif /* HAVE_SYSTEMD */
(!Browsing || !BrowseLocalProtocols || !cupsArrayCount(Printers)))
{
timeout = IdleExitTimeout;
@@ -2114,8 +2117,12 @@
* jobs or shared printers to advertise...
*/
- if (cupsArrayCount(ActiveJobs) ||
+ if (cupsArrayCount(ActiveJobs) || /* Active jobs */
+# ifdef HAVE_SYSTEMD
+ WebInterface || /* Web interface enabled */
+# endif /* HAVE_SYSTEMD */
(Browsing && BrowseLocalProtocols && cupsArrayCount(Printers)))
+ /* Printers being shared */
{
cupsdLogMessage(CUPSD_LOG_DEBUG, "Creating keep-alive file \"" CUPS_KEEPALIVE "\".");
Index: scheduler/org.cups.cupsd.socket.in
===================================================================
--- scheduler/org.cups.cupsd.socket.in (revision 12213)
+++ scheduler/org.cups.cupsd.socket.in (working copy)
@@ -3,10 +3,6 @@
[Socket]
ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@
-ListenStream=[::1]:631
-ListenStream=127.0.0.1:631
-BindIPv6Only=ipv6-only
-ReusePort=true
[Install]
WantedBy=sockets.target

17
extra/cups/str4500.patch Normal file
View file

@ -0,0 +1,17 @@
diff -up cups-2.0.0/cups/util.c.str4500 cups-2.0.0/cups/util.c
--- cups-2.0.0/cups/util.c.str4500 2014-10-15 12:59:27.105942488 +0100
+++ cups-2.0.0/cups/util.c 2014-10-15 13:03:38.618187112 +0100
@@ -846,10 +846,10 @@ cupsGetPPD3(http_t *http, /* I - H
snprintf(ppdname, sizeof(ppdname), "%s/ppd/%s.ppd", cg->cups_serverroot,
name);
- if (!stat(ppdname, &ppdinfo))
+ if (!stat(ppdname, &ppdinfo) && !access(ppdname, R_OK))
{
/*
- * OK, the file exists, use it!
+ * OK, the file exists and is readable, use it!
*/
if (buffer[0])