unify line endings
authorStricted <info@stricted.de>
Mon, 23 Feb 2015 10:40:30 +0000 (11:40 +0100)
committerStricted <info@stricted.de>
Mon, 23 Feb 2015 10:40:30 +0000 (11:40 +0100)
lib/util/DNSSECUtil.class.php
lib/util/ParseZone.class.php

index ef21f4371d861c8a16e31aad4008019bad5e57d8..69532925fc8f67d3879ed2dbf364cc24ef5a8484 100644 (file)
@@ -70,6 +70,9 @@ class DNSSECUtil {
         * @return      boolean
         */
        public static function validatePublicKey ($content) {
+               // unify newlines
+               $content = preg_replace("/(\r\n)|(\r)/", "\n", $content);
+               
                $pattern = "; This is a (key|zone)-signing key, keyid (?P<keyid>[0-9]+), for (?P<domain>[\s\S]+)\.\n";
                $pattern .= "; Created: (?P<created>[0-9]+) \(([a-z0-9: ]+)\)\n";
                $pattern .= "; Publish: (?P<publish>[0-9]+) \(([a-z0-9: ]+)\)\n";
@@ -102,6 +105,9 @@ class DNSSECUtil {
         * @return      boolean
         */
        public static function validatePrivateKey ($content) {
+               // unify newlines
+               $content = preg_replace("/(\r\n)|(\r)/", "\n", $content);
+               
                $pattern = "Private-key-format: v([0-9a-z.]+)\n";
                $pattern .= "Algorithm: (?P<algorithm>[0-9]+) \(([0-9a-z\-]+)\)\n";
                $pattern .= "Modulus: (?P<modulus>[\s\S]+)\n";
index 2a85663086014b1fead183f6364a98fcde9e05d1..87abe868d4575dd6ae73d83f2392a33ab4ef6a34 100644 (file)
@@ -50,6 +50,10 @@ class ParseZone {
         */
        public function __construct ($file, $origin = "") {
                if (!empty($origin)) $this->origin = $origin;
+               
+               // unify newlines
+               $file = preg_replace("/(\r\n)|(\r)/", "\n", $file);
+               
                // unify all lines
                $file = preg_replace_callback('/(\([^()]*\))/', function ($matches) {
                        $a = explode("\n", $matches[0]);