aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/poller.php4
-rw-r--r--include/zot.php14
-rw-r--r--mod/regdir.php4
-rw-r--r--mod/zfinger.php5
4 files changed, 18 insertions, 9 deletions
diff --git a/include/poller.php b/include/poller.php
index 06311eb39..43cc3f3c0 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -166,8 +166,8 @@ function poller_run($argv, $argc){
);
$dirmode = intval(get_config('system','directory_mode'));
- if($dirmode == DIRECTORY_MODE_SECONDARY) {
- logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . z_root() . '&realm=' . get_directory_realm()),true));
+ if($dirmode === DIRECTORY_MODE_SECONDARY) {
+ logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . urlencode(z_root()) . '&realm=' . urlencode(get_directory_realm())),true));
}
/**
diff --git a/include/zot.php b/include/zot.php
index 5c12dc4ba..99a787cd9 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -2536,6 +2536,9 @@ function import_site($arr,$pubkey) {
if($arr['directory_mode'] == 'standalone')
$site_directory = DIRECTORY_MODE_STANDALONE;
+
+
+
$register_policy = 0;
if($arr['register_policy'] == 'closed')
$register_policy = REGISTER_CLOSED;
@@ -2573,6 +2576,17 @@ function import_site($arr,$pubkey) {
$site_location = htmlspecialchars($arr['location'],ENT_COMPAT,'UTF-8',false);
$site_realm = htmlspecialchars($arr['realm'],ENT_COMPAT,'UTF-8',false);
+ // You can have one and only one primary directory per realm.
+ // Downgrade any others claiming to be primary. As they have
+ // flubbed up this badly already, don't let them be directory servers at all.
+
+ if(($site_directory === DIRECTORY_MODE_PRIMARY)
+ && ($site_realm === get_directory_realm())
+ && ($arr['url'] != get_directory_primary())) {
+ $site_directory = DIRECTORY_MODE_NORMAL;
+ }
+
+
if($exists) {
if(($siterecord['site_flags'] != $site_directory)
|| ($siterecord['site_access'] != $access_policy)
diff --git a/mod/regdir.php b/mod/regdir.php
index f12659dad..5331c1dd4 100644
--- a/mod/regdir.php
+++ b/mod/regdir.php
@@ -78,11 +78,11 @@ function regdir_init(&$a) {
}
else {
- // We can put this in the sql without the condition after 31 march 2015 assuming
+ // We can put this in the sql without the condition after 31 april 2015 assuming
// most directory servers will have updated by then
// This just makes sure it happens if I forget
- $sql_extra = ((datetime_convert() > datetime_convert('UTC','UTC','2015-03-31')) ? ' and site_valid = 1 ' : '' );
+ $sql_extra = ((datetime_convert() > datetime_convert('UTC','UTC','2015-04-31')) ? ' and site_valid = 1 ' : '' );
if($dirmode == DIRECTORY_MODE_STANDALONE) {
$r = array(array('site_url' => z_root()));
}
diff --git a/mod/zfinger.php b/mod/zfinger.php
index f4b7efd96..e236a1e73 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -239,11 +239,6 @@ function zfinger_init(&$a) {
if(($dirmode === false) || ($dirmode == DIRECTORY_MODE_NORMAL))
$ret['site']['directory_mode'] = 'normal';
- // downgrade mis-configured primaries
-
- if($dirmode == DIRECTORY_MODE_PRIMARY && z_root() != get_directory_primary())
- $dirmode = DIRECTORY_MODE_SECONDARY;
-
if($dirmode == DIRECTORY_MODE_PRIMARY)
$ret['site']['directory_mode'] = 'primary';
elseif($dirmode == DIRECTORY_MODE_SECONDARY)