aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/item.php2
-rw-r--r--mod/post.php29
2 files changed, 26 insertions, 5 deletions
diff --git a/mod/item.php b/mod/item.php
index a8d1bdf31..6678930ec 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -545,6 +545,8 @@ function item_post(&$a) {
echo json_encode(array('preview' => $o));
killme();
}
+ if($orig_post)
+ $datarray['edit'] = true;
call_hooks('post_local',$datarray);
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);