]> 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:26:19 +0000 (17:26 -0400)
committerMichael R Sweet <msweet@msweet.org>
Fri, 5 Apr 2024 21:26:19 +0000 (17:26 -0400)
scheduler/ipp.c

index 1611f9ab9fea6aa36a53437b5872d0fd23a6d8a6..798a8044c17e3e1cd70f2c4f251292724b89e796 100644 (file)
@@ -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);
 }