diff options
| author | grunfink <grunfink@comam.es> | 2026-04-06 11:39:15 +0200 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2026-04-06 11:39:15 +0200 |
| commit | 45d7d893a27ae5cce4d2f905bb47245a36fd7087 (patch) | |
| tree | 485ff8b9685c0bc254414a264d9c072fb0935a55 | |
| parent | fc1789ac3d88d930f117fe116b947ff948cdf239 (diff) | |
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.
| -rw-r--r-- | webfinger.c | 16 |
1 files changed, 16 insertions, 0 deletions
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) { |