]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler now substitutes default values for invalid job attributes when
authorMichael R Sweet <michaelrsweet@gmail.com>
Wed, 13 Dec 2017 20:00:35 +0000 (15:00 -0500)
committerMichael R Sweet <michaelrsweet@gmail.com>
Wed, 13 Dec 2017 20:00:35 +0000 (15:00 -0500)
running in "relaxed conformance" mode (Issue #5186)

CHANGES.md
scheduler/ipp.c

index 076487618ff99050385a1aadec1c98ca4c5cae16..e0b9d6faf0472e8692170513976df998f45d82ba 100644 (file)
@@ -49,3 +49,5 @@ Changes in CUPS v2.3b1
 - Fixed a journald support bug in the scheduler (Issue #5181)
 - Fixed PAM module detection and added support for the common PAM definitions
   (Issue #5185)
+- The scheduler now substitutes default values for invalid job attributes when
+  running in "relaxed conformance" mode (Issue #5186)
index caa1cc49ee259749d794bf53a2c99c17d92e7992..4f8d13b6c943e504f0d2b2eef647b5f2795f050f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * IPP routines for the CUPS scheduler.
  *
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * This file contains Kerberos support code, copyright 2006 by
@@ -1584,15 +1584,30 @@ add_job(cupsd_client_t  *con,           /* I - Client connection */
                     _("Bad job-name value: Wrong type or count."));
     if ((attr = ippCopyAttribute(con->response, attr, 0)) != NULL)
       attr->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
-    return (NULL);
+
+    if (StrictConformance)
+      return (NULL);
+
+    /* Don't use invalid attribute */
+    ippDeleteAttribute(con->request, attr);
+
+    ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL, "Untitled");
   }
   else if (!ippValidateAttribute(attr))
   {
     send_ipp_status(con, IPP_ATTRIBUTES, _("Bad job-name value: %s"),
                     cupsLastErrorString());
+
     if ((attr = ippCopyAttribute(con->response, attr, 0)) != NULL)
       attr->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
-    return (NULL);
+
+    if (StrictConformance)
+      return (NULL);
+
+    /* Don't use invalid attribute */
+    ippDeleteAttribute(con->request, attr);
+
+    ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL, "Untitled");
   }
 
   attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME);
@@ -1600,9 +1615,17 @@ add_job(cupsd_client_t  *con,            /* I - Client connection */
   if (attr && !ippValidateAttribute(attr))
   {
     send_ipp_status(con, IPP_ATTRIBUTES, _("Bad requesting-user-name value: %s"), cupsLastErrorString());
+
     if ((attr = ippCopyAttribute(con->response, attr, 0)) != NULL)
       attr->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
-    return (NULL);
+
+    if (StrictConformance)
+      return (NULL);
+
+    /* Don't use invalid attribute */
+    ippDeleteAttribute(con->request, attr);
+
+    attr = ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "reqeusting-user-name", NULL, "anonymous");
   }
 
   if ((job = cupsdAddJob(priority, printer->name)) == NULL)