From: Michael R Sweet Date: Wed, 13 Dec 2017 20:00:35 +0000 (-0500) Subject: The scheduler now substitutes default values for invalid job attributes when X-Git-Tag: v2.3b1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d14c1bbc690ff302842e6a65aeb4685ef3796c2;p=thirdparty%2Fcups.git The scheduler now substitutes default values for invalid job attributes when running in "relaxed conformance" mode (Issue #5186) --- diff --git a/CHANGES.md b/CHANGES.md index 076487618f..e0b9d6faf0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) diff --git a/scheduler/ipp.c b/scheduler/ipp.c index caa1cc49ee..4f8d13b6c9 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -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)