Index: backend/ipp.c
===================================================================
--- backend/ipp.c (revision 10578)
+++ backend/ipp.c (working copy)
@@ -331,7 +331,7 @@
if ((auth_info_required = getenv("AUTH_INFO_REQUIRED")) == NULL)
auth_info_required = "none";
- state_reasons = _cupsArrayNewStrings(getenv("PRINTER_STATE_REASONS"));
+ state_reasons = _cupsArrayNewStrings(getenv("PRINTER_STATE_REASONS"), ',');
#ifdef HAVE_GSSAPI
/*
@@ -2297,7 +2297,8 @@
*media_size; /* media-size value */
const char *media_source, /* media-source value */
*media_type, /* media-type value */
- *collate_str; /* multiple-document-handling value */
+ *collate_str, /* multiple-document-handling value */
+ *mandatory; /* Mandatory attributes */
/*
@@ -2366,6 +2367,85 @@
* Send standard IPP attributes...
*/
+ if (pc->password &&
+ (keyword = cupsGetOption("job-password", num_options,
+ options)) != NULL)
+ {
+ ippAddOctetString(request, IPP_TAG_OPERATION, "job-password",
+ keyword, strlen(keyword));
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+ "job-password-encryption", NULL, "none");
+ }
+
+ if (pc->account_id &&
+ (keyword = cupsGetOption("job-account-id", num_options,
+ options)) != NULL)
+ ippAddString(request, IPP_TAG_JOB, IPP_TAG_NAME, "job-account-id",
+ NULL, keyword);
+
+ if (pc->account_id &&
+ (keyword = cupsGetOption("job-accounting-user-id", num_options,
+ options)) != NULL)
+ ippAddString(request, IPP_TAG_JOB, IPP_TAG_NAME,
+ "job-accounting-user-id", NULL, keyword);
+
+ for (mandatory = (char *)cupsArrayFirst(pc->mandatory);
+ mandatory;
+ mandatory = (char *)cupsArrayNext(pc->mandatory))
+ {
+ if (strcmp(mandatory, "copies") &&
+ strcmp(mandatory, "destination-uris") &&
+ strcmp(mandatory, "finishings") &&
+ strcmp(mandatory, "job-account-id") &&
+ strcmp(mandatory, "job-accounting-user-id") &&
+ strcmp(mandatory, "job-password") &&
+ strcmp(mandatory, "media") &&
+ strncmp(mandatory, "media-col", 9) &&
+ strcmp(mandatory, "multiple-document-handling") &&
+ strcmp(mandatory, "output-bin") &&
+ strcmp(mandatory, "print-color-mode") &&
+ strcmp(mandatory, "print-quality") &&
+ strcmp(mandatory, "sides") &&
+ (keyword = cupsGetOption(mandatory, num_options, options)) != NULL)
+ {
+ _ipp_option_t *opt = _ippFindOption(mandatory);
+ /* Option type */
+ ipp_tag_t value_tag = opt ? opt->value_tag : IPP_TAG_NAME;
+ /* Value type */
+
+ switch (value_tag)
+ {
+ case IPP_TAG_INTEGER :
+ case IPP_TAG_ENUM :
+ ippAddInteger(request, IPP_TAG_JOB, value_tag, mandatory,
+ atoi(keyword));
+ break;
+ case IPP_TAG_BOOLEAN :
+ ippAddBoolean(request, IPP_TAG_JOB, mandatory,
+ !_cups_strcasecmp(keyword, "true"));
+ break;
+ case IPP_TAG_RANGE :
+ {
+ int lower, upper; /* Range */
+
+ if (sscanf(keyword, "%d-%d", &lower, &upper) != 2)
+ lower = upper = atoi(keyword);
+
+ ippAddRange(request, IPP_TAG_JOB, mandatory, lower, upper);
+ }
+ break;
+ case IPP_TAG_STRING :
+ ippAddOctetString(request, IPP_TAG_JOB, mandatory, keyword,
+ strlen(keyword));
+ break;
+ default :
+ ippAddString(request, IPP_TAG_JOB, value_tag, mandatory,
+ NULL, keyword);
+ break;
+ }
+ }
+ }
+
if ((keyword = cupsGetOption("PageSize", num_options, options)) == NULL)
keyword = cupsGetOption("media", num_options, options);
@@ -2431,19 +2511,19 @@
ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "output-bin",
NULL, keyword);
- if ((keyword = cupsGetOption("output-mode", num_options,
+ if ((keyword = cupsGetOption("print-color-mode", num_options,
options)) != NULL)
- ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "output-mode",
+ ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "print-color-mode",
NULL, keyword);
else if ((keyword = cupsGetOption("ColorModel", num_options,
options)) != NULL)
{
if (!_cups_strcasecmp(keyword, "Gray"))
- ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "output-mode",
- NULL, "monochrome");
+ ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD,
+ "print-color-mode", NULL, "monochrome");
else
- ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "output-mode",
- NULL, "color");
+ ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD,
+ "print-color-mode", NULL, "color");
}
if ((keyword = cupsGetOption("print-quality", num_options,
@@ -3133,7 +3213,7 @@
else
op = '\0';
- new_reasons = _cupsArrayNewStrings(s);
+ new_reasons = _cupsArrayNewStrings(s, ',');
}
else
return;
Index: doc/help/api-cups.html
===================================================================
--- doc/help/api-cups.html (revision 10583)
+++ doc/help/api-cups.html (working copy)
@@ -1025,7 +1025,7 @@
Discussion
New option arrays can be initialized simply by passing 0 for the
"num_options" parameter.
-
+
Create the Windows PPD file for a printer.
char *cupsAdminCreateWindowsPPD (
@@ -1047,7 +1047,7 @@
Return Value
PPD file or NULL
-
+
Export a printer to Samba.
int cupsAdminExportSamba (
Index: doc/help/spec-ppd.html
===================================================================
--- doc/help/spec-ppd.html (revision 10578)
+++ doc/help/spec-ppd.html (working copy)
@@ -410,7 +410,11 @@
cupsIPPFinishings
cupsIPPReason
cupsIPPSupplies
+ cupsJobAccountId
+ cupsJobAccountingUserId
+ cupsJobPassword
cupsLanguages
+ cupsMandatory
cupsManualCopies
cupsMarkerName
cupsMarkerNotice
@@ -1706,6 +1710,49 @@
*cupsIPPSupplies: False
+
+
+
+*cupsJobAccountId: boolean
+
+This keyword defines whether the printer accepts the job-account-id IPP attribute.
+
+Example:
+
+
+*% Specify the printer accepts the job-account-id IPP attribute.
+*cupsJobAccountId: True
+
+
+
+
+
+*cupsJobAccountingUserId: boolean
+
+This keyword defines whether the printer accepts the job-accounting-user-id IPP attribute.
+
+Example:
+
+
+*% Specify the printer accepts the job-accounting-user-id IPP attribute.
+*cupsJobAccountingUserId: True
+
+
+
+
+
+*cupsJobPassword: "format"
+
+This keyword defines the format of the job-password IPP attribute, if supported by the printer. Currently the only supported format is "1111" indicating a 4-digit PIN code.
+
+Example:
+
+
+*% Specify the printer supports 4-digit PIN codes.
+*cupsJobPassword: "1111"
+
+
+
*cupsLanguages: "locale list"
@@ -1721,6 +1768,21 @@
*cupsLanguages: "en_CA en_UK en_US fr_CA fr_FR"
+
+
+
+*cupsMandatory: "attribute1 attribute2 ... attributeN"
+
+This keyword defines a list of IPP attributes that must be provided when submitting a print job creation request.
+
+Example:
+
+
+*% Specify that the user must supply a job-password
+*cupsMandatory: "job-password job-password-encryption"
+
+
+
*cupsManualCopies: boolean
@@ -2249,6 +2311,18 @@
+Changes in CUPS 1.7
+
+
+
+
Changes in CUPS 1.6
Index: cups/array.c
===================================================================
--- cups/array.c (revision 10578)
+++ cups/array.c (working copy)
@@ -138,8 +138,7 @@
/*
- * '_cupsArrayAddStrings()' - Add zero or more comma-delimited strings to an
- * array.
+ * '_cupsArrayAddStrings()' - Add zero or more delimited strings to an array.
*
* Note: The array MUST be created using the @link _cupsArrayNewStrings@
* function. Duplicate strings are NOT added. If the string pointer "s" is NULL
@@ -148,7 +147,8 @@
int /* O - 1 on success, 0 on failure */
_cupsArrayAddStrings(cups_array_t *a, /* I - Array */
- const char *s) /* I - Comma-delimited strings or NULL */
+ const char *s, /* I - Delimited strings or NULL */
+ char delim)/* I - Delimiter character */
{
char *buffer, /* Copy of string */
*start, /* Start of string */
@@ -159,12 +159,23 @@
if (!a || !s || !*s)
return (0);
- if (!strchr(s, ','))
+ if (delim == ' ')
{
/*
- * String doesn't contain a comma, so add it as a single value...
+ * Skip leading whitespace...
*/
+ while (*s && isspace(*s & 255))
+ s ++;
+ }
+
+ if (!strchr(s, delim) ||
+ (delim == ' ' && !strchr(s, '\t') && !strchr(s, '\n')))
+ {
+ /*
+ * String doesn't contain a delimiter, so add it as a single value...
+ */
+
if (!cupsArrayFind(a, (void *)s))
status = cupsArrayAdd(a, (void *)s);
}
@@ -179,7 +190,14 @@
* it...
*/
- if ((end = strchr(start, ',')) != NULL)
+ if (delim == ' ')
+ {
+ while (*end && !isspace(*end & 255))
+ end ++;
+ while (*end && isspace(*end & 255))
+ *end++ = '\0';
+ }
+ else if ((end = strchr(start, delim)) != NULL)
*end++ = '\0';
else
end = start + strlen(start);
@@ -782,7 +800,8 @@
*/
cups_array_t * /* O - Array */
-_cupsArrayNewStrings(const char *s) /* I - Comma-delimited strings or NULL */
+_cupsArrayNewStrings(const char *s, /* I - Delimited strings or NULL */
+ char delim) /* I - Delimiter character */
{
cups_array_t *a; /* Array */
@@ -790,7 +809,7 @@
if ((a = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0,
(cups_acopy_func_t)_cupsStrAlloc,
(cups_afree_func_t)_cupsStrFree)) != NULL)
- _cupsArrayAddStrings(a, s);
+ _cupsArrayAddStrings(a, s, delim);
return (a);
}
Index: cups/dest.c
===================================================================
--- cups/dest.c (revision 10581)
+++ cups/dest.c (working copy)
@@ -1409,6 +1409,7 @@
"printer-is-shared",
"printer-location",
"printer-make-and-model",
+ "printer-mandatory-job-attributes",
"printer-name",
"printer-state",
"printer-state-change-time",
@@ -1514,6 +1515,7 @@
!strcmp(attr->name, "printer-info") ||
!strcmp(attr->name, "printer-is-shared") ||
!strcmp(attr->name, "printer-make-and-model") ||
+ !strcmp(attr->name, "printer-mandatory-job-attributes") ||
!strcmp(attr->name, "printer-state") ||
!strcmp(attr->name, "printer-state-change-time") ||
!strcmp(attr->name, "printer-type") ||
Index: cups/auth.c
===================================================================
--- cups/auth.c (revision 10578)
+++ cups/auth.c (working copy)
@@ -190,11 +190,18 @@
* Nope - get a new password from the user...
*/
+ char default_username[HTTP_MAX_VALUE];
+ /* Default username */
+
cg = _cupsGlobals();
if (!cg->lang_default)
cg->lang_default = cupsLangDefault();
+ if (httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "username",
+ default_username))
+ cupsSetUser(default_username);
+
snprintf(prompt, sizeof(prompt),
_cupsLangString(cg->lang_default, _("Password for %s on %s? ")),
cupsUser(),
Index: cups/ppd-cache.c
===================================================================
--- cups/ppd-cache.c (revision 10578)
+++ cups/ppd-cache.c (working copy)
@@ -557,6 +557,19 @@
}
else if (!_cups_strcasecmp(line, "MaxCopies"))
pc->max_copies = atoi(value);
+ else if (!_cups_strcasecmp(line, "JobAccountId"))
+ pc->account_id = !_cups_strcasecmp(value, "true");
+ else if (!_cups_strcasecmp(line, "JobAccountingUserId"))
+ pc->accounting_user_id = !_cups_strcasecmp(value, "true");
+ else if (!_cups_strcasecmp(line, "JobPassword"))
+ pc->password = _cupsStrAlloc(value);
+ else if (!_cups_strcasecmp(line, "Mandatory"))
+ {
+ if (pc->mandatory)
+ _cupsArrayAddStrings(pc->mandatory, value, ' ');
+ else
+ pc->mandatory = _cupsArrayNewStrings(value, ' ');
+ }
else
{
DEBUG_printf(("_ppdCacheCreateWithFile: Unknown %s on line %d.", line,
@@ -1367,6 +1380,23 @@
pc->max_copies = 9999;
/*
+ * cupsJobAccountId, cupsJobAccountingUserId, cupsJobPassword, and
+ * cupsMandatory.
+ */
+
+ if ((ppd_attr = ppdFindAttr(ppd, "cupsJobAccountId", NULL)) != NULL)
+ pc->account_id = !_cups_strcasecmp(ppd_attr->value, "true");
+
+ if ((ppd_attr = ppdFindAttr(ppd, "cupsJobAccountingUserId", NULL)) != NULL)
+ pc->accounting_user_id = !_cups_strcasecmp(ppd_attr->value, "true");
+
+ if ((ppd_attr = ppdFindAttr(ppd, "cupsJobPassword", NULL)) != NULL)
+ pc->password = _cupsStrAlloc(ppd_attr->value);
+
+ if ((ppd_attr = ppdFindAttr(ppd, "cupsMandatory", NULL)) != NULL)
+ pc->mandatory = _cupsArrayNewStrings(ppd_attr->value, ' ');
+
+ /*
* Return the cache data...
*/
@@ -1466,6 +1496,10 @@
cupsArrayDelete(pc->prefilters);
cupsArrayDelete(pc->finishings);
+ _cupsStrFree(pc->password);
+
+ cupsArrayDelete(pc->mandatory);
+
free(pc);
}
@@ -2358,6 +2392,22 @@
cupsFilePrintf(fp, "MaxCopies %d\n", pc->max_copies);
/*
+ * Accounting/quota/PIN/managed printing values...
+ */
+
+ cupsFilePrintf(fp, "AccountId %s\n", pc->account_id ? "true" : "false");
+ cupsFilePrintf(fp, "AccountingUserId %s\n",
+ pc->accounting_user_id ? "true" : "false");
+
+ if (pc->password)
+ cupsFilePutConf(fp, "Password", pc->password);
+
+ for (value = (char *)cupsArrayFirst(pc->mandatory);
+ value;
+ value = (char *)cupsArrayNext(pc->mandatory))
+ cupsFilePutConf(fp, "Mandatory", value);
+
+ /*
* IPP attributes, if any...
*/
Index: cups/encode.c
===================================================================
--- cups/encode.c (revision 10578)
+++ cups/encode.c (working copy)
@@ -71,9 +71,15 @@
{ 0, "hue", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "hue-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 1, "include-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION },
+ { 0, "job-account-id", IPP_TAG_NAME, IPP_TAG_JOB },
+ { 0, "job-account-id-default",IPP_TAG_NAME, IPP_TAG_PRINTER },
+ { 0, "job-accounting-user-id", IPP_TAG_NAME, IPP_TAG_JOB },
+ { 0, "job-accounting-user-id-default", IPP_TAG_NAME, IPP_TAG_PRINTER },
{ 0, "job-impressions", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "job-k-limit", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "job-page-limit", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
+ { 0, "job-password", IPP_TAG_STRING, IPP_TAG_OPERATION },
+ { 0, "job-password-encryption", IPP_TAG_KEYWORD, IPP_TAG_OPERATION },
{ 0, "job-priority", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "job-quota-period", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 1, "job-sheets", IPP_TAG_NAME, IPP_TAG_JOB },
Index: cups/array-private.h
===================================================================
--- cups/array-private.h (revision 10578)
+++ cups/array-private.h (working copy)
@@ -3,7 +3,7 @@
*
* Private array definitions for CUPS.
*
- * Copyright 2011 by Apple Inc.
+ * Copyright 2011-2012 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -37,9 +37,10 @@
* Functions...
*/
-extern int _cupsArrayAddStrings(cups_array_t *a, const char *s)
- _CUPS_API_1_5;
-extern cups_array_t *_cupsArrayNewStrings(const char *s) _CUPS_API_1_5;
+extern int _cupsArrayAddStrings(cups_array_t *a, const char *s,
+ char delim) _CUPS_API_1_5;
+extern cups_array_t *_cupsArrayNewStrings(const char *s, char delim)
+ _CUPS_API_1_5;
# ifdef __cplusplus
}
Index: cups/ppd-private.h
===================================================================
--- cups/ppd-private.h (revision 10578)
+++ cups/ppd-private.h (working copy)
@@ -49,7 +49,7 @@
* Constants...
*/
-# define _PPD_CACHE_VERSION 3 /* Version number in cache file */
+# define _PPD_CACHE_VERSION 4 /* Version number in cache file */
/*
@@ -141,7 +141,11 @@
*prefilters; /* cupsPreFilter values */
int single_file; /* cupsSingleFile value */
cups_array_t *finishings; /* cupsIPPFinishings values */
- int max_copies; /* cupsMaxCopies value */
+ int max_copies, /* cupsMaxCopies value */
+ account_id, /* cupsJobAccountId value */
+ accounting_user_id; /* cupsJobAccountingUserId value */
+ char *password; /* cupsJobPassword value */
+ cups_array_t *mandatory; /* cupsMandatory value */
};
Index: cups/cups-private.h
===================================================================
--- cups/cups-private.h (revision 10578)
+++ cups/cups-private.h (working copy)
@@ -24,6 +24,7 @@
# include "string-private.h"
# include "debug-private.h"
+# include "array-private.h"
# include "ipp-private.h"
# include "http-private.h"
# include "language-private.h"
Index: filter/spec-ppd.shtml
===================================================================
--- filter/spec-ppd.shtml (revision 10578)
+++ filter/spec-ppd.shtml (working copy)
@@ -1264,6 +1264,49 @@
*cupsIPPSupplies: False
+
+
+
+*cupsJobAccountId: boolean
+
+This keyword defines whether the printer accepts the job-account-id IPP attribute.
+
+Example:
+
+
+*% Specify the printer accepts the job-account-id IPP attribute.
+*cupsJobAccountId: True
+
+
+
+
+
+*cupsJobAccountingUserId: boolean
+
+This keyword defines whether the printer accepts the job-accounting-user-id IPP attribute.
+
+Example:
+
+
+*% Specify the printer accepts the job-accounting-user-id IPP attribute.
+*cupsJobAccountingUserId: True
+
+
+
+
+
+*cupsJobPassword: "format"
+
+This keyword defines the format of the job-password IPP attribute, if supported by the printer. Currently the only supported format is "1111" indicating a 4-digit PIN code.
+
+Example:
+
+
+*% Specify the printer supports 4-digit PIN codes.
+*cupsJobPassword: "1111"
+
+
+
*cupsLanguages: "locale list"
@@ -1279,6 +1322,21 @@
*cupsLanguages: "en_CA en_UK en_US fr_CA fr_FR"
+
+
+
+*cupsMandatory: "attribute1 attribute2 ... attributeN"
+
+This keyword defines a list of IPP attributes that must be provided when submitting a print job creation request.
+
+Example:
+
+
+*% Specify that the user must supply a job-password
+*cupsMandatory: "job-password job-password-encryption"
+
+
+
*cupsManualCopies: boolean
@@ -1807,6 +1865,18 @@
+Changes in CUPS 1.7
+
+
+
+
Changes in CUPS 1.6
Index: scheduler/util.c
===================================================================
--- scheduler/util.c (revision 10578)
+++ scheduler/util.c (working copy)
@@ -3,7 +3,7 @@
*
* Mini-daemon utility functions for CUPS.
*
- * Copyright 2007-2011 by Apple Inc.
+ * Copyright 2007-2012 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -163,7 +163,7 @@
if (!s || !*s)
return (NULL);
else
- return (_cupsArrayNewStrings(s));
+ return (_cupsArrayNewStrings(s, ','));
}
Index: scheduler/ipp.c
===================================================================
--- scheduler/ipp.c (revision 10578)
+++ scheduler/ipp.c (working copy)
@@ -1274,6 +1274,7 @@
http_status_t status; /* Policy status */
ipp_attribute_t *attr, /* Current attribute */
*auth_info; /* auth-info attribute */
+ const char *mandatory; /* Current mandatory job attribute */
const char *val; /* Default option value */
int priority; /* Job priority */
cupsd_job_t *job; /* Current job */
@@ -1350,9 +1351,30 @@
/*
* Validate job template attributes; for now just document-format,
- * copies, number-up, and page-ranges...
+ * copies, job-sheets, number-up, page-ranges, mandatory attributes, and
+ * media...
*/
+ if (printer->pc)
+ {
+ for (mandatory = (char *)cupsArrayFirst(printer->pc->mandatory);
+ mandatory;
+ mandatory = (char *)cupsArrayNext(printer->pc->mandatory))
+ {
+ if (!ippFindAttribute(con->request, mandatory, IPP_TAG_ZERO))
+ {
+ /*
+ * Missing a required attribute...
+ */
+
+ send_ipp_status(con, IPP_CONFLICT,
+ _("The \"%s\" attribute is required for print jobs."),
+ mandatory);
+ return (NULL);
+ }
+ }
+ }
+
if (filetype && printer->filetypes &&
!cupsArrayFind(printer->filetypes, filetype))
{
Index: scheduler/printers.c
===================================================================
--- scheduler/printers.c (revision 10578)
+++ scheduler/printers.c (working copy)
@@ -348,9 +348,9 @@
"multiple-document-handling",
"number-up",
"output-bin",
- "output-mode",
"orientation-requested",
"page-ranges",
+ "print-color-mode",
"print-quality",
"printer-resolution",
"sides"
@@ -367,9 +367,9 @@
"multiple-document-handling",
"number-up",
"output-bin",
- "output-mode",
"orientation-requested",
"page-ranges",
+ "print-color-mode",
"print-quality",
"printer-resolution",
"sides"
@@ -3248,6 +3248,9 @@
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("copies-default"));
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("document-format-default"));
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("finishings-default"));
+ cupsArrayAdd(CommonDefaults, _cupsStrAlloc("job-account-id-default"));
+ cupsArrayAdd(CommonDefaults,
+ _cupsStrAlloc("job-accounting-user-id-default"));
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("job-hold-until-default"));
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("job-priority-default"));
cupsArrayAdd(CommonDefaults, _cupsStrAlloc("job-sheets-default"));
@@ -3753,7 +3756,8 @@
qualities[3]; /* print-quality values */
int num_margins, /* Number of media-*-margin-supported values */
margins[16]; /* media-*-margin-supported values */
- const char *filter; /* Current filter */
+ const char *filter, /* Current filter */
+ *mandatory; /* Current mandatory attribute */
static const char * const sides[3] = /* sides-supported values */
{
"one-sided",
@@ -3839,6 +3843,23 @@
ippAddBoolean(p->ppd_attrs, IPP_TAG_PRINTER, "color-supported",
ppd->color_device);
+
+ if (p->pc->account_id)
+ ippAddBoolean(p->ppd_attrs, IPP_TAG_PRINTER, "job-account-id-supported",
+ 1);
+
+ if (p->pc->accounting_user_id)
+ ippAddBoolean(p->ppd_attrs, IPP_TAG_PRINTER,
+ "job-accounting-user-id-supported", 1);
+
+ if (p->pc->password)
+ {
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "job-password-encryption-supported", NULL, "none");
+ ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
+ "job-password-supported", strlen(p->pc->password));
+ }
+
if (ppd->throughput)
{
ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
@@ -4314,41 +4335,51 @@
}
/*
- * output-mode and print-color-mode...
+ * print-color-mode...
*/
if (ppd->color_device)
{
- static const char * const output_modes[] =
+ static const char * const color_modes[] =
{
"monochrome",
"color"
};
ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "output-mode-supported", 2, NULL, output_modes);
+ "print-color-mode-supported", 2, NULL, color_modes);
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "output-mode-default", NULL, "color");
-
- ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "print-color-mode-supported", 2, NULL, output_modes);
- ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"print-color-mode-default", NULL, "color");
}
else
{
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "output-mode-supported", NULL, "monochrome");
- ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "output-mode-default", NULL, "monochrome");
-
- ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"print-color-mode-supported", NULL, "monochrome");
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"print-color-mode-default", NULL, "monochrome");
}
/*
+ * Mandatory job attributes, if any...
+ */
+
+ if (cupsArrayCount(p->pc->mandatory) > 0)
+ {
+ int count = cupsArrayCount(p->pc->mandatory);
+ /* Number of mandatory attributes */
+
+ attr = ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "printer-mandatory-job-attributes", count, NULL,
+ NULL);
+
+ for (val = attr->values,
+ mandatory = (char *)cupsArrayFirst(p->pc->mandatory);
+ mandatory;
+ val ++, mandatory = (char *)cupsArrayNext(p->pc->mandatory))
+ val->string.text = _cupsStrRetain(mandatory);
+ }
+
+ /*
* Printer resolutions...
*/
Index: scheduler/job.c
===================================================================
--- scheduler/job.c (revision 10578)
+++ scheduler/job.c (working copy)
@@ -3441,19 +3441,16 @@
"com.apple.print.DocumentTicket.PMSpoolFormat",
IPP_TAG_ZERO) &&
!ippFindAttribute(job->attrs, "APPrinterPreset", IPP_TAG_ZERO) &&
- (ippFindAttribute(job->attrs, "output-mode", IPP_TAG_ZERO) ||
- ippFindAttribute(job->attrs, "print-color-mode", IPP_TAG_ZERO) ||
+ (ippFindAttribute(job->attrs, "print-color-mode", IPP_TAG_ZERO) ||
ippFindAttribute(job->attrs, "print-quality", IPP_TAG_ZERO)))
{
/*
- * Map output-mode and print-quality to a preset...
+ * Map print-color-mode and print-quality to a preset...
*/
if ((attr = ippFindAttribute(job->attrs, "print-color-mode",
- IPP_TAG_KEYWORD)) == NULL)
- attr = ippFindAttribute(job->attrs, "output-mode", IPP_TAG_KEYWORD);
-
- if (attr && !strcmp(attr->values[0].string.text, "monochrome"))
+ IPP_TAG_KEYWORD)) != NULL &&
+ !strcmp(attr->values[0].string.text, "monochrome"))
print_color_mode = _PWG_PRINT_COLOR_MODE_MONOCHROME;
else
print_color_mode = _PWG_PRINT_COLOR_MODE_COLOR;
@@ -3649,9 +3646,12 @@
continue;
if (!strncmp(attr->name, "job-", 4) &&
+ strcmp(attr->name, "job-account-id") &&
+ strcmp(attr->name, "job-accounting-user-id") &&
strcmp(attr->name, "job-billing") &&
strcmp(attr->name, "job-impressions") &&
strcmp(attr->name, "job-originating-host-name") &&
+ strcmp(attr->name, "job-password") &&
strcmp(attr->name, "job-uuid") &&
!(job->printer->type & CUPS_PRINTER_REMOTE))
continue;