From: mike Date: Thu, 17 May 2007 18:26:05 +0000 (+0000) Subject: More Bonjour shared printer fixes for STR #2384. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a1a1e56bccd9407af6f29de5ad467c1018a6ab82;p=thirdparty%2Fcups.git More Bonjour shared printer fixes for STR #2384. 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 --- diff --git a/scheduler/dirsvc.c b/scheduler/dirsvc.c index 0969ae9803..bd81099720 100644 --- a/scheduler/dirsvc.c +++ b/scheduler/dirsvc.c @@ -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) diff --git a/scheduler/ipp.c b/scheduler/ipp.c index ce410a4a67..3e2d5f6a8f 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -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; diff --git a/scheduler/printers.c b/scheduler/printers.c index 685ee75508..af1909b5d4 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -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 */ diff --git a/scheduler/printers.h b/scheduler/printers.h index 2f51366a2f..b2630bd223 100644 --- a/scheduler/printers.h +++ b/scheduler/printers.h @@ -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 */