mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +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:
parent
8489f9ed7f
commit
661a34ccfc
@ -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>
|
2006-11-20 Mickael Remond <mickael.remond@process-one.net>
|
||||||
|
|
||||||
* src/ejd2odbc.erl: Copy mod_private data from Mnesia to
|
* src/ejd2odbc.erl: Copy mod_private data from Mnesia to
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
{hosts, ["localhost"]}.
|
{hosts, ["localhost"]}.
|
||||||
|
|
||||||
%% Define the maximum number of time a single user is allowed to connect:
|
%% 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:
|
%% Anonymous login support:
|
||||||
%% auth_method: anonymous
|
%% auth_method: anonymous
|
||||||
|
@ -515,7 +515,7 @@ check_max_sessions(LUser, LServer) ->
|
|||||||
SIDs = mnesia:dirty_select(
|
SIDs = mnesia:dirty_select(
|
||||||
session,
|
session,
|
||||||
[{#session{sid = '$1', usr = {LUser, LServer, '_'}, _ = '_'}, [], ['$1']}]),
|
[{#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;
|
if length(SIDs) =< MaxSessions -> ok;
|
||||||
true -> {_, Pid} = lists:min(SIDs),
|
true -> {_, Pid} = lists:min(SIDs),
|
||||||
Pid ! replaced
|
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
|
%% This option defines the max number of time a given users are allowed to
|
||||||
%% log in
|
%% log in
|
||||||
%% Defaults to infinity
|
%% Defaults to infinity
|
||||||
get_max_user_sessions(Host) ->
|
get_max_user_sessions(LUser, Host) ->
|
||||||
case ejabberd_config:get_local_option({max_user_sessions, Host}) of
|
case acl:match_rule(
|
||||||
undefined -> ?MAX_USER_SESSIONS;
|
Host, max_user_sessions, jlib:make_jid(LUser, Host, "")) of
|
||||||
Max -> Max
|
Max when is_integer(Max) -> Max;
|
||||||
|
infinity -> infinity;
|
||||||
|
_ -> ?MAX_USER_SESSIONS
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ recvd_wait_bind_response(Pkt, S) ->
|
|||||||
check_id(S#eldap.id, Msg#'LDAPMessage'.messageID),
|
check_id(S#eldap.id, Msg#'LDAPMessage'.messageID),
|
||||||
case Msg#'LDAPMessage'.protocolOp of
|
case Msg#'LDAPMessage'.protocolOp of
|
||||||
{bindResponse, Result} ->
|
{bindResponse, Result} ->
|
||||||
case Result#'LDAPResult'.resultCode of
|
case Result#'BindResponse'.resultCode of
|
||||||
success -> bound;
|
success -> bound;
|
||||||
Error -> {fail_bind, Error}
|
Error -> {fail_bind, Error}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user