Florian Schaal
2014-01-24 cd072acba40b59634cf43fc61681b42ebca69eaa
changed the regex; new line at the end is allowed - prevents problems when using cut&paste for the private-key in the interface
1 files modified
4 ■■■■ changed files
interface/lib/classes/validate_dkim.inc.php 4 ●●●● patch | view | raw | blame | history
interface/lib/classes/validate_dkim.inc.php
@@ -87,10 +87,10 @@
    function validate_post($key, $value) {
        switch ($key) {
        case 'public':
            if (preg_match("/(^-----BEGIN PUBLIC KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,221}(-----END PUBLIC KEY-----(\n|\r)$)/", $value) === 1) { return true; } else { return false; }
            if (preg_match("/(^-----BEGIN PUBLIC KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,221}(-----END PUBLIC KEY-----(\n|\r)?$)/", $value) === 1) { return true; } else { return false; }
            break;
        case 'private':
            if (preg_match("/(^-----BEGIN RSA PRIVATE KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,850}(-----END RSA PRIVATE KEY-----(\n|\r)$)/", $value) === 1) { return true; } else { return false; }
            if (preg_match("/(^-----BEGIN RSA PRIVATE KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,850}(-----END RSA PRIVATE KEY-----(\n|\r)?$)/", $value) === 1) { return true; } else { return false; }
            break;
        }
    }