diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-09-08 20:14:17 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-09-08 20:14:17 -0700 |
commit | ffb1997902facb36b78a7cfa522f41f2b3d71cda (patch) | |
tree | e9fe47acf26c5fd2c742677f2610b60d3008eb26 /include/poller.php | |
parent | b49858b038a0a05bbe7685929e88071d0e125538 (diff) | |
download | volse-hubzilla-ffb1997902facb36b78a7cfa522f41f2b3d71cda.tar.gz volse-hubzilla-ffb1997902facb36b78a7cfa522f41f2b3d71cda.tar.bz2 volse-hubzilla-ffb1997902facb36b78a7cfa522f41f2b3d71cda.zip |
mistpark 2.0 infrasturcture lands
Diffstat (limited to 'include/poller.php')
-rw-r--r-- | include/poller.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/poller.php b/include/poller.php index 96c647278..58189b2a8 100644 --- a/include/poller.php +++ b/include/poller.php @@ -15,6 +15,8 @@ require_once('simplepie/simplepie.inc'); require_once('include/items.php'); + require_once('include/Contact.php'); + $a->set_baseurl(get_config('system','url')); $contacts = q("SELECT * FROM `contact` @@ -73,7 +75,7 @@ ? datetime_convert('UTC','UTC','now - 30 days','Y-m-d\TH:i:s\Z') : datetime_convert('UTC','UTC',$contact['last-update'],'Y-m-d\TH:i:s\Z')); - $idtosend = (($contact['duplex']) ? $contact['issued-id'] : $contact['dfrn-id']); + $idtosend = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']); $url = $contact['poll'] . '?dfrn_id=' . $idtosend . '&type=data&last_update=' . $last_update ; @@ -87,9 +89,15 @@ echo "XML: " . $xml; $res = simplexml_load_string($xml); + if(intval($res->status) == 1) + mark_for_death($contact); + if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id))) continue; + if($contact['term-date'] != '0000-00-00 00:00:00') + unmark_for_death($contact); + $postvars = array(); $sent_dfrn_id = hex2bin($res->dfrn_id); @@ -97,7 +105,7 @@ echo "XML: " . $xml; $final_dfrn_id = ''; - if($contact['duplex']) { + if(($contact['duplex']) && strlen($contact['prvkey'])) { openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']); openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']); @@ -108,13 +116,12 @@ echo "XML: " . $xml; } $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.')); - if(($final_dfrn_id != $contact['dfrn-id']) - || (($contact['duplex']) && ($final_dfrn_id != $contact['issued-id']))) { + if($final_dfrn_id != $idtosend) // did not decode properly - cannot trust this site continue; } - $postvars['dfrn_id'] = (($contact['duplex']) ? $contact['issued-id'] : $contact['dfrn-id']); + $postvars['dfrn_id'] = $idtosend; $xml = post_url($contact['poll'],$postvars); |