[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#766334: BrowseAllow all gets into cups-browsed.conf by default resulting in no remote printers



Control: tags -1 +pending +patch

Le jeudi, 30 octobre 2014, 12.13:09 Tim Waugh a écrit :
> On Thu, 2014-10-30 at 11:10 +0100, Till Kamppeter wrote:
> > The "Browse..." directive implementation was done by Tim Waugh as
> > part of the legacy CUPS broadcasting/browsing support. I do not
> > know the exact details, especially not of combinations of various
> > lines. I only know that all clients are allowed if no line is
> > given.
> > 
> > Tim, can you help here? Thanks,
> 
> I've added support for 'BrowseAllow All' in revno 7303.

Cool, thanks! I will be backporting this patch in the version targetted 
for Jessie. Expect an upload to sid in the next few days.

Cheers,
OdyX
Description: cups-browsed: support 'BrowseAllow All'
Bug-Debian: https://bugs.debian.org/766334
Origin: http://bzr.linuxfoundation.org/loggerhead/openprinting/cups-filters/revision/7303
Author: Tim Waugh <twaugh@redhat.com>
Last-Update: 2014-10-30
=== modified file 'utils/cups-browsed.c'
--- a/utils/cups-browsed.c
+++ b/utils/cups-browsed.c
@@ -117,6 +117,7 @@
 cups_array_t *remote_printers;
 static cups_array_t *netifs;
 static cups_array_t *browseallow;
+static gboolean browseallow_all = FALSE;
 
 static GMainLoop *gmainloop = NULL;
 #ifdef HAVE_AVAHI
@@ -1669,8 +1670,8 @@
 allowed (struct sockaddr *srcaddr)
 {
   allow_t *allow;
-  if (cupsArrayCount(browseallow) == 0) {
-    /* No "BrowseAllow" line, allow all servers */
+  if (browseallow_all || cupsArrayCount(browseallow) == 0) {
+    /* "BrowseAllow All", or no "BrowseAllow" line, so allow all servers */
     return TRUE;
   }
   for (allow = cupsArrayFirst (browseallow);
@@ -2522,7 +2523,14 @@
 {
   char *p;
   struct in_addr addr;
-  allow_t *allow = calloc (1, sizeof (allow_t));
+  allow_t *allow;
+
+  if (!strcasecmp (value, "all")) {
+    browseallow_all = TRUE;
+    return 0;
+  }
+  
+  allow = calloc (1, sizeof (allow_t));
   if (value == NULL)
     goto fail;
   p = strchr (value, '/');
--- a/utils/cups-browsed.conf.5
+++ b/utils/cups-browsed.conf.5
@@ -16,6 +16,7 @@
 .PP
 .nf
 .fam C
+        BrowseAllow All
         BrowseAllow 192.168.7.20
         BrowseAllow 192.168.7.0/24
         BrowseAllow 192.168.7.0/255.255.255.0
--- a/utils/cups-browsed.conf.in
+++ b/utils/cups-browsed.conf.in
@@ -14,6 +14,7 @@
 # BrowseProtocols none
 
 # Only browse remote printers from selected servers
+# BrowseAllow all
 # BrowseAllow cups.example.com
 # BrowseAllow 192.168.1.12
 # BrowseAllow 192.168.1.0/24

Reply to: