]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler now validates ErrorPolicy values in config files (STR #4591)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 6 May 2015 21:11:47 +0000 (21:11 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 6 May 2015 21:11:47 +0000 (21:11 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12620 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES.txt
scheduler/conf.c
scheduler/printers.c

index 3196a0629e2af7a9994c0dbc84ce49178bf2b21e..d6a4a2873cebce6095fa75b54bcf4d26bfc86563 100644 (file)
@@ -26,4 +26,7 @@ CHANGES IN CUPS V2.1b1
          (<rdar://problem/19024491>)
        - The cupstestppd program did not handle "maxsize(nnn)" entries in
          cupsFilter/cupsFilter2 values (<rdar://problem/18974858>)
-       - Now check the return value of rename() calls (STR #4589)
\ No newline at end of file
+       - The scheduler now checks the return value of rename() calls
+         (STR #4589)
+       - The scheduler now validates ErrorPolicy values in config files
+         (STR #4591)
\ No newline at end of file
index 79ef5465381c6d1430b04183da745b41b429b6bd..a58de4204b019058d3dfeb95c3875146589f3b6d 100644 (file)
@@ -1182,6 +1182,19 @@ cupsdReadConfiguration(void)
 
   cupsdUpdateEnv();
 
+  /*
+   * Validate the default error policy...
+   */
+
+  if (strcmp(ErrorPolicy, "retry-current-job") &&
+      strcmp(ErrorPolicy, "abort-job") &&
+      strcmp(ErrorPolicy, "retry-job") &&
+      strcmp(ErrorPolicy, "stop-printer"))
+  {
+    cupsdLogMessage(CUPSD_LOG_ALERT, "Invalid ErrorPolicy \"%s\", resetting to \"stop-printer\".", ErrorPolicy);
+    cupsdSetString(&ErrorPolicy, "stop-printer");
+  }
+
  /*
   * Update default paper size setting as needed...
   */
index 262c9908fd9bdfdffa63b6c374854e3343ffad20..88391af83046a7545464b47b895b1948bacff284 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Printer routines for the CUPS scheduler.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -1214,10 +1214,17 @@ cupsdLoadAllPrinters(void)
     else if (!_cups_strcasecmp(line, "ErrorPolicy"))
     {
       if (value)
-        cupsdSetString(&p->error_policy, value);
+      {
+       if (strcmp(value, "retry-current-job") &&
+           strcmp(value, "abort-job") &&
+           strcmp(value, "retry-job") &&
+           strcmp(value, "stop-printer"))
+         cupsdLogMessage(CUPSD_LOG_ALERT, "Invalid ErrorPolicy \"%s\" on line %d or printers.conf.", ErrorPolicy, linenum);
+       else
+         cupsdSetString(&p->error_policy, value);
+      }
       else
-       cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of printers.conf.", linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum);
     }
     else if (!_cups_strcasecmp(line, "Attribute") && value)
     {