aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-03-07 15:45:42 -0800
committerzotlabs <mike@macgirvin.com>2019-03-07 15:45:42 -0800
commit1f7622e4c42bf71d1d38dd88c40c903d83a8d6c0 (patch)
tree4c71a2ba6e4d0871e7e08e13499fb62379d8fe81
parent0b2213dd41a7ef275766725c070e16f8ba94d5a5 (diff)
downloadvolse-hubzilla-1f7622e4c42bf71d1d38dd88c40c903d83a8d6c0.tar.gz
volse-hubzilla-1f7622e4c42bf71d1d38dd88c40c903d83a8d6c0.tar.bz2
volse-hubzilla-1f7622e4c42bf71d1d38dd88c40c903d83a8d6c0.zip
fetch private objects using delivery channel credentials
-rw-r--r--Zotlabs/Lib/Libzot.php33
1 files changed, 28 insertions, 5 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 4efd869f3..bc0826189 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1125,9 +1125,14 @@ class Libzot {
logger('Activity rejected: ' . print_r($data,true));
return;
}
- $arr = Activity::decode_note($AS);
+ if (is_array($AS->obj)) {
+ $arr = Activity::decode_note($AS);
+ }
+ else {
+ $arr = [];
+ }
- logger($AS->debug());
+ logger($AS->debug(),LOGGER_DATA);
}
@@ -1230,7 +1235,7 @@ class Libzot {
$relay = (($env['type'] === 'response') ? true : false );
- $result = self::process_delivery($env['sender'],$arr,$deliveries,$relay,false,$message_request);
+ $result = self::process_delivery($env['sender'],$AS,$arr,$deliveries,$relay,false,$message_request);
}
elseif($env['type'] === 'sync') {
// $arr = get_channelsync_elements($data);
@@ -1412,7 +1417,7 @@ class Libzot {
* @return array
*/
- static function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $request = false) {
+ static function process_delivery($sender, $act, $arr, $deliveries, $relay, $public = false, $request = false) {
$result = [];
@@ -1441,6 +1446,24 @@ class Libzot {
$DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>');
+ if(($act) && ($act->obj) && (! is_array($act->obj))) {
+ // The initial object fetch failed using the sys channel credentials.
+ // Try again using the delivery channel credentials.
+ // We will also need to re-parse the $item array,
+ // but preserve any values that were set during anonymous parsing.
+
+ $o = Activity::fetch($act->obj,$channel);
+ if($o) {
+ $act->obj = $o;
+ $arr = array_merge(Activity::decode_note($act),$arr);
+ }
+ else {
+ $DR->update('Incomplete or corrupt activity');
+ $result[] = $DR->get();
+ continue;
+ }
+ }
+
/**
* We need to block normal top-level message delivery from our clones, as the delivered
* message doesn't have ACL information in it as the cloned copy does. That copy
@@ -1859,7 +1882,7 @@ class Libzot {
logger('FOF Activity received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
logger('FOF Activity recipient: ' . $channel['channel_portable_id'], LOGGER_DATA, LOG_DEBUG);
- $result = self::process_delivery($arr['owner_xchan'],$arr, [ $channel['channel_portable_id'] ],false,false,true);
+ $result = self::process_delivery($arr['owner_xchan'],$AS, $arr, [ $channel['channel_portable_id'] ],false,false,true);
if ($result) {
$ret = array_merge($ret, $result);
}