aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-09-19 03:30:59 -0700
committerFriendika <info@friendika.com>2011-09-19 03:30:59 -0700
commitfd18b42a5a4dfb212dac1272294a0934076183b7 (patch)
treed6cbdf3478d18a63831996abc933927e76fc0d9b /mod
parent0a30a91b14c8887db668d74759953405f02d4e65 (diff)
downloadvolse-hubzilla-fd18b42a5a4dfb212dac1272294a0934076183b7.tar.gz
volse-hubzilla-fd18b42a5a4dfb212dac1272294a0934076183b7.tar.bz2
volse-hubzilla-fd18b42a5a4dfb212dac1272294a0934076183b7.zip
Check all keys before use
Diffstat (limited to 'mod')
-rw-r--r--mod/dfrn_notify.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index d174c87ee..bd665c208 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -807,7 +807,7 @@ function dfrn_notify_content(&$a) {
intval(time() + 90 )
);
- logger('dfrn_notify: challenge=' . $hash );
+ logger('dfrn_notify: challenge=' . $hash, LOGGER_DEBUG );
$sql_extra = '';
switch($direction) {
@@ -841,14 +841,18 @@ function dfrn_notify_content(&$a) {
$encrypted_id = '';
$id_str = $my_id . '.' . mt_rand(1000,9999);
- if((($r[0]['duplex']) && strlen($r[0]['prvkey'])) || (! strlen($r[0]['pubkey']))) {
- openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
- openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
- }
- else {
- openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
- openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
+ if(strlen($r[0]['prvkey']) || strlen($r[0]['pubkey'])) {
+ if(($r[0]['duplex']) || (! strlen($r[0]['pubkey']))) {
+ openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
+ openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
+ }
+ else {
+ openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
+ openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
+ }
}
+ else
+ $status = 1;
$challenge = bin2hex($challenge);
$encrypted_id = bin2hex($encrypted_id);