From da649e397e63e71d8111f4b6be1d569f5ad2d319 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 26 Aug 2015 13:49:07 -0700 Subject: import fixes --- mod/import.php | 34 +++++++++++++++++++++++++++++++++- version.inc | 2 +- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/mod/import.php b/mod/import.php index 2961867a8..b3d0859e4 100644 --- a/mod/import.php +++ b/mod/import.php @@ -225,10 +225,36 @@ function import_post(&$a) { foreach($hublocs as $hubloc) { $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'] ); + + $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)) { + if(intval($hubloc['hubloc_primary']) { + $hubloc['hubloc_flags'] |= HUBLOC_FLAGS_PRIMARY; + unset($hubloc['hubloc_primary']); + } + if(intval($hubloc['hubloc_orphancheck']) { + $hubloc['hubloc_flags'] |= HUBLOC_FLAGS_ORPHANCHECK; + unset($hubloc['hubloc_orphancheck']); + } + if(intval($hubloc['hubloc_deleted']) { + $hubloc['hubloc_flags'] |= HUBLOC_FLAGS_DELETED; + unset($hubloc['hubloc_deleted']); + } + if(intval($hubloc['hubloc_error']) { + $hubloc['hubloc_status'] |= HUBLOC_ERROR; + unset($hubloc['hubloc_error']); + } + } + if(($hubloc['hubloc_hash'] === $channel['channel_hash']) && ($hubloc['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) && ($seize)) $hubloc['hubloc_flags'] = ($hubloc['hubloc_flags'] ^ HUBLOC_FLAGS_PRIMARY); @@ -308,6 +334,12 @@ function import_post(&$a) { 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; + } + $r = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1", dbesc($xchan['xchan_hash']) ); diff --git a/version.inc b/version.inc index 853449713..988848405 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-08-24.1134 +2015-08-26.1136 -- cgit v1.2.3