aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-29 17:21:14 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-29 17:21:14 -0700
commita795f03c486c0d6c32badc9850870f95d8d09059 (patch)
treeab29e2445cd19b7cb17044a64423b2b4070523c1
parent8f7b869c080d26861f3ab65d3fca2e7f249c8304 (diff)
downloadvolse-hubzilla-a795f03c486c0d6c32badc9850870f95d8d09059.tar.gz
volse-hubzilla-a795f03c486c0d6c32badc9850870f95d8d09059.tar.bz2
volse-hubzilla-a795f03c486c0d6c32badc9850870f95d8d09059.zip
improve the sys channel location repair to check key issues and re-installs and/or site moves
-rw-r--r--include/zot.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/zot.php b/include/zot.php
index 8e053ed6f..ed0e84775 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3798,6 +3798,9 @@ function zotinfo($arr) {
function check_zotinfo($channel,$locations,&$ret) {
+
+// logger('locations: ' . print_r($locations,true),LOGGER_DATA);
+
// This function will likely expand as we find more things to detect and fix.
// 1. Because magic-auth is reliant on it, ensure that the system channel has a valid hubloc
// Force this to be the case if anything is found to be wrong with it.
@@ -3808,10 +3811,15 @@ function check_zotinfo($channel,$locations,&$ret) {
// the sys channel must have a location (hubloc)
$valid_location = false;
if((count($locations) === 1) && ($locations[0]['primary']) && (! $locations[0]['deleted'])) {
- $valid_location = true;
+ if((rsa_verify($locations[0]['url'],base64url_decode($locations[0]['url_sig']),$channel['channel_pubkey']))
+ && ($locations[0]['sitekey'] === get_config('system','pubkey'))
+ && ($locations[0]['url'] === z_root()))
+ $valid_location = true;
+ else
+ logger('sys channel: invalid url signature');
}
- if((! $locations) || (! $valid_locations)) {
+ if((! $locations) || (! $valid_location)) {
logger('System channel locations are not valid. Attempting repair.');