]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
More Bonjour shared printer fixes for STR #2384.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 17 May 2007 18:26:05 +0000 (18:26 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 17 May 2007 18:26:05 +0000 (18:26 +0000)
scheduler/dirsvc.c:
    - cupsdDeregisterPrinter(): Don't deregister hardwired remote printers.
    - cupsdRegisterPrinter(): Don't register hardwired remote printers.
    - cupsdSendBrowseList(): Don't share hardwired remote printers.

scheduler/ipp.c:
    - copy_printer_attrs(): Use external_type as the base value
      for the printer-type attribute we send.

scheduler/printers.c:
    - cupsdSetPrinterAttrs(): Save printer_type value in external_type.

scheduler/printers.h:
    - Add external_type to cupsd_printer_t structure.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@6538 7a7537e8-13f0-0310-91df-b6672ffda945

scheduler/dirsvc.c
scheduler/ipp.c
scheduler/printers.c
scheduler/printers.h

index 0969ae9803b3e126505ada5002c416acbced80cd..bd810997202b627aeaa2d76393085e048d2a683e 100644 (file)
@@ -199,7 +199,7 @@ cupsdDeregisterPrinter(
   */
 
   if (!Browsing || !p->shared ||
-      (p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)))
+      (p->external_type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)))
     return;
 
  /*
@@ -626,7 +626,7 @@ void
 cupsdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
 {
   if (!Browsing || !BrowseLocalProtocols || !BrowseInterval || !NumBrowsers ||
-      (p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)))
+      (p->external_type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)))
     return;
 
 #ifdef HAVE_LIBSLP
@@ -830,7 +830,7 @@ cupsdSendBrowseList(void)
     for (count = 0, p = (cupsd_printer_t *)cupsArrayFirst(Printers);
          count < max_count && p != NULL;
         p = (cupsd_printer_t *)cupsArrayNext(Printers))
-      if (!(p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) &&
+      if (!(p->external_type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) &&
           p->shared && p->browse_time < ut)
         count ++;
 
@@ -856,7 +856,8 @@ cupsdSendBrowseList(void)
 
       if (!p)
         break;
-      else if ((p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) ||
+      else if ((p->external_type & (CUPS_PRINTER_REMOTE |
+                                    CUPS_PRINTER_IMPLICIT)) ||
                !p->shared)
         continue;
       else if (p->browse_time < ut)
index ce410a4a6738bb5bd832ad881121ade7b36147ed..3e2d5f6a8f80f3f19988580c762a4096d2e12437 100644 (file)
@@ -4529,7 +4529,7 @@ copy_printer_attrs(
     * Add the CUPS-specific printer-type attribute...
     */
 
-    type = printer->type;
+    type = printer->external_type;
 
     if (printer == DefaultPrinter)
       type |= CUPS_PRINTER_DEFAULT;
index 685ee75508b95d7fd72fa2e75454e69d5282643b..af1909b5d40c65331c7e5c7d605c65de76e48e33 100644 (file)
@@ -2310,11 +2310,21 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
     }
   }
 
+ /*
+  * Save the local printer type value, which may have the CUPS_PRINTER_REMOTE
+  * bit set.  We use this value when sending the printer-type attribute to
+  * clients so they know whether the printer is really remote.  Doing it
+  * this way prevents the browsing code from timing out hardwired remote
+  * printers...
+  */
+
+  p->external_type = printer_type;
+
  /*
   * Copy the printer options into a browse attributes string we can re-use.
   */
 
-  if (!(p->type & CUPS_PRINTER_REMOTE))
+  if (!(printer_type & CUPS_PRINTER_REMOTE))
   {
     const char *valptr;                /* Pointer into value */
     char       *attrptr;               /* Pointer into attribute string */
index 2f51366a2febb36e68be8cdf3e6df5f7cafbb130..b2630bd2236aa661fa2ac730bf5a365dc4329fd4 100644 (file)
@@ -63,7 +63,8 @@ typedef struct cupsd_printer_s
   char         *reasons[16];           /* printer-state-reasons strings */
   time_t       state_time;             /* Time at this state */
   char         *job_sheets[2];         /* Banners/job sheets */
-  cups_ptype_t type;                   /* Printer type (color, small, etc.) */
+  cups_ptype_t type,                   /* Printer type (color, small, etc.) */
+               external_type;          /* Printer type that is advertised */
   char         *browse_attrs;          /* Attributes sent with browse data */
   time_t       browse_expire;          /* Expiration time for printer */
   time_t       browse_time;            /* Last time update was sent/received */