From 8f236771c675ba18fa053182c4d25199e3f98277 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 21 Nov 2013 14:42:48 -0800 Subject: mark hublocs with incorrect sitekeys deleted --- mod/post.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mod/post.php') diff --git a/mod/post.php b/mod/post.php index 64e08e632..0ce58ec9f 100644 --- a/mod/post.php +++ b/mod/post.php @@ -265,6 +265,7 @@ function post_post(&$a) { if((! $forgery) && (! $secret_fail)) break; } + if($forgery) { $ret['message'] = 'possible site forgery'; logger('mod_zot: pickup: ' . $ret['message']); @@ -312,6 +313,7 @@ function post_post(&$a) { ); } } + $encrypted = crypto_encapsulate(json_encode($ret),$sitekey); json_return_and_die($encrypted); @@ -355,6 +357,18 @@ function post_post(&$a) { intval($hub['hubloc_id']) ); + /** + * This hub has now been proven to be valid. + * Any hub with the same URL and a different sitekey cannot be valid. + * Get rid of them (mark them deleted). There's a good chance they were re-installs. + * + */ + + q("update hubloc set hubloc_flags = ( hubloc_flags | %d ) where hubloc_url = '%s' and hubloc_sitekey != '%s' ", + intval(HUBLOC_FLAGS_DELETED), + dbesc($hub['hubloc_url']), + dbesc($hub['hubloc_sitekey']) + ); // TODO: check which hub is primary and take action if mismatched -- cgit v1.2.3