25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-24 17:29:28 +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().
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),
case acl:match_rule(Host, Access, From) of
allow ->
?DEBUG("Performing external service discovery for ~ts",
[jid:encode(From)]),
case get_services(Host, From, Request) of
{ok, Services} when Restricted -> % A <credentials/> request.
xmpp:make_iq_result(IQ, #credentials{services = Services});
{ok, Services} ->
xmpp:make_iq_result(IQ, #services{list = Services});
{error, timeout} -> % Has been logged already.