]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Report an error if you use lpadmin to set defaults for a temporary queue (Issue ...
authorMichael R Sweet <msweet@msweet.org>
Fri, 5 Apr 2024 21:27:23 +0000 (17:27 -0400)
committerMichael R Sweet <msweet@msweet.org>
Fri, 5 Apr 2024 21:27:23 +0000 (17:27 -0400)
CHANGES.md
scheduler/ipp.c

index a4222f6df5d6dfe4126176f80e8eac86848b4b91..aec692a5c80719c81850f27ef22dd02e1cde7f5d 100644 (file)
@@ -12,6 +12,7 @@ Changes in CUPS v2.4.8 (TBA)
 - Updated IPP Everywhere printer creation error reporting (Issue #347)
 - Raised `cups_enum_dests()` timeout for listing available IPP printers
   (Issue #751)
+- Now report an error for temporary printer defaults with lpadmin (Issue #237)
 - Fixed mapping of PPD InputSlot, MediaType, and OutputBin values (Issue #238)
 - Fixed "document-unprintable-error" handling (Issue #391)
 - Fixed the web interface not showing an error for a non-existent printer
index 7408a97a02c3442d9431edee090e2a15bd1b6da3..7a8148411c69db25386479dba05a615fa99e21ed 100644 (file)
@@ -11015,6 +11015,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;
 
@@ -11035,6 +11038,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;
@@ -11049,6 +11055,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;
@@ -11063,6 +11072,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;
 
@@ -11074,6 +11086,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;
 
@@ -11085,6 +11100,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;
 
@@ -11099,6 +11117,9 @@ set_printer_defaults(
       cupsd_policy_t *p;               /* Policy */
 
 
+      if (printer->temporary)
+        goto temporary_printer;
+
       if (attr->value_tag != IPP_TAG_NAME)
         continue;
 
@@ -11120,6 +11141,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;
 
@@ -11150,6 +11174,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...
     */
@@ -11223,6 +11250,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);
 }