summaryrefslogtreecommitdiff
path: root/testing/cups
diff options
context:
space:
mode:
Diffstat (limited to 'testing/cups')
-rw-r--r--testing/cups/PKGBUILD174
-rw-r--r--testing/cups/PKGBUILD.16146
-rw-r--r--testing/cups/avahi-missing-in-conditionals.patch118
-rwxr-xr-xtesting/cups/cups68
-rw-r--r--testing/cups/cups-avahi-1-config.patch42
-rw-r--r--testing/cups/cups-avahi-2-backend.patch1118
-rw-r--r--testing/cups/cups-avahi-3-timeouts.patch381
-rw-r--r--testing/cups/cups-avahi-4-poll.patch529
-rw-r--r--testing/cups/cups-avahi-5-services.patch1272
-rw-r--r--testing/cups/cups-no-export-ssllibs.patch12
-rw-r--r--testing/cups/cups-no-gcrypt.patch38
-rw-r--r--testing/cups/cups-no-gzip-man.patch18
-rw-r--r--testing/cups/cups-no-gzip-man.patch.1618
-rw-r--r--testing/cups/cups-systemd-socket.patch395
-rw-r--r--testing/cups/cups.install38
-rw-r--r--testing/cups/cups.logrotate8
-rw-r--r--testing/cups/cups.pam3
-rw-r--r--testing/cups/cupsd-conf-remove-obsolete-browse-directives.patch12
-rw-r--r--testing/cups/recognize-remote-cups-queue-via-dnssd-uri.patch25
-rw-r--r--testing/cups/usb-backend-reset-after-job-only-for-specific-devices.patch74
20 files changed, 0 insertions, 4489 deletions
diff --git a/testing/cups/PKGBUILD b/testing/cups/PKGBUILD
deleted file mode 100644
index 12273883e..000000000
--- a/testing/cups/PKGBUILD
+++ /dev/null
@@ -1,174 +0,0 @@
-# $Id: PKGBUILD 165915 2012-09-03 20:05:26Z heftig $
-# Maintainer: Andreas Radke <andyrtr@archlinux.org>
-
-pkgbase="cups"
-pkgname=('libcups' 'cups')
-pkgver=1.6.1
-pkgrel=6
-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' 'gnutls>=2.8.3' 'cups-filters' 'bc'
- 'colord' 'xinetd' 'gzip' 'autoconf' 'libusb' 'dbus-core' 'avahi' 'hicolor-icon-theme' 'systemd')
-source=(ftp://ftp.easysw.com/pub/cups/${pkgver}/cups-${pkgver}-source.tar.bz2
- cups-no-export-ssllibs.patch
- cups-no-gcrypt.patch
- cups-no-gzip-man.patch
- cups-systemd-socket.patch
- cups cups.logrotate cups.pam
- cupsd-conf-remove-obsolete-browse-directives.patch
- avahi-missing-in-conditionals.patch
- recognize-remote-cups-queue-via-dnssd-uri.patch
- usb-backend-reset-after-job-only-for-specific-devices.patch)
-#options=('!emptydirs')
-md5sums=('87ade07e3d1efd03c9c3add949cf9c00'
- '9b8467a1e51d360096b70e2c3c081e6c'
- '3733c23e77eb503bd94cc368e02830dc'
- '90c30380d4c8cd48a908cfdadae1ea24'
- 'b4868b83f7f2d6ec24a1be76509379f0'
- '9657daa21760bb0b5fa3d8b51d5e01a1'
- 'f861b18f4446c43918c8643dcbbd7f6d'
- '96f82c38f3f540b53f3e5144900acf17'
- '6bef262b5081051e88cd2ae94fed1867'
- '9c91b1319f4b20dc323986cb4abbe806'
- 'dcef8dd5614461166cada8a706eebb49'
- '0779ef8ba1d724ebb3b9bf360deba52b')
-
-build() {
- cd ${srcdir}/${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 -Np1 -i ${srcdir}/cups-systemd-socket.patch
-
- # 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"
- # don't zip man pages in make install, let makepkg do that / Fedora
- patch -Np1 -i ${srcdir}/cups-no-gzip-man.patch
-
- # upstream bugtracker patches
- # http://www.cups.org/str.php?L4157 - fix broken default server config
- patch -Np1 -i ${srcdir}/cupsd-conf-remove-obsolete-browse-directives.patch
- # http://www.cups.org/str.php?L4156 - In many DNS-SD/Bonjour conditionals Avahi is not considered
- patch -Np1 -i ${srcdir}/avahi-missing-in-conditionals.patch
- # http://www.cups.org/str.php?L4158 - DNS-SD-based print queues pointing to CUPS server are not considered remote printers with driver on server
- patch -Np1 -i ${srcdir}/recognize-remote-cups-queue-via-dnssd-uri.patch
- # http://cups.org/str.php?L4155 / https://bugs.archlinux.org/task/30965
- patch -Np0 -i ${srcdir}/usb-backend-reset-after-job-only-for-specific-devices.patch
-
- # Rebuild configure script for not zipping man-pages.
- aclocal -I config-scripts
- autoconf -I config-scripts
-
- ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
- --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 \
- --enable-pam=yes \
- --enable-raw-printing \
- --enable-dbus --with-dbusdir=/etc/dbus-1 \
- --enable-ssl=yes --enable-gnutls \
- --enable-threads \
- --enable-avahi\
- --with-php=/usr/bin/php-cgi \
- --with-optim="$CFLAGS"
- make
-}
-
-check() {
- cd "$srcdir/$pkgbase-$pkgver"
- #httpAddrGetList(workstation64): FAIL
- #1 TESTS FAILED!
- #make[1]: *** [testhttp] Error 1
- 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')
-backup=(etc/cups/client.conf)
-
- cd ${srcdir}/${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
- install -m755 ${srcdir}/${pkgbase}-${pkgver}/cups-config ${pkgdir}/usr/bin/cups-config
-
- # install client.conf man page and config file
- install -dm755 ${pkgdir}/usr/share/man/man5
- #install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5.gz ${pkgdir}/usr/share/man/man5/
- install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5 ${pkgdir}/usr/share/man/man5/
- install -dm755 ${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
-}
-
-package_cups() {
-pkgdesc="The CUPS Printing System - daemon package"
-install=cups.install
-backup=(etc/cups/cupsd.conf
- etc/cups/snmp.conf
- etc/cups/printers.conf
- etc/cups/classes.conf
- etc/cups/subscriptions.conf
- etc/dbus-1/system.d/cups.conf
- etc/logrotate.d/cups
- etc/pam.d/cups
- etc/xinetd.d/cups-lpd)
-depends=('acl' 'pam' "libcups>=${pkgver}" 'cups-filters' 'bc' 'colord' 'libusb' 'dbus-core' 'libsystemd' 'hicolor-icon-theme')
-optdepends=('xdg-utils: xdg .desktop file support')
-
- cd ${srcdir}/${pkgbase}-${pkgver}
- make BUILDROOT=${pkgdir} install-data install-exec
-
- # this one we ship in the libcups pkg
- rm -f ${pkgdir}/usr/bin/cups-config
-
- # kill the sysv stuff
- rm -rf ${pkgdir}/etc/rc*.d
- rm -rf ${pkgdir}/etc/init.d
- install -D -m755 ../cups ${pkgdir}/etc/rc.d/cupsd
- install -D -m644 ../cups.logrotate ${pkgdir}/etc/logrotate.d/cups
- install -D -m644 ../cups.pam ${pkgdir}/etc/pam.d/cups
-
- # fix perms on /var/spool and /etc
- chmod 755 ${pkgdir}/var/spool
- chmod 755 ${pkgdir}/etc
-
- # 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
-
- # 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}
-
- # fix .desktop file
- sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' ${pkgdir}/usr/share/applications/cups.desktop
-
- # compress some driver files, adopted from Fedora
- find ${pkgdir}/usr/share/cups/model -name "*.ppd" | xargs gzip -n9f
-
- # remove client.conf man page
- rm -f ${pkgdir}/usr/share/man/man5/client.conf.5
-
- # remove files now part of cups-filters
- 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
-
- # Provide native service for arch-daemons generator
- ln -s cups.service "$pkgdir/usr/lib/systemd/system/cupsd.service"
-}
diff --git a/testing/cups/PKGBUILD.16 b/testing/cups/PKGBUILD.16
deleted file mode 100644
index 01faba047..000000000
--- a/testing/cups/PKGBUILD.16
+++ /dev/null
@@ -1,146 +0,0 @@
-# $Id: PKGBUILD 159509 2012-05-25 16:34:34Z andyrtr $
-# Maintainer: Andreas Radke <andyrtr@archlinux.org>
-
-pkgbase="cups"
-pkgname=('libcups' 'cups')
-pkgver=1.6b1
-pkgrel=1
-arch=('i686' 'x86_64')
-license=('GPL')
-url="http://www.cups.org/"
-makedepends=('libtiff>=4.0.0' 'libpng>=1.5.7' 'acl' 'openslp' 'pam' 'xdg-utils' 'krb5' 'gnutls>=2.8.3' 'cups-filters' 'bc' 'colord'
- 'xinetd' 'gzip' 'autoconf' 'libusb' 'dbus-core' 'avahi' 'hicolor-icon-theme')
-source=(ftp://ftp.easysw.com/pub/cups/${pkgver}/cups-${pkgver}-source.tar.bz2
- cups-no-export-ssllibs.patch
- cups-no-gcrypt.patch
- cups-no-gzip-man.patch
- cups cups.logrotate cups.pam)
-#options=('!emptydirs')
-md5sums=('468a40755a872d84be89111ce97a69d1'
- '9b8467a1e51d360096b70e2c3c081e6c'
- '3733c23e77eb503bd94cc368e02830dc'
- '90c30380d4c8cd48a908cfdadae1ea24'
- '9657daa21760bb0b5fa3d8b51d5e01a1'
- 'f861b18f4446c43918c8643dcbbd7f6d'
- '96f82c38f3f540b53f3e5144900acf17')
-
-build() {
- cd ${srcdir}/${pkgbase}-${pkgver}
-
- # 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"
- # don't zip man pages in make install, let makepkg do that / Fedora
- patch -Np1 -i ${srcdir}/cups-no-gzip-man.patch
-
- # Rebuild configure script for not zipping man-pages.
- aclocal -I config-scripts
- autoconf -I config-scripts
-
- ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
- --libdir=/usr/lib \
- --with-logdir=/var/log/cups \
- --with-docdir=/usr/share/cups/doc \
- --with-cups-user=daemon \
- --with-cups-group=lp \
- --enable-pam=yes \
- --enable-raw-printing \
- --enable-dbus --with-dbusdir=/etc/dbus-1 \
- --enable-ssl=yes --enable-gnutls \
- --enable-threads \
- --enable-avahi\
- --with-php=/usr/bin/php-cgi \
- --with-optim="$CFLAGS"
- make
-}
-
-check() {
- cd "$srcdir/$pkgbase-$pkgver"
- #httpAddrGetList(workstation64): FAIL
- #1 TESTS FAILED!
- #make[1]: *** [testhttp] Error 1
- 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')
-backup=(etc/cups/client.conf)
-
- cd ${srcdir}/${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
- install -m755 ${srcdir}/${pkgbase}-${pkgver}/cups-config ${pkgdir}/usr/bin/cups-config
-
- # install client.conf man page and config file
- install -dm755 ${pkgdir}/usr/share/man/man5
- #install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5.gz ${pkgdir}/usr/share/man/man5/
- install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/man/client.conf.5 ${pkgdir}/usr/share/man/man5/
- install -dm755 ${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
-}
-
-package_cups() {
-pkgdesc="The CUPS Printing System - daemon package"
-install=cups.install
-backup=(etc/cups/cupsd.conf
- etc/cups/snmp.conf
- etc/cups/printers.conf
- etc/cups/classes.conf
- etc/cups/subscriptions.conf
- etc/dbus-1/system.d/cups.conf
- etc/logrotate.d/cups
- etc/pam.d/cups
- etc/xinetd.d/cups-lpd)
-depends=('acl' 'openslp' 'pam' "libcups>=${pkgver}" 'cups-filters' 'bc' 'libusb' 'dbus-core' 'hicolor-icon-theme')
-optdepends=('xdg-utils: xdg .desktop file support')
-
- cd ${srcdir}/${pkgbase}-${pkgver}
- make BUILDROOT=${pkgdir} install-data install-exec
-
- # this one we ship in the libcups pkg
- rm -f ${pkgdir}/usr/bin/cups-config
-
- # kill the sysv stuff
- rm -rf ${pkgdir}/etc/rc*.d
- rm -rf ${pkgdir}/etc/init.d
- install -D -m755 ../cups ${pkgdir}/etc/rc.d/cupsd
- install -D -m644 ../cups.logrotate ${pkgdir}/etc/logrotate.d/cups
- install -D -m644 ../cups.pam ${pkgdir}/etc/pam.d/cups
-
- # fix perms on /var/spool and /etc
- chmod 755 ${pkgdir}/var/spool
- chmod 755 ${pkgdir}/etc
-
- # 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
-
- # 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}
-
- # fix .desktop file
- sed -i 's|^Exec=htmlview http://localhost:631/|Exec=xdg-open http://localhost:631/|g' ${pkgdir}/usr/share/applications/cups.desktop
-
- # compress some driver files, adopted from Fedora
- find ${pkgdir}/usr/share/cups/model -name "*.ppd" | xargs gzip -n9f
-
- # remove client.conf man page
- rm -f ${pkgdir}/usr/share/man/man5/client.conf.5
-
- # remove files now part of cups-filters
- rm -v ${pkgdir}/usr/lib/cups/filter/bannertops
- 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
-}
diff --git a/testing/cups/avahi-missing-in-conditionals.patch b/testing/cups/avahi-missing-in-conditionals.patch
deleted file mode 100644
index b261f58ae..000000000
--- a/testing/cups/avahi-missing-in-conditionals.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-diff -uraN cups/scheduler/client.c cups-new/scheduler/client.c
---- cups/scheduler/client.c 2012-05-25 15:28:49.000000000 +0200
-+++ cups-new/scheduler/client.c 2012-08-04 20:13:17.082220961 +0200
-@@ -4021,7 +4021,7 @@
- !strncmp(host, "[::1]:", 6));
- }
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- /*
- * Check if the hostname is something.local (Bonjour); if so, allow it.
- */
-@@ -4040,7 +4040,7 @@
- !_cups_strcasecmp(end, ".local.") ||
- !_cups_strncasecmp(end, ".local.:", 8)))
- return (1);
--#endif /* HAVE_DNSSD */
-+#endif /* HAVE_DNSSD || HAVE_AVAHI */
-
- /*
- * Check if the hostname is an IP address...
-@@ -4101,7 +4101,7 @@
- }
- }
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- for (a = (cupsd_alias_t *)cupsArrayFirst(DNSSDAlias);
- a;
- a = (cupsd_alias_t *)cupsArrayNext(DNSSDAlias))
-@@ -4126,7 +4126,7 @@
- return (1);
- }
- }
--#endif /* HAVE_DNSSD */
-+#endif /* HAVE_DNSSD || HAVE_AVAHI */
-
- /*
- * Check for interface hostname matches...
-diff -uraN cups/scheduler/conf.c cups-new/scheduler/conf.c
---- cups/scheduler/conf.c 2012-05-25 15:28:49.000000000 +0200
-+++ cups-new/scheduler/conf.c 2012-08-04 20:15:49.830978405 +0200
-@@ -89,9 +89,9 @@
- {
- { "AccessLog", &AccessLog, CUPSD_VARTYPE_STRING },
- { "AutoPurgeJobs", &JobAutoPurge, CUPSD_VARTYPE_BOOLEAN },
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- { "BrowseDNSSDSubTypes", &DNSSDSubTypes, CUPSD_VARTYPE_STRING },
--#endif /* HAVE_DNSSD */
-+#endif /* HAVE_DNSSD || HAVE_AVAHI */
- { "BrowseWebIF", &BrowseWebIF, CUPSD_VARTYPE_BOOLEAN },
- { "Browsing", &Browsing, CUPSD_VARTYPE_BOOLEAN },
- { "CacheDir", &CacheDir, CUPSD_VARTYPE_STRING },
-@@ -735,9 +735,9 @@
- Browsing = CUPS_DEFAULT_BROWSING;
- DefaultShared = CUPS_DEFAULT_DEFAULT_SHARED;
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- cupsdSetString(&DNSSDSubTypes, "_cups,_print");
--#endif /* HAVE_DNSSD */
-+#endif /* HAVE_DNSSD || HAVE_AVAHI */
-
- cupsdSetString(&LPDConfigFile, CUPS_DEFAULT_LPD_CONFIG_FILE);
- cupsdSetString(&SMBConfigFile, CUPS_DEFAULT_SMB_CONFIG_FILE);
-diff -uraN cups/scheduler/ipp.c cups-new/scheduler/ipp.c
---- cups/scheduler/ipp.c 2012-05-25 15:28:49.000000000 +0200
-+++ cups-new/scheduler/ipp.c 2012-08-04 20:13:17.086220978 +0200
-@@ -4813,7 +4813,7 @@
- ippAddDate(con->response, IPP_TAG_PRINTER, "printer-current-time",
- ippTimeToDate(curtime));
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- if (!ra || cupsArrayFind(ra, "printer-dns-sd-name"))
- {
- if (printer->reg_name)
-@@ -4823,7 +4823,7 @@
- ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_NOVALUE,
- "printer-dns-sd-name", 0);
- }
--#endif /* HAVE_DNSSD */
-+#endif /* HAVE_DNSSD || HAVE_AVAHI */
-
- if (!ra || cupsArrayFind(ra, "printer-error-policy"))
- ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_NAME,
-diff -uraN cups/scheduler/main.c cups-new/scheduler/main.c
---- cups/scheduler/main.c 2012-05-25 15:28:49.000000000 +0200
-+++ cups-new/scheduler/main.c 2012-08-04 20:13:17.090221001 +0200
-@@ -781,9 +781,9 @@
- * Got an error from select!
- */
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- cupsd_printer_t *p; /* Current printer */
--#endif /* HAVE_DNSSD */
-+#endif /* HAVE_DNSSD || HAVE_AVAHI */
-
-
- if (errno == EINTR) /* Just interrupted by a signal */
-@@ -824,13 +824,13 @@
- job->print_pipes[0], job->print_pipes[1],
- job->back_pipes[0], job->back_pipes[1]);
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
- p;
- p = (cupsd_printer_t *)cupsArrayNext(Printers))
- cupsdLogMessage(CUPSD_LOG_EMERG, "printer[%s] reg_name=\"%s\"", p->name,
- p->reg_name ? p->reg_name : "(null)");
--#endif /* HAVE_DNSSD */
-+#endif /* HAVE_DNSSD || HAVE_AVAHI */
-
- break;
- }
diff --git a/testing/cups/cups b/testing/cups/cups
deleted file mode 100755
index 744c8e663..000000000
--- a/testing/cups/cups
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-
-daemon_name=cupsd
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-#. /etc/conf.d/$daemon_name.conf
-
-get_pid() {
- pidof -o %PPID $daemon_name
-}
-
-case "$1" in
- start)
- stat_busy "Starting $daemon_name daemon"
-
- PID=$(get_pid)
- if [ -z "$PID" ]; then
- [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
- # RUN
- $daemon_name
- #
- if [ $? -gt 0 ]; then
- stat_fail
- exit 1
- else
- echo $(get_pid) > /var/run/$daemon_name.pid
- add_daemon $daemon_name
- stat_done
- fi
- else
- stat_fail
- exit 1
- fi
- ;;
-
- stop)
- stat_busy "Stopping $daemon_name daemon"
- PID=$(get_pid)
- # KILL
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- #
- if [ $? -gt 0 ]; then
- stat_fail
- exit 1
- else
- rm -f /var/run/$daemon_name.pid &> /dev/null
- rm_daemon $daemon_name
- stat_done
- fi
- ;;
-
- restart)
- $0 stop
- sleep 3
- $0 start
- ;;
-
- status)
- stat_busy "Checking $daemon_name status";
- ck_status $daemon_name
- ;;
-
- *)
- echo "usage: $0 {start|stop|restart|status}"
-esac
-
-exit 0
diff --git a/testing/cups/cups-avahi-1-config.patch b/testing/cups/cups-avahi-1-config.patch
deleted file mode 100644
index 304cd2607..000000000
--- a/testing/cups/cups-avahi-1-config.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff -up cups-1.5.2/config.h.in.avahi-1-config cups-1.5.2/config.h.in
---- cups-1.5.2/config.h.in.avahi-1-config 2011-06-16 21:12:16.000000000 +0100
-+++ cups-1.5.2/config.h.in 2012-03-14 15:04:51.365347165 +0000
-@@ -390,6 +390,13 @@
-
-
- /*
-+ * Do we have Avahi for DNS Service Discovery?
-+ */
-+
-+#undef HAVE_AVAHI
-+
-+
-+/*
- * Do we have <sys/ioctl.h>?
- */
-
-diff -up cups-1.5.2/config-scripts/cups-dnssd.m4.avahi-1-config cups-1.5.2/config-scripts/cups-dnssd.m4
---- cups-1.5.2/config-scripts/cups-dnssd.m4.avahi-1-config 2011-05-12 06:21:56.000000000 +0100
-+++ cups-1.5.2/config-scripts/cups-dnssd.m4 2012-03-14 15:04:51.365347165 +0000
-@@ -23,6 +23,21 @@ AC_ARG_WITH(dnssd-includes, [ --with-dn
- DNSSDLIBS=""
- DNSSD_BACKEND=""
-
-+AC_ARG_ENABLE(avahi, [ --enable-avahi turn on DNS Service Discovery support, default=no],
-+ [if test x$enable_avahi = xyes; then
-+ AC_MSG_CHECKING(for Avahi)
-+ if $PKGCONFIG --exists avahi-client; then
-+ AC_MSG_RESULT(yes)
-+ CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`"
-+ DNSSDLIBS="`$PKGCONFIG --libs avahi-client`"
-+ DNSSD_BACKEND="dnssd"
-+ AC_DEFINE(HAVE_AVAHI)
-+ enable_dnssd=no
-+ else
-+ AC_MSG_RESULT(no)
-+ fi
-+ fi])
-+
- if test x$enable_dnssd != xno; then
- AC_CHECK_HEADER(dns_sd.h, [
- case "$uname" in \ No newline at end of file
diff --git a/testing/cups/cups-avahi-2-backend.patch b/testing/cups/cups-avahi-2-backend.patch
deleted file mode 100644
index 00e12a0a3..000000000
--- a/testing/cups/cups-avahi-2-backend.patch
+++ /dev/null
@@ -1,1118 +0,0 @@
-diff -up cups-1.5.3/backend/dnssd.c.avahi-2-backend cups-1.5.3/backend/dnssd.c
---- cups-1.5.3/backend/dnssd.c.avahi-2-backend 2012-05-15 16:53:18.164774446 +0200
-+++ cups-1.5.3/backend/dnssd.c 2012-05-15 17:09:07.684155704 +0200
-@@ -15,14 +15,21 @@
- *
- * Contents:
- *
-+ * next_txt_record() - Get next TXT record from a cups_txt_records_t.
-+ * parse_txt_record_pair() - Read key/value pair in cups_txt_records_t.
- * main() - Browse for printers.
- * browse_callback() - Browse devices.
- * browse_local_callback() - Browse local devices.
- * compare_devices() - Compare two devices.
- * exec_backend() - Execute the backend that corresponds to the
- * resolved service name.
-+ * device_type() - Get DNS-SD type enumeration from string.
- * get_device() - Create or update a device.
- * query_callback() - Process query data.
-+ * avahi_client_callback() - Avahi client callback function.
-+ * avahi_query_callback() - Avahi query callback function.
-+ * avahi_browse_callback() - Avahi browse callback function.
-+ * find_device() - Find a device from its name and domain.
- * sigterm_handler() - Handle termination signals...
- * unquote() - Unquote a name string.
- */
-@@ -33,7 +40,18 @@
-
- #include "backend-private.h"
- #include <cups/array.h>
--#include <dns_sd.h>
-+#ifdef HAVE_DNSSD
-+# include <dns_sd.h>
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+# include <avahi-client/client.h>
-+# include <avahi-client/lookup.h>
-+# include <avahi-common/simple-watch.h>
-+# include <avahi-common/domain.h>
-+# include <avahi-common/error.h>
-+# include <avahi-common/malloc.h>
-+#define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX
-+#endif /* HAVE_AVAHI */
-
-
- /*
-@@ -53,7 +71,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 */
-@@ -65,6 +88,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...
-@@ -78,6 +115,7 @@ static int job_canceled = 0;
- * Local functions...
- */
-
-+#ifdef HAVE_DNSSD
- static void browse_callback(DNSServiceRef sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
-@@ -95,13 +133,6 @@ static void browse_local_callback(DNSSe
- const char *replyDomain,
- void *context)
- __attribute__((nonnull(1,5,6,7,8)));
--static int compare_devices(cups_device_t *a, cups_device_t *b);
--static void exec_backend(char **argv);
--static cups_device_t *get_device(cups_array_t *devices,
-- const char *serviceName,
-- const char *regtype,
-- const char *replyDomain)
-- __attribute__((nonnull(1,2,3,4)));
- static void query_callback(DNSServiceRef sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
-@@ -111,10 +142,119 @@ static void query_callback(DNSServiceRe
- const void *rdata, uint32_t ttl,
- void *context)
- __attribute__((nonnull(1,5,9,11)));
-+#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)
-+ __attribute__((nonnull(1,2,3,4)));
- static void sigterm_handler(int sig);
- static void unquote(char *dst, const char *src, size_t dstsize)
- __attribute__((nonnull(1,2)));
-
-+#ifdef HAVE_AVAHI
-+static AvahiSimplePoll *simple_poll = NULL;
-+static int avahi_got_callback;
-+#endif /* HAVE_AVAHI */
-+
-+
-+/*
-+ * 'next_txt_record()' - Get next TXT record from a cups_txt_records_t.
-+ */
-+
-+static cups_txt_records_t *
-+next_txt_record (cups_txt_records_t *txt)
-+{
-+#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;
-+}
-+
-+
-+/*
-+ * 'parse_txt_record_pair()' - Read key/value pair in cups_txt_records_t.
-+ */
-+
-+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.
-@@ -125,6 +265,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 */
-@@ -138,12 +285,11 @@ main(int argc, /* I - Number of comm
- pdl_datastream_ref, /* AppSocket service reference */
- printer_ref, /* LPD service reference */
- riousbprint_ref; /* Remote IO service reference */
-- 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 */
-@@ -203,6 +349,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");
-@@ -263,6 +452,7 @@ main(int argc, /* I - Number of comm
- riousbprint_ref = main_ref;
- DNSServiceBrowse(&riousbprint_ref, kDNSServiceFlagsShareConnection, 0,
- "_riousbprint._tcp", NULL, browse_callback, devices);
-+#endif /* HAVE_DNSSD */
-
- /*
- * Loop until we are killed...
-@@ -270,6 +460,9 @@ main(int argc, /* I - Number of comm
-
- while (!job_canceled)
- {
-+ int announce = 0;
-+
-+#ifdef HAVE_DNSSD
- FD_ZERO(&input);
- FD_SET(fd, &input);
-
-@@ -289,11 +482,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 */
-@@ -307,6 +524,7 @@ main(int argc, /* I - Number of comm
- if (device->sent)
- sent ++;
-
-+#ifdef HAVE_DNSSD
- if (device->ref)
- count ++;
-
-@@ -338,14 +556,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;
-@@ -406,6 +633,7 @@ main(int argc, /* I - Number of comm
- }
-
-
-+#ifdef HAVE_DNSSD
- /*
- * 'browse_callback()' - Browse devices.
- */
-@@ -494,6 +722,7 @@ browse_local_callback(
- device->fullName);
- device->sent = 1;
- }
-+#endif /* HAVE_DNSSD */
-
-
- /*
-@@ -574,6 +803,41 @@ exec_backend(char **argv) /* I - Comman
-
-
- /*
-+ * 'device_type()' - Get DNS-SD type enumeration from string.
-+ */
-+
-+static int
-+device_type (const char *regtype)
-+{
-+#ifdef HAVE_AVAHI
-+ if (!strcmp(regtype, "_ipp._tcp"))
-+ return (CUPS_DEVICE_IPP);
-+ else if (!strcmp(regtype, "_ipps._tcp") ||
-+ !strcmp(regtype, "_ipp-tls._tcp"))
-+ return (CUPS_DEVICE_IPPS);
-+ else if (!strcmp(regtype, "_fax-ipp._tcp"))
-+ return (CUPS_DEVICE_FAX_IPP);
-+ else if (!strcmp(regtype, "_printer._tcp"))
-+ return (CUPS_DEVICE_PDL_DATASTREAM);
-+#else
-+ if (!strcmp(regtype, "_ipp._tcp."))
-+ return (CUPS_DEVICE_IPP);
-+ else if (!strcmp(regtype, "_ipps._tcp.") ||
-+ !strcmp(regtype, "_ipp-tls._tcp."))
-+ return (CUPS_DEVICE_IPPS);
-+ else if (!strcmp(regtype, "_fax-ipp._tcp."))
-+ return (CUPS_DEVICE_FAX_IPP);
-+ else if (!strcmp(regtype, "_printer._tcp."))
-+ return (CUPS_DEVICE_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.
- */
-
-@@ -594,20 +858,7 @@ get_device(cups_array_t *devices, /* I -
- */
-
- key.name = (char *)serviceName;
--
-- if (!strcmp(regtype, "_ipp._tcp."))
-- key.type = CUPS_DEVICE_IPP;
-- else if (!strcmp(regtype, "_ipps._tcp.") ||
-- !strcmp(regtype, "_ipp-tls._tcp."))
-- key.type = CUPS_DEVICE_IPPS;
-- else if (!strcmp(regtype, "_fax-ipp._tcp."))
-- key.type = CUPS_DEVICE_FAX_IPP;
-- else if (!strcmp(regtype, "_printer._tcp."))
-- 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;
-@@ -627,8 +878,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);
- }
-@@ -648,6 +905,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);
-
-@@ -655,13 +915,20 @@ 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);
- }
-
-
-+#ifdef HAVE_DNSSD
- /*
- * 'query_callback()' - Process query data.
- */
-@@ -685,7 +952,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\", "
-@@ -719,94 +986,233 @@ query_callback(
- if ((ptr = strstr(name, "._")) != NULL)
- *ptr = '\0';
-
-- if (strstr(fullName, "_ipp._tcp."))
-- dkey.type = CUPS_DEVICE_IPP;
-- else if (strstr(fullName, "_ipps._tcp.") ||
-- strstr(fullName, "_ipp-tls._tcp."))
-- dkey.type = CUPS_DEVICE_IPPS;
-- else if (strstr(fullName, "_fax-ipp._tcp."))
-- dkey.type = CUPS_DEVICE_FAX_IPP;
-- else if (strstr(fullName, "_printer._tcp."))
-- 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
-+/*
-+ * 'avahi_client_callback()' - Avahi client callback function.
-+ */
-+
-+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);
-+ }
-+}
-+
-+
-+/*
-+ * 'avahi_query_callback()' - Avahi query callback function.
-+ */
-+
-+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);
-
-- for (device = cupsArrayFind(devices, &dkey);
-+ avahi_service_resolver_free (resolver);
-+}
-+
-+
-+/*
-+ * 'avahi_browse_callback()' - Avahi browse callback function.
-+ */
-+
-+static void
-+avahi_browse_callback(AvahiServiceBrowser *browser,
-+ AvahiIfIndex interface,
-+ 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;
-+
-+ case AVAHI_BROWSER_REMOVE:
-+ case AVAHI_BROWSER_ALL_FOR_NOW:
-+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
-+ break;
-+ }
-+}
-+#endif /* HAVE_AVAHI */
-+
-+
-+/*
-+ * 'find_device()' - Find a device from its name and domain.
-+ */
-+
-+static cups_device_t *
-+find_device (cups_array_t *devices,
-+ cups_txt_records_t *txt,
-+ cups_device_t *dkey)
-+{
-+ cups_device_t *device;
-+ char *ptr;
-+
-+ for (device = cupsArrayFind(devices, dkey);
- device;
- device = cupsArrayNext(devices))
- {
-- if (_cups_strcasecmp(device->name, dkey.name) ||
-- _cups_strcasecmp(device->domain, dkey.domain))
-+ if (_cups_strcasecmp(device->name, dkey->name) ||
-+ _cups_strcasecmp(device->domain, dkey->domain))
- {
- device = NULL;
- break;
- }
-- 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;
--
-- for (ptr = key; data < datanext && *data != '='; data ++)
-- *ptr++ = *data;
-- *ptr = '\0';
-+ char *key;
-+ char *value;
-
-- if (data < datanext && *data == '=')
-- {
-- data ++;
--
-- if (data < datanext)
-- memcpy(value, data, datanext - data);
-- value[datanext - data] = '\0';
-+ if (parse_txt_record_pair (txt))
-+ goto next;
-
-- fprintf(stderr, "DEBUG2: query_callback: \"%s=%s\".\n",
-- key, value);
-- }
-- else
-- {
-- fprintf(stderr, "DEBUG2: query_callback: \"%s\" with no value.\n",
-- key);
-- continue;
-- }
--
-- if (!_cups_strncasecmp(key, "usb_", 4))
-+ key = txt->key;
-+ value = txt->value;
-+ if (!strncasecmp(key, "usb_", 4))
- {
- /*
- * Add USB device ID information...
-@@ -861,6 +1267,10 @@ query_callback(
- if (device->type == CUPS_DEVICE_PRINTER)
- device->sent = 1;
- }
-+
-+ next:
-+ if (next_txt_record (txt) == NULL)
-+ break;
- }
-
- if (device->device_id)
-@@ -917,11 +1327,9 @@ query_callback(
- }
- }
-
-- if (!device)
-- fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
-+ return device;
- }
-
--
- /*
- * 'sigterm_handler()' - Handle termination signals...
- */
-diff -up cups-1.5.3/cups/http-support.c.avahi-2-backend cups-1.5.3/cups/http-support.c
---- cups-1.5.3/cups/http-support.c.avahi-2-backend 2012-02-15 02:06:12.000000000 +0100
-+++ cups-1.5.3/cups/http-support.c 2012-05-15 17:04:51.045944634 +0200
-@@ -43,6 +43,10 @@
- * http_copy_decode() - Copy and decode a URI.
- * http_copy_encode() - Copy and encode a URI.
- * http_resolve_cb() - Build a device URI for the given service name.
-+ * avahi_resolve_uri_client_cb()
-+ * - Avahi client callback for resolving URI.
-+ * avahi_resolve_uri_resolver_cb()
-+ * - Avahi resolver callback for resolving URI.
- */
-
- /*
-@@ -60,6 +64,11 @@
- # include <sys/select.h>
- # endif /* WIN32 */
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+# include <avahi-client/client.h>
-+# include <avahi-client/lookup.h>
-+# include <avahi-common/simple-watch.h>
-+#endif /* HAVE_AVAHI */
-
-
- /*
-@@ -127,6 +136,24 @@ static void DNSSD_API http_resolve_cb(DN
- 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
-@@ -1434,6 +1461,9 @@ _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
- # ifdef WIN32
- # pragma comment(lib, "dnssd.lib")
-@@ -1452,6 +1482,17 @@ _httpResolveURI(
- fd_set input_set; /* Input set for select() */
- struct timeval stimeout; /* Timeout value for select() */
- #endif /* HAVE_POLL */
-+#else /* HAVE_AVAHI */
-+ AvahiSimplePoll *simple_poll;
-+ AvahiClient *client;
-+ int error;
-+ struct
-+ {
-+ AvahiSimplePoll *poll;
-+ _http_uribuf_t uribuf;
-+ } user_data;
-+#endif /* HAVE_DNSSD */
-+
-
- if (options & _HTTP_RESOLVE_STDERR)
- fprintf(stderr, "DEBUG: Resolving \"%s\"...\n", hostname);
-@@ -1488,9 +1529,16 @@ _httpResolveURI(
- if (domain)
- *domain++ = '\0';
-
-+#ifdef HAVE_DNSSD
- uribuf.buffer = resolved_uri;
- uribuf.bufsize = resolved_size;
- uribuf.options = options;
-+#else
-+ user_data.uribuf.buffer = resolved_uri;
-+ user_data.uribuf.bufsize = resolved_size;
-+ user_data.uribuf.options = options;
-+#endif
-+
- resolved_uri[0] = '\0';
-
- DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
-@@ -1504,6 +1552,7 @@ _httpResolveURI(
-
- uri = NULL;
-
-+#ifdef HAVE_DNSSD
- if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
- {
- localref = ref;
-@@ -1611,6 +1660,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 (options & _HTTP_RESOLVE_STDERR)
- {
-@@ -1622,13 +1701,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 ((options & _HTTP_RESOLVE_STDERR) && !uri)
- _cupsLangPrintFilter(stderr, "ERROR", _("Unable to find printer."));
-@@ -1916,6 +1995,115 @@ http_resolve_cb(
- }
- #endif /* HAVE_DNSSD */
-
-+#ifdef HAVE_AVAHI
-+/*
-+ * 'avahi_resolve_uri_client_cb()' - Avahi client callback for resolving URI.
-+ */
-+
-+static void
-+avahi_resolve_uri_client_cb (AvahiClient *client,
-+ AvahiClientState state,
-+ 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);
-+}
-+
-+
-+/*
-+ * 'avahi_resolve_uri_resolver_cb()' - Avahi resolver callback for resolving
-+ * URI.
-+ */
-+
-+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 10284 2012-02-15 01:06:12Z mike $". \ No newline at end of file
diff --git a/testing/cups/cups-avahi-3-timeouts.patch b/testing/cups/cups-avahi-3-timeouts.patch
deleted file mode 100644
index daf852a0f..000000000
--- a/testing/cups/cups-avahi-3-timeouts.patch
+++ /dev/null
@@ -1,381 +0,0 @@
-diff -up cups-1.5.2/scheduler/cupsd.h.avahi-3-timeouts cups-1.5.2/scheduler/cupsd.h
---- cups-1.5.2/scheduler/cupsd.h.avahi-3-timeouts 2011-05-11 23:17:34.000000000 +0100
-+++ cups-1.5.2/scheduler/cupsd.h 2012-03-14 15:06:36.509476983 +0000
-@@ -140,6 +140,15 @@ extern const char *cups_hstrerror(int);
-
- typedef void (*cupsd_selfunc_t)(void *data);
-
-+#ifdef HAVE_AVAHI
-+/*
-+ * Timeout callback function type...
-+ */
-+
-+typedef struct _cupsd_timeout_s cupsd_timeout_t;
-+typedef void (*cupsd_timeoutfunc_t)(cupsd_timeout_t *timeout, void *data);
-+#endif /* HAVE_AVAHI */
-+
-
- /*
- * Globals...
-@@ -173,6 +182,11 @@ VAR int Launchd VALUE(0);
- /* Running from launchd */
- #endif /* HAVE_LAUNCH_H */
-
-+#ifdef HAVE_AVAHI
-+VAR cups_array_t *Timeouts; /* Timed callbacks for main loop */
-+#endif /* HAVE_AVAHI */
-+
-+
-
- /*
- * Prototypes...
-@@ -242,6 +256,20 @@ extern void cupsdStopSelect(void);
- extern void cupsdStartServer(void);
- extern void cupsdStopServer(void);
-
-+#ifdef HAVE_AVAHI
-+extern void cupsdInitTimeouts(void);
-+extern cupsd_timeout_t *cupsdAddTimeout (const struct timeval *tv,
-+ cupsd_timeoutfunc_t cb,
-+ void *data);
-+extern cupsd_timeout_t *cupsdNextTimeout (long *delay);
-+extern void cupsdRunTimeout (cupsd_timeout_t *timeout);
-+extern void cupsdUpdateTimeout (cupsd_timeout_t *timeout,
-+ const struct timeval *tv);
-+extern void cupsdRemoveTimeout (cupsd_timeout_t *timeout);
-+#endif /* HAVE_AVAHI */
-+
-+extern int cupsdRemoveFile(const char *filename);
-+
-
- /*
- * End of "$Id: cupsd.h 9766 2011-05-11 22:17:34Z mike $".
-diff -up cups-1.5.2/scheduler/main.c.avahi-3-timeouts cups-1.5.2/scheduler/main.c
---- cups-1.5.2/scheduler/main.c.avahi-3-timeouts 2012-03-14 15:04:17.655305548 +0000
-+++ cups-1.5.2/scheduler/main.c 2012-03-14 15:06:36.511476986 +0000
-@@ -146,6 +146,10 @@ main(int argc, /* I - Number of comm
- int launchd_idle_exit;
- /* Idle exit on select timeout? */
- #endif /* HAVE_LAUNCHD */
-+#ifdef HAVE_AVAHI
-+ cupsd_timeout_t *tmo; /* Next scheduled timed callback */
-+ long tmo_delay; /* Time before it must be called */
-+#endif /* HAVE_AVAHI */
-
-
- #ifdef HAVE_GETEUID
-@@ -535,6 +539,14 @@ main(int argc, /* I - Number of comm
-
- httpInitialize();
-
-+#ifdef HAVE_AVAHI
-+ /*
-+ * Initialize timed callback structures.
-+ */
-+
-+ cupsdInitTimeouts();
-+#endif /* HAVE_AVAHI */
-+
- cupsdStartServer();
-
- /*
-@@ -874,6 +886,16 @@ main(int argc, /* I - Number of comm
- }
- #endif /* __APPLE__ */
-
-+#ifdef HAVE_AVAHI
-+ /*
-+ * If a timed callback is due, run it.
-+ */
-+
-+ tmo = cupsdNextTimeout (&tmo_delay);
-+ if (tmo && tmo_delay == 0)
-+ cupsdRunTimeout (tmo);
-+#endif /* HAVE_AVAHI */
-+
- #ifndef __APPLE__
- /*
- * Update the network interfaces once a minute...
-@@ -1787,6 +1809,10 @@ select_timeout(int fds) /* I - Number
- cupsd_job_t *job; /* Job information */
- cupsd_subscription_t *sub; /* Subscription information */
- const char *why; /* Debugging aid */
-+#ifdef HAVE_AVAHI
-+ cupsd_timeout_t *tmo; /* Timed callback */
-+ long tmo_delay; /* Seconds before calling it */
-+#endif /* HAVE_AVAHI */
-
-
- /*
-@@ -1829,6 +1855,19 @@ select_timeout(int fds) /* I - Number
- }
- #endif /* __APPLE__ */
-
-+#ifdef HAVE_AVAHI
-+ /*
-+ * See if there are any scheduled timed callbacks to run.
-+ */
-+
-+ if ((tmo = cupsdNextTimeout(&tmo_delay)) != NULL &&
-+ (now + tmo_delay) < timeout)
-+ {
-+ timeout = tmo_delay;
-+ why = "run a timed callback";
-+ }
-+#endif /* HAVE_AVAHI */
-+
- /*
- * Check whether we are accepting new connections...
- */
-diff -up cups-1.5.2/scheduler/Makefile.avahi-3-timeouts cups-1.5.2/scheduler/Makefile
---- cups-1.5.2/scheduler/Makefile.avahi-3-timeouts 2012-03-14 15:04:17.685305586 +0000
-+++ cups-1.5.2/scheduler/Makefile 2012-03-14 15:06:36.508476980 +0000
-@@ -39,7 +39,8 @@ CUPSDOBJS = \
- server.o \
- statbuf.o \
- subscriptions.o \
-- sysman.o
-+ sysman.o \
-+ timeout.o
- LIBOBJS = \
- filter.o \
- mime.o \
-diff -up cups-1.5.2/scheduler/timeout.c.avahi-3-timeouts cups-1.5.2/scheduler/timeout.c
---- cups-1.5.2/scheduler/timeout.c.avahi-3-timeouts 2012-03-14 15:06:36.552477037 +0000
-+++ cups-1.5.2/scheduler/timeout.c 2012-03-14 15:06:36.552477037 +0000
-@@ -0,0 +1,235 @@
-+/*
-+ * "$Id$"
-+ *
-+ * Timeout functions for the Common UNIX Printing System (CUPS).
-+ *
-+ * Copyright (C) 2010, 2011 Red Hat, Inc.
-+ * Authors:
-+ * Tim Waugh <twaugh@redhat.com>
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ *
-+ * Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ *
-+ * Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-+ * OF THE POSSIBILITY OF SUCH DAMAGE.
-+ *
-+ * Contents:
-+ *
-+ * cupsdInitTimeouts() - Initialise timeout structure.
-+ * cupsdAddTimeout() - Add a timed callback.
-+ * cupsdNextTimeout() - Find the next enabled timed callback.
-+ * cupsdUpdateTimeout() - Adjust the time of a timed callback or disable it.
-+ * cupsdRemoveTimeout() - Discard a timed callback.
-+ * compare_timeouts() - Compare timed callbacks for array sorting.
-+ */
-+
-+#include <config.h>
-+
-+#ifdef HAVE_AVAHI /* Applies to entire file... */
-+
-+/*
-+ * Include necessary headers...
-+ */
-+
-+#include "cupsd.h"
-+
-+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
-+# include <malloc.h>
-+#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
-+
-+#ifdef HAVE_AVAHI
-+# include <avahi-common/timeval.h>
-+#endif /* HAVE_AVAHI */
-+
-+
-+struct _cupsd_timeout_s
-+{
-+ struct timeval when;
-+ int enabled;
-+ cupsd_timeoutfunc_t callback;
-+ void *data;
-+};
-+
-+/*
-+ * Local functions...
-+ */
-+
-+/*
-+ * 'compare_timeouts()' - Compare timed callbacks for array sorting.
-+ */
-+
-+static int
-+compare_addrs (void *p0, void *p1)
-+{
-+ if (p0 == p1)
-+ return (0);
-+ if (p0 < p1)
-+ return (-1);
-+ return (1);
-+}
-+
-+static int
-+compare_timeouts (cupsd_timeout_t *p0, cupsd_timeout_t *p1)
-+{
-+ int addrsdiff = compare_addrs (p0, p1);
-+ int tvdiff;
-+
-+ if (addrsdiff == 0)
-+ return (0);
-+
-+ if (!p0->enabled || !p1->enabled)
-+ {
-+ if (!p0->enabled && !p1->enabled)
-+ return (addrsdiff);
-+
-+ return (p0->enabled ? -1 : 1);
-+ }
-+
-+ tvdiff = avahi_timeval_compare (&p0->when, &p1->when);
-+ if (tvdiff != 0)
-+ return (tvdiff);
-+
-+ return (addrsdiff);
-+}
-+
-+
-+/*
-+ * 'cupsdInitTimeouts()' - Initialise timeout structures.
-+ */
-+
-+void
-+cupsdInitTimeouts(void)
-+{
-+ Timeouts = cupsArrayNew ((cups_array_func_t)compare_timeouts, NULL);
-+}
-+
-+
-+/*
-+ * 'cupsdAddTimeout()' - Add a timed callback.
-+ */
-+
-+cupsd_timeout_t * /* O - Timeout handle */
-+cupsdAddTimeout(const struct timeval *tv, /* I - Absolute time */
-+ cupsd_timeoutfunc_t cb, /* I - Callback function */
-+ void *data) /* I - User data */
-+{
-+ cupsd_timeout_t *timeout;
-+
-+ timeout = malloc (sizeof(cupsd_timeout_t));
-+ if (timeout != NULL)
-+ {
-+ timeout->enabled = (tv != NULL);
-+ if (tv)
-+ {
-+ timeout->when.tv_sec = tv->tv_sec;
-+ timeout->when.tv_usec = tv->tv_usec;
-+ }
-+
-+ timeout->callback = cb;
-+ timeout->data = data;
-+ cupsArrayAdd (Timeouts, timeout);
-+ }
-+
-+ return timeout;
-+}
-+
-+
-+/*
-+ * 'cupsdNextTimeout()' - Find the next enabled timed callback.
-+ */
-+
-+cupsd_timeout_t * /* O - Next enabled timeout or NULL */
-+cupsdNextTimeout(long *delay) /* O - Seconds before scheduled */
-+{
-+ cupsd_timeout_t *first = cupsArrayFirst (Timeouts);
-+ struct timeval curtime;
-+
-+ if (first && !first->enabled)
-+ first = NULL;
-+
-+ if (first && delay)
-+ {
-+ gettimeofday (&curtime, NULL);
-+ if (avahi_timeval_compare (&curtime, &first->when) > 0)
-+ {
-+ *delay = 0;
-+ } else {
-+ *delay = 1 + first->when.tv_sec - curtime.tv_sec;
-+ if (first->when.tv_usec < curtime.tv_usec)
-+ (*delay)--;
-+ }
-+ }
-+
-+ return (first);
-+}
-+
-+
-+/*
-+ * 'cupsdRunTimeout()' - Run a timed callback.
-+ */
-+
-+void
-+cupsdRunTimeout(cupsd_timeout_t *timeout) /* I - Timeout */
-+{
-+ if (!timeout)
-+ return;
-+ timeout->enabled = 0;
-+ if (!timeout->callback)
-+ return;
-+ timeout->callback (timeout, timeout->data);
-+}
-+
-+/*
-+ * 'cupsdUpdateTimeout()' - Adjust the time of a timed callback or disable it.
-+ */
-+
-+void
-+cupsdUpdateTimeout(cupsd_timeout_t *timeout, /* I - Timeout */
-+ const struct timeval *tv) /* I - Absolute time or NULL */
-+{
-+ cupsArrayRemove (Timeouts, timeout);
-+ timeout->enabled = (tv != NULL);
-+ if (tv)
-+ {
-+ timeout->when.tv_sec = tv->tv_sec;
-+ timeout->when.tv_usec = tv->tv_usec;
-+ }
-+ cupsArrayAdd (Timeouts, timeout);
-+}
-+
-+
-+/*
-+ * 'cupsdRemoveTimeout()' - Discard a timed callback.
-+ */
-+
-+void
-+cupsdRemoveTimeout(cupsd_timeout_t *timeout) /* I - Timeout */
-+{
-+ cupsArrayRemove (Timeouts, timeout);
-+ free (timeout);
-+}
-+
-+
-+#endif /* HAVE_AVAHI ... from top of file */
-+
-+/*
-+ * End of "$Id$".
-+ */
diff --git a/testing/cups/cups-avahi-4-poll.patch b/testing/cups/cups-avahi-4-poll.patch
deleted file mode 100644
index d7fa5fd56..000000000
--- a/testing/cups/cups-avahi-4-poll.patch
+++ /dev/null
@@ -1,529 +0,0 @@
-diff -up cups-1.5.2/scheduler/avahi.c.avahi-4-poll cups-1.5.2/scheduler/avahi.c
---- cups-1.5.2/scheduler/avahi.c.avahi-4-poll 2012-03-14 15:07:29.477542381 +0000
-+++ cups-1.5.2/scheduler/avahi.c 2012-03-14 15:07:29.477542381 +0000
-@@ -0,0 +1,441 @@
-+/*
-+ * "$Id$"
-+ *
-+ * Avahi poll implementation for the CUPS scheduler.
-+ *
-+ * Copyright (C) 2010, 2011 Red Hat, Inc.
-+ * Authors:
-+ * Tim Waugh <twaugh@redhat.com>
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ *
-+ * Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ *
-+ * Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-+ * OF THE POSSIBILITY OF SUCH DAMAGE.
-+ *
-+ * Contents:
-+ *
-+ * watch_read_cb - Read callback for file descriptor
-+ * watch_write_cb - Write callback for file descriptor
-+ * watched_fd_add_select() - Call cupsdAddSelect() as needed
-+ * watch_new() - Create a new file descriptor watch
-+ * watch_free() - Free a file descriptor watch
-+ * watch_update() - Update watched events for a file descriptor
-+ * watch_get_events() - Get events that happened for a file descriptor
-+ * timeout_cb() - Run a timed Avahi callback
-+ * timeout_new() - Set a wakeup time
-+ * timeout_update() - Update the expiration time for a timeout
-+ * timeout_free() - Free a timeout
-+ * compare_watched_fds() - Compare watched file descriptors for array sorting
-+ * avahi_cups_poll_new() - Create a new Avahi main loop object for CUPS
-+ * avahi_cups_poll_free() - Free an Avahi main loop object for CUPS
-+ * avahi_cups_poll_get() - Get the abstract poll API structure
-+ */
-+
-+#include <config.h>
-+
-+#ifdef HAVE_AVAHI /* Applies to entire file... */
-+
-+/*
-+ * Include necessary headers...
-+ */
-+
-+#include "cupsd.h"
-+
-+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
-+# include <malloc.h>
-+#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
-+
-+#ifdef HAVE_AVAHI
-+# include <avahi-common/timeval.h>
-+#endif /* HAVE_AVAHI */
-+
-+
-+typedef struct
-+{
-+ AvahiCupsPoll *cups_poll;
-+
-+ int fd;
-+ AvahiWatchEvent occurred;
-+ cups_array_t *watches;
-+} cupsd_watched_fd_t;
-+
-+struct AvahiWatch
-+{
-+ cupsd_watched_fd_t *watched_fd;
-+
-+ AvahiWatchEvent events;
-+ AvahiWatchCallback callback;
-+ void *userdata;
-+};
-+
-+struct AvahiTimeout
-+{
-+ AvahiCupsPoll *cups_poll;
-+ AvahiTimeoutCallback callback;
-+ void *userdata;
-+ cupsd_timeout_t *cupsd_timeout;
-+};
-+
-+/*
-+ * Local functions...
-+ */
-+
-+static AvahiWatch * watch_new(const AvahiPoll *api,
-+ int fd,
-+ AvahiWatchEvent events,
-+ AvahiWatchCallback callback,
-+ void *userdata);
-+static void watch_free(AvahiWatch *watch);
-+static void watch_update(AvahiWatch *watch,
-+ AvahiWatchEvent events);
-+static AvahiWatchEvent watch_get_events(AvahiWatch *watch);
-+
-+
-+/*
-+ * 'watch_read_cb' - Read callback for file descriptor
-+ */
-+
-+static void
-+watch_read_cb (void *userdata)
-+{
-+ AvahiWatch *watch;
-+ cupsd_watched_fd_t *watched_fd = userdata;
-+ watched_fd->occurred |= AVAHI_WATCH_IN;
-+ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
-+ watch;
-+ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches))
-+ {
-+ if (watch->events & watched_fd->occurred)
-+ {
-+ (watch->callback) (watch, watched_fd->fd,
-+ AVAHI_WATCH_IN, watch->userdata);
-+ watched_fd->occurred &= ~AVAHI_WATCH_IN;
-+ break;
-+ }
-+ }
-+}
-+
-+
-+/*
-+ * 'watch_write_cb' - Write callback for file descriptor
-+ */
-+
-+static void
-+watch_write_cb (void *userdata)
-+{
-+ AvahiWatch *watch;
-+ cupsd_watched_fd_t *watched_fd = userdata;
-+ watched_fd->occurred |= AVAHI_WATCH_OUT;
-+ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
-+ watch;
-+ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches))
-+ {
-+ if (watch->events & watched_fd->occurred)
-+ {
-+ (watch->callback) (watch, watched_fd->fd,
-+ AVAHI_WATCH_OUT, watch->userdata);
-+ watched_fd->occurred &= ~AVAHI_WATCH_OUT;
-+ break;
-+ }
-+ }
-+}
-+
-+
-+/*
-+ * 'watched_fd_add_select' - Call cupsdAddSelect() as needed
-+ */
-+
-+static int /* O - Watches? */
-+watched_fd_add_select (cupsd_watched_fd_t *watched_fd)
-+{
-+ AvahiWatch *watch;
-+ cupsd_selfunc_t read_cb = NULL, write_cb = NULL;
-+ int any_watches = 0;
-+
-+ for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
-+ watch;
-+ watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches))
-+ {
-+ any_watches = 1;
-+ if (watch->events & (AVAHI_WATCH_IN |
-+ AVAHI_WATCH_ERR |
-+ AVAHI_WATCH_HUP))
-+ {
-+ read_cb = (cupsd_selfunc_t)watch_read_cb;
-+ if (write_cb != NULL)
-+ break;
-+ }
-+
-+ if (watch->events & AVAHI_WATCH_OUT)
-+ {
-+ write_cb = (cupsd_selfunc_t)watch_write_cb;
-+ if (read_cb != NULL)
-+ break;
-+ }
-+ }
-+
-+ if (read_cb || write_cb)
-+ cupsdAddSelect (watched_fd->fd, read_cb, write_cb, watched_fd);
-+ else
-+ cupsdRemoveSelect (watched_fd->fd);
-+
-+ return (any_watches);
-+}
-+
-+/*
-+ * 'watch_new' - Create a new file descriptor watch
-+ */
-+
-+static AvahiWatch *
-+watch_new (const AvahiPoll *api,
-+ int fd,
-+ AvahiWatchEvent events,
-+ AvahiWatchCallback callback,
-+ void *userdata)
-+{
-+ cupsd_watched_fd_t key, *watched_fd;
-+ AvahiCupsPoll *cups_poll = api->userdata;
-+ AvahiWatch *watch = malloc(sizeof(AvahiWatch));
-+ if (watch == NULL)
-+ return (NULL);
-+
-+ watch->events = events;
-+ watch->callback = callback;
-+ watch->userdata = userdata;
-+
-+ key.fd = fd;
-+ watched_fd = cupsArrayFind (cups_poll->watched_fds, &key);
-+ if (watched_fd == NULL)
-+ {
-+ watched_fd = malloc(sizeof(cupsd_watched_fd_t));
-+ if (watched_fd == NULL)
-+ {
-+ free (watch);
-+ return (NULL);
-+ }
-+
-+ watched_fd->fd = fd;
-+ watched_fd->occurred = 0;
-+ watched_fd->cups_poll = cups_poll;
-+ watched_fd->watches = cupsArrayNew (NULL, NULL);
-+ cupsArrayAdd (cups_poll->watched_fds, watched_fd);
-+ }
-+
-+ watch->watched_fd = watched_fd;
-+ cupsArrayAdd(watched_fd->watches, watch);
-+ watched_fd_add_select (watched_fd);
-+ return (watch);
-+}
-+
-+
-+/*
-+ * 'watch_free' - Free a file descriptor watch
-+ */
-+
-+static void
-+watch_free (AvahiWatch *watch)
-+{
-+ cupsd_watched_fd_t *watched_fd = watch->watched_fd;
-+ AvahiCupsPoll *cups_poll = watched_fd->cups_poll;
-+
-+ cupsArrayRemove (watched_fd->watches, watch);
-+ free (watch);
-+
-+ if (!watched_fd_add_select (watched_fd))
-+ {
-+ /* No more watches */
-+ cupsArrayRemove (cups_poll->watched_fds, watched_fd);
-+ free (watched_fd);
-+ }
-+}
-+
-+
-+/*
-+ * 'watch_update' - Update watched events for a file descriptor
-+ */
-+
-+static void
-+watch_update (AvahiWatch *watch,
-+ AvahiWatchEvent events)
-+{
-+ watch->events = events;
-+ watched_fd_add_select (watch->watched_fd);
-+}
-+
-+
-+/*
-+ * 'watch_get_events' - Get events that happened for a file descriptor
-+ */
-+
-+static AvahiWatchEvent
-+watch_get_events (AvahiWatch *watch)
-+{
-+ return (watch->watched_fd->occurred);
-+}
-+
-+
-+/*
-+ * 'timeout_cb()' - Run a timed Avahi callback
-+ */
-+
-+static void
-+timeout_cb (cupsd_timeout_t *cupsd_timeout, void *userdata)
-+{
-+ AvahiTimeout *timeout = userdata;
-+ (timeout->callback) (timeout, timeout->userdata);
-+}
-+
-+
-+/*
-+ * 'timeout_new' - Set a wakeup time
-+ */
-+
-+static AvahiTimeout *
-+timeout_new (const AvahiPoll *api,
-+ const struct timeval *tv,
-+ AvahiTimeoutCallback callback,
-+ void *userdata)
-+{
-+ AvahiTimeout *timeout;
-+ AvahiCupsPoll *cups_poll = api->userdata;
-+
-+ timeout = malloc(sizeof(AvahiTimeout));
-+ if (timeout == NULL)
-+ return (NULL);
-+
-+ timeout->cups_poll = cups_poll;
-+ timeout->callback = callback;
-+ timeout->userdata = userdata;
-+ timeout->cupsd_timeout = cupsdAddTimeout (tv,
-+ (cupsd_timeoutfunc_t)timeout_cb,
-+ timeout);
-+ cupsArrayAdd (cups_poll->timeouts, timeout);
-+ return (timeout);
-+}
-+
-+
-+/*
-+ * 'timeout_update' - Update the expiration time for a timeout
-+ */
-+
-+static void
-+timeout_update (AvahiTimeout *timeout,
-+ const struct timeval *tv)
-+{
-+ cupsdUpdateTimeout (timeout->cupsd_timeout, tv);
-+}
-+
-+
-+/*
-+ * ' timeout_free' - Free a timeout
-+ */
-+
-+static void
-+timeout_free (AvahiTimeout *timeout)
-+{
-+ cupsArrayRemove (timeout->cups_poll->timeouts, timeout);
-+ cupsdRemoveTimeout (timeout->cupsd_timeout);
-+ free (timeout);
-+}
-+
-+
-+/*
-+ * 'compare_watched_fds' - Compare watched file descriptors for array sorting
-+ */
-+static int
-+compare_watched_fds(cupsd_watched_fd_t *p0,
-+ cupsd_watched_fd_t *p1)
-+{
-+ /*
-+ * Compare by fd (no two elements have the same fd)
-+ */
-+
-+ if (p0->fd == p1->fd)
-+ return 0;
-+
-+ return (p0->fd < p1->fd ? -1 : 1);
-+}
-+
-+
-+/*
-+ * 'avahi_cups_poll_new' - Create a new Avahi main loop object for CUPS
-+ */
-+
-+AvahiCupsPoll *
-+avahi_cups_poll_new (void)
-+{
-+ AvahiCupsPoll *cups_poll = malloc(sizeof(AvahiCupsPoll));
-+ if (cups_poll == NULL)
-+ return (NULL);
-+
-+ cups_poll->watched_fds = cupsArrayNew ((cups_array_func_t)compare_watched_fds,
-+ NULL);
-+ cups_poll->timeouts = cupsArrayNew (NULL, NULL);
-+
-+ cups_poll->api.userdata = cups_poll;
-+ cups_poll->api.watch_new = watch_new;
-+ cups_poll->api.watch_free = watch_free;
-+ cups_poll->api.watch_update = watch_update;
-+ cups_poll->api.watch_get_events = watch_get_events;
-+
-+ cups_poll->api.timeout_new = timeout_new;
-+ cups_poll->api.timeout_update = timeout_update;
-+ cups_poll->api.timeout_free = timeout_free;
-+
-+ return (cups_poll);
-+}
-+
-+
-+/*
-+ * 'avahi_cups_poll_free' - Free an Avahi main loop object for CUPS
-+ */
-+void
-+avahi_cups_poll_free (AvahiCupsPoll *cups_poll)
-+{
-+ cupsd_watched_fd_t *watched_fd;
-+
-+ for (watched_fd = (cupsd_watched_fd_t*)cupsArrayFirst(cups_poll->watched_fds);
-+ watched_fd;
-+ watched_fd = (cupsd_watched_fd_t*)cupsArrayNext(cups_poll->watched_fds))
-+ cupsArrayClear (watched_fd->watches);
-+
-+ cupsArrayClear (cups_poll->watched_fds);
-+ cupsArrayClear (cups_poll->timeouts);
-+}
-+
-+
-+/*
-+ * 'avahi_cups_poll_get' - Get the abstract poll API structure
-+ */
-+
-+const AvahiPoll *
-+avahi_cups_poll_get (AvahiCupsPoll *cups_poll)
-+{
-+ return (&cups_poll->api);
-+}
-+
-+
-+#endif /* HAVE_AVAHI ... from top of file */
-+
-+/*
-+ * End of "$Id$".
-+ */
-diff -up cups-1.5.2/scheduler/avahi.h.avahi-4-poll cups-1.5.2/scheduler/avahi.h
---- cups-1.5.2/scheduler/avahi.h.avahi-4-poll 2012-03-14 15:07:29.477542381 +0000
-+++ cups-1.5.2/scheduler/avahi.h 2012-03-14 15:07:29.477542381 +0000
-@@ -0,0 +1,69 @@
-+/*
-+ * "$Id$"
-+ *
-+ * Avahi poll implementation for the CUPS scheduler.
-+ *
-+ * Copyright (C) 2010, 2011 Red Hat, Inc.
-+ * Authors:
-+ * Tim Waugh <twaugh@redhat.com>
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ *
-+ * Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ *
-+ * Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-+ * OF THE POSSIBILITY OF SUCH DAMAGE.
-+ */
-+
-+#include <config.h>
-+
-+#ifdef HAVE_AVAHI
-+# include <avahi-client/client.h>
-+# include <avahi-client/publish.h>
-+#endif /* HAVE_AVAHI */
-+
-+#ifdef HAVE_AUTHORIZATION_H
-+# include <Security/Authorization.h>
-+#endif /* HAVE_AUTHORIZATION_H */
-+
-+
-+#ifdef HAVE_AVAHI
-+typedef struct
-+{
-+ AvahiPoll api;
-+ cups_array_t *watched_fds;
-+ cups_array_t *timeouts;
-+} AvahiCupsPoll;
-+#endif /* HAVE_AVAHI */
-+
-+/*
-+ * Prototypes...
-+ */
-+
-+#ifdef HAVE_AVAHI
-+extern AvahiCupsPoll * avahi_cups_poll_new(void);
-+extern void avahi_cups_poll_free(AvahiCupsPoll *cups_poll);
-+extern const AvahiPoll *avahi_cups_poll_get(AvahiCupsPoll *cups_poll);
-+#endif /* HAVE_AVAHI */
-+
-+
-+/*
-+ * End of "$Id$".
-+ */
-diff -up cups-1.5.2/scheduler/Makefile.avahi-4-poll cups-1.5.2/scheduler/Makefile
---- cups-1.5.2/scheduler/Makefile.avahi-4-poll 2012-03-14 15:06:36.508476980 +0000
-+++ cups-1.5.2/scheduler/Makefile 2012-03-14 15:07:29.476542380 +0000
-@@ -17,6 +17,7 @@ include ../Makedefs
-
- CUPSDOBJS = \
- auth.o \
-+ avahi.o \
- banners.o \
- cert.o \
- classes.o \
diff --git a/testing/cups/cups-avahi-5-services.patch b/testing/cups/cups-avahi-5-services.patch
deleted file mode 100644
index 820b3c32b..000000000
--- a/testing/cups/cups-avahi-5-services.patch
+++ /dev/null
@@ -1,1272 +0,0 @@
-diff -up cups-1.5.2/cgi-bin/admin.c.avahi-5-services cups-1.5.2/cgi-bin/admin.c
---- cups-1.5.2/cgi-bin/admin.c.avahi-5-services 2011-08-17 22:01:53.000000000 +0100
-+++ cups-1.5.2/cgi-bin/admin.c 2012-03-14 15:08:25.701611799 +0000
-@@ -1643,7 +1643,7 @@ do_config_server(http_t *http) /* I - H
- else
- local_protocols[0] = '\0';
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- if (cgiGetVariable("BROWSE_LOCAL_DNSSD"))
- {
- if (local_protocols[0])
-@@ -1651,7 +1651,7 @@ do_config_server(http_t *http) /* I - H
- else
- strcat(local_protocols, "dnssd");
- }
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
- #ifdef HAVE_LDAP
- if (cgiGetVariable("BROWSE_LOCAL_LDAP"))
-@@ -2718,9 +2718,9 @@ do_menu(http_t *http) /* I - HTTP conn
- #endif /* HAVE_GSSAPI */
- cgiSetVariable("KERBEROS", "");
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- cgiSetVariable("HAVE_DNSSD", "1");
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
- #ifdef HAVE_LDAP
- cgiSetVariable("HAVE_LDAP", "1");
-diff -up cups-1.5.2/scheduler/avahi.h.avahi-5-services cups-1.5.2/scheduler/avahi.h
---- cups-1.5.2/scheduler/avahi.h.avahi-5-services 2012-03-14 15:07:29.477542381 +0000
-+++ cups-1.5.2/scheduler/avahi.h 2012-03-14 15:08:25.701611799 +0000
-@@ -3,7 +3,7 @@
- *
- * Avahi poll implementation for the CUPS scheduler.
- *
-- * Copyright (C) 2010, 2011 Red Hat, Inc.
-+ * Copyright (C) 2010, 2011, 2012 Red Hat, Inc.
- * Authors:
- * Tim Waugh <twaugh@redhat.com>
- *
-@@ -32,37 +32,40 @@
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
--#include <config.h>
-+#ifndef _CUPS_AVAHI_H_
-+# define _CUPS_AVAHI_H_
-
--#ifdef HAVE_AVAHI
--# include <avahi-client/client.h>
--# include <avahi-client/publish.h>
--#endif /* HAVE_AVAHI */
-+/*
-+ * Include necessary headers...
-+ */
-
--#ifdef HAVE_AUTHORIZATION_H
--# include <Security/Authorization.h>
--#endif /* HAVE_AUTHORIZATION_H */
-+# include <config.h>
-
-+# ifdef HAVE_AVAHI
-+# include <avahi-client/client.h>
-+# include <avahi-client/publish.h>
-+# endif /* HAVE_AVAHI */
-
--#ifdef HAVE_AVAHI
-+# ifdef HAVE_AVAHI
- typedef struct
- {
- AvahiPoll api;
- cups_array_t *watched_fds;
- cups_array_t *timeouts;
- } AvahiCupsPoll;
--#endif /* HAVE_AVAHI */
-+# endif /* HAVE_AVAHI */
-
- /*
- * Prototypes...
- */
-
--#ifdef HAVE_AVAHI
-+# ifdef HAVE_AVAHI
- extern AvahiCupsPoll * avahi_cups_poll_new(void);
- extern void avahi_cups_poll_free(AvahiCupsPoll *cups_poll);
- extern const AvahiPoll *avahi_cups_poll_get(AvahiCupsPoll *cups_poll);
--#endif /* HAVE_AVAHI */
-+# endif /* HAVE_AVAHI */
-
-+#endif /* !_CUPS_AVAHI_H_ */
-
- /*
- * End of "$Id$".
-diff -up cups-1.5.2/scheduler/client.c.avahi-5-services cups-1.5.2/scheduler/client.c
---- cups-1.5.2/scheduler/client.c.avahi-5-services 2012-01-13 23:00:22.000000000 +0000
-+++ cups-1.5.2/scheduler/client.c 2012-03-14 15:08:25.703611797 +0000
-@@ -4989,7 +4989,7 @@ valid_host(cupsd_client_t *con) /* I -
- !strncmp(host, "[::1]:", 6));
- }
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- /*
- * Check if the hostname is something.local (Bonjour); if so, allow it.
- */
-@@ -4998,7 +4998,7 @@ valid_host(cupsd_client_t *con) /* I -
- (!_cups_strcasecmp(end, ".local") || !_cups_strncasecmp(end, ".local:", 7) ||
- !_cups_strcasecmp(end, ".local.") || !_cups_strncasecmp(end, ".local.:", 8)))
- return (1);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
- /*
- * Check if the hostname is an IP address...
-diff -up cups-1.5.2/scheduler/conf.c.avahi-5-services cups-1.5.2/scheduler/conf.c
---- cups-1.5.2/scheduler/conf.c.avahi-5-services 2012-03-14 15:04:17.636305526 +0000
-+++ cups-1.5.2/scheduler/conf.c 2012-03-14 15:08:25.706611803 +0000
-@@ -652,7 +652,7 @@ cupsdReadConfiguration(void)
- Browsing = CUPS_DEFAULT_BROWSING;
- DefaultShared = CUPS_DEFAULT_DEFAULT_SHARED;
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- cupsdSetString(&DNSSDRegType, "_ipp._tcp,_cups");
- #endif /* HAVE_DNSSD */
-
-diff -up cups-1.5.2/scheduler/dirsvc.c.avahi-5-services cups-1.5.2/scheduler/dirsvc.c
---- cups-1.5.2/scheduler/dirsvc.c.avahi-5-services 2012-03-14 15:04:17.674305572 +0000
-+++ cups-1.5.2/scheduler/dirsvc.c 2012-03-14 15:08:25.709611806 +0000
-@@ -27,6 +27,7 @@
- * ldap_connect() - Start new LDAP connection
- * ldap_reconnect() - Reconnect to LDAP Server
- * ldap_disconnect() - Disconnect from LDAP Server
-+ * cupsdStartAvahiClient() - Start an Avahi client if needed
- * cupsdStartBrowsing() - Start sending and receiving broadcast
- * information.
- * cupsdStartPolling() - Start polling servers as needed.
-@@ -40,11 +41,12 @@
- * dequote() - Remote quotes from a string.
- * dnssdAddAlias() - Add a DNS-SD alias name.
- * dnssdBuildTxtRecord() - Build a TXT record from printer info.
-- * dnssdComparePrinters() - Compare the registered names of two printers.
- * dnssdDeregisterPrinter() - Stop sending broadcast information for a
- * printer.
- * dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT
- * record format.
-+ * avahiPackTxtRecord() - Pack an array of key/value pairs into an
-+ * AvahiStringList.
- * dnssdRegisterCallback() - DNSServiceRegister callback.
- * dnssdRegisterPrinter() - Start sending broadcast information for a
- * printer or update the broadcast contents.
-@@ -83,6 +85,7 @@
- */
-
- #include "cupsd.h"
-+#include <assert.h>
- #include <grp.h>
-
- #ifdef HAVE_DNSSD
-@@ -97,6 +100,17 @@
- # endif /* HAVE_SYSTEMCONFIGURATION */
- # endif /* __APPLE__ */
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+# include <avahi-common/domain.h>
-+#endif /* HAVE_AVAHI */
-+
-+
-+#ifdef HAVE_DNSSD
-+typedef char *cupsd_txt_record_t;
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+typedef AvahiStringList *cupsd_txt_record_t;
-+#endif /* HAVE_AVAHI */
-
-
- /*
-@@ -159,27 +173,38 @@ static void update_polling(void);
- static void update_smb(int onoff);
-
-
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+static cupsd_txt_record_t dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
-+ int for_lpd);
-+static void dnssdDeregisterPrinter(cupsd_printer_t *p);
-+static void dnssdRegisterPrinter(cupsd_printer_t *p);
-+static void dnssdStop(void);
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-+
- #ifdef HAVE_DNSSD
- # ifdef HAVE_COREFOUNDATION
- static void dnssdAddAlias(const void *key, const void *value,
- void *context);
- # endif /* HAVE_COREFOUNDATION */
--static char *dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
-- int for_lpd);
--static int dnssdComparePrinters(cupsd_printer_t *a, cupsd_printer_t *b);
--static void dnssdDeregisterPrinter(cupsd_printer_t *p);
--static char *dnssdPackTxtRecord(int *txt_len, char *keyvalue[][2],
-- int count);
- static void dnssdRegisterCallback(DNSServiceRef sdRef,
- DNSServiceFlags flags,
- DNSServiceErrorType errorCode,
- const char *name, const char *regtype,
- const char *domain, void *context);
--static void dnssdRegisterPrinter(cupsd_printer_t *p);
--static void dnssdStop(void);
- static void dnssdUpdate(void);
- #endif /* HAVE_DNSSD */
-
-+#ifdef HAVE_AVAHI
-+static AvahiStringList *avahiPackTxtRecord(char *keyvalue[][2],
-+ int count);
-+static void avahi_entry_group_cb (AvahiEntryGroup *group,
-+ AvahiEntryGroupState state,
-+ void *userdata);
-+static void avahi_client_cb (AvahiClient *client,
-+ AvahiClientState state,
-+ void *userdata);
-+#endif /* HAVE_AVAHI */
-+
- #ifdef HAVE_LDAP
- static const char * const ldap_attrs[] =/* CUPS LDAP attributes */
- {
-@@ -283,10 +308,10 @@ cupsdDeregisterPrinter(
- ldap_dereg_printer(p);
- #endif /* HAVE_LDAP */
-
--#ifdef HAVE_DNSSD
-- if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef)
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+ if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD))
- dnssdDeregisterPrinter(p);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- }
-
-
-@@ -702,10 +727,10 @@ cupsdRegisterPrinter(cupsd_printer_t *p)
- slpRegisterPrinter(p); */
- #endif /* HAVE_LIBSLP */
-
--#ifdef HAVE_DNSSD
-- if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef)
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+ if ((BrowseLocalProtocols & BROWSE_DNSSD))
- dnssdRegisterPrinter(p);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- }
-
-
-@@ -1419,6 +1444,36 @@ ldap_disconnect(LDAP *ld) /* I - LDAP h
- #endif /* HAVE_LDAP */
-
-
-+#ifdef HAVE_AVAHI
-+/*
-+ * 'cupsdStartAvahiClient()' - Start an Avahi client if needed
-+ */
-+
-+void
-+cupsdStartAvahiClient(void)
-+{
-+ int error = 0;
-+
-+ if (!AvahiCupsClient && !AvahiCupsClientConnecting)
-+ {
-+ if (!AvahiCupsPollHandle)
-+ AvahiCupsPollHandle = avahi_cups_poll_new ();
-+
-+ if (AvahiCupsPollHandle)
-+ {
-+ if (avahi_client_new (avahi_cups_poll_get (AvahiCupsPollHandle),
-+ AVAHI_CLIENT_NO_FAIL,
-+ avahi_client_cb, NULL,
-+ &error) != NULL)
-+ AvahiCupsClientConnecting = 1;
-+ else
-+ cupsdLogMessage (CUPSD_LOG_WARN, "Avahi client failed: %d", error);
-+ }
-+ }
-+}
-+#endif /* HAVE_AVAHI */
-+
-+
- /*
- * 'cupsdStartBrowsing()' - Start sending and receiving broadcast information.
- */
-@@ -1542,13 +1597,16 @@ cupsdStartBrowsing(void)
- else
- BrowseSocket = -1;
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_DNSSD)
- {
-+#ifdef HAVE_DNSSD
- DNSServiceErrorType error; /* Error from service creation */
-+#endif /* HAVE_DNSSD */
- cupsd_listener_t *lis; /* Current listening socket */
-
-
-+#ifdef HAVE_DNSSD
- /*
- * First create a "master" connection for all registrations...
- */
-@@ -1573,6 +1631,7 @@ cupsdStartBrowsing(void)
- fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
-
- cupsdAddSelect(fd, (cupsd_selfunc_t)dnssdUpdate, NULL, NULL);
-+#endif /* HAVE_DNSSD */
-
- /*
- * Then get the port we use for registrations. If we are not listening
-@@ -1598,17 +1657,23 @@ cupsdStartBrowsing(void)
- */
-
- if (BrowseRemoteProtocols & BROWSE_DNSSD)
-- DNSSDPrinters = cupsArrayNew((cups_array_func_t)dnssdComparePrinters,
-- NULL);
-+ DNSSDPrinters = cupsArrayNew(NULL, NULL);
-
- /*
- * Set the computer name and register the web interface...
- */
-
- cupsdUpdateDNSSDName();
-+
-+#ifdef HAVE_AVAHI
-+ cupsdStartAvahiClient ();
-+#endif /* HAVE_AVAHI */
-+
-+#ifdef HAVE_DNSSD
- }
-- }
- #endif /* HAVE_DNSSD */
-+ }
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
- #ifdef HAVE_LIBSLP
- if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
-@@ -1834,10 +1899,10 @@ cupsdStopBrowsing(void)
- BrowseSocket = -1;
- }
-
--#ifdef HAVE_DNSSD
-- if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef)
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+ if ((BrowseLocalProtocols & BROWSE_DNSSD))
- dnssdStop();
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
- #ifdef HAVE_LIBSLP
- if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) &&
-@@ -1902,7 +1967,7 @@ cupsdStopPolling(void)
- }
-
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- /*
- * 'cupsdUpdateDNSSDName()' - Update the computer name we use for browsing...
- */
-@@ -1910,8 +1975,14 @@ cupsdStopPolling(void)
- void
- cupsdUpdateDNSSDName(void)
- {
-+#ifdef HAVE_DNSSD
- DNSServiceErrorType error; /* Error from service creation */
- char webif[1024]; /* Web interface share name */
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+ int ret; /* Error from service creation */
-+ char webif[AVAHI_LABEL_MAX]; /* Web interface share name */
-+#endif /* HAVE_AVAHI */
- # ifdef HAVE_SYSTEMCONFIGURATION
- SCDynamicStoreRef sc; /* Context for dynamic store */
- CFDictionaryRef btmm; /* Back-to-My-Mac domains */
-@@ -2042,6 +2113,7 @@ cupsdUpdateDNSSDName(void)
- else
- strlcpy(webif, "CUPS Web Interface", sizeof(webif));
-
-+#ifdef HAVE_DNSSD
- if (WebIFRef)
- DNSServiceRefDeallocate(WebIFRef);
-
-@@ -2054,9 +2126,45 @@ cupsdUpdateDNSSDName(void)
- NULL)) != kDNSServiceErr_NoError)
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "DNS-SD web interface registration failed: %d", error);
-+#endif /* HAVE_DNSSD */
-+
-+#ifdef HAVE_AVAHI
-+ if (!AvahiCupsClient)
-+ /*
-+ * Client not yet running.
-+ */
-+ return;
-+
-+ if (AvahiWebIFGroup)
-+ avahi_entry_group_reset (AvahiWebIFGroup);
-+ else
-+ AvahiWebIFGroup = avahi_entry_group_new (AvahiCupsClient,
-+ avahi_entry_group_cb,
-+ NULL);
-+
-+ if (AvahiWebIFGroup)
-+ {
-+ ret = avahi_entry_group_add_service (AvahiWebIFGroup,
-+ AVAHI_IF_UNSPEC,
-+ AVAHI_PROTO_UNSPEC,
-+ 0, /* flags */
-+ webif, /* name */
-+ "_http._tcp", /* type */
-+ NULL, /* domain */
-+ NULL, /* host */
-+ DNSSDPort, /* port */
-+ "path=/", NULL);
-+ if (ret == 0)
-+ ret = avahi_entry_group_commit (AvahiWebIFGroup);
-+
-+ if (ret != 0)
-+ cupsdLogMessage (CUPSD_LOG_ERROR,
-+ "Avahi web interface registration failed: %d", ret);
-+ }
-+#endif /* HAVE_AVAHI */
- }
- }
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
-
- #ifdef HAVE_LDAP
-@@ -2334,13 +2442,15 @@ dnssdAddAlias(const void *key, /* I - K
- "Bad Back to My Mac domain in dynamic store!");
- }
- # endif /* HAVE_COREFOUNDATION */
-+#endif /* HAVE_DNSSD */
-
-
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- /*
- * 'dnssdBuildTxtRecord()' - Build a TXT record from printer info.
- */
-
--static char * /* O - TXT record */
-+static cupsd_txt_record_t /* O - TXT record */
- dnssdBuildTxtRecord(
- int *txt_len, /* O - TXT record length */
- cupsd_printer_t *p, /* I - Printer information */
-@@ -2379,7 +2489,12 @@ dnssdBuildTxtRecord(
- keyvalue[i ][0] = "ty";
- keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown";
-
-- snprintf(admin_hostname, sizeof(admin_hostname), "%s.local.", DNSSDHostName);
-+ snprintf(admin_hostname, sizeof(admin_hostname),
-+ "%s.local"
-+#ifdef HAVE_DNSSD
-+ "." /* terminating dot no good for Avahi */
-+#endif /* HAVE_DNSSD */
-+ , DNSSDHostName);
- httpAssembleURIf(HTTP_URI_CODING_ALL, adminurl_str, sizeof(adminurl_str),
- "http", NULL, admin_hostname, DNSSDPort, "/%s/%s",
- (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers",
-@@ -2462,19 +2577,12 @@ dnssdBuildTxtRecord(
- * Then pack them into a proper txt record...
- */
-
-+#ifdef HAVE_DNSSD
- return (dnssdPackTxtRecord(txt_len, keyvalue, i));
--}
--
--
--/*
-- * 'dnssdComparePrinters()' - Compare the registered names of two printers.
-- */
--
--static int /* O - Result of comparison */
--dnssdComparePrinters(cupsd_printer_t *a,/* I - First printer */
-- cupsd_printer_t *b)/* I - Second printer */
--{
-- return (_cups_strcasecmp(a->reg_name, b->reg_name));
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+ return (avahiPackTxtRecord(keyvalue, i));
-+#endif /* HAVE_AVAHI */
- }
-
-
-@@ -2489,6 +2597,10 @@ dnssdDeregisterPrinter(
- {
- cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdDeregisterPrinter(%s)", p->name);
-
-+#ifdef HAVE_DNSSD
-+ if (!DNSSDRef)
-+ return;
-+
- /*
- * Closing the socket deregisters the service
- */
-@@ -2524,6 +2636,24 @@ dnssdDeregisterPrinter(
- free(p->printer_txt);
- p->printer_txt = NULL;
- }
-+#endif /* HAVE_DNSSD */
-+
-+#ifdef HAVE_AVAHI
-+ if (p->avahi_group)
-+ {
-+ avahi_entry_group_reset (p->avahi_group);
-+ avahi_entry_group_free (p->avahi_group);
-+ p->avahi_group = NULL;
-+
-+ if (p->ipp_txt)
-+ avahi_string_list_free (p->ipp_txt);
-+
-+ if (p->printer_txt)
-+ avahi_string_list_free (p->printer_txt);
-+
-+ p->ipp_txt = p->printer_txt = NULL;
-+ }
-+#endif /* HAVE_AVAHI */
-
- /*
- * Remove the printer from the array of DNS-SD printers, then clear the
-@@ -2533,8 +2663,10 @@ dnssdDeregisterPrinter(
- cupsArrayRemove(DNSSDPrinters, p);
- cupsdClearString(&p->reg_name);
- }
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
-
-+#ifdef HAVE_DNSSD
- /*
- * 'dnssdPackTxtRecord()' - Pack an array of key/value pairs into the
- * TXT record format.
-@@ -2644,8 +2776,10 @@ dnssdRegisterCallback(
- LastEvent |= CUPSD_EVENT_PRINTER_MODIFIED;
- }
- }
-+#endif /* HAVE_DNSSD */
-
-
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- /*
- * 'dnssdRegisterPrinter()' - Start sending broadcast information for a printer
- * or update the broadcast contents.
-@@ -2654,20 +2788,40 @@ dnssdRegisterCallback(
- static void
- dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
- {
-+#ifdef HAVE_DNSSD
- DNSServiceErrorType se; /* dnssd errors */
- char *ipp_txt, /* IPP TXT record buffer */
- *printer_txt, /* LPD TXT record buffer */
-- name[1024], /* Service name */
-- *nameptr; /* Pointer into name */
-+ name[1024]; /* Service name */
- int ipp_len, /* IPP TXT record length */
- printer_len, /* LPD TXT record length */
- printer_port; /* LPD port number */
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+ int ret; /* Error code */
-+ AvahiStringList *ipp_txt, /* IPP TXT record */
-+ *printer_txt; /* LPD TXT record */
-+ char name[AVAHI_LABEL_MAX], /* Service name */
-+ fullsubtype[AVAHI_LABEL_MAX]; /* Full subtype */
-+ char *regtype_copy, /* Writeable copy of reg type */
-+ *subtype, /* Current service sub type */
-+ *nextsubtype; /* Next service sub type */
-+#endif /* HAVE_AVAHI */
-+ char *nameptr; /* Pointer into name */
- const char *regtype; /* Registration type */
-
-
-+#ifdef HAVE_DNSSD
-+ if (!DNSSDRef)
-+ return;
-+
- cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name,
- !p->ipp_ref ? "new" : "update");
--
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name,
-+ !p->avahi_group ? "new" : "update");
-+#endif /* HAVE_AVAHI */
- /*
- * If per-printer sharing was just disabled make sure we're not
- * registered before returning.
-@@ -2686,12 +2840,36 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
- if (p->info && strlen(p->info) > 0)
- {
- if (DNSSDComputerName)
-- snprintf(name, sizeof(name), "%s @ %s", p->info, DNSSDComputerName);
-+ {
-+ /*
-+ * Make sure there is room for at least 15 characters of
-+ * DNSSDComputerName.
-+ */
-+
-+ assert(sizeof(name) >= 15 + 4);
-+ nameptr = name + strlcpy(name, p->info,
-+ sizeof(name) - 4 -
-+ strnlen(DNSSDComputerName, 15));
-+ nameptr += strlcpy(nameptr, " @ ", sizeof(name) - (nameptr - name));
-+ strlcpy(nameptr, DNSSDComputerName, sizeof(name) - (nameptr - name));
-+ }
- else
- strlcpy(name, p->info, sizeof(name));
- }
- else if (DNSSDComputerName)
-- snprintf(name, sizeof(name), "%s @ %s", p->name, DNSSDComputerName);
-+ {
-+ /*
-+ * Make sure there is room for at least 15 characters of
-+ * DNSSDComputerName.
-+ */
-+
-+ assert(sizeof(name) >= 15 + 4);
-+ nameptr = name + strlcpy(name, p->info,
-+ sizeof(name) - 4 -
-+ strnlen(DNSSDComputerName, 15));
-+ nameptr += strlcpy(nameptr, " @ ", sizeof(name) - (nameptr - name));
-+ strlcpy(nameptr, DNSSDComputerName, sizeof(name) - (nameptr - name));
-+ }
- else
- strlcpy(name, p->name, sizeof(name));
-
-@@ -2712,6 +2890,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
- * Register IPP and (optionally) LPD...
- */
-
-+#ifdef HAVE_DNSSD
- ipp_len = 0; /* anti-compiler-warning-code */
- ipp_txt = dnssdBuildTxtRecord(&ipp_len, p, 0);
-
-@@ -2884,6 +3063,209 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
-
- if (printer_txt)
- free(printer_txt);
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+ if (!AvahiCupsClient)
-+ /*
-+ * Client not running yet. The client callback will call us again later.
-+ */
-+ return;
-+
-+ ipp_txt = dnssdBuildTxtRecord(NULL, p, 0);
-+ printer_txt = dnssdBuildTxtRecord(NULL, p, 1);
-+ regtype = (p->type & CUPS_PRINTER_FAX) ? "_fax-ipp._tcp" : DNSSDRegType;
-+
-+ if (p->avahi_group && p->ipp_txt && ipp_txt &&
-+ !avahi_string_list_equal (p->ipp_txt, ipp_txt))
-+ {
-+ /*
-+ * Update the existing registration...
-+ */
-+
-+ avahi_string_list_free (p->ipp_txt);
-+
-+ if (p->printer_txt)
-+ avahi_string_list_free (p->printer_txt);
-+
-+ /*
-+ * Update the service group entry.
-+ */
-+
-+ regtype_copy = strdup (regtype);
-+ subtype = strchr (regtype_copy, ',');
-+ if (subtype)
-+ *subtype = '\0';
-+
-+ cupsdLogMessage (CUPSD_LOG_DEBUG,
-+ "Updating TXT record for %s (%s)", name, regtype_copy);
-+ ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group,
-+ AVAHI_IF_UNSPEC,
-+ AVAHI_PROTO_UNSPEC,
-+ 0, name,
-+ regtype_copy,
-+ NULL, ipp_txt);
-+ free (regtype_copy);
-+
-+ if (ret < 0)
-+ goto update_failed;
-+
-+ p->ipp_txt = ipp_txt;
-+ ipp_txt = NULL;
-+
-+ if (BrowseLocalProtocols & BROWSE_LPD)
-+ {
-+ ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group,
-+ AVAHI_IF_UNSPEC,
-+ AVAHI_PROTO_UNSPEC,
-+ 0, name,
-+ "_printer._tcp", NULL,
-+ printer_txt);
-+ if (ret < 0)
-+ goto update_failed;
-+
-+ p->printer_txt = printer_txt;
-+ printer_txt = NULL;
-+ }
-+
-+ ret = avahi_entry_group_commit (p->avahi_group);
-+ if (ret < 0)
-+ {
-+ update_failed:
-+ cupsdLogMessage (CUPSD_LOG_ERROR,
-+ "Failed to update TXT record for %s: %d",
-+ name, ret);
-+ avahi_entry_group_reset (p->avahi_group);
-+ avahi_entry_group_free (p->avahi_group);
-+ p->avahi_group = NULL;
-+ ipp_txt = p->ipp_txt;
-+ p->ipp_txt = NULL;
-+ }
-+ }
-+
-+ if (!p->avahi_group)
-+ {
-+ /*
-+ * Initial registration. Use the _fax subtype for fax queues...
-+ */
-+
-+ p->avahi_group = avahi_entry_group_new (AvahiCupsClient,
-+ avahi_entry_group_cb,
-+ p);
-+
-+ cupsdLogMessage(CUPSD_LOG_DEBUG,
-+ "Registering Avahi printer %s with name \"%s\" and "
-+ "type \"%s\"", p->name, name, regtype);
-+
-+ if (!p->avahi_group)
-+ {
-+ ret = 0;
-+ goto add_failed;
-+ }
-+
-+ /*
-+ * Add each service type (DNSSDRegType may contain several,
-+ * separated by commas).
-+ */
-+
-+ subtype = regtype_copy = strdup (regtype);
-+ while (subtype && *subtype)
-+ {
-+ nextsubtype = strchr (subtype, ',');
-+ if (nextsubtype)
-+ *nextsubtype++ = '\0';
-+
-+ if (subtype == regtype_copy)
-+ {
-+ /*
-+ * Main type entry.
-+ */
-+
-+ cupsdLogMessage (CUPSD_LOG_DEBUG,
-+ "Adding TXT record for %s (%s)", name, regtype_copy);
-+ ret = avahi_entry_group_add_service_strlst (p->avahi_group,
-+ AVAHI_IF_UNSPEC,
-+ AVAHI_PROTO_UNSPEC,
-+ 0, name, regtype_copy,
-+ NULL, NULL,
-+ DNSSDPort,
-+ ipp_txt);
-+ }
-+ else
-+ {
-+ /*
-+ * Sub-type entry.
-+ */
-+
-+ snprintf (fullsubtype, sizeof(fullsubtype),
-+ "%s._sub.%s", subtype, regtype_copy);
-+ cupsdLogMessage (CUPSD_LOG_DEBUG,
-+ "Adding TXT record for %s (%s)", name, fullsubtype);
-+ ret = avahi_entry_group_add_service_subtype (p->avahi_group,
-+ AVAHI_IF_UNSPEC,
-+ AVAHI_PROTO_UNSPEC,
-+ 0, name,
-+ regtype_copy,
-+ NULL, fullsubtype);
-+ }
-+
-+ if (ret < 0)
-+ {
-+ free (regtype_copy);
-+ goto add_failed;
-+ }
-+
-+ subtype = nextsubtype;
-+ }
-+
-+ free (regtype_copy);
-+ p->ipp_txt = ipp_txt;
-+ ipp_txt = NULL;
-+
-+ if (BrowseLocalProtocols & BROWSE_LPD)
-+ {
-+ cupsdLogMessage(CUPSD_LOG_DEBUG,
-+ "Registering Avahi printer %s with name \"%s\" and "
-+ "type \"_printer._tcp\"", p->name, name);
-+
-+ ret = avahi_entry_group_add_service_strlst (p->avahi_group,
-+ AVAHI_IF_UNSPEC,
-+ AVAHI_PROTO_UNSPEC,
-+ 0, name,
-+ "_printer._tcp", NULL, NULL,
-+ 515,
-+ printer_txt);
-+ if (ret < 0)
-+ goto add_failed;
-+
-+ p->printer_txt = printer_txt;
-+ printer_txt = NULL;
-+ }
-+
-+ ret = avahi_entry_group_commit (p->avahi_group);
-+
-+ if (ret < 0)
-+ {
-+ add_failed:
-+ cupsdLogMessage (CUPSD_LOG_ERROR,
-+ "Failed to add Avahi entry for %s: %d",
-+ name, ret);
-+ if (p->avahi_group)
-+ {
-+ avahi_entry_group_reset (p->avahi_group);
-+ avahi_entry_group_free (p->avahi_group);
-+ p->avahi_group = NULL;
-+ }
-+ ipp_txt = p->ipp_txt;
-+ p->ipp_txt = NULL;
-+ }
-+ }
-+
-+ if (ipp_txt)
-+ avahi_string_list_free (ipp_txt);
-+
-+ if (printer_txt)
-+ avahi_string_list_free (printer_txt);
-+#endif /* HAVE_AVAHI */
- }
-
-
-@@ -2896,6 +3278,10 @@ dnssdStop(void)
- {
- cupsd_printer_t *p; /* Current printer */
-
-+#ifdef HAVE_DNSSD
-+ if (!DNSSDRef)
-+ return;
-+#endif /* HAVE_DNSSD */
-
- /*
- * De-register the individual printers
-@@ -2910,12 +3296,23 @@ dnssdStop(void)
- * Shutdown the rest of the service refs...
- */
-
-+#ifdef HAVE_DNSSD
- if (WebIFRef)
- {
- DNSServiceRefDeallocate(WebIFRef);
- WebIFRef = NULL;
- }
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+ if (AvahiWebIFGroup)
-+ {
-+ avahi_entry_group_reset (AvahiWebIFGroup);
-+ avahi_entry_group_free (AvahiWebIFGroup);
-+ AvahiWebIFGroup = NULL;
-+ }
-+#endif /* HAVE_AVAHI */
-
-+#ifdef HAVE_DNSSD
- if (RemoteRef)
- {
- DNSServiceRefDeallocate(RemoteRef);
-@@ -2926,14 +3323,17 @@ dnssdStop(void)
-
- DNSServiceRefDeallocate(DNSSDRef);
- DNSSDRef = NULL;
-+#endif /* HAVE_DNSSD */
-
- cupsArrayDelete(DNSSDPrinters);
- DNSSDPrinters = NULL;
-
- DNSSDPort = 0;
- }
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
-
-+#ifdef HAVE_DNSSD
- /*
- * 'dnssdUpdate()' - Handle DNS-SD queries.
- */
-@@ -2955,6 +3355,153 @@ dnssdUpdate(void)
- #endif /* HAVE_DNSSD */
-
-
-+#ifdef HAVE_AVAHI
-+/*
-+ * 'avahiPackTxtRecord()' - Pack an array of key/value pairs into an
-+ * AvahiStringList.
-+ */
-+
-+static AvahiStringList * /* O - new string list */
-+avahiPackTxtRecord(char *keyvalue[][2], /* I - Table of key value pairs */
-+ int count) /* I - Number of items in table */
-+{
-+ AvahiStringList *strlst = NULL;
-+ char **elements;
-+ size_t len;
-+ int i = 0;
-+
-+ elements = malloc ((1 + count) * sizeof (char *));
-+ if (!elements)
-+ goto cleanup;
-+
-+ for (i = 0; i < count; i++)
-+ {
-+ len = (1 + strlen (keyvalue[i][0]) +
-+ (keyvalue[i][1] ? 1 + strlen (keyvalue[i][1]) : 1));
-+ elements[i] = malloc (len * sizeof (char));
-+ if (!elements[i])
-+ goto cleanup;
-+
-+ snprintf (elements[i], len, "%s=%s", keyvalue[i][0], keyvalue[i][1]);
-+ }
-+
-+ strlst = avahi_string_list_new_from_array ((const char **) elements, count);
-+
-+cleanup:
-+ while (--i >= 0)
-+ free (elements[i]);
-+
-+ free (elements);
-+ return (strlst);
-+}
-+
-+
-+/*
-+ * 'avahi_entry_group_cb()' - Avahi entry group callback function.
-+ */
-+static void
-+avahi_entry_group_cb (AvahiEntryGroup *group,
-+ AvahiEntryGroupState state,
-+ void *userdata)
-+{
-+ char *name;
-+
-+ if (userdata)
-+ name = ((cupsd_printer_t *) userdata)->reg_name;
-+ else
-+ name = "CUPS web interface";
-+
-+ switch (state)
-+ {
-+ case AVAHI_ENTRY_GROUP_UNCOMMITED:
-+ case AVAHI_ENTRY_GROUP_REGISTERING:
-+ break;
-+
-+ case AVAHI_ENTRY_GROUP_ESTABLISHED:
-+ cupsdLogMessage (CUPSD_LOG_DEBUG,
-+ "Avahi entry group established for %s", name);
-+ break;
-+
-+ default:
-+ cupsdLogMessage (CUPSD_LOG_DEBUG,
-+ "Avahi entry group %s has state %d",
-+ name, state);
-+ break;
-+ }
-+}
-+
-+
-+/*
-+ * 'avahi_client_cb()' - Avahi client callback function.
-+ */
-+static void
-+avahi_client_cb (AvahiClient *client,
-+ AvahiClientState state,
-+ void *userdata)
-+{
-+ cupsd_printer_t *printer;
-+ switch (state)
-+ {
-+ case AVAHI_CLIENT_S_RUNNING:
-+ /*
-+ * Avahi client started successfully.
-+ */
-+ AvahiCupsClient = client;
-+ AvahiCupsClientConnecting = 0;
-+ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client started");
-+
-+ cupsdUpdateDNSSDName ();
-+
-+ for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers);
-+ printer;
-+ printer = (cupsd_printer_t *)cupsArrayNext(Printers))
-+ if (Browsing && (BrowseLocalProtocols & BROWSE_DNSSD) &&
-+ (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT |
-+ CUPS_PRINTER_SCANNER))) && printer->shared)
-+ dnssdRegisterPrinter (printer);
-+
-+ break;
-+
-+ case AVAHI_CLIENT_CONNECTING:
-+ /*
-+ * No Avahi daemon, client is waiting.
-+ */
-+ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client connecting");
-+ break;
-+
-+ case AVAHI_CLIENT_S_REGISTERING:
-+ /*
-+ * Not yet registered.
-+ */
-+ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client registering");
-+ break;
-+
-+ case AVAHI_CLIENT_FAILURE:
-+ /*
-+ * Avahi client failed, close it to allow a clean restart.
-+ */
-+ cupsdLogMessage (CUPSD_LOG_ERROR,
-+ "Avahi client failed, "
-+ "closing client to allow a clean restart");
-+
-+ for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers);
-+ printer;
-+ printer = (cupsd_printer_t *)cupsArrayNext(Printers))
-+ dnssdDeregisterPrinter (printer);
-+
-+ avahi_client_free(client);
-+ AvahiCupsClientConnecting = 0;
-+ AvahiCupsClient = NULL;
-+
-+ break;
-+
-+ default:
-+ cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client state: %d", state);
-+ }
-+}
-+#endif /* HAVE_AVAHI */
-+
-+
- /*
- * 'get_auth_info_required()' - Get the auth-info-required value to advertise.
- */
-diff -up cups-1.5.2/scheduler/dirsvc.h.avahi-5-services cups-1.5.2/scheduler/dirsvc.h
---- cups-1.5.2/scheduler/dirsvc.h.avahi-5-services 2011-03-21 02:12:14.000000000 +0000
-+++ cups-1.5.2/scheduler/dirsvc.h 2012-03-14 15:08:25.711611808 +0000
-@@ -31,6 +31,10 @@
- # endif /* HAVE_LDAP_SSL_H */
- #endif /* HAVE_LDAP */
-
-+#ifdef HAVE_AVAHI
-+# include <avahi-client/publish.h>
-+#endif /* HAVE_AVAHI */
-+
- /*
- * Browse protocols...
- */
-@@ -131,19 +135,22 @@ VAR int PollPipe VALUE(0);
- VAR cupsd_statbuf_t *PollStatusBuffer VALUE(NULL);
- /* Status buffer for pollers */
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- VAR char *DNSSDComputerName VALUE(NULL),
- /* Computer/server name */
- *DNSSDHostName VALUE(NULL),
- /* Hostname */
- *DNSSDRegType VALUE(NULL);
- /* Bonjour registration type */
--VAR cups_array_t *DNSSDAlias VALUE(NULL);
-- /* List of dynamic ServerAlias's */
- VAR int DNSSDPort VALUE(0);
- /* Port number to register */
- VAR cups_array_t *DNSSDPrinters VALUE(NULL);
- /* Printers we have registered */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-+
-+#ifdef HAVE_DNSSD
-+VAR cups_array_t *DNSSDAlias VALUE(NULL);
-+ /* List of dynamic ServerAlias's */
- VAR DNSServiceRef DNSSDRef VALUE(NULL),
- /* Master DNS-SD service reference */
- WebIFRef VALUE(NULL),
-@@ -152,6 +159,17 @@ VAR DNSServiceRef DNSSDRef VALUE(NULL),
- /* Remote printer browse reference */
- #endif /* HAVE_DNSSD */
-
-+#ifdef HAVE_AVAHI
-+VAR AvahiCupsPoll *AvahiCupsPollHandle VALUE(NULL);
-+ /* AvahiCupsPoll object */
-+VAR AvahiClient *AvahiCupsClient VALUE(NULL);
-+ /* AvahiClient object */
-+VAR int AvahiCupsClientConnecting VALUE(0);
-+ /* Is AvahiClient object connecting? */
-+VAR AvahiEntryGroup *AvahiWebIFGroup VALUE(NULL);
-+ /* Web interface entry group */
-+#endif /* HAVE_AVAHI */
-+
- #ifdef HAVE_LIBSLP
- VAR SLPHandle BrowseSLPHandle VALUE(NULL);
- /* SLP API handle */
-@@ -195,13 +213,14 @@ extern void cupsdRegisterPrinter(cupsd_p
- extern void cupsdRestartPolling(void);
- extern void cupsdSaveRemoteCache(void);
- extern void cupsdSendBrowseList(void);
-+extern void cupsdStartAvahiClient(void);
- extern void cupsdStartBrowsing(void);
- extern void cupsdStartPolling(void);
- extern void cupsdStopBrowsing(void);
- extern void cupsdStopPolling(void);
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- extern void cupsdUpdateDNSSDName(void);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- #ifdef HAVE_LDAP
- extern void cupsdUpdateLDAPBrowse(void);
- #endif /* HAVE_LDAP */
-diff -up cups-1.5.2/scheduler/ipp.c.avahi-5-services cups-1.5.2/scheduler/ipp.c
---- cups-1.5.2/scheduler/ipp.c.avahi-5-services 2012-03-14 15:04:17.665305560 +0000
-+++ cups-1.5.2/scheduler/ipp.c 2012-03-14 15:08:25.715611813 +0000
-@@ -6099,7 +6099,7 @@ copy_printer_attrs(
- ippAddDate(con->response, IPP_TAG_PRINTER, "printer-current-time",
- ippTimeToDate(curtime));
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- if (!ra || cupsArrayFind(ra, "printer-dns-sd-name"))
- {
- if (printer->reg_name)
-@@ -6109,7 +6109,7 @@ copy_printer_attrs(
- ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_NOVALUE,
- "printer-dns-sd-name", 0);
- }
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
- if (!ra || cupsArrayFind(ra, "printer-error-policy"))
- ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_NAME,
-diff -up cups-1.5.2/scheduler/main.c.avahi-5-services cups-1.5.2/scheduler/main.c
---- cups-1.5.2/scheduler/main.c.avahi-5-services 2012-03-14 15:06:36.511476986 +0000
-+++ cups-1.5.2/scheduler/main.c 2012-03-14 15:08:25.718611817 +0000
-@@ -120,6 +120,10 @@ main(int argc, /* I - Number of comm
- cupsd_listener_t *lis; /* Current listener */
- time_t current_time, /* Current time */
- activity, /* Client activity timer */
-+#ifdef HAVE_AVAHI
-+ avahi_client_time, /* Time for next Avahi client
-+ check */
-+#endif /* HAVE_AVAHI */
- browse_time, /* Next browse send time */
- senddoc_time, /* Send-Document time */
- expire_time, /* Subscription expire time */
-@@ -672,6 +676,9 @@ main(int argc, /* I - Number of comm
- */
-
- current_time = time(NULL);
-+#ifdef HAVE_AVAHI
-+ avahi_client_time = current_time;
-+#endif /* HAVE_AVAHI */
- browse_time = current_time;
- event_time = current_time;
- expire_time = current_time;
-@@ -894,6 +901,16 @@ main(int argc, /* I - Number of comm
- tmo = cupsdNextTimeout (&tmo_delay);
- if (tmo && tmo_delay == 0)
- cupsdRunTimeout (tmo);
-+
-+ /*
-+ * Try to restart the Avahi client every 10 seconds if needed...
-+ */
-+
-+ if ((current_time - avahi_client_time) >= 10)
-+ {
-+ avahi_client_time = current_time;
-+ cupsdStartAvahiClient();
-+ }
- #endif /* HAVE_AVAHI */
-
- #ifndef __APPLE__
-diff -up cups-1.5.2/scheduler/printers.c.avahi-5-services cups-1.5.2/scheduler/printers.c
---- cups-1.5.2/scheduler/printers.c.avahi-5-services 2012-03-14 15:04:17.646305537 +0000
-+++ cups-1.5.2/scheduler/printers.c 2012-03-14 15:08:25.720611819 +0000
-@@ -883,9 +883,9 @@ cupsdDeletePrinter(
- cupsdClearString(&p->alert);
- cupsdClearString(&p->alert_description);
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- cupsdClearString(&p->pdl);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-
- cupsArrayDelete(p->filetypes);
-
-@@ -3787,7 +3787,7 @@ add_printer_formats(cupsd_printer_t *p)
- attr->values[i].string.text = _cupsStrAlloc(mimetype);
- }
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- {
- char pdl[1024]; /* Buffer to build pdl list */
- mime_filter_t *filter; /* MIME filter looping var */
-@@ -3843,7 +3843,7 @@ add_printer_formats(cupsd_printer_t *p)
-
- cupsdSetString(&p->pdl, pdl);
- }
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- }
-
-
-diff -up cups-1.5.2/scheduler/printers.h.avahi-5-services cups-1.5.2/scheduler/printers.h
---- cups-1.5.2/scheduler/printers.h.avahi-5-services 2011-03-18 18:42:46.000000000 +0000
-+++ cups-1.5.2/scheduler/printers.h 2012-03-14 15:08:25.721611820 +0000
-@@ -16,6 +16,9 @@
- #ifdef HAVE_DNSSD
- # include <dns_sd.h>
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+# include "avahi.h"
-+#endif /* HAVE_AVAHI */
- #include <cups/pwg-private.h>
-
-
-@@ -95,16 +98,23 @@ struct cupsd_printer_s
- time_t marker_time; /* Last time marker attributes were updated */
- _ppd_cache_t *pc; /* PPD cache and mapping data */
-
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- char *reg_name, /* Name used for service registration */
-- *pdl, /* pdl value for TXT record */
-- *ipp_txt, /* IPP TXT record contents */
-+ *pdl; /* pdl value for TXT record */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-+#ifdef HAVE_DNSSD
-+ char *ipp_txt, /* IPP TXT record contents */
- *printer_txt; /* LPD TXT record contents */
- int ipp_len, /* IPP TXT record length */
- printer_len; /* LPD TXT record length */
- DNSServiceRef ipp_ref, /* Reference for _ipp._tcp,_cups */
- printer_ref; /* Reference for _printer._tcp */
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+ AvahiStringList *ipp_txt, /* IPP TXT record */
-+ *printer_txt; /* LPD TXT record */
-+ AvahiEntryGroup *avahi_group; /* Avahi entry group */
-+#endif /* HAVE_AVAHI */
- };
-
-
diff --git a/testing/cups/cups-no-export-ssllibs.patch b/testing/cups/cups-no-export-ssllibs.patch
deleted file mode 100644
index 9be3c819b..000000000
--- a/testing/cups/cups-no-export-ssllibs.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up cups-1.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.5b1/config-scripts/cups-ssl.m4
---- cups-1.5b1/config-scripts/cups-ssl.m4.no-export-ssllibs 2011-05-11 02:52:08.000000000 +0200
-+++ cups-1.5b1/config-scripts/cups-ssl.m4 2011-05-23 17:47:27.000000000 +0200
-@@ -164,7 +164,7 @@ AC_SUBST(IPPALIASES)
- AC_SUBST(SSLFLAGS)
- AC_SUBST(SSLLIBS)
-
--EXPORT_SSLLIBS="$SSLLIBS"
-+EXPORT_SSLLIBS=""
- AC_SUBST(EXPORT_SSLLIBS)
-
-
diff --git a/testing/cups/cups-no-gcrypt.patch b/testing/cups/cups-no-gcrypt.patch
deleted file mode 100644
index 42f71d0d4..000000000
--- a/testing/cups/cups-no-gcrypt.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-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 @@
- 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)
- if $PKGCONFIG --exists gnutls; then
- have_ssl=1
- SSLLIBS=`$PKGCONFIG --libs gnutls`
-@@ -110,16 +109,6 @@
- AC_DEFINE(HAVE_SSL)
- AC_DEFINE(HAVE_GNUTLS)
- fi
--
-- if test $have_ssl = 1; then
-- 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>
diff --git a/testing/cups/cups-no-gzip-man.patch b/testing/cups/cups-no-gzip-man.patch
deleted file mode 100644
index 69899b9cb..000000000
--- a/testing/cups/cups-no-gzip-man.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-diff -up cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man cups-1.5b1/config-scripts/cups-manpages.m4
---- cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man 2011-05-12 07:21:56.000000000 +0200
-+++ cups-1.5b1/config-scripts/cups-manpages.m4 2011-05-23 17:25:50.000000000 +0200
-@@ -69,10 +69,10 @@ case "$uname" in
- ;;
- Linux* | GNU* | Darwin*)
- # Linux, GNU Hurd, and 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/testing/cups/cups-no-gzip-man.patch.16 b/testing/cups/cups-no-gzip-man.patch.16
deleted file mode 100644
index 69899b9cb..000000000
--- a/testing/cups/cups-no-gzip-man.patch.16
+++ /dev/null
@@ -1,18 +0,0 @@
-diff -up cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man cups-1.5b1/config-scripts/cups-manpages.m4
---- cups-1.5b1/config-scripts/cups-manpages.m4.no-gzip-man 2011-05-12 07:21:56.000000000 +0200
-+++ cups-1.5b1/config-scripts/cups-manpages.m4 2011-05-23 17:25:50.000000000 +0200
-@@ -69,10 +69,10 @@ case "$uname" in
- ;;
- Linux* | GNU* | Darwin*)
- # Linux, GNU Hurd, and 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/testing/cups/cups-systemd-socket.patch b/testing/cups/cups-systemd-socket.patch
deleted file mode 100644
index 83fabdb4f..000000000
--- a/testing/cups/cups-systemd-socket.patch
+++ /dev/null
@@ -1,395 +0,0 @@
-diff -up cups-1.6b1/config.h.in.systemd-socket cups-1.6b1/config.h.in
---- cups-1.6b1/config.h.in.systemd-socket 2012-05-17 00:57:03.000000000 +0200
-+++ cups-1.6b1/config.h.in 2012-05-28 11:16:35.657250584 +0200
-@@ -506,6 +506,13 @@
-
-
- /*
-+ * Do we have systemd support?
-+ */
-+
-+#undef HAVE_SYSTEMD
-+
-+
-+/*
- * Various scripting languages...
- */
-
-diff -up cups-1.6b1/config-scripts/cups-systemd.m4.systemd-socket cups-1.6b1/config-scripts/cups-systemd.m4
---- cups-1.6b1/config-scripts/cups-systemd.m4.systemd-socket 2012-05-28 11:16:35.658250577 +0200
-+++ cups-1.6b1/config-scripts/cups-systemd.m4 2012-05-28 11:16:35.658250577 +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.6b1/configure.in.systemd-socket cups-1.6b1/configure.in
---- cups-1.6b1/configure.in.systemd-socket 2012-04-23 19:26:57.000000000 +0200
-+++ cups-1.6b1/configure.in 2012-05-28 11:16:35.658250577 +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)
-
-@@ -66,6 +67,9 @@ AC_OUTPUT(Makedefs
- conf/snmp.conf
- cups-config
- data/testprint
-+ data/cups.service
-+ data/cups.socket
-+ data/cups.path
- desktop/cups.desktop
- doc/help/ref-cupsd-conf.html
- doc/help/standard.html
-diff -up cups-1.6b1/cups/usersys.c.systemd-socket cups-1.6b1/cups/usersys.c
---- cups-1.6b1/cups/usersys.c.systemd-socket 2012-04-23 19:26:57.000000000 +0200
-+++ cups-1.6b1/cups/usersys.c 2012-05-28 11:16:35.659250570 +0200
-@@ -975,7 +975,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.6b1/data/cups.path.in.systemd-socket cups-1.6b1/data/cups.path.in
---- cups-1.6b1/data/cups.path.in.systemd-socket 2012-05-28 11:16:35.659250570 +0200
-+++ cups-1.6b1/data/cups.path.in 2012-05-28 11:16:35.659250570 +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.6b1/data/cups.service.in.systemd-socket cups-1.6b1/data/cups.service.in
---- cups-1.6b1/data/cups.service.in.systemd-socket 2012-05-28 11:16:35.659250570 +0200
-+++ cups-1.6b1/data/cups.service.in 2012-05-28 11:16:35.659250570 +0200
-@@ -0,0 +1,10 @@
-+[Unit]
-+Description=CUPS Printing Service
-+
-+[Service]
-+ExecStart=@sbindir@/cupsd -f
-+PrivateTmp=true
-+
-+[Install]
-+Also=cups.socket cups.path
-+WantedBy=printer.target
-diff -up cups-1.6b1/data/cups.socket.in.systemd-socket cups-1.6b1/data/cups.socket.in
---- cups-1.6b1/data/cups.socket.in.systemd-socket 2012-05-28 11:16:35.660250563 +0200
-+++ cups-1.6b1/data/cups.socket.in 2012-05-28 11:16:35.660250563 +0200
-@@ -0,0 +1,8 @@
-+[Unit]
-+Description=CUPS Printing Service Sockets
-+
-+[Socket]
-+ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@
-+
-+[Install]
-+WantedBy=sockets.target
-diff -up cups-1.6b1/data/Makefile.systemd-socket cups-1.6b1/data/Makefile
---- cups-1.6b1/data/Makefile.systemd-socket 2011-08-27 11:23:01.000000000 +0200
-+++ cups-1.6b1/data/Makefile 2012-05-28 11:16:35.660250563 +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.6b1/Makedefs.in.systemd-socket cups-1.6b1/Makedefs.in
---- cups-1.6b1/Makedefs.in.systemd-socket 2012-05-28 11:16:35.648250647 +0200
-+++ cups-1.6b1/Makedefs.in 2012-05-28 11:16:35.660250563 +0200
-@@ -134,11 +134,13 @@ 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)
- DNSSDLIBS = @DNSSDLIBS@
- LAUNCHDLIBS = @LAUNCHDLIBS@
-+SDLIBS = @SDLIBS@
- LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \
- -L../scheduler @LDARCHFLAGS@ \
- @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
-@@ -229,6 +231,7 @@ PAMFILE = @PAMFILE@
-
- DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@
- DBUSDIR = @DBUSDIR@
-+SYSTEMDUNITDIR = $(BUILDROOT)@systemdsystemunitdir@
-
-
- #
-diff -up cups-1.6b1/scheduler/client.h.systemd-socket cups-1.6b1/scheduler/client.h
---- cups-1.6b1/scheduler/client.h.systemd-socket 2012-03-22 21:30:20.000000000 +0100
-+++ cups-1.6b1/scheduler/client.h 2012-05-28 11:16:35.661250556 +0200
-@@ -77,6 +77,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.6b1/scheduler/listen.c.systemd-socket cups-1.6b1/scheduler/listen.c
---- cups-1.6b1/scheduler/listen.c.systemd-socket 2011-04-16 01:38:13.000000000 +0200
-+++ cups-1.6b1/scheduler/listen.c 2012-05-28 11:16:35.661250556 +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.6b1/scheduler/main.c.systemd-socket cups-1.6b1/scheduler/main.c
---- cups-1.6b1/scheduler/main.c.systemd-socket 2012-05-28 11:16:35.612250897 +0200
-+++ cups-1.6b1/scheduler/main.c 2012-05-28 12:49:32.698375139 +0200
-@@ -26,6 +26,8 @@
- * launchd_checkin() - Check-in with launchd and collect the listening
- * fds.
- * launchd_checkout() - Update the launchd KeepAlive file as needed.
-+ * systemd_checkin() - Check-in with systemd and collect the
-+ * listening fds.
- * parent_handler() - Catch USR1/CHLD signals...
- * process_children() - Process all dead children...
- * select_timeout() - Calculate the select timeout value.
-@@ -62,6 +64,10 @@
- # endif /* !LAUNCH_JOBKEY_SERVICEIPC */
- #endif /* HAVE_LAUNCH_H */
-
-+#ifdef HAVE_SYSTEMD
-+#include <systemd/sd-daemon.h>
-+#endif /* HAVE_SYSTEMD */
-+
- #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
- # include <malloc.h>
- #endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
-@@ -78,6 +84,9 @@
- static void launchd_checkin(void);
- static void launchd_checkout(void);
- #endif /* HAVE_LAUNCHD */
-+#ifdef HAVE_SYSTEMD
-+static void systemd_checkin(void);
-+#endif /* HAVE_SYSTEMD */
- static void parent_handler(int sig);
- static void process_children(void);
- static void sigchld_handler(int sig);
-@@ -528,6 +537,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...
- */
-@@ -738,6 +754,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...
- */
-@@ -1516,6 +1541,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.6b1/scheduler/Makefile.systemd-socket cups-1.6b1/scheduler/Makefile
---- cups-1.6b1/scheduler/Makefile.systemd-socket 2012-05-21 19:40:22.000000000 +0200
-+++ cups-1.6b1/scheduler/Makefile 2012-05-28 11:16:35.663250542 +0200
-@@ -371,7 +371,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 $@...
-@@ -379,7 +379,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
-
diff --git a/testing/cups/cups.install b/testing/cups/cups.install
deleted file mode 100644
index fc015f951..000000000
--- a/testing/cups/cups.install
+++ /dev/null
@@ -1,38 +0,0 @@
-post_install() {
- if [ -x usr/bin/xdg-icon-resource ]; then
- xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
- fi
- echo ">> If you use an HTTPS connection to CUPS, the first time you access"
- echo ">> the interface it may take a very long time before the site comes up."
- echo ">> This is because the first request triggers the generation of the CUPS"
- echo ">> SSL certificates which can be a very time-consuming job."
-}
-
-post_upgrade() {
- if [ -x usr/bin/xdg-icon-resource ]; then
- xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
- fi
- if [ "`vercmp $2 1.4.7-2`" -lt 0 ]; then
- # important upgrade notice
- echo "daemon script has been renamed to /etc/rc.d/cupsd"
- echo "change your entry in /etc/rc.conf"
- fi
- if [ "`vercmp $2 1.6.0`" -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."
- fi
-}
-
-post_remove() {
- if [ -x usr/bin/xdg-icon-resource ]; then
- xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
- fi
-}
diff --git a/testing/cups/cups.logrotate b/testing/cups/cups.logrotate
deleted file mode 100644
index 9c49bbdaf..000000000
--- a/testing/cups/cups.logrotate
+++ /dev/null
@@ -1,8 +0,0 @@
-/var/log/cups/*log {
- missingok
- notifempty
- delaycompress
- postrotate
- /bin/kill -HUP `cat /var/run/cups.pid 2>/dev/null` 2>/dev/null || true
- endscript
-}
diff --git a/testing/cups/cups.pam b/testing/cups/cups.pam
deleted file mode 100644
index 53724d1f8..000000000
--- a/testing/cups/cups.pam
+++ /dev/null
@@ -1,3 +0,0 @@
-auth required pam_unix.so
-account required pam_unix.so
-session required pam_unix.so
diff --git a/testing/cups/cupsd-conf-remove-obsolete-browse-directives.patch b/testing/cups/cupsd-conf-remove-obsolete-browse-directives.patch
deleted file mode 100644
index 97636c7f2..000000000
--- a/testing/cups/cupsd-conf-remove-obsolete-browse-directives.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -uraN cups/conf/cupsd.conf.in cups-new/conf/cupsd.conf.in
---- cups/conf/cupsd.conf.in 2012-05-25 15:28:25.000000000 +0200
-+++ cups-new/conf/cupsd.conf.in 2012-08-04 20:56:26.699062177 +0200
-@@ -19,8 +19,6 @@
-
- # Show shared printers on the local network.
- Browsing On
--BrowseOrder allow,deny
--BrowseAllow all
- BrowseLocalProtocols @CUPS_BROWSE_LOCAL_PROTOCOLS@
-
- # Default authentication type, when authentication is required...
diff --git a/testing/cups/recognize-remote-cups-queue-via-dnssd-uri.patch b/testing/cups/recognize-remote-cups-queue-via-dnssd-uri.patch
deleted file mode 100644
index 6349bd901..000000000
--- a/testing/cups/recognize-remote-cups-queue-via-dnssd-uri.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-diff -uraN cups/scheduler/printers.c cups-new/scheduler/printers.c
---- cups/scheduler/printers.c 2012-05-25 15:28:49.000000000 +0200
-+++ cups-new/scheduler/printers.c 2012-08-04 20:58:40.475725544 +0200
-@@ -4829,13 +4829,14 @@
- "printer-make-and-model", NULL,
- "Local System V Printer");
- }
-- else if (!strncmp(p->device_uri, "ipp://", 6) &&
-- (strstr(p->device_uri, "/printers/") != NULL ||
-- strstr(p->device_uri, "/classes/") != NULL ||
-- ((strstr(p->device_uri, "._ipp.") != NULL ||
-- strstr(p->device_uri, "._ipps.") != NULL) &&
-- !strcmp(p->device_uri + strlen(p->device_uri) - 5,
-- "/cups"))))
-+ else if ((!strncmp(p->device_uri, "ipp://", 6) &&
-+ (strstr(p->device_uri, "/printers/") != NULL ||
-+ strstr(p->device_uri, "/classes/") != NULL)) ||
-+ (!strncmp(p->device_uri, "dnssd://", 8) &&
-+ (strstr(p->device_uri, "._ipp.") != NULL ||
-+ strstr(p->device_uri, "._ipps.") != NULL) &&
-+ !strcmp(p->device_uri + strlen(p->device_uri) - 5,
-+ "/cups")))
- {
- /*
- * Tell the client this is really a hard-wired remote printer.
diff --git a/testing/cups/usb-backend-reset-after-job-only-for-specific-devices.patch b/testing/cups/usb-backend-reset-after-job-only-for-specific-devices.patch
deleted file mode 100644
index dcf91c833..000000000
--- a/testing/cups/usb-backend-reset-after-job-only-for-specific-devices.patch
+++ /dev/null
@@ -1,74 +0,0 @@
---- backend/usb-libusb.c.orig 2012-07-16 19:10:55.000000000 +0200
-+++ backend/usb-libusb.c 2012-08-06 11:01:58.034150159 +0200
-@@ -70,7 +70,7 @@
- read_endp, /* Read endpoint */
- protocol, /* Protocol: 1 = Uni-di, 2 = Bi-di. */
- usblp_attached, /* "usblp" kernel module attached? */
-- opened_for_job; /* Set to 1 by print_device() */
-+ reset_after_job; /* Set to 1 by print_device() */
- unsigned int quirks; /* Quirks flags */
- struct libusb_device_handle *handle; /* Open handle to device */
- } usb_printer_t;
-@@ -122,6 +122,8 @@
- #define USBLP_QUIRK_USB_INIT 0x2 /* needs vendor USB init string */
- #define USBLP_QUIRK_BAD_CLASS 0x4 /* descriptor uses vendor-specific
- Class or SubClass */
-+#define USBLP_QUIRK_RESET 0x4000 /* After printing do a reset
-+ for clean-up */
- #define USBLP_QUIRK_NO_REATTACH 0x8000 /* After printing we cannot re-attach
- the usblp kernel module */
-
-@@ -147,9 +149,11 @@
- { 0x04b8, 0x0202, USBLP_QUIRK_BAD_CLASS }, /* Seiko Epson Receipt
- Printer M129C */
- { 0x067b, 0x2305, USBLP_QUIRK_BIDIR |
-- USBLP_QUIRK_NO_REATTACH },
-+ USBLP_QUIRK_NO_REATTACH |
-+ USBLP_QUIRK_RESET },
- /* Prolific Technology, Inc. PL2305 Parallel Port
- (USB -> Parallel adapter) */
-+ { 0x04e8, 0x0000, USBLP_QUIRK_RESET }, /* All Samsung devices */
- { 0, 0 }
- };
-
-@@ -256,7 +260,12 @@
- }
-
- g.print_fd = print_fd;
-- g.printer->opened_for_job = 1;
-+
-+ /*
-+ * Some devices need a reset after finishing a job, these devices are
-+ * marked with the USBLP_QUIRK_RESET quirk.
-+ */
-+ g.printer->reset_after_job = (g.printer->quirks & USBLP_QUIRK_RESET ? 1 : 0);
-
- /*
- * If we are printing data from a print driver on stdin, ignore SIGTERM
-@@ -772,7 +781,7 @@
- * Reset the device to clean up after the job
- */
-
-- if (printer->opened_for_job == 1)
-+ if (printer->reset_after_job == 1)
- {
- if ((errcode = libusb_reset_device(printer->handle)) < 0)
- fprintf(stderr,
-@@ -1288,7 +1297,7 @@
- }
-
- printer->usblp_attached = 0;
-- printer->opened_for_job = 0;
-+ printer->reset_after_job = 0;
-
- if (verbose)
- fputs("STATE: +connecting-to-device\n", stderr);
-@@ -1586,7 +1595,7 @@
- for (i = 0; quirk_printers[i].vendorId; i++)
- {
- if (vendor == quirk_printers[i].vendorId &&
-- product == quirk_printers[i].productId)
-+ (product == 0x0000 || product == quirk_printers[i].productId))
- return quirk_printers[i].quirks;
- }
- return 0;