"cupsdAddPrinter: Adding %s to Printers", p->name);
cupsArrayAdd(Printers, p);
- if (!ImplicitPrinters)
- ImplicitPrinters = cupsArrayNew(compare_printers, NULL);
-
/*
* Return the new printer...
*/
update ? "Job stopped due to printer being deleted." :
"Job stopped.");
- /*
- * If this printer is the next for browsing, point to the next one...
- */
-
- if (p == BrowseNext)
- {
- cupsArrayFind(Printers, p);
- BrowseNext = (cupsd_printer_t *)cupsArrayNext(Printers);
- }
-
/*
* Remove the printer from the list...
*/
"cupsdDeletePrinter: Removing %s from Printers", p->name);
cupsArrayRemove(Printers, p);
- if (p->type & CUPS_PRINTER_IMPLICIT)
- {
- cupsdLogMessage(CUPSD_LOG_DEBUG2,
- "cupsdDeletePrinter: Removing %s from ImplicitPrinters",
- p->name);
- cupsArrayRemove(ImplicitPrinters, p);
- }
-
/*
* Remove the dummy interface/icon/option files under IRIX...
*/
*/
if (p == DefaultPrinter)
- {
DefaultPrinter = NULL;
- if (UseNetworkDefault)
- {
- /*
- * Find the first network default printer and use it...
- */
-
- cupsd_printer_t *dp; /* New default printer */
-
-
- for (dp = (cupsd_printer_t *)cupsArrayFirst(Printers);
- dp;
- dp = (cupsd_printer_t *)cupsArrayNext(Printers))
- if (dp != p && (dp->type & CUPS_PRINTER_DEFAULT))
- {
- DefaultPrinter = dp;
- break;
- }
- }
- }
-
/*
* Remove this printer from any classes...
*/
- if (!(p->type & CUPS_PRINTER_IMPLICIT))
- {
- changed = cupsdDeletePrinterFromClasses(p);
+ changed = cupsdDeletePrinterFromClasses(p);
- /*
- * Deregister from any browse protocols...
- */
+ /*
+ * Deregister from any browse protocols...
+ */
- cupsdDeregisterPrinter(p, 1);
- }
+ cupsdDeregisterPrinter(p, 1);
/*
* Free all memory used by the printer...
cupsArrayDelete(p->filetypes);
- if (p->browse_attrs)
- free(p->browse_attrs);
-
cupsFreeOptions(p->num_options, p->options);
free(p);
"cupsdRenamePrinter: Removing %s from Printers", p->name);
cupsArrayRemove(Printers, p);
- if (p->type & CUPS_PRINTER_IMPLICIT)
- {
- cupsdLogMessage(CUPSD_LOG_DEBUG2,
- "cupsdRenamePrinter: Removing %s from ImplicitPrinters",
- p->name);
- cupsArrayRemove(ImplicitPrinters, p);
- }
-
/*
* Rename the printer type...
*/
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"cupsdRenamePrinter: Adding %s to Printers", p->name);
cupsArrayAdd(Printers, p);
-
- if (p->type & CUPS_PRINTER_IMPLICIT)
- {
- cupsdLogMessage(CUPSD_LOG_DEBUG2,
- "cupsdRenamePrinter: Adding %s to ImplicitPrinters",
- p->name);
- cupsArrayAdd(ImplicitPrinters, p);
- }
}
printer = (cupsd_printer_t *)cupsArrayNext(Printers))
{
/*
- * Skip remote destinations and printer classes...
+ * Skip printer classes...
*/
- if ((printer->type & CUPS_PRINTER_DISCOVERED) ||
- (printer->type & CUPS_PRINTER_CLASS) ||
- (printer->type & CUPS_PRINTER_IMPLICIT))
+ if (printer->type & CUPS_PRINTER_CLASS)
continue;
/*
void
cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
{
- int i, /* Looping var */
- length; /* Length of browse attributes */
+ int i; /* Looping var */
char resource[HTTP_MAX_URI]; /* Resource portion of URI */
int num_air; /* Number of auth-info-required values */
const char * const *air; /* auth-info-required values */
const char *auth_supported; /* Authentication supported */
ipp_t *oldattrs; /* Old printer attributes */
ipp_attribute_t *attr; /* Attribute data */
- cups_option_t *option; /* Current printer option */
char *name, /* Current user/group name */
*filter; /* Current filter */
static const char * const air_none[] =
num_air = p->num_auth_info_required;
air = p->auth_info_required;
}
- else if ((p->type & CUPS_PRINTER_AUTHENTICATED) &&
- (p->type & CUPS_PRINTER_DISCOVERED))
+ else if (p->type & CUPS_PRINTER_AUTHENTICATED)
{
num_air = 2;
air = air_userpass;
auth_supported = "negotiate";
#endif /* HAVE_GSSAPI */
- if (!(p->type & CUPS_PRINTER_DISCOVERED))
- {
- if (auth_type != CUPSD_AUTH_NONE)
- p->type |= CUPS_PRINTER_AUTHENTICATED;
- else
- p->type &= ~CUPS_PRINTER_AUTHENTICATED;
- }
+ if (auth_type != CUPSD_AUTH_NONE)
+ p->type |= CUPS_PRINTER_AUTHENTICATED;
+ else
+ p->type &= ~CUPS_PRINTER_AUTHENTICATED;
}
- else if (!(p->type & CUPS_PRINTER_DISCOVERED))
+ else
p->type &= ~CUPS_PRINTER_AUTHENTICATED;
/*
ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"auth-info-required", num_air, NULL, air);
- if (cupsArrayCount(Banners) > 0 && !(p->type & CUPS_PRINTER_DISCOVERED))
+ if (cupsArrayCount(Banners) > 0)
{
/*
* Setup the job-sheets-default attribute...
p->raw = 0;
p->remote = 0;
- if (p->type & CUPS_PRINTER_DISCOVERED)
+ /*
+ * Assign additional attributes depending on whether this is a printer
+ * or class...
+ */
+
+ if (p->type & CUPS_PRINTER_CLASS)
{
+ p->raw = 1;
+ p->type &= ~CUPS_PRINTER_OPTIONS;
+
/*
- * Tell the client this is a remote printer of some type...
+ * Add class-specific attributes...
*/
- if (strchr(p->uri, '?'))
+ ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+ "printer-make-and-model", NULL, "Local Printer Class");
+ ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
+ "file:///dev/null");
+
+ if (p->num_printers > 0)
{
/*
- * Strip trailing "?options" from URI...
+ * Add a list of member names; URIs are added in copy_printer_attrs...
*/
- char *ptr; /* Pointer into URI */
+ attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME,
+ "member-names", p->num_printers, NULL, NULL);
+ p->type |= CUPS_PRINTER_OPTIONS;
- strlcpy(resource, p->uri, sizeof(resource));
- if ((ptr = strchr(resource, '?')) != NULL)
- *ptr = '\0';
+ for (i = 0; i < p->num_printers; i ++)
+ {
+ if (attr != NULL)
+ attr->values[i].string.text = _cupsStrRetain(p->printers[i]->name);
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI,
- "printer-uri-supported", NULL, resource);
+ p->type &= ~CUPS_PRINTER_OPTIONS | p->printers[i]->type;
+ }
}
- else
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI,
- "printer-uri-supported", NULL, p->uri);
-
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "printer-more-info",
- NULL, p->uri);
-
- if (p->make_model)
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "printer-make-and-model", NULL, p->make_model);
-
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
- p->uri);
-
- p->raw = 1;
- p->remote = 1;
}
else
{
/*
- * Assign additional attributes depending on whether this is a printer
- * or class...
+ * Add printer-specific attributes...
*/
- if (p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT))
- {
- p->raw = 1;
- p->type &= ~CUPS_PRINTER_OPTIONS;
-
- /*
- * Add class-specific attributes...
- */
-
- if ((p->type & CUPS_PRINTER_IMPLICIT) && p->num_printers > 0 &&
- p->printers[0]->make_model)
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "printer-make-and-model", NULL, p->printers[0]->make_model);
- else
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "printer-make-and-model", NULL, "Local Printer Class");
+ ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
+ p->sanitized_device_uri);
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
- "file:///dev/null");
+ /*
+ * Assign additional attributes from the PPD file (if any)...
+ */
- if (p->num_printers > 0)
- {
- /*
- * Add a list of member names; URIs are added in copy_printer_attrs...
- */
+ load_ppd(p);
- attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME,
- "member-names", p->num_printers, NULL, NULL);
- p->type |= CUPS_PRINTER_OPTIONS;
+ /*
+ * Add filters for printer...
+ */
- for (i = 0; i < p->num_printers; i ++)
- {
- if (attr != NULL)
- attr->values[i].string.text = _cupsStrRetain(p->printers[i]->name);
+ cupsdSetPrinterReasons(p, "-cups-missing-filter-warning,"
+ "cups-insecure-filter-warning");
- p->type &= ~CUPS_PRINTER_OPTIONS | p->printers[i]->type;
- }
- }
+ if (p->pc && p->pc->filters)
+ {
+ for (filter = (char *)cupsArrayFirst(p->pc->filters);
+ filter;
+ filter = (char *)cupsArrayNext(p->pc->filters))
+ add_printer_filter(p, p->filetype, filter);
}
- else
+ else if (!(p->type & CUPS_PRINTER_REMOTE))
{
- /*
- * Add printer-specific attributes...
- */
+ char interface[1024]; /* Interface script */
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
- p->sanitized_device_uri);
- /*
- * Assign additional attributes from the PPD file (if any)...
- */
-
- load_ppd(p);
-
- /*
- * Add filters for printer...
- */
-
- cupsdSetPrinterReasons(p, "-cups-missing-filter-warning,"
- "cups-insecure-filter-warning");
-
- if (p->pc && p->pc->filters)
+ snprintf(interface, sizeof(interface), "%s/interfaces/%s", ServerRoot,
+ p->name);
+ if (!access(interface, X_OK))
{
- for (filter = (char *)cupsArrayFirst(p->pc->filters);
- filter;
- filter = (char *)cupsArrayNext(p->pc->filters))
- add_printer_filter(p, p->filetype, filter);
+ /*
+ * Yes, we have a System V style interface script; use it!
+ */
+
+ snprintf(interface, sizeof(interface), "*/* 0 %s/interfaces/%s",
+ ServerRoot, p->name);
+ add_printer_filter(p, p->filetype, interface);
}
- else if (!(p->type & CUPS_PRINTER_REMOTE))
+ else
{
- char interface[1024]; /* Interface script */
-
-
- snprintf(interface, sizeof(interface), "%s/interfaces/%s", ServerRoot,
- p->name);
- if (!access(interface, X_OK))
- {
- /*
- * Yes, we have a System V style interface script; use it!
- */
-
- snprintf(interface, sizeof(interface), "*/* 0 %s/interfaces/%s",
- ServerRoot, p->name);
- add_printer_filter(p, p->filetype, interface);
- }
- else
- {
- /*
- * Add a filter from application/vnd.cups-raw to printer/name to
- * handle "raw" printing by users.
- */
+ /*
+ * Add a filter from application/vnd.cups-raw to printer/name to
+ * handle "raw" printing by users.
+ */
- add_printer_filter(p, p->filetype, "application/vnd.cups-raw 0 -");
+ add_printer_filter(p, p->filetype, "application/vnd.cups-raw 0 -");
- /*
- * Add a PostScript filter, since this is still possibly PS printer.
- */
+ /*
+ * Add a PostScript filter, since this is still possibly PS printer.
+ */
- add_printer_filter(p, p->filetype,
- "application/vnd.cups-postscript 0 -");
- }
+ add_printer_filter(p, p->filetype,
+ "application/vnd.cups-postscript 0 -");
}
+ }
- if (p->pc && p->pc->prefilters)
- {
- if (!p->prefiltertype)
- p->prefiltertype = mimeAddType(MimeDatabase, "prefilter", p->name);
+ if (p->pc && p->pc->prefilters)
+ {
+ if (!p->prefiltertype)
+ p->prefiltertype = mimeAddType(MimeDatabase, "prefilter", p->name);
- for (filter = (char *)cupsArrayFirst(p->pc->prefilters);
- filter;
- filter = (char *)cupsArrayNext(p->pc->prefilters))
- add_printer_filter(p, p->prefiltertype, filter);
- }
+ for (filter = (char *)cupsArrayFirst(p->pc->prefilters);
+ filter;
+ filter = (char *)cupsArrayNext(p->pc->prefilters))
+ add_printer_filter(p, p->prefiltertype, filter);
}
}
* Force sharing off for remote queues...
*/
- if (p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT))
+ if (p->type & CUPS_PRINTER_REMOTE)
p->shared = 0;
- else
- {
- /*
- * Copy the printer options into a browse attributes string we can re-use.
- */
-
- const char *valptr; /* Pointer into value */
- char *attrptr; /* Pointer into attribute string */
-
-
- /*
- * Free the old browse attributes as needed...
- */
-
- if (p->browse_attrs)
- free(p->browse_attrs);
-
- /*
- * Compute the length of all attributes + job-sheets, lease-duration,
- * and BrowseLocalOptions.
- */
-
- for (length = 1, i = p->num_options, option = p->options;
- i > 0;
- i --, option ++)
- {
- length += strlen(option->name) + 2;
-
- if (option->value)
- {
- for (valptr = option->value; *valptr; valptr ++)
- if (strchr(" \"\'\\", *valptr))
- length += 2;
- else
- length ++;
- }
- }
-
- length += 13 + strlen(p->job_sheets[0]) + strlen(p->job_sheets[1]);
- length += 32;
- if (BrowseLocalOptions)
- length += 12 + strlen(BrowseLocalOptions);
-
- /*
- * Allocate the new string...
- */
-
- if ((p->browse_attrs = calloc(1, length)) == NULL)
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "Unable to allocate %d bytes for browse data!",
- length);
- else
- {
- /*
- * Got the allocated string, now copy the options and attributes over...
- */
-
- sprintf(p->browse_attrs, "job-sheets=%s,%s lease-duration=%d",
- p->job_sheets[0], p->job_sheets[1], BrowseTimeout);
- attrptr = p->browse_attrs + strlen(p->browse_attrs);
-
- if (BrowseLocalOptions)
- {
- sprintf(attrptr, " ipp-options=%s", BrowseLocalOptions);
- attrptr += strlen(attrptr);
- }
-
- for (i = p->num_options, option = p->options;
- i > 0;
- i --, option ++)
- {
- *attrptr++ = ' ';
- strcpy(attrptr, option->name);
- attrptr += strlen(attrptr);
-
- if (option->value)
- {
- *attrptr++ = '=';
-
- for (valptr = option->value; *valptr; valptr ++)
- {
- if (strchr(" \"\'\\", *valptr))
- *attrptr++ = '\\';
-
- *attrptr++ = *valptr;
- }
- }
- }
- }
- }
/*
* Populate the document-format-supported attribute...
};
- /*
- * Can't set status of remote printers...
- */
-
- if (p->type & CUPS_PRINTER_DISCOVERED)
- return;
-
/*
* Set the new state...
*/
* Let the browse code know this needs to be updated...
*/
- BrowseNext = p;
- p->state_time = time(NULL);
- p->browse_time = 0;
+ p->state_time = time(NULL);
#ifdef __sgi
write_irix_state(p);
p;
p = (cupsd_printer_t *)cupsArrayNext(Printers))
{
- /*
- * Remove remote printers if we are no longer browsing...
- */
-
- if (!Browsing &&
- (p->type & (CUPS_PRINTER_IMPLICIT | CUPS_PRINTER_DISCOVERED)))
- {
- if (p->type & CUPS_PRINTER_IMPLICIT)
- cupsArrayRemove(ImplicitPrinters, p);
-
- cupsArraySave(Printers);
- cupsdDeletePrinter(p, 0);
- cupsArrayRestore(Printers);
- continue;
- }
-
/*
* Update the operation policy pointer...
*/
p->op_policy_ptr = DefaultPolicyPtr;
/*
- * Update printer attributes as needed...
+ * Update printer attributes...
*/
- if (!(p->type & CUPS_PRINTER_DISCOVERED))
- cupsdSetPrinterAttrs(p);
+ cupsdSetPrinterAttrs(p);
}
}
*printer = p;
if (dtype)
- *dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT |
- CUPS_PRINTER_REMOTE | CUPS_PRINTER_DISCOVERED);
+ *dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE);
return (p->name);
}
*printer = p;
if (dtype)
- *dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT |
- CUPS_PRINTER_REMOTE | CUPS_PRINTER_DISCOVERED);
+ *dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE);
return (p->name);
}
static void
dirty_printer(cupsd_printer_t *p) /* I - Printer */
{
- if (p->type & CUPS_PRINTER_DISCOVERED)
- cupsdMarkDirty(CUPSD_DIRTY_REMOTE);
- else if (p->type & CUPS_PRINTER_CLASS)
+ if (p->type & CUPS_PRINTER_CLASS)
cupsdMarkDirty(CUPSD_DIRTY_CLASSES);
else
cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
_pwg_map_t *pwgsource, /* Current PWG source */
*pwgtype; /* Current PWG type */
ipp_attribute_t *attr; /* Attribute data */
- ipp_value_t *val; /* Attribute value */
+ _ipp_value_t *val; /* Attribute value */
int num_finishings, /* Number of finishings */
finishings[5]; /* finishings-supported values */
int num_qualities, /* Number of print-quality values */