match hosts instead of urls to decide if to zid or not to zid

This commit is contained in:
Mario Vavti 2018-03-15 14:53:18 +01:00
parent 6c709551ce
commit 34fee2a790

View File

@ -53,13 +53,13 @@ function zid($s, $address = '') {
$mine = get_my_url(); $mine = get_my_url();
$myaddr = (($address) ? $address : get_my_address()); $myaddr = (($address) ? $address : get_my_address());
/** $mine_parsed = parse_url($mine);
* @FIXME checking against our own channel url is no longer reliable. We may have a lot $s_parsed = parse_url($s);
* of urls attached to our channel. Should probably match against our site, since we
* will not need to remote authenticate on our own site anyway.
*/
if ($mine && $myaddr && (! link_compare($mine,$s))) if($mine_parsed['host'] === $s_parsed['host'])
$url_match = true;
if ($mine && $myaddr && (! $url_match))
$zurl = $s . (($num_slashes >= 3) ? '' : '/') . $achar . 'zid=' . urlencode($myaddr); $zurl = $s . (($num_slashes >= 3) ? '' : '/') . $achar . 'zid=' . urlencode($myaddr);
else else
$zurl = $s; $zurl = $s;
@ -346,4 +346,4 @@ function owt_init($token) {
info(sprintf( t('OpenWebAuth: %1$s welcomes %2$s'),\App::get_hostname(), $hubloc['xchan_name'])); info(sprintf( t('OpenWebAuth: %1$s welcomes %2$s'),\App::get_hostname(), $hubloc['xchan_name']));
logger('OpenWebAuth: auth success from ' . $hubloc['xchan_addr']); logger('OpenWebAuth: auth success from ' . $hubloc['xchan_addr']);
} }