]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/classes.c
Fix a scheduler crash bug (rdar://42198057)
[thirdparty/cups.git] / scheduler / classes.c
index e3dc17b3920bbe817bb1a6ffe7237d605796f7ae..776e79a913af09f4450397ab010472fd6da16a65 100644 (file)
@@ -1,14 +1,10 @@
 /*
  * Printer class routines for the CUPS scheduler.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file.  If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  */
 
 /*
@@ -346,6 +342,13 @@ cupsdLoadAllClasses(void)
       cupsdLogMessage(CUPSD_LOG_ERROR,
                       "Syntax error on line %d of classes.conf.", linenum);
     }
+    else if (!_cups_strcasecmp(line, "PrinterId"))
+    {
+      if (value && (i = atoi(value)) > 0)
+        p->printer_id = i;
+      else
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Bad PrinterId on line %d of classes.conf.", linenum);
+    }
     else if (!_cups_strcasecmp(line, "UUID"))
     {
       if (value && !strncmp(value, "urn:uuid:", 9))
@@ -713,6 +716,9 @@ cupsdSaveAllClasses(void)
     else
       cupsFilePrintf(fp, "<Class %s>\n", pclass->name);
 
+    if (pclass->printer_id)
+      cupsFilePrintf(fp, "PrinterId %d\n", pclass->printer_id);
+
     cupsFilePrintf(fp, "UUID %s\n", pclass->uuid);
 
     if (pclass->num_auth_info_required > 0)