aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-02-25 14:34:30 -0800
committerredmatrix <git@macgirvin.com>2016-02-25 14:34:30 -0800
commit7972de13caf21647c8cc2e82c499a344f7191a22 (patch)
tree240881fffc3c89e128d83fa94ef7014eefdfd970
parentebfa1a12b9cc3d939ed49a7f66e5687267a409d3 (diff)
downloadvolse-hubzilla-7972de13caf21647c8cc2e82c499a344f7191a22.tar.gz
volse-hubzilla-7972de13caf21647c8cc2e82c499a344f7191a22.tar.bz2
volse-hubzilla-7972de13caf21647c8cc2e82c499a344f7191a22.zip
backtrace openssl_verify errors so that we can find bad keys - as there is very little relevant context available at this level.
-rw-r--r--Zotlabs/Zot/Receiver.php7
-rw-r--r--include/crypto.php15
-rw-r--r--include/queue_fn.php4
3 files changed, 21 insertions, 5 deletions
diff --git a/Zotlabs/Zot/Receiver.php b/Zotlabs/Zot/Receiver.php
index 238de1332..71d57eb35 100644
--- a/Zotlabs/Zot/Receiver.php
+++ b/Zotlabs/Zot/Receiver.php
@@ -41,9 +41,10 @@ class Receiver {
if(! $this->messagetype)
$this->error = true;
- $this->sender = ((array_key_exists('sender',$this->data)) ? $this->data['sender'] : null);
- $this->recipients = ((array_key_exists('recipients',$this->data)) ? $this->data['recipients'] : null);
-
+ if($this->data) {
+ $this->sender = ((array_key_exists('sender',$this->data)) ? $this->data['sender'] : null);
+ $this->recipients = ((array_key_exists('recipients',$this->data)) ? $this->data['recipients'] : null);
+ }
if($this->sender)
$this->ValidateSender();
diff --git a/include/crypto.php b/include/crypto.php
index 494a2a5b9..50ec2a3a6 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -21,6 +21,21 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') {
if(intval(OPENSSL_ALGO_SHA256) && $alg === 'sha256')
$alg = OPENSSL_ALGO_SHA256;
$verify = openssl_verify($data,$sig,$key,$alg);
+
+ if(! $verify) {
+ logger('openssl_verify: ' . openssl_error_string(),LOGGER_NORMAL,LOG_ERR);
+ logger('openssl_verify: key: ' . $key, LOGGER_DEBUG, LOG_ERR);
+ // provide a backtrace so that we can debug key issues
+ if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
+ $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ if($stack) {
+ foreach($stack as $s) {
+ logger('stack: ' . basename($s['file']) . ':' . $s['line'] . ':' . $s['function'] . '()',LOGGER_DEBUG,LOG_ERR);
+ }
+ }
+ }
+ }
+
return $verify;
}
diff --git a/include/queue_fn.php b/include/queue_fn.php
index 3112a832b..676620e2f 100644
--- a/include/queue_fn.php
+++ b/include/queue_fn.php
@@ -126,7 +126,7 @@ function queue_deliver($outq, $immediate = false) {
remove_queue_item($outq['outq_hash']);
// server is responding - see if anything else is going to this destination and is piled up
- // and try to send some more. We're relying on the fact that delivery_loop() results in an
+ // and try to send some more. We're relying on the fact that do_delivery() results in an
// immediate delivery otherwise we could get into a queue loop.
if(! $immediate) {
@@ -141,7 +141,7 @@ function queue_deliver($outq, $immediate = false) {
}
}
if($piled_up) {
- delivery_loop($piled_up);
+ do_delivery($piled_up);
}
}
}