From d00860430f3d90e75a464cee03d3ff79c34715eb Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 25 May 2023 08:03:10 +0000 Subject: owa fixes for where keyId = acct:xxx@yyy.zz --- Zotlabs/Module/Owa.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Owa.php') diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 02997d3f1..920a92240 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -32,7 +32,7 @@ class Owa extends Controller { $keyId = $sigblock['keyId']; if ($keyId) { $r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash - WHERE ( hubloc_addr = '%s' OR hubloc_id_url = '%s' ) AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC", + WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s') AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC", dbesc(str_replace('acct:', '', $keyId)), dbesc($keyId) ); @@ -40,11 +40,13 @@ class Owa extends Controller { $found = discover_by_webbie($keyId); if ($found) { $r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash - WHERE hubloc_id_url = '%s' AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC ", + WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s') AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC ", + dbesc(str_replace('acct:', '', $keyId)), dbesc($keyId) ); } } + if ($r) { foreach ($r as $hubloc) { $verified = HTTPSig::verify(file_get_contents('php://input'), $hubloc['xchan_pubkey']); @@ -73,7 +75,8 @@ class Owa extends Controller { if ($found) { $r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash - WHERE hubloc_id_url = '%s' AND hubloc_deleted = 0 ORDER BY hubloc_id DESC LIMIT 1", + WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s') AND hubloc_deleted = 0 ORDER BY hubloc_id DESC LIMIT 1", + dbesc(str_replace('acct:', '', $keyId)), dbesc($keyId) ); -- cgit v1.2.3