25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

mod_vcard: Return explicit error stanza when user attempts to modify other's vcard

This commit is contained in:
Badlop 2024-10-07 11:50:36 +02:00
parent 3669ac8aed
commit 50ef49d190

View File

@ -400,6 +400,12 @@ make_vcard_search(User, LUser, LServer, VCARD) ->
lorgunit = LOrgUnit}.
-spec vcard_iq_set(iq()) -> iq() | {stop, stanza_error()}.
vcard_iq_set(#iq{from = #jid{user = FromUser, lserver = FromLServer},
to = #jid{user = ToUser, lserver = ToLServer},
lang = Lang})
when (FromUser /= ToUser) or (FromLServer /= ToLServer) ->
Txt = ?T("User not allowed to perform an IQ set on another user's vCard."),
{stop, xmpp:err_forbidden(Txt, Lang)};
vcard_iq_set(#iq{from = From, lang = Lang, sub_els = [VCard]} = IQ) ->
#jid{user = User, lserver = LServer} = From,
case set_vcard(User, LServer, VCard) of