From 26a9140960cd7a53cb4f52f3a69bad04482b7d46 Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Fri, 26 Sep 2014 08:46:15 -0400
Subject: [PATCH] changed regex for private-key
---
interface/lib/classes/validate_dkim.inc.php | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/interface/lib/classes/validate_dkim.inc.php b/interface/lib/classes/validate_dkim.inc.php
index 71b8e85..71fd8c5 100644
--- a/interface/lib/classes/validate_dkim.inc.php
+++ b/interface/lib/classes/validate_dkim.inc.php
@@ -73,7 +73,7 @@
* @return boolean - true if $POST contains a real key-file
*/
function validate_post($key, $value, $dkim_strength) {
- $value=str_replace("\n", "", $value);
+ $value=str_replace(array("\n", "-----BEGIN RSA PRIVATE KEY-----", "-----END RSA PRIVATE 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; }
@@ -82,7 +82,7 @@
if ( $dkim_strength == 1024 ) $range = "{812,816}";
if ( $dkim_strength == 2048 ) $range = "{1588,1592}";
if ( $dkim_strength == 4096 ) $range = "{3132,3136}";
- if (preg_match("/^-----BEGIN RSA PRIVATE KEY-----[a-zA-Z0-9\/\+=]".$range."-----END RSA PRIVATE KEY-----$/", $value) === 1) return true; else return false;
+ if ( preg_match("/^[a-zA-Z0-9\/\+=]".$range."$/", $value ) === 1) return true; else return false;
break;
}
}
--
Gitblit v1.9.1