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

* src/ejabberd_c2s.erl: We should allow use of bare resource in from by the client (partially revert r1727) (EJAB-812)

SVN Revision: 1759
This commit is contained in:
Mickaël Rémond 2008-12-28 12:15:51 +00:00
parent 1944aa097f
commit 707aa4fb8c
2 changed files with 31 additions and 13 deletions

View File

@ -1,3 +1,8 @@
2008-12-28 Mickael Remond <mremond@process-one.net>
* src/ejabberd_c2s.erl: We should allow use of bare resource in from by
the client (partially revert r1727) (EJAB-812).
2008-12-26 Badlop <badlop@process-one.net> 2008-12-26 Badlop <badlop@process-one.net>
* src/web/ejabberd_web_admin.erl: Show in ejabberd Web Admin the * src/web/ejabberd_web_admin.erl: Show in ejabberd Web Admin the

View File

@ -1983,20 +1983,33 @@ 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 ->
El; jlib:replace_from(FromJID, El);
{value, SJID} -> {value, JIDElString} ->
JID = jlib:string_to_jid(SJID), JIDEl = jlib:string_to_jid(JIDElString),
case JID of case JIDEl#jid.lresource of
error -> "" ->
'invalid-from'; %% Matching JID: The stanza is ok
#jid{} -> if JIDEl#jid.luser == FromJID#jid.luser andalso
if JIDEl#jid.lserver == FromJID#jid.lserver ->
(JID#jid.luser == FromJID#jid.luser) and %% We force the resource on the from attribute in the packet.
(JID#jid.lserver == FromJID#jid.lserver) and %% This is strictly needed only for IQ (to
(JID#jid.lresource == FromJID#jid.lresource) -> %% reply to the client), but I do not see
El; %% any good reason for now not to do it on
true -> %% all packets.
%% Need to be changed to support multiple
%% resource binding per connection.
jlib:replace_from(FromJID, El);
true ->
'invalid-from' '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 end
end. end.