mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
* src/ejabberd_c2s.erl: Bugfix in "from" attribute checking
SVN Revision: 1763
This commit is contained in:
parent
5a5ab955cb
commit
df478a8e90
@ -1,3 +1,7 @@
|
||||
2008-12-29 Alexey Shchepin <alexey@process-one.net>
|
||||
|
||||
* src/ejabberd_c2s.erl: Bugfix in "from" attribute checking
|
||||
|
||||
2008-12-29 Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
||||
|
||||
* src/odbc/ejabberd_odbc.erl: Print meaningful error message when
|
||||
|
@ -1983,14 +1983,21 @@ 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;
|
||||
(JID#jid.luser == FromJID#jid.luser) and
|
||||
(JID#jid.lserver == FromJID#jid.lserver) and
|
||||
(JID#jid.lresource == "") ->
|
||||
%% We force the resource on the from attribute in the packet.
|
||||
%% This is strictly needed only for IQ (to
|
||||
%% reply to the client), but I do not see
|
||||
@ -1998,18 +2005,9 @@ check_from(El, FromJID) ->
|
||||
%% all packets.
|
||||
%% Need to be changed to support multiple
|
||||
%% resource binding per connection.
|
||||
jlib:replace_from(FromJID, El);
|
||||
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'
|
||||
true ->
|
||||
'invalid-from'
|
||||
end
|
||||
end
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user