25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

mod_stun_disco: Fix syntax of credentials response

As per XEP-0215 (#3.3), the response to a credentials request must use
the <credentials/> element rather than <services/>.

Thanks to Thilo Molitor for spotting the issue.
This commit is contained in:
Holger Weiss 2024-12-18 20:43:03 +01:00
parent ce3bc85d32
commit 8cfcc69100

View File

@ -484,13 +484,15 @@ process_iq(#iq{lang = Lang} = IQ) ->
-spec process_iq_get(iq(), request()) -> iq(). -spec process_iq_get(iq(), request()) -> iq().
process_iq_get(#iq{from = From, to = #jid{lserver = Host}, lang = Lang} = IQ, process_iq_get(#iq{from = From, to = #jid{lserver = Host}, lang = Lang} = IQ,
Request) -> #request{restricted = Restricted} = Request) ->
Access = mod_stun_disco_opt:access(Host), Access = mod_stun_disco_opt:access(Host),
case acl:match_rule(Host, Access, From) of case acl:match_rule(Host, Access, From) of
allow -> allow ->
?DEBUG("Performing external service discovery for ~ts", ?DEBUG("Performing external service discovery for ~ts",
[jid:encode(From)]), [jid:encode(From)]),
case get_services(Host, From, Request) of case get_services(Host, From, Request) of
{ok, Services} when Restricted -> % A <credentials/> request.
xmpp:make_iq_result(IQ, #credentials{services = Services});
{ok, Services} -> {ok, Services} ->
xmpp:make_iq_result(IQ, #services{list = Services}); xmpp:make_iq_result(IQ, #services{list = Services});
{error, timeout} -> % Has been logged already. {error, timeout} -> % Has been logged already.