]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - systemv/lpadmin.c
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / systemv / lpadmin.c
index c608c2d30f01451e995eb8c732040be154f16441..565b51f9ac5caa7d1d20d903daa4f40eac87285c 100644 (file)
@@ -1,14 +1,10 @@
 /*
  * "lpadmin" command for CUPS.
  *
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
  * Copyright 1997-2006 by Easy Software Products.
  *
- * 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
- * missing or damaged, see the license at "http://www.cups.org/".
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  */
 
 /*
@@ -218,6 +214,25 @@ main(int  argc,                    /* I - Number of command-line arguments */
 
                file = argv[i];
              }
+
+             if (*opt == 'i')
+             {
+              /*
+               * Check to see that the specified file is, in fact, a PPD...
+               */
+
+                cups_file_t *fp = cupsFileOpen(file, "r");
+                char line[256];
+
+                if (!cupsFileGets(fp, line, sizeof(line)) || strncmp(line, "*PPD-Adobe", 10))
+                {
+                  _cupsLangPuts(stderr, _("lpadmin: System V interface scripts are no longer supported for security reasons."));
+                  cupsFileClose(fp);
+                  return (1);
+                }
+
+                cupsFileClose(fp);
+             }
              break;
 
          case 'E' : /* Enable the printer/enable encryption */
@@ -1572,8 +1587,7 @@ validate_name(const char *name)           /* I - Name to check */
   for (ptr = name; *ptr; ptr ++)
     if (*ptr == '@')
       break;
-    else if ((*ptr >= 0 && *ptr <= ' ') || *ptr == 127 || *ptr == '/' ||
-             *ptr == '#')
+    else if ((*ptr >= 0 && *ptr <= ' ') || *ptr == 127 || *ptr == '/' || *ptr == '\\' || *ptr == '?' || *ptr == '\'' || *ptr == '\"' || *ptr == '#')
       return (0);
 
  /*