*
* Printer routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2009 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
ippAddBoolean(history, IPP_TAG_PRINTER, "printer-is-shared", p->shared);
ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-state-message",
NULL, p->state_message);
-#ifdef __APPLE__
- if (p->recoverable)
- ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_TEXT,
- "com.apple.print.recoverable-message", NULL, p->recoverable);
-#endif /* __APPLE__ */
if (p->num_reasons == 0)
ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"printer-state-reasons", NULL, "none");
/* charset-configured */
ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_CHARSET | IPP_TAG_COPY,
- "charset-configured", NULL, DefaultCharset);
+ "charset-configured", NULL, "utf-8");
/* charset-supported */
ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_CHARSET | IPP_TAG_COPY,
ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_TEXT | IPP_TAG_COPY,
"cups-version", NULL, CUPS_SVERSION + 6);
- /* generated-natural-language-supported */
- ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE | IPP_TAG_COPY,
+ /* generated-natural-language-supported (no IPP_TAG_COPY) */
+ ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE,
"generated-natural-language-supported", NULL, DefaultLanguage);
/* ipp-versions-supported */
ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"multiple-operation-time-out", MultipleOperationTimeout);
- /* natural-language-configured */
- ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE | IPP_TAG_COPY,
+ /* natural-language-configured (no IPP_TAG_COPY) */
+ ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE,
"natural-language-configured", NULL, DefaultLanguage);
/* notify-attributes-supported */
for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
p;
p = (cupsd_printer_t *)cupsArrayNext(Printers))
+ {
+ p->op_policy_ptr = DefaultPolicyPtr;
cupsdDeletePrinter(p, 0);
+ }
}
* 'cupsdDeletePrinter()' - Delete a printer from the system.
*/
-void
+int /* O - 1 if classes affected, 0 otherwise */
cupsdDeletePrinter(
cupsd_printer_t *p, /* I - Printer to delete */
int update) /* I - Update printers.conf? */
{
- int i; /* Looping var */
+ int i, /* Looping var */
+ changed = 0; /* Class changed? */
#ifdef __sgi
char filename[1024]; /* Interface script filename */
#endif /* __sgi */
if (!(p->type & CUPS_PRINTER_IMPLICIT))
{
- cupsdDeletePrinterFromClasses(p);
+ changed = cupsdDeletePrinterFromClasses(p);
/*
* Deregister from any browse protocols...
if (p->browse_attrs)
free(p->browse_attrs);
-#ifdef __APPLE__
- cupsdClearString(&p->recoverable);
-#endif /* __APPLE__ */
-
cupsFreeOptions(p->num_options, p->options);
free(p);
*/
cupsArrayRestore(Printers);
+
+ return (changed);
}
else if (!strcasecmp(line, "Reason"))
{
if (value &&
- strcmp(value, "com.apple.print.recoverable-warning") &&
strcmp(value, "connecting-to-device") &&
strcmp(value, "cups-insecure-filter-warning") &&
strcmp(value, "cups-missing-filter-warning"))
cupsFilePrintf(fp, "StateTime %d\n", (int)printer->state_time);
for (i = 0; i < printer->num_reasons; i ++)
- if (strcmp(printer->reasons[i], "com.apple.print.recoverable-warning") &&
- strcmp(printer->reasons[i], "connecting-to-device") &&
+ if (strcmp(printer->reasons[i], "connecting-to-device") &&
strcmp(printer->reasons[i], "cups-insecure-filter-warning") &&
strcmp(printer->reasons[i], "cups-missing-filter-warning"))
cupsFilePutConf(fp, "Reason", printer->reasons[i]);
int update) /* I - Update printers.conf? */
{
ipp_pstate_t old_state; /* Old printer state */
+ static const char * const printer_states[] =
+ { /* State strings */
+ "idle",
+ "processing",
+ "stopped"
+ };
/*
{
cupsdAddEvent(s == IPP_PRINTER_STOPPED ? CUPSD_EVENT_PRINTER_STOPPED :
CUPSD_EVENT_PRINTER_STATE, p, NULL,
- "%s \"%s\" state changed.",
+ "%s \"%s\" state changed to %s.",
(p->type & CUPS_PRINTER_CLASS) ? "Class" : "Printer",
- p->name);
+ p->name, printer_states[p->state]);
/*
* Let the browse code know this needs to be updated...
if (!RunUser)
{
/*
- * Only use filters that are owned by root and do not have world write
- * permissions.
+ * Only use filters that are owned by root and do not have group or world
+ * write permissions.
*/
- if (fileinfo.st_uid || (fileinfo.st_mode & (S_ISUID | S_IWOTH)) != 0)
+ if (fileinfo.st_uid ||
+ (fileinfo.st_mode & (S_ISUID | S_IWGRP | S_IWOTH)) != 0)
{
if (fileinfo.st_uid)
snprintf(p->state_message, sizeof(p->state_message),
if (!stat(filename, &fileinfo) &&
(fileinfo.st_uid ||
- (fileinfo.st_mode & (S_ISUID | S_IWOTH)) != 0))
+ (fileinfo.st_mode & (S_ISUID | S_IWGRP | S_IWOTH)) != 0))
{
if (fileinfo.st_uid)
snprintf(p->state_message, sizeof(p->state_message),
filter;
filter = (mime_filter_t *)cupsArrayNext(MimeDatabase->filters))
{
- if (filter->dst == p->filetype && filter->filter &&
+ if (filter->dst == p->filetype && filter->filter &&
strstr(filter->filter, "PrintJobMgr"))
break;
}