]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/cups-driverd.cxx
Exit with keep-alive instead of doing a in-place restart when on-demand
[thirdparty/cups.git] / scheduler / cups-driverd.cxx
index c6e4b17e5c01fd51a999ab5cddd424e9ad7d8404..6e14a3ec63b8ac4d7e2649380bd796969ef60e40 100644 (file)
@@ -1,13 +1,11 @@
 /*
- * "$Id$"
- *
  * PPD/driver support for CUPS.
  *
  * This program handles listing and installing static PPD files, PPD files
  * created from driver information files, and dynamically generated PPD files
  * using driver helper programs.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products.
  *
  * These coded instructions, statements, and computer programs are the
@@ -33,7 +31,7 @@
  * Constants...
  */
 
-#define PPD_SYNC       0x50504437      /* Sync word for ppds.dat (PPD7) */
+#define PPD_SYNC       0x50504438      /* Sync word for ppds.dat (PPD8) */
 #define PPD_MAX_LANG   32              /* Maximum languages */
 #define PPD_MAX_PROD   32              /* Maximum products */
 #define PPD_MAX_VERS   32              /* Maximum versions */
 #define PPD_TYPE_PDF           1       /* PDF PPD */
 #define PPD_TYPE_RASTER                2       /* CUPS raster PPD */
 #define PPD_TYPE_FAX           3       /* Facsimile/MFD PPD */
-#define PPD_TYPE_UNKNOWN       4       /* Other/hybrid PPD */
-#define PPD_TYPE_DRV           5       /* Driver info file */
-#define PPD_TYPE_ARCHIVE       6       /* Archive file */
+#define PPD_TYPE_OBJECT_ANY    4       /* 3D (AMF/STL/g-code) PPD */
+#define PPD_TYPE_OBJECT_DIRECT 5       /* 3D (AMF/STL/g-code) PPD over any connection */
+#define PPD_TYPE_OBJECT_STORAGE        6       /* 3D (AMF/STL/g-code) PPD for storage to SD card, etc. */
+#define PPD_TYPE_UNKNOWN       7       /* Other/hybrid PPD */
+#define PPD_TYPE_DRV           8       /* Driver info file */
+#define PPD_TYPE_ARCHIVE       9       /* Archive file */
 
 #define TAR_BLOCK      512             /* Number of bytes in a block */
 #define TAR_BLOCKS     10              /* Blocking factor */
@@ -135,6 +136,9 @@ static const char * const PPDTypes[] =      /* ppd-type values */
                          "pdf",
                          "raster",
                          "fax",
+                         "object",
+                         "object-direct",
+                         "object-storage",
                          "unknown",
                          "drv",
                          "archive"
@@ -442,6 +446,12 @@ cat_ppd(const char *name,          /* I - PPD name */
   * Figure out if this is a static or dynamic PPD file...
   */
 
+  if (strstr(name, "../"))
+  {
+    fputs("ERROR: Invalid PPD name.\n", stderr);
+    return (1);
+  }
+
   strlcpy(scheme, name, sizeof(scheme));
   if ((sptr = strchr(scheme, ':')) != NULL)
   {
@@ -1321,7 +1331,7 @@ list_ppds(int        request_id,  /* I - Request ID */
 
       if (device_id_re &&
          !regexec(device_id_re, ppd->record.device_id,
-                   (int)(sizeof(re_matches) / sizeof(re_matches[0])),
+                   (size_t)(sizeof(re_matches) / sizeof(re_matches[0])),
                   re_matches, 0))
       {
        /*
@@ -1351,7 +1361,7 @@ list_ppds(int        request_id,  /* I - Request ID */
 
       if (make_and_model_re &&
           !regexec(make_and_model_re, ppd->record.make_and_model,
-                  (int)(sizeof(re_matches) / sizeof(re_matches[0])),
+                  (size_t)(sizeof(re_matches) / sizeof(re_matches[0])),
                   re_matches, 0))
       {
        // See how much of the make-and-model string we matched...
@@ -2095,12 +2105,28 @@ load_ppd(const char  *filename,         /* I - Real filename */
       if (!_cups_strncasecmp(ptr, "true", 4))
        type = PPD_TYPE_FAX;
     }
-    else if (!strncmp(line, "*cupsFilter:", 12) && type == PPD_TYPE_POSTSCRIPT)
+    else if ((!strncmp(line, "*cupsFilter:", 12) || !strncmp(line, "*cupsFilter2:", 13)) && type == PPD_TYPE_POSTSCRIPT)
     {
       if (strstr(line + 12, "application/vnd.cups-raster"))
        type = PPD_TYPE_RASTER;
       else if (strstr(line + 12, "application/vnd.cups-pdf"))
        type = PPD_TYPE_PDF;
+      else if (strstr(line + 12, "application/amf") ||
+               strstr(line + 12, "application/g-code") ||
+               strstr(line + 12, "application/sla"))
+       type = PPD_TYPE_OBJECT_ANY;
+    }
+    else if (!strncmp(line, "*cups3DWorkflows:", 17))
+    {
+      int is_direct = strstr(line + 17, "direct") != NULL;
+      int is_storage = strstr(line + 17, "storage") != NULL;
+
+      if (is_direct && !is_storage)
+        type = PPD_TYPE_OBJECT_DIRECT;
+      if (!is_direct && is_storage)
+        type = PPD_TYPE_OBJECT_STORAGE;
+      else
+        type = PPD_TYPE_OBJECT_ANY;
     }
     else if (!strncmp(line, "*cupsModelNumber:", 17))
       sscanf(line, "*cupsModelNumber:%d", &model_number);
@@ -2900,8 +2926,3 @@ regex_string(const char *s)               /* I - String to compare */
 
   return (NULL);
 }
-
-
-/*
- * End of "$Id$".
- */