25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* src/ejabberd_c2s.erl: Bugfix in "from" attribute checking

SVN Revision: 1727
This commit is contained in:
Alexey Shchepin 2008-12-12 13:08:00 +00:00
parent 6e5a32308a
commit 620cbc765c
2 changed files with 16 additions and 18 deletions

View File

@ -1,3 +1,7 @@
2008-12-12 Alexey Shchepin <alexey@process-one.net>
* src/ejabberd_c2s.erl: Bugfix in "from" attribute checking
2008-12-09 Christophe Romain <christophe.romain@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: prevent publish items with invalid

View File

@ -1983,26 +1983,20 @@ is_ip_blacklisted({IP,_Port}) ->
check_from(El, FromJID) ->
case xml:get_tag_attr("from", El) of
false ->
jlib:replace_from(FromJID, El);
{value, JIDElString} ->
JIDEl = jlib:string_to_jid(JIDElString),
case JIDEl#jid.lresource of
"" ->
%% Matching JID: The stanza is ok
if JIDEl#jid.luser == FromJID#jid.luser andalso
JIDEl#jid.lserver == FromJID#jid.lserver ->
El;
{value, SJID} ->
JID = jlib:string_to_jid(SJID),
case JID of
error ->
'invalid-from';
#jid{} ->
if
(JID#jid.luser == FromJID#jid.luser) and
(JID#jid.lserver == FromJID#jid.lserver) and
(JID#jid.lresource == FromJID#jid.lresource) ->
El;
true ->
true ->
'invalid-from'
end;
_ ->
%% Matching JID: The stanza is ok
if JIDEl#jid.luser == FromJID#jid.luser andalso
JIDEl#jid.lserver == FromJID#jid.lserver andalso
JIDEl#jid.lresource == FromJID#jid.lresource ->
El;
true ->
'invalid-from'
end
end
end.