1
1
Fork 0

backward compatibility

This commit is contained in:
Friendika 2011-02-01 22:45:46 -08:00
parent a347d040f0
commit fce9988f73
2 changed files with 20 additions and 23 deletions

View file

@ -813,7 +813,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$final_dfrn_id = ''; $final_dfrn_id = '';
if($dfrn_version > 2.1) {
if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']); openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']); openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
@ -822,18 +822,6 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']); openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']); openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
} }
}
else {
if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
}
else {
openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
}
}
$final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.')); $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
@ -868,13 +856,22 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
logger('rino: sent key = ' . $key); logger('rino: sent key = ' . $key);
if($dfrn_version >= 2.1) {
if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']); openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
} }
else { else {
openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']); openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
} }
}
else {
if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
}
else {
openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
}
}
logger('md5 rawkey ' . md5($postvars['key'])); logger('md5 rawkey ' . md5($postvars['key']));

View file

@ -91,7 +91,7 @@ function dfrn_notify_post(&$a) {
logger('rino: md5 raw key: ' . md5($rawkey)); logger('rino: md5 raw key: ' . md5($rawkey));
$final_key = ''; $final_key = '';
if($dfrn_version > 2.1) { if($dfrn_version >= 2.1) {
if((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) { if((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) {
openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']); openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
} }