mirror of
https://github.com/processone/ejabberd.git
synced 2024-09-27 14:30:55 +02: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>
|
2008-12-29 Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
||||||
|
|
||||||
* src/odbc/ejabberd_odbc.erl: Print meaningful error message when
|
* src/odbc/ejabberd_odbc.erl: Print meaningful error message when
|
||||||
|
@ -1983,14 +1983,21 @@ is_ip_blacklisted({IP,_Port}) ->
|
|||||||
check_from(El, FromJID) ->
|
check_from(El, FromJID) ->
|
||||||
case xml:get_tag_attr("from", El) of
|
case xml:get_tag_attr("from", El) of
|
||||||
false ->
|
false ->
|
||||||
jlib:replace_from(FromJID, El);
|
El;
|
||||||
{value, JIDElString} ->
|
{value, SJID} ->
|
||||||
JIDEl = jlib:string_to_jid(JIDElString),
|
JID = jlib:string_to_jid(SJID),
|
||||||
case JIDEl#jid.lresource of
|
case JID of
|
||||||
"" ->
|
error ->
|
||||||
%% Matching JID: The stanza is ok
|
'invalid-from';
|
||||||
if JIDEl#jid.luser == FromJID#jid.luser andalso
|
#jid{} ->
|
||||||
JIDEl#jid.lserver == FromJID#jid.lserver ->
|
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.
|
%% We force the resource on the from attribute in the packet.
|
||||||
%% This is strictly needed only for IQ (to
|
%% This is strictly needed only for IQ (to
|
||||||
%% reply to the client), but I do not see
|
%% reply to the client), but I do not see
|
||||||
@ -1998,18 +2005,9 @@ check_from(El, FromJID) ->
|
|||||||
%% all packets.
|
%% all packets.
|
||||||
%% Need to be changed to support multiple
|
%% Need to be changed to support multiple
|
||||||
%% resource binding per connection.
|
%% 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;
|
El;
|
||||||
true ->
|
true ->
|
||||||
'invalid-from'
|
'invalid-from'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user