From: Michael R Sweet Date: Fri, 5 Apr 2024 21:26:19 +0000 (-0400) Subject: Report an error if you use lpadmin to set defaults for a temporary queue (Issue ... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88150a39328bec04ac09c47494daf929cacab113;p=thirdparty%2Fcups.git Report an error if you use lpadmin to set defaults for a temporary queue (Issue #237) --- diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 1611f9ab9f..798a8044c1 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -11000,6 +11000,9 @@ set_printer_defaults( * Only allow keywords and names... */ + if (printer->temporary) + goto temporary_printer; + if (attr->value_tag != IPP_TAG_NAME && attr->value_tag != IPP_TAG_KEYWORD) continue; @@ -11020,6 +11023,9 @@ set_printer_defaults( } else if (!strcmp(attr->name, "requesting-user-name-allowed")) { + if (printer->temporary) + goto temporary_printer; + cupsdFreeStrings(&(printer->users)); printer->deny_users = 0; @@ -11034,6 +11040,9 @@ set_printer_defaults( } else if (!strcmp(attr->name, "requesting-user-name-denied")) { + if (printer->temporary) + goto temporary_printer; + cupsdFreeStrings(&(printer->users)); printer->deny_users = 1; @@ -11048,6 +11057,9 @@ set_printer_defaults( } else if (!strcmp(attr->name, "job-quota-period")) { + if (printer->temporary) + goto temporary_printer; + if (attr->value_tag != IPP_TAG_INTEGER) continue; @@ -11059,6 +11071,9 @@ set_printer_defaults( } else if (!strcmp(attr->name, "job-k-limit")) { + if (printer->temporary) + goto temporary_printer; + if (attr->value_tag != IPP_TAG_INTEGER) continue; @@ -11070,6 +11085,9 @@ set_printer_defaults( } else if (!strcmp(attr->name, "job-page-limit")) { + if (printer->temporary) + goto temporary_printer; + if (attr->value_tag != IPP_TAG_INTEGER) continue; @@ -11084,6 +11102,9 @@ set_printer_defaults( cupsd_policy_t *p; /* Policy */ + if (printer->temporary) + goto temporary_printer; + if (attr->value_tag != IPP_TAG_NAME) continue; @@ -11105,6 +11126,9 @@ set_printer_defaults( } else if (!strcmp(attr->name, "printer-error-policy")) { + if (printer->temporary) + goto temporary_printer; + if (attr->value_tag != IPP_TAG_NAME && attr->value_tag != IPP_TAG_KEYWORD) continue; @@ -11135,6 +11159,9 @@ set_printer_defaults( namelen > (sizeof(name) - 1) || attr->num_values != 1) continue; + if (printer->temporary) + goto temporary_printer; + /* * OK, anything else must be a user-defined default... */ @@ -11208,6 +11235,17 @@ set_printer_defaults( } return (1); + + /* + * If we get here this is a temporary printer and you can't set defaults for + * this kind of queue... + */ + + temporary_printer: + + send_ipp_status(con, IPP_STATUS_ERROR_NOT_POSSIBLE, _("Unable to save value for \"%s\" with a temporary printer."), attr->name); + + return (0); }