Index: cups-filters-1.0.58/README
===================================================================
--- cups-filters-1.0.58.orig/README
+++ cups-filters-1.0.58/README
@@ -183,8 +183,8 @@ POSTSCRIPT PRINTING DEBUG MODE
 HELPER DAEMON FOR BROWSING REMOTE CUPS PRINTERS AND IPP NETWORK PRINTERS
 
     From version 1.6.0 on in CUPS the CUPS broadcasting/browsing
-    facility was dropped, in favour of Bonjour-based broadcasting of
-    shared printers. This is done as Bonjour broadcasting of shared
+    facility was dropped, in favour of DNS-SD-based broadcasting of
+    shared printers. This is done as DNS-SD broadcasting of shared
     printers is a standard, established by the PWG (Printing Working
     Group, http://www.pwg.org/), and most other network services
     (shared file systems, shared media files/streams, remote desktop
@@ -195,31 +195,21 @@ HELPER DAEMON FOR BROWSING REMOTE CUPS P
     remote printers available locally without any configuration
     efforts. This is a regression compared to the old CUPS
     broadcasting/browsing. The intention of CUPS upstream is that the
-    application's print dialogs browse the Bonjour broadcasts as an
+    application's print dialogs browse the DNS-SD broadcasts as an
     AirPrint-capable iPhone does, but it will take its time until all
     toolkit developers add the needed functionality, and programs
     using old toolkits or no toolkits at all, or the command line stay
     uncovered.
 
-    The solution is cups-browsed, a helper daemon running in parallel
-    to the CUPS daemon which listens to Bonjour broadcasts of shared
-    CUPS printers on remote machines in the local network via Avahi,
-    and can also listen for (and send) CUPS Browsing broadcasts. For
-    each reported remote printer it creates a local raw queue pointing
-    to the remote printer so that the printer appears in local print
-    dialogs and is also available for printing via the command
-    line. As with the former CUPS broadcasting/browsing with this
-    queue the driver on the server is used and the local print dialogs
-    give access to all options of the server-side printer driver.
-
-    Note that CUPS broadcasting/browsing is available for legacy
-    support, to let the local CUPS daemon work seamlessly together
-    with remote CUPS daemons of version 1.5.x and older which only
-    support CUPS broadcasting/browsing. In networks with only CUPS
-    1.6.x servers (or Ubuntu or Fedora/Red Hat servers with CUPS
-    1.5.x) please use the native Bonjour broadcasting of your servers
-    and cups-browsed, configured for Bonjour browsing only on the
-    clients.
+    The solution is cups-browsed, a helper daemon running in parallel to
+    the CUPS daemon which listens to DNS-SD broadcasts of shared CUPS
+    printers on remote machines in the local network via Avahi. For each
+    reported remote printer it creates a local raw queue pointing to the
+    remote printer so that the printer appears in local print dialogs and
+    is also available for printing via the command line. As with the
+    former CUPS broadcasting/browsing with this queue the driver on the
+    server is used and the local print dialogs give access to all options
+    of the server-side printer driver.
 
     Also high availability with redundant print servers is
     supported. If there is more than one server providing a shared
@@ -327,7 +317,7 @@ HELPER DAEMON FOR BROWSING REMOTE CUPS P
     of avahi-daemon.
 
     Here is some info on how cups-browsed works internally (first concept of a
-    daemon which does only Bonjour browsing):
+    daemon which does only DNS-SD browsing):
 
     - Daemon start
       o Wait for CUPS daemon if it is not running
@@ -383,7 +373,7 @@ HELPER DAEMON FOR BROWSING REMOTE CUPS P
     of the others by one with simple name (mark old queue disappeared
     with timeout now-1 sec and create new queue with simple name).
 
-    Fill description of the created CUPS queue with the Bonjour
+    Fill description of the created CUPS queue with the DNS-SD
     service name (= original description) and location with the server
     name without .local.
 
Index: cups-filters-1.0.58/configure.ac
===================================================================
--- cups-filters-1.0.58.orig/configure.ac
+++ cups-filters-1.0.58/configure.ac
@@ -641,7 +641,7 @@ Build configuration:
 	cups-config:     ${with_cups_config}
 	font directory:  ${sysconfdir}/${FONTDIR}
 	init directory:  ${INITDDIR}
-	cups dom socket: ${CUPS_DEFAULT_DOMAINSOCKET}
+	cups domain socket: ${CUPS_DEFAULT_DOMAINSOCKET}
 	gs-path:         ${with_gs_path}
 	imagefilters:    ${enable_imagefilters}
 	jpeg:            ${with_jpeg}
Index: cups-filters-1.0.58/utils/cups-browsed.8
===================================================================
--- cups-filters-1.0.58.orig/utils/cups-browsed.8
+++ cups-filters-1.0.58/utils/cups-browsed.8
@@ -14,17 +14,13 @@
 .fam T
 .fi
 .SH DESCRIPTION
-\fBcups-browsed\fP has three independently switchable functions:
+\fBcups-browsed\fP has two independently switchable functions:
 .IP 1. 4
-Browse Bonjour broadcasts of remote printers and create/remove local
+Browse DNS-SD broadcasts of remote printers and create/remove local
 raw queues pointing to these printers.
 .IP 2. 4
-Browse CUPS broadcasts of remote printers and create/remove local raw
-queues pointing to these printers.
-.IP 3. 4
-Broadcast local queues with the CUPS protocol.
-.PP
-Note that 2. and 3. are only to allow communication with legacy CUPS servers (1.5.x or older) on the remote machine(s). The standard method to broadcast for shared/network printers to broadcast their presence is Bonjour. The CUPS broadcasting/browsing protocol is deprecated.
+Find shared printers on given CUPS servers and create local CUPS queues
+pointing to them.
 
 cups-browsed can be run permanently (from system boot to shutdown) or on-demand (for example to save resources on mobile devices). For running it on-demend an auto-shutdown feature can be activated to let cups-browsed terminate when it does not have queues any more to take care of.
 
@@ -51,14 +47,6 @@ Auto shutdown mode, \fBmode\fP is \fBoff
 \fISIGUSR2\f1: Switches cups-browsed into auto shutdown mode.
 
 .SH NOTES
-Please take references to cups 1.6.x to include newer versions.
-Similarily, cups 1.5.x is intended to encompass older versions too.
-.PP
-In environments with only cups 1.6.x servers and clients (plus
-\fBcups-browsed\fP on either server or client or both) the function described in 1.
-enables the automatic discovery of remote queues and their display in
-printing dialogues of applications and with command line tools.
-.PP
 The facility provided by 3. means that servers running cups 1.6.x plus
 \fBcups-browsed\fP can broadcast their local queues so that clients with cups
 1.5.x get these queues automatically available. The outcome of 2. is
Index: cups-filters-1.0.58/utils/cups-browsed.c
===================================================================
--- cups-filters-1.0.58.orig/utils/cups-browsed.c
+++ cups-filters-1.0.58/utils/cups-browsed.c
@@ -118,6 +118,7 @@ cups_array_t *remote_printers;
 static cups_array_t *netifs;
 static cups_array_t *browseallow;
 
+static gboolean inhibit_local_printers_update = FALSE;
 static GMainLoop *gmainloop = NULL;
 #ifdef HAVE_AVAHI
 static AvahiGLibPoll *glib_poll = NULL;
@@ -128,7 +129,6 @@ static guint queues_timer_id = (guint) -
 static int browsesocket = -1;
 
 #define BROWSE_DNSSD (1<<0)
-#define BROWSE_CUPS  (1<<1)
 static unsigned int BrowseLocalProtocols = 0;
 static unsigned int BrowseRemoteProtocols = BROWSE_DNSSD;
 static unsigned int BrowseInterval = 60;
@@ -267,13 +267,14 @@ password_callback (const char *prompt,
 gboolean
 autoshutdown_execute (gpointer data)
 {
-  /* Are we still in auto shutdown mode and are we still without queues */
-  if (autoshutdown && cupsArrayCount(remote_printers) == 0) {
-    debug_printf("cups-browsed: Automatic shutdown as there are no print queues maintained by us for %d sec.\n",
+  debug_printf("autoshutdown_execute() in THREAD %ld\n", pthread_self());
+  /* Are we still in auto shutdown mode and are we still without queuea or jobs? */
+  if (autoshutdown) {
+    debug_printf("cups-browsed: Automatic shutdown as there are no print queues maintained by us or no jobs on them for %d sec.\n",
 		 autoshutdown_timeout);
     g_main_loop_quit(gmainloop);
+    g_main_context_wakeup(NULL);
   }
-
   /* Stop this timeout handler, we needed it only once */
   return FALSE;
 }
@@ -1732,100 +1733,6 @@ allowed (struct sockaddr *srcaddr)
   return FALSE;
 }
 
-gboolean
-process_browse_data (GIOChannel *source,
-		     GIOCondition condition,
-		     gpointer data)
-{
-  char packet[2048];
-  http_addr_t srcaddr;
-  socklen_t srclen;
-  ssize_t got;
-  unsigned int type;
-  unsigned int state;
-  char remote_host[256];
-  char uri[1024];
-  char info[1024];
-  char *c = NULL, *end = NULL;
-
-  memset(packet, 0, sizeof(packet));
-  memset(remote_host, 0, sizeof(remote_host));
-  memset(uri, 0, sizeof(uri));
-  memset(info, 0, sizeof(info));
-
-  srclen = sizeof (srcaddr);
-  got = recvfrom (browsesocket, packet, sizeof (packet) - 1, 0,
-		  &srcaddr.addr, &srclen);
-  if (got == -1) {
-    debug_printf ("cupsd-browsed: error receiving browse packet: %s\n",
-		  strerror (errno));
-    /* Remove this I/O source */
-    return FALSE;
-  }
-
-  packet[got] = '\0';
-  httpAddrString (&srcaddr, remote_host, sizeof (remote_host) - 1);
-
-  /* Check this packet is allowed */
-  if (!allowed ((struct sockaddr *) &srcaddr)) {
-    debug_printf("cups-browsed: browse packet from %s disallowed\n",
-		 remote_host);
-    return TRUE;
-  }
-
-  debug_printf("cups-browsed: browse packet received from %s\n",
-	       remote_host);
-
-  if (sscanf (packet, "%x%x%1023s", &type, &state, uri) < 3) {
-    debug_printf("cups-browsed: incorrect browse packet format\n");
-    return TRUE;
-  }
-
-  info[0] = '\0';
-
-  /* do not read OOB */
-  end = packet + sizeof(packet);
-  c = strchr (packet, '\"');
-  if (c >= end)
-     return TRUE;
-
-  if (c) {
-    /* Skip location field */
-    for (c++; c < end && *c != '\"'; c++)
-      ;
-
-    if (c >= end)
-       return TRUE;
-
-    if (*c == '\"') {
-      for (c++; c < end && isspace(*c); c++)
-	;
-    }
-
-    if (c >= end)
-      return TRUE;
-
-    /* Is there an info field? */
-    if (*c == '\"') {
-      int i;
-      c++;
-      for (i = 0;
-	   i < sizeof (info) - 1 && *c != '\"' && c < end;
-	   i++, c++)
-	info[i] = *c;
-      info[i] = '\0';
-    }
-  }
-  if (c >= end)
-    return TRUE;
-
-  found_cups_printer (remote_host, uri, info);
-  recheck_timer ();
-
-  /* Don't remove this I/O source */
-  return TRUE;
-}
-
 void
 update_netifs (void)
 {
@@ -2602,8 +2509,6 @@ read_configuration (const char *filename
       while (p) {
 	if (!strcasecmp(p, "dnssd"))
 	  protocols |= BROWSE_DNSSD;
-	else if (!strcasecmp(p, "cups"))
-	  protocols |= BROWSE_CUPS;
 	else if (strcasecmp(p, "none"))
 	  debug_printf("cups-browsed: Unknown protocol '%s'\n", p);
 
@@ -2861,12 +2766,7 @@ int main(int argc, char*argv[]) {
 	    /* Mark as unconfirmed, if no Avahi report of this queue appears
 	       in a certain time frame, we will remove the queue */
 	    p->status = STATUS_UNCONFIRMED;
-
-	    if (BrowseRemoteProtocols & BROWSE_CUPS)
-	      p->timeout = time(NULL) + BrowseTimeout;
-	    else
-	      p->timeout = time(NULL) + TIMEOUT_CONFIRM;
-
+	    p->timeout = time(NULL) + TIMEOUT_CONFIRM;
 	    p->duplicate = 0;
 	    debug_printf("cups-browsed: Found CUPS queue %s (URI: %s) from previous session.\n",
 			 p->name, p->uri);
@@ -2925,41 +2825,6 @@ int main(int argc, char*argv[]) {
   avahi_init();
 #endif /* HAVE_AVAHI */
 
-  if (BrowseLocalProtocols & BROWSE_CUPS ||
-      BrowseRemoteProtocols & BROWSE_CUPS) {
-    /* Set up our CUPS Browsing socket */
-    browsesocket = socket (AF_INET, SOCK_DGRAM, 0);
-    if (browsesocket == -1) {
-      debug_printf("cups-browsed: failed to create CUPS Browsing socket: %s\n",
-		   strerror (errno));
-    } else {
-      struct sockaddr_in addr;
-      memset (&addr, 0, sizeof (addr));
-      addr.sin_addr.s_addr = htonl (INADDR_ANY);
-      addr.sin_family = AF_INET;
-      addr.sin_port = htons (BrowsePort);
-      if (bind (browsesocket, (struct sockaddr *)&addr, sizeof (addr))) {
-	debug_printf("cups-browsed: failed to bind CUPS Browsing socket: %s\n",
-		     strerror (errno));
-	close (browsesocket);
-	browsesocket = -1;
-      } else {
-	int on = 1;
-	if (setsockopt (browsesocket, SOL_SOCKET, SO_BROADCAST,
-			&on, sizeof (on))) {
-	  debug_printf("cups-browsed: failed to allow broadcast: %s\n",
-		       strerror (errno));
-	  BrowseLocalProtocols &= ~BROWSE_CUPS;
-	}
-      }
-    }
-
-    if (browsesocket == -1) {
-      BrowseLocalProtocols &= ~BROWSE_CUPS;
-      BrowseRemoteProtocols &= ~BROWSE_CUPS;
-    }
-  }
-
   if (BrowseLocalProtocols == 0 &&
       BrowseRemoteProtocols == 0 &&
       !BrowsePoll) {
@@ -2976,18 +2841,6 @@ int main(int argc, char*argv[]) {
   gmainloop = g_main_loop_new (NULL, FALSE);
   recheck_timer ();
 
-  if (BrowseRemoteProtocols & BROWSE_CUPS) {
-    GIOChannel *browse_channel = g_io_channel_unix_new (browsesocket);
-    g_io_channel_set_close_on_unref (browse_channel, FALSE);
-    g_io_add_watch (browse_channel, G_IO_IN, process_browse_data, NULL);
-  }
-
-  if (BrowseLocalProtocols & BROWSE_CUPS) {
-      debug_printf ("cups-browsed: will send browse data every %ds\n",
-		    BrowseInterval);
-      g_idle_add (send_browse_data, NULL);
-  }
-
   if (BrowsePoll) {
     size_t index;
     for (index = 0;
Index: cups-filters-1.0.58/utils/cups-browsed.conf.5
===================================================================
--- cups-filters-1.0.58.orig/utils/cups-browsed.conf.5
+++ cups-filters-1.0.58/utils/cups-browsed.conf.5
@@ -26,8 +26,6 @@ all hosts when BrowseRemoteProtocols use
 The BrowsePoll directive polls a server for available printers once
 every 60 seconds. Multiple BrowsePoll directives can be specified
 to poll multiple servers. The default port to connect to is 631.
-BrowsePoll works independently of whether CUPS browsing is activated
-in BrowseRemoteProtocols.
 .PP
 .nf
 .fam C
@@ -41,7 +39,7 @@ in BrowseRemoteProtocols.
 The BrowseLocalProtocols directive specifies the protocols to use
 when advertising local shared printers on the network. The default
 is "none". Control of advertising of local shared printers using
-dnssd is done in /etc/cups/cupsd.conf.
+dnssd is done by CUPS and configured in /etc/cups/cupsd.conf.
 .PP
 .nf
 .fam C
@@ -54,13 +52,11 @@ dnssd is done in /etc/cups/cupsd.conf.
 The BrowseRemoteProtocols directive specifies the protocols to use
 when finding remote shared printers on the network. Multiple
 protocols can be specified by separating them with spaces.
-The default is "dnssd cups".
+The default is "dnssd".
 .PP
 .nf
 .fam C
         BrowseRemoteProtocols none
-        BrowseRemoteProtocols CUPS dnssd
-        BrowseRemoteProtocols CUPS
         BrowseRemoteProtocols dnssd
 
 .fam T
@@ -75,8 +71,6 @@ BrowseRemoteProtocols.
 .nf
 .fam C
         BrowseProtocols none
-        BrowseProtocols CUPS dnssd
-        BrowseProtocols CUPS
         BrowseProtocols dnssd
 
 .fam T
Index: cups-filters-1.0.58/utils/cups-browsed.conf.in
===================================================================
--- cups-filters-1.0.58.orig/utils/cups-browsed.conf.in
+++ cups-filters-1.0.58/utils/cups-browsed.conf.in
@@ -1,16 +1,16 @@
 # Which protocols will we use to discover printers on the network?
-# Can use DNSSD and/or CUPS, or 'none' for neither.
+# Can use DNSSD, or 'none' for neither.
 BrowseRemoteProtocols @BROWSEREMOTEPROTOCOLS@
 
 # Which protocols will we use to broadcast shared local printers to the network?
-# Can use DNSSD and/or CUPS, or 'none' for neither.
+# Can use DNSSD, or 'none' for neither.
 # Only CUPS is actually supported, as DNSSD is done by CUPS itself (we ignore
 # DNSSD in this directive).
 # BrowseLocalProtocols none
 
 # Settings of this directive apply to both BrowseRemoteProtocols and
 # BrowseLocalProtocols.
-# Can use DNSSD and/or CUPS, or 'none' for neither.
+# Can use DNSSD, or 'none' for neither.
 # BrowseProtocols none
 
 # Only browse remote printers from selected servers
