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

* src/eldap/eldap.erl: Bugfix (thanks to Evgeniy Khramtsov)

* src/ejabberd_sm.erl: The max_user_sessions option is now
configured via access rule
* src/ejabberd.cfg.example: Likewise

SVN Revision: 680
This commit is contained in:
Alexey Shchepin 2006-11-23 06:34:05 +00:00
parent 8489f9ed7f
commit 661a34ccfc
4 changed files with 17 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2006-11-23 Alexey Shchepin <alexey@sevcom.net>
* src/eldap/eldap.erl: Bugfix (thanks to Evgeniy Khramtsov)
* src/ejabberd_sm.erl: The max_user_sessions option is now
configured via access rule
* src/ejabberd.cfg.example: Likewise
2006-11-20 Mickael Remond <mickael.remond@process-one.net>
* src/ejd2odbc.erl: Copy mod_private data from Mnesia to

View File

@ -100,7 +100,7 @@
{hosts, ["localhost"]}.
%% Define the maximum number of time a single user is allowed to connect:
{max_user_sessions, 10}.
{access, max_user_sessions, [{10, all}]}.
%% Anonymous login support:
%% auth_method: anonymous

View File

@ -515,7 +515,7 @@ check_max_sessions(LUser, LServer) ->
SIDs = mnesia:dirty_select(
session,
[{#session{sid = '$1', usr = {LUser, LServer, '_'}, _ = '_'}, [], ['$1']}]),
MaxSessions = get_max_user_sessions(LServer),
MaxSessions = get_max_user_sessions(LUser, LServer),
if length(SIDs) =< MaxSessions -> ok;
true -> {_, Pid} = lists:min(SIDs),
Pid ! replaced
@ -526,10 +526,12 @@ check_max_sessions(LUser, LServer) ->
%% This option defines the max number of time a given users are allowed to
%% log in
%% Defaults to infinity
get_max_user_sessions(Host) ->
case ejabberd_config:get_local_option({max_user_sessions, Host}) of
undefined -> ?MAX_USER_SESSIONS;
Max -> Max
get_max_user_sessions(LUser, Host) ->
case acl:match_rule(
Host, max_user_sessions, jlib:make_jid(LUser, Host, "")) of
Max when is_integer(Max) -> Max;
infinity -> infinity;
_ -> ?MAX_USER_SESSIONS
end.

View File

@ -713,7 +713,7 @@ recvd_wait_bind_response(Pkt, S) ->
check_id(S#eldap.id, Msg#'LDAPMessage'.messageID),
case Msg#'LDAPMessage'.protocolOp of
{bindResponse, Result} ->
case Result#'LDAPResult'.resultCode of
case Result#'BindResponse'.resultCode of
success -> bound;
Error -> {fail_bind, Error}
end