From d35209561d3b3436a853db0d24561c91923edb74 Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Mon, 5 Jul 2004 21:51:23 +0000 Subject: [PATCH] * src/ejabberd_auth.erl: Minor fix * src/ejabberd_c2s.erl: Fixed sending of presence to own resources SVN Revision: 239 --- ChangeLog | 6 ++++++ src/ejabberd_auth.erl | 2 +- src/ejabberd_c2s.erl | 19 ++++++++++++------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 994eb4f83..476cd708c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-07-06 Alexey Shchepin + + * src/ejabberd_auth.erl: Minor fix + + * src/ejabberd_c2s.erl: Fixed sending of presence to own resources + 2004-06-18 Alexey Shchepin * src/web/ejabberd_web_admin.erl: Added configuration of listened diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl index 48c4edf8b..fc239680b 100644 --- a/src/ejabberd_auth.erl +++ b/src/ejabberd_auth.erl @@ -176,7 +176,7 @@ check_password_internal(User, Password, StreamID, Digest) -> if DigRes -> true; true -> - Passwd == Password + (Passwd == Password) and (Password /= "") end; _ -> false diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index a85ee24e0..5b771cb83 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -255,6 +255,10 @@ wait_for_auth({xmlstreamelement, El}, StateData) -> send_element(StateData, Res), change_shaper(StateData, JID), {Fs, Ts} = mod_roster:get_subscription_lists(U), + LJID = jlib:jid_tolower( + jlib:jid_remove_resource(JID)), + Fs1 = [LJID | Fs], + Ts1 = [LJID | Ts], PrivList = case catch mod_privacy:get_user_list(U) of {'EXIT', _} -> none; @@ -264,8 +268,8 @@ wait_for_auth({xmlstreamelement, El}, StateData) -> StateData#state{user = U, resource = R, jid = JID, - pres_f = ?SETS:from_list(Fs), - pres_t = ?SETS:from_list(Ts), + pres_f = ?SETS:from_list(Fs1), + pres_t = ?SETS:from_list(Ts1), privacy_list = PrivList}}; _ -> ?INFO_MSG( @@ -504,7 +508,7 @@ wait_for_session({xmlstreamelement, El}, StateData) -> U = StateData#state.user, R = StateData#state.resource, io:format("SASLAUTH: ~p~n", [{U, R}]), - JID = jlib:make_jid(U, StateData#state.server, R), + JID = StateData#state.jid, case acl:match_rule(StateData#state.access, JID) of allow -> ?INFO_MSG("(~w) Opened session for ~s", @@ -515,14 +519,17 @@ wait_for_session({xmlstreamelement, El}, StateData) -> send_element(StateData, Res), change_shaper(StateData, JID), {Fs, Ts} = mod_roster:get_subscription_lists(U), + LJID = jlib:jid_tolower(jlib:jid_remove_resource(JID)), + Fs1 = [LJID | Fs], + Ts1 = [LJID | Ts], PrivList = case catch mod_privacy:get_user_list(U) of {'EXIT', _} -> none; PL -> PL end, {next_state, session_established, - StateData#state{pres_f = ?SETS:from_list(Fs), - pres_t = ?SETS:from_list(Ts), + StateData#state{pres_f = ?SETS:from_list(Fs1), + pres_t = ?SETS:from_list(Ts1), privacy_list = PrivList}}; _ -> ?INFO_MSG("(~w) Forbidden session for ~s", @@ -1017,8 +1024,6 @@ presence_update(From, Packet, StateData) -> NewState = if FromUnavail -> - % TODO: watching ourself - resend_offline_messages(StateData), presence_broadcast_first( From, StateData#state{pres_last = Packet,