From 45d7d893a27ae5cce4d2f905bb47245a36fd7087 Mon Sep 17 00:00:00 2001 From: grunfink Date: Mon, 6 Apr 2026 11:39:15 +0200 Subject: Webfinger: if the 'subject' is not an acct:, search in 'aliases'. Implementations like Hubzilla return a subject that is an http: instead of an acct:, but have one in the 'aliases' array, so use it. --- webfinger.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/webfinger.c b/webfinger.c index fc0094f..c62951a 100644 --- a/webfinger.c +++ b/webfinger.c @@ -96,6 +96,22 @@ int webfinger_request_signed(snac *snac, const char *qs, xs_str **actor, xs_str if (subject && xs_startswith(subject, "acct:")) *user = xs_replace_n(subject, "acct:", "", 1); + else { + /* subject not an 'acct:': try in the aliases + (i.e. hubzilla does this) */ + const char *aliases = xs_dict_get(obj, "aliases"); + + if (xs_is_list(aliases)) { + const char *v; + + xs_list_foreach(aliases, v) { + if (xs_startswith(v, "acct:")) { + *user = xs_replace_n(v, "acct:", "", 1); + break; + } + } + } + } } if (actor != NULL) { -- cgit