aboutsummaryrefslogtreecommitdiffstats
path: root/mod/post.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-05-16 20:21:12 -0700
committerfriendica <info@friendica.com>2013-05-16 20:21:12 -0700
commitdeedac6ae542a1ff8d599076b7e0ef344d30e1a8 (patch)
tree34716c0f51ee88d1ae1507e3c3f61d52a0fc5d52 /mod/post.php
parent98018f4969f3b2ab8e56a15cc6ee72ea190a0da5 (diff)
downloadvolse-hubzilla-deedac6ae542a1ff8d599076b7e0ef344d30e1a8.tar.gz
volse-hubzilla-deedac6ae542a1ff8d599076b7e0ef344d30e1a8.tar.bz2
volse-hubzilla-deedac6ae542a1ff8d599076b7e0ef344d30e1a8.zip
workarounds for people that re-install and end up polluting everybody's databases with stale entries
Diffstat (limited to 'mod/post.php')
-rw-r--r--mod/post.php29
1 files changed, 24 insertions, 5 deletions
diff --git a/mod/post.php b/mod/post.php
index 20100c032..286eb743d 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -200,17 +200,36 @@ function post_post(&$a) {
logger('mod_zot: pickup: ' . $ret['message']);
json_return_and_die($ret);
}
- // verify the url_sig
- $sitekey = $r[0]['hubloc_sitekey'];
-// logger('sitekey: ' . $sitekey);
- if(! rsa_verify($data['callback'],base64url_decode($data['callback_sig']),$sitekey)) {
+ foreach ($r as $hubsite) {
+
+ // verify the url_sig
+ // If the server was re-installed at some point, there could be multiple hubs with the same url and callback.
+ // Only one will have a valid key.
+
+ $forgery = true;
+ $secret_fail = true;
+
+ $sitekey = $hubsite['hubloc_sitekey'];
+
+ // logger('sitekey: ' . $sitekey);
+
+ if(rsa_verify($data['callback'],base64url_decode($data['callback_sig']),$sitekey)) {
+ $forgery = false;
+ }
+ if(rsa_verify($data['secret'],base64url_decode($data['secret_sig']),$sitekey)) {
+ $secret_fail = false;
+ }
+ if((! $forgery) && (! $secret_fail))
+ break;
+ }
+ if($forgery) {
$ret['message'] = 'possible site forgery';
logger('mod_zot: pickup: ' . $ret['message']);
json_return_and_die($ret);
}
- if(! rsa_verify($data['secret'],base64url_decode($data['secret_sig']),$sitekey)) {
+ if($secret_fail) {
$ret['message'] = 'secret validation failed';
logger('mod_zot: pickup: ' . $ret['message']);
json_return_and_die($ret);