]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler no longer accepts or sends job description attributes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 26 Sep 2012 02:02:16 +0000 (02:02 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 26 Sep 2012 02:02:16 +0000 (02:02 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10614 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.6.txt
cups/encode.c
scheduler/ipp.c
scheduler/job.c

index 32c6fe204e6cc24985f47ae6c06d0b7a07624ab6..853ddc3436823996efc104f4aa46006ea80a8925 100644 (file)
@@ -4,6 +4,7 @@ CHANGES-1.6.txt
 CHANGES IN CUPS V1.6.2
 
        - Documentation fixes
+       - The scheduler no longer accepts or sends job description attributes.
        - The IPP backend now works around some conformance issues for broken
          printers (STR #4190)
        - cupsBackendReport() now filters out all control characters from the
index d19d2d48a128837ed8f770f882a22151c586d43e..98dc1357dc46ddb13c986e7293568010b53925e9 100644 (file)
@@ -76,8 +76,16 @@ static const _ipp_option_t ipp_options[] =
   { 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-hold-until",       IPP_TAG_KEYWORD,        IPP_TAG_JOB },
+  { 0, "job-id",               IPP_TAG_INTEGER,        IPP_TAG_ZERO }, /* never send as option */
   { 0, "job-impressions",      IPP_TAG_INTEGER,        IPP_TAG_JOB },
   { 0, "job-k-limit",          IPP_TAG_INTEGER,        IPP_TAG_PRINTER },
+  { 0, "job-k-octets",         IPP_TAG_INTEGER,        IPP_TAG_ZERO }, /* never send as option */
+  { 0, "job-k-octets-completed",IPP_TAG_INTEGER,       IPP_TAG_ZERO }, /* never send as option */
+  { 0, "job-impressions",      IPP_TAG_INTEGER,        IPP_TAG_ZERO }, /* never send as option */
+  { 0, "job-impressions-completed", IPP_TAG_INTEGER,   IPP_TAG_ZERO }, /* never send as option */
+  { 0, "job-media-sheets",     IPP_TAG_INTEGER,        IPP_TAG_ZERO }, /* never send as option */
+  { 0, "job-media-sheets-completed", IPP_TAG_INTEGER,  IPP_TAG_ZERO }, /* never send as option */
   { 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 },
@@ -85,6 +93,9 @@ static const _ipp_option_t ipp_options[] =
   { 0, "job-quota-period",     IPP_TAG_INTEGER,        IPP_TAG_PRINTER },
   { 1, "job-sheets",           IPP_TAG_NAME,           IPP_TAG_JOB },
   { 1, "job-sheets-default",   IPP_TAG_NAME,           IPP_TAG_PRINTER },
+  { 0, "job-state",            IPP_TAG_ENUM,           IPP_TAG_ZERO }, /* never send as option */
+  { 0, "job-state-message",    IPP_TAG_TEXT,           IPP_TAG_ZERO }, /* never send as option */
+  { 0, "job-state-reasons",    IPP_TAG_KEYWORD,        IPP_TAG_ZERO }, /* never send as option */
   { 0, "job-uuid",             IPP_TAG_URI,            IPP_TAG_JOB },
   { 0, "landscape",            IPP_TAG_BOOLEAN,        IPP_TAG_JOB },
   { 1, "marker-change-time",   IPP_TAG_INTEGER,        IPP_TAG_PRINTER },
@@ -186,6 +197,9 @@ static const _ipp_option_t ipp_options[] =
   { 0, "sides",                        IPP_TAG_KEYWORD,        IPP_TAG_JOB,
                                                        IPP_TAG_DOCUMENT },
   { 0, "sides-default",                IPP_TAG_KEYWORD,        IPP_TAG_PRINTER },
+  { 0, "time-at-completed",    IPP_TAG_INTEGER,        IPP_TAG_ZERO }, /* never send as option */
+  { 0, "time-at-creation",     IPP_TAG_INTEGER,        IPP_TAG_ZERO }, /* never send as option */
+  { 0, "time-at-processing",   IPP_TAG_INTEGER,        IPP_TAG_ZERO }, /* never send as option */
   { 0, "wrap",                 IPP_TAG_BOOLEAN,        IPP_TAG_JOB },
   { 0, "wrap-default",         IPP_TAG_BOOLEAN,        IPP_TAG_PRINTER },
   { 0, "x-dimension",          IPP_TAG_INTEGER,        IPP_TAG_JOB,
index 0ef61b70bb0ca3e58e6513335022f122564e99a1..3da7bb9f504926fe0639dd8a15b5af653e74959f 100644 (file)
@@ -1286,6 +1286,21 @@ add_job(cupsd_client_t  *con,            /* I - Client connection */
   ipp_attribute_t *media_col,          /* media-col attribute */
                *media_margin;          /* media-*-margin attribute */
   ipp_t                *unsup_col;             /* media-col in unsupported response */
+  static const char * const readonly[] =/* List of read-only attributes */
+  {
+    "job-id",
+    "job-k-octets",
+    /*"job-impressions",*/             /* For now we allow this since cupsd can't count */
+    "job-impressions-completed",
+    "job-media-sheets",
+    "job-media-sheets-completed",
+    "job-state",
+    "job-state-message",
+    "job-state-reasons",
+    "time-at-completed",
+    "time-at-creation",
+    "time-at-processing"
+  };
 
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job(%p[%d], %p(%s), %p(%s/%s))",
@@ -1355,6 +1370,27 @@ add_job(cupsd_client_t  *con,            /* I - Client connection */
   * media...
   */
 
+  for (i = 0; i < (int)(sizeof(readonly) / sizeof(readonly[0])); i ++)
+  {
+    if ((attr = ippFindAttribute(con->request, readonly[i],
+                                 IPP_TAG_ZERO)) != NULL)
+    {
+      ippDeleteAttribute(con->request, attr);
+
+      if (StrictConformance)
+      {
+       send_ipp_status(con, IPP_BAD_REQUEST,
+                       _("The '%s' Job Description attribute cannot be "
+                         "supplied in a job creation request."), readonly[i]);
+       return (NULL);
+      }
+
+      cupsdLogMessage(CUPSD_LOG_WARN,
+                      "Unexpected '%s' Job Description attribute in a job "
+                      "creation request.", readonly[i]);
+    }
+  }
+
   if (printer->pc)
   {
     for (mandatory = (char *)cupsArrayFirst(printer->pc->mandatory);
index bd39995b21811905b0ed4cbd00efcb42f48abde2..33ce6a1c60153e6ebf6d8123c183150d90e4c7b4 100644 (file)
@@ -3643,7 +3643,13 @@ get_options(cupsd_job_t *job,            /* I - Job */
          attr->value_tag == IPP_TAG_BEGIN_COLLECTION) /* Not yet supported */
        continue;
 
-      if (!strcmp(attr->name, "job-hold-until"))
+      if (!strcmp(attr->name, "job-hold-until") ||
+          !strcmp(attr->name, "job-id") ||
+          !strcmp(attr->name, "job-k-octets") ||
+          !strcmp(attr->name, "job-media-sheets") ||
+          !strcmp(attr->name, "job-media-sheets-completed") ||
+          !strcmp(attr->name, "job-state") ||
+          !strcmp(attr->name, "job-state-reasons"))
        continue;
 
       if (!strncmp(attr->name, "job-", 4) &&