summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2011-10-21 20:21:48 +0200
committerMichael Tänzer <neo@nhng.de>2011-10-21 20:21:48 +0200
commit7b95895e259908c2ef600e021258b08543fd0fce (patch)
treea14d43c76ca39e58035038aa79c710873c3b25c3
parent8d2e661d78cc1fb095e3a37d80cb4e0d37ac1e9e (diff)
downloadcacert-devel-7b95895e259908c2ef600e021258b08543fd0fce.tar.gz
cacert-devel-7b95895e259908c2ef600e021258b08543fd0fce.tar.xz
cacert-devel-7b95895e259908c2ef600e021258b08543fd0fce.zip
bug 978: Log more details if something fails so debugging becomes easier
Signed-off-by: Michael Tänzer <neo@nhng.de>
-rw-r--r--includes/lib/check_weak_key.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/includes/lib/check_weak_key.php b/includes/lib/check_weak_key.php
index adf74c0..241d4f3 100644
--- a/includes/lib/check_weak_key.php
+++ b/includes/lib/check_weak_key.php
@@ -120,7 +120,7 @@ function checkWeakKeyText($text)
$algorithm))
{
return failWithId("checkWeakKeyText(): Couldn't extract the ".
- "public key algorithm used");
+ "public key algorithm used.\nData:\n$text");
} else {
$algorithm = $algorithm[1];
}
@@ -132,7 +132,7 @@ function checkWeakKeyText($text)
$keysize))
{
return failWithId("checkWeakKeyText(): Couldn't parse the RSA ".
- "key size");
+ "key size.\nData:\n$text");
} else {
$keysize = intval($keysize[1]);
}
@@ -167,14 +167,15 @@ function checkWeakKeyText($text)
// not vulnerable => do nothing
} else {
return failWithId("checkWeakKeyText(): Something went wrong in".
- "checkDebianVulnerability()");
+ "checkDebianVulnerability().\nKeysize: $keysize\n".
+ "Data:\n$text");
}
if (!preg_match('/^\s*Exponent: (\d+) \(0x[0-9a-fA-F]+\)$/m', $text,
$exponent))
{
return failWithId("checkWeakKeyText(): Couldn't parse the RSA ".
- "exponent");
+ "exponent.\nData:\n$text");
} else {
$exponent = $exponent[1]; // exponent might be very big =>
//handle as string using bc*()
@@ -231,7 +232,8 @@ function checkDebianVulnerability($text, $keysize = 0)
$algorithm))
{
trigger_error("checkDebianVulnerability(): Couldn't extract ".
- "the public key algorithm used", E_USER_WARNING);
+ "the public key algorithm used.\nData:\n$text",
+ E_USER_WARNING);
return null;
} else {
$algorithm = $algorithm[1];
@@ -244,7 +246,7 @@ function checkDebianVulnerability($text, $keysize = 0)
$keysize))
{
trigger_error("checkDebianVulnerability(): Couldn't parse the ".
- "RSA key size", E_USER_WARNING);
+ "RSA key size.\nData:\n$text", E_USER_WARNING);
return null;
} else {
$keysize = intval($keysize[1]);
@@ -275,7 +277,7 @@ function checkDebianVulnerability($text, $keysize = 0)
$text, $modulus))
{
trigger_error("checkDebianVulnerability(): Couldn't extract the ".
- "RSA modulus", E_USER_WARNING);
+ "RSA modulus.\nData:\n$text", E_USER_WARNING);
return null;
} else {
$modulus = $modulus[1];