From bd2d99aced589797b124cec10212572e565fc519 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 26 Aug 2015 15:56:32 -0700 Subject: import fixes --- mod/import.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/mod/import.php b/mod/import.php index deee0c6e7..d081a18e4 100644 --- a/mod/import.php +++ b/mod/import.php @@ -277,7 +277,13 @@ function import_post(&$a) { if($hublocs) { foreach($hublocs as $hubloc) { - if(! array_key_exists('hubloc_primary',$hublocs)) { + $hash = make_xchan_hash($hubloc['hubloc_guid'],$hubloc['hubloc_guid_sig']); + if($hubloc['hubloc_network'] === 'zot' && $hash !== $hubloc['hubloc_hash']) { + logger('forged hubloc: ' . print_r($hubloc,true)); + continue; + } + + if(! array_key_exists('hubloc_primary',$hubloc)) { $hubloc['hubloc_primary'] = (($hubloc['hubloc_flags'] & 0x0001) ? 1 : 0); $hubloc['hubloc_orphancheck'] = (($hubloc['hubloc_flags'] & 0x0004) ? 1 : 0); $hubloc['hubloc_error'] = (($hubloc['hubloc_status'] & 0x0003) ? 1 : 0); @@ -286,7 +292,7 @@ function import_post(&$a) { $arr = array( 'guid' => $hubloc['hubloc_guid'], - 'guid_sig' => $hubloc['guid_sig'], + 'guid_sig' => $hubloc['hubloc_guid_sig'], 'url' => $hubloc['hubloc_url'], 'url_sig' => $hubloc['hubloc_url_sig'] ); @@ -384,6 +390,13 @@ function import_post(&$a) { $xchans = $data['xchan']; if($xchans) { foreach($xchans as $xchan) { + + $hash = make_xchan_hash($xchan['xchan_guid'],$xchan['xchan_guid_sig']); + if($xchan['xchan_network'] === 'zot' && $hash !== $xchan['xchan_hash']) { + logger('forged xchan: ' . print_r($xchan,true)); + continue; + } + if(! array_key_exists('xchan_hidden',$xchan)) { $xchan['xchan_hidden'] = (($xchan['xchan_flags'] & 0x0001) ? 1 : 0); $xchan['xchan_orphan'] = (($xchan['xchan_flags'] & 0x0002) ? 1 : 0); -- cgit v1.2.3