]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Validate the FileVersion and FormatVersion values.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 15 Dec 2008 17:12:41 +0000 (17:12 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 15 Dec 2008 17:12:41 +0000 (17:12 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@8194 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
systemv/cupstestppd.c

index 1d49849677cb28bc6fcdf8ed207129cb6a55af4f..6bed9053488934388f0aa8fe6c52b1bc71897ba5 100644 (file)
@@ -1,9 +1,11 @@
-CHANGES.txt - 2008-12-11
+CHANGES.txt - 2008-12-15
 ------------------------
 
 CHANGES IN CUPS V1.4b2
 
        - Documentation updates (STR #2983, STR #2998, STR #3021)
+       - The cupstestppd utility now validates the FileVersion and
+         FormatVersion values in PPD files.
        - The default cupsd.conf file did not reflect the
          --with-local-protocols value set at compile-time (STR #3037)
        - The cupsGetPPD* APIs now create symlinks to local PPD files
index 552190df8a6995d2945b613b28adf9d523832bc6..066f26d7b9164c9b5b937ed15b965b9cd027acf7 100644 (file)
@@ -514,9 +514,28 @@ main(int  argc,                            /* I - Number of command-line args */
          }
        }
 
-      if (ppdFindAttr(ppd, "FileVersion", NULL) != NULL)
+      if ((attr = ppdFindAttr(ppd, "FileVersion", NULL)) != NULL)
       {
-       if (verbose > 0)
+        for (ptr = attr->value; *ptr; ptr ++)
+         if (!isdigit(*ptr & 255) && *ptr != '.')
+           break;
+
+       if (*ptr)
+       {
+         if (verbose >= 0)
+         {
+           if (!errors && !verbose)
+             _cupsLangPuts(stdout, _(" FAIL\n"));
+
+           _cupsLangPrintf(stdout,
+                           _("      **FAIL**  Bad FileVersion \"%s\"\n"
+                             "                REF: Page 56, section 5.3.\n"),
+                           attr->value);
+         }
+
+         errors ++;
+       }
+       else if (verbose > 0)
          _cupsLangPuts(stdout, _("        PASS    FileVersion\n"));
       }
       else
@@ -534,9 +553,33 @@ main(int  argc,                            /* I - Number of command-line args */
        errors ++;
       }
 
-      if (ppdFindAttr(ppd, "FormatVersion", NULL) != NULL)
+      if ((attr = ppdFindAttr(ppd, "FormatVersion", NULL)) != NULL)
       {
-       if (verbose > 0)
+        ptr = attr->value;
+       if (*ptr == '4' && ptr[1] == '.')
+       {
+         
+         for (ptr += 2; *ptr; ptr ++)
+           if (!isdigit(*ptr & 255))
+             break;
+        }
+
+       if (*ptr)
+       {
+         if (verbose >= 0)
+         {
+           if (!errors && !verbose)
+             _cupsLangPuts(stdout, _(" FAIL\n"));
+
+           _cupsLangPrintf(stdout,
+                           _("      **FAIL**  Bad FormatVersion \"%s\"\n"
+                             "                REF: Page 56, section 5.3.\n"),
+                           attr->value);
+         }
+
+         errors ++;
+       }
+       else if (verbose > 0)
          _cupsLangPuts(stdout, _("        PASS    FormatVersion\n"));
       }
       else