Commit 319c5a16 authored by Xuetian Weng's avatar Xuetian Weng
Browse files

update cups and fix systemd service path

parent 758ff8f0
......@@ -2,88 +2,49 @@
pkgbase="cups"
pkgname=('libcups' 'cups')
pkgver=1.6.3
pkgrel=4
pkgver=2.0.0
pkgrel=1
arch=('x86_64')
license=('GPL')
url="http://www.cups.org/"
makedepends=('libtiff' 'libpng' 'acl' 'pam' 'xdg-utils' 'krb5' 'gnutls>=2.8.3' 'cups-filters' 'bc'
'colord' 'xinetd' 'gzip' 'autoconf' 'libusb' 'dbus-core' 'avahi' 'hicolor-icon-theme' 'systemd')
source=(http://www.cups.org/software/${pkgver}/cups-${pkgver}-source.tar.gz
makedepends=('libtiff>=4.0.0' 'libpng>=1.5.7' 'acl' 'pam' 'xdg-utils' 'krb5' 'gnutls>=2.8.3'
'cups-filters' 'bc' 'colord' 'xinetd' 'gzip' 'autoconf' 'libusb' 'dbus-core'
'avahi' 'hicolor-icon-theme' 'systemd' 'inetutils' 'libpaper' 'valgrind')
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-dbus-utf8.patch
cups-res_init.patch
cups-avahi-address.patch
cups-enum-all.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=('3c50d396fef2ba721224fe65880fe3c3'
'f861b18f4446c43918c8643dcbbd7f6d'
cups-1.6.0-fix-install-perms.patch)
md5sums=('2cdd81fea23e9e29555c24bdfd0d7c89'
'SKIP'
'fc8286f185e2cc5f7e1f6843bf193e2b'
'96f82c38f3f540b53f3e5144900acf17'
'9b8467a1e51d360096b70e2c3c081e6c'
'cc4101beccb5ed6deb1c92707a575925'
'3ba9e3410df1dc3015463d615ef91b3b'
'1beb4896f217bc241bc08a422274ec0c'
'90c30380d4c8cd48a908cfdadae1ea24'
'b4868b83f7f2d6ec24a1be76509379f0'
'dd97f8282cbfbab11b2dbec681d29ccb'
'8fe27d4248cacbc02824e7937cab4088'
'df0c367c0022e3c7d8e01827e8a6c5e7'
'f30c2a161caaf27854581507cde8cac6'
'5117f65342fcc69c6a506529e4daca9e'
'9247e218eea94ebda0aebc8ee0e77db8'
'cb58bf4e0b80eaee383712e5c84a1ab4'
'b578bcd17949a7203237ba1e31f78ef9'
'0becd6ab8782b97f19a02c1dc174c75e')
'451609db34f95209d64c38474de27ce1'
'5117f65342fcc69c6a506529e4daca9e')
prepare() {
cd ${pkgbase}-${pkgver}
# 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 -p1 -i ${srcdir}/cups-systemd-socket.patch
cd ${pkgbase}-${pkgver}
# improve build and linking
# Do not export SSL libs in cups-config
patch -p1 -i "${srcdir}/cups-no-export-ssllibs.patch"
patch -p1 -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 -p1 -i ${srcdir}/cups-no-gzip-man.patch
# various bugfixes (upstream reports/SVN or Fedora/Debian
# Ensure attributes are valid UTF-8 in dbus notifier
patch -p1 -i ${srcdir}/cups-dbus-utf8.patch
# 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 -p1 -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 -p1 -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 -p1 -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
patch -Np1 -i ${srcdir}/cups-no-gzip-man.patch
# move /var/run -> /run for pid file
patch -p1 -i ${srcdir}/cups-1.6.2-statedir.patch
# Re-initialise the resolver on failure in httpAddrGetList()
patch -p1 -i ${srcdir}/cups-res_init.patch
# Use IP address when resolving DNSSD URIs
patch -p1 -i ${srcdir}/cups-avahi-address.patch
# Return from cupsEnumDests() once all records have been returned.
patch -p1 -i ${srcdir}/cups-enum-all.patch
patch -Np1 -i ${srcdir}/cups-1.6.2-statedir.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
# Rebuild configure script for not zipping man-pages.
aclocal -I config-scripts
......@@ -91,35 +52,39 @@ prepare() {
}
build() {
cd ${srcdir}/${pkgbase}-${pkgver}
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
cd ${pkgbase}-${pkgver}
./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 \
--with-cups-group=lp \
--with-xinetd=no \
--enable-pam=yes \
--enable-raw-printing \
--enable-webif \
--enable-relro \
--enable-dbus --with-dbusdir=/etc/dbus-1 \
--enable-ssl=yes --enable-gnutls \
--enable-ssl=yes \
--enable-threads \
--enable-avahi\
--enable-libpaper \
--with-php=/usr/bin/php-cgi \
--with-optim="$CFLAGS"
make
}
check() {
cd ${pkgbase}-${pkgver}
#make -k check || /bin/true
}
package_libcups() {
pkgdesc="The CUPS Printing System - client libraries and headers"
depends=('gnutls>=2.8.3' 'libtiff>=4.0.0' 'libpng>=1.5.7' 'krb5' 'avahi')
depends=('gnutls>=2.8.3' 'libtiff>=4.0.0' 'libpng>=1.5.7' 'krb5' 'avahi' 'libusb')
backup=(etc/cups/client.conf)
cd ${srcdir}/${pkgbase}-${pkgver}
cd ${pkgbase}-${pkgver}
make BUILDROOT=${pkgdir} install-headers install-libs
# put this into the libs pkg to make other software find the libs(no pkg-config file included)
mkdir -p ${pkgdir}/usr/bin
......@@ -128,11 +93,11 @@ backup=(etc/cups/client.conf)
# install client.conf man page and config file
install -dm755 ${pkgdir}/usr/share/man/man5
install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5 ${pkgdir}/usr/share/man/man5/
install -dm755 ${pkgdir}/etc/cups
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
chgrp lp ${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
}
package_cups() {
......@@ -146,11 +111,13 @@ backup=(etc/cups/cupsd.conf
etc/cups/subscriptions.conf
etc/dbus-1/system.d/cups.conf
etc/logrotate.d/cups
etc/pam.d/cups)
depends=('acl' 'pam' "libcups>=${pkgver}" 'cups-filters' 'bc' 'colord' 'libusb' 'dbus-core' 'systemd' 'hicolor-icon-theme')
etc/pam.d/cups
etc/xinetd.d/cups-lpd)
depends=('acl' 'pam' "libcups>=${pkgver}" 'cups-filters' 'bc' 'colord'
'dbus-core' 'systemd' 'libpaper' 'hicolor-icon-theme')
optdepends=('xdg-utils: xdg .desktop file support')
cd ${srcdir}/${pkgbase}-${pkgver}
cd ${pkgbase}-${pkgver}
make BUILDROOT=${pkgdir} install-data install-exec
# this one we ship in the libcups pkg
......@@ -168,14 +135,14 @@ optdepends=('xdg-utils: xdg .desktop file support')
# install ssl directory where to store the certs, solves some samba issues
install -dm700 -g lp ${pkgdir}/etc/cups/ssl
# remove directory from package, we create it in cups rc.d file
rm -rf ${pkgdir}/var/run
# remove directory from package, it will be recreated at each server start
rm -rf ${pkgdir}/run
# install some more configuration files that will get filled by cupsd
touch ${pkgdir}/etc/cups/printers.conf
touch ${pkgdir}/etc/cups/classes.conf
touch ${pkgdir}/etc/cups/subscriptions.conf
chgrp lp ${pkgdir}/etc/cups/{printers.conf,classes.conf,subscriptions.conf}
chgrp -R lp ${pkgdir}/etc/cups
# fix .desktop file
sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' ${pkgdir}/usr/share/applications/cups.desktop
......@@ -190,8 +157,6 @@ optdepends=('xdg-utils: xdg .desktop file support')
rm -v ${pkgdir}/usr/share/cups/banners/*
rm -v ${pkgdir}/usr/share/cups/data/testprint
# comment out all conversion rules which use any of the removed filters
perl -p -i -e 's:^(.*\s+bannertops\s*)$:#\1:' /usr/share/cups/mime/mime.convs
perl -p -i -e 's:^(.*\s+bannertops\s*)$:#\1:' $pkgdir/usr/share/cups/mime/mime.convs
# Provide native service
ln -s cups.service "$pkgdir/usr/lib/systemd/system/cupsd.service"
}
diff -up cups-1.6b1/Makedefs.in.0755 cups-1.6b1/Makedefs.in
--- cups-1.6b1/Makedefs.in.0755 2012-05-23 01:58:31.000000000 +0200
+++ cups-1.6b1/Makedefs.in 2012-05-25 16:09:40.545463214 +0200
@@ -40,14 +40,14 @@ SHELL = /bin/sh
# Installation programs...
#
-INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
+INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
INSTALL_COMPDATA = $(INSTALL) -c -m 444 @INSTALL_GZIP@
INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -c -m 444
INSTALL_DIR = $(INSTALL) -d
-INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
+INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
INSTALL_MAN = $(INSTALL) -c -m 444
-INSTALL_SCRIPT = $(INSTALL) -c -m 555
+INSTALL_SCRIPT = $(INSTALL) -c -m 755
#
# Default user, group, and system groups for the scheduler...
diff -ruN cups-1.6.2.orig/config-scripts/cups-directories.m4 cups-1.6.2/config-scripts/cups-directories.m4
--- cups-1.6.2.orig/config-scripts/cups-directories.m4 2012-10-01 03:55:23.000000000 +0200
+++ cups-1.6.2/config-scripts/cups-directories.m4 2013-04-02 00:11:41.000000000 +0200
@@ -429,7 +429,7 @@
;;
*)
# All others
- CUPS_STATEDIR="$localstatedir/run/cups"
+ CUPS_STATEDIR="/run/cups"
;;
esac
@@ -420,7 +420,7 @@
;;
*)
# All others
- CUPS_STATEDIR="$localstatedir/run/cups"
+ CUPS_STATEDIR="/run/cups"
;;
esac])
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
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;
}
/*
diff -up cups-1.6.1/notifier/dbus.c.dbus-utf8 cups-1.6.1/notifier/dbus.c
--- cups-1.6.1/notifier/dbus.c.dbus-utf8 2012-01-20 19:00:32.000000000 +0000
+++ cups-1.6.1/notifier/dbus.c 2012-10-31 11:04:47.686973616 +0000
@@ -31,6 +31,9 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <assert.h>
+#include <locale.h>
+#include <wchar.h>
#ifdef HAVE_DBUS
# include <dbus/dbus.h>
@@ -157,10 +160,82 @@ enum
* Local functions...
*/
-static int acquire_lock(int *fd, char *lockfile, size_t locksize);
+static int acquire_lock(int *fd, char *lockfile, size_t locksize);
+static const char *validate_utf8(const char *str);
/*
+ * 'validate_utf8()' - Convert to valid UTF-8
+ */
+
+static const char *
+validate_utf8 (const char *str)
+{
+ static char *buffer = NULL;
+ static size_t buflen = 0;
+ char *p;
+ size_t str_len;
+ unsigned int i;
+ mbstate_t instate, outstate;
+
+ if (str == NULL)
+ {
+ free (buffer);
+ return (NULL);
+ }
+
+ /* Is it already valid? */
+ if (mbstowcs (NULL, str, 0) != (size_t) -1)
+ return str;
+
+ /* Make sure our buffer is at least as large as the input string */
+ str_len = strlen (str);
+ if (str_len > buflen)
+ {
+ if (buffer == NULL)
+ /* Set encoding type to UTF-8 the first time we need to */
+ setlocale (LC_CTYPE, "en_US.UTF-8");
+
+ buflen = str_len + 1;
+ buffer = realloc (buffer, buflen);
+ }
+
+ memset (&instate, '\0', sizeof (mbstate_t));
+ memset (&outstate, '\0', sizeof (mbstate_t));
+ p = buffer;
+ i = 0;
+ while (i < str_len)
+ {
+ wchar_t wc;
+ size_t used, written;
+ mbstate_t orig_instate = instate;
+ used = mbrtowc (&wc, str + i, str_len - i, &instate);
+ switch (used)
+ {
+ case (size_t) -2:
+ case (size_t) -1:
+ wc = L'?'; /* so replacement is never longer than original char */
+ instate = orig_instate;
+ /* fallthru */
+ case 0:
+ used = 1;
+ }
+
+ written = wcrtomb (p, wc, &outstate);
+ if (written != -1)
+ {
+ p += written;
+ assert (p - buffer < buflen);
+ }
+
+ i += used;
+ }
+
+ *p = '\0';
+ return buffer;
+}
+
+/*
* 'main()' - Read events and send DBUS notifications.
*/
@@ -366,7 +441,7 @@ main(int argc, /* I - Number of comm
attr = ippFindAttribute(msg, "notify-text", IPP_TAG_TEXT);
if (attr)
{
- const char *val = ippGetString(attr, 0, NULL);
+ const char *val = validate_utf8 (ippGetString(attr, 0, NULL));
if (!dbus_message_iter_append_string(&iter, &val))
goto bail;
}
@@ -530,7 +605,7 @@ main(int argc, /* I - Number of comm
attr = ippFindAttribute(msg, "job-name", IPP_TAG_NAME);
if (attr)
{
- const char *val = ippGetString(attr, 0, NULL);
+ const char *val = validate_utf8 (ippGetString(attr, 0, NULL));
if (!dbus_message_iter_append_string(&iter, &val))
goto bail;
}
diff -up cups-1.5b1/backend/usb-unix.c.direct-usb cups-1.5b1/backend/usb-unix.c
--- cups-1.5b1/backend/usb-unix.c.direct-usb 2011-05-20 05:49:49.000000000 +0200
+++ cups-1.5b1/backend/usb-unix.c 2011-05-23 17:52:14.000000000 +0200
@@ -102,6 +102,9 @@ print_device(const char *uri, /* I - De
_cups_strncasecmp(hostname, "Minolta", 7);
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
+ if (use_bc && !strncmp(uri, "usb:/dev/", 9))
+ use_bc = 0;
+
if ((device_fd = open_device(uri, &use_bc)) == -1)
{
if (getenv("CLASS") != NULL)
@@ -331,12 +334,7 @@ open_device(const char *uri, /* I - Dev
if (!strncmp(uri, "usb:/dev/", 9))
#ifdef __linux
{
- /*
- * Do not allow direct devices anymore...
- */
-
- errno = ENODEV;
- return (-1);
+ return (open(uri + 4, O_RDWR | O_EXCL));
}
else if (!strncmp(uri, "usb://", 6))
{
diff -up cups-1.6b1/backend/dnssd.c.dnssd-deviceid cups-1.6b1/backend/dnssd.c
--- cups-1.6b1/backend/dnssd.c.dnssd-deviceid 2012-05-21 18:05:58.000000000 +0200
+++ cups-1.6b1/backend/dnssd.c 2012-05-25 16:27:49.226874427 +0200
@@ -1181,15 +1181,22 @@ query_callback(
if (device->device_id)
free(device->device_id);
+ if (device_id[0])
+ {
+ /* Mark this as the real device ID. */
+ ptr = device_id + strlen(device_id);
+ snprintf(ptr, sizeof(device_id) - (ptr - device_id), "FZY:0;");
+ }
+
if (!device_id[0] && strcmp(model, "Unknown"))
{
if (make_and_model[0])
- snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;",
+ snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;FZY:1;",
make_and_model, model);
else if (!_cups_strncasecmp(model, "designjet ", 10))
- snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s", model + 10);
+ snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s;FZY:1;", model + 10);
else if (!_cups_strncasecmp(model, "stylus ", 7))
- snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s", model + 7);
+ snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s;FZY:1;", model + 7);
else if ((ptr = strchr(model, ' ')) != NULL)
{
/*
@@ -1199,7 +1206,7 @@ query_callback(
memcpy(make_and_model, model, ptr - model);
make_and_model[ptr - model] = '\0';
- snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s",
+ snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;FZY:1;",
make_and_model, ptr + 1);
}
}
diff -up cups-1.5.0/scheduler/ipp.c.driverd-timeout cups-1.5.0/scheduler/ipp.c
--- cups-1.5.0/scheduler/ipp.c.driverd-timeout 2011-10-10 17:03:41.801690962 +0100
+++ cups-1.5.0/scheduler/ipp.c 2011-10-10 17:03:41.861689834 +0100
@@ -5723,7 +5723,7 @@ copy_model(cupsd_client_t *con, /* I -
close(temppipe[1]);
/*
- * 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;
@@ -5743,7 +5743,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 -up cups-1.5.3/backend/ipp.c.eggcups cups-1.5.3/backend/ipp.c
--- cups-1.5.3/backend/ipp.c.eggcups 2012-05-05 01:00:01.000000000 +0200
+++ cups-1.5.3/backend/ipp.c 2012-05-15 16:50:41.142868986 +0200
@@ -138,6 +138,70 @@ static cups_array_t *state_reasons; /* A
static char tmpfilename[1024] = "";
/* Temporary spool file name */
+#if HAVE_DBUS
+#include <dbus/dbus.h>
+
+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...
@@ -1520,6 +1584,15 @@ main(int argc, /* I - Number of comm
_("Print file accepted - job ID %d."), job_id);
}