Improvement coming from trunk (SVN #622):
* src/eldap/eldap.erl: Enable the keepalive socket option (thanks to Evgeniy Khramtsov) * src/ejabberd_auth_ldap.erl: Now uses two LDAP connections (thanks to Evgeniy Khramtsov) * src/eldap/eldap_filter.erl: Bugfix (thanks to Evgeniy Khramtsov) * src/mod_vcard_ldap.erl: Likewise SVN Revision: 623
This commit is contained in:
parent
e734ad1682
commit
ccfcfa49fa
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2006-09-23 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/eldap/eldap.erl: Enable the keepalive socket option (thanks
|
||||
to Evgeniy Khramtsov)
|
||||
|
||||
* src/ejabberd_auth_ldap.erl: Now uses two LDAP connections
|
||||
(thanks to Evgeniy Khramtsov)
|
||||
|
||||
* src/eldap/eldap_filter.erl: Bugfix (thanks to Evgeniy Khramtsov)
|
||||
* src/mod_vcard_ldap.erl: Likewise
|
||||
|
||||
2006-09-22 Mickael Remond <mickael.remond@process-one.net>
|
||||
|
||||
* src/msgs/cs.msg: Added Czech translation (thanks to Milos Svasek).
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
-record(state, {host,
|
||||
eldap_id,
|
||||
bind_eldap_id,
|
||||
servers,
|
||||
port,
|
||||
dn,
|
||||
|
@ -101,6 +102,11 @@ init(Host) ->
|
|||
State#state.port,
|
||||
State#state.dn,
|
||||
State#state.password),
|
||||
eldap:start_link(State#state.bind_eldap_id,
|
||||
State#state.servers,
|
||||
State#state.port,
|
||||
State#state.dn,
|
||||
State#state.password),
|
||||
ejabberd_ctl:register_commands(
|
||||
Host,
|
||||
[{"registered-users", "list all registered users"}],
|
||||
|
@ -174,7 +180,7 @@ handle_call({check_pass, User, Password}, _From, State) ->
|
|||
false ->
|
||||
false;
|
||||
DN ->
|
||||
case eldap:bind(State#state.eldap_id, DN, Password) of
|
||||
case eldap:bind(State#state.bind_eldap_id, DN, Password) of
|
||||
ok -> true;
|
||||
_ -> false
|
||||
end
|
||||
|
@ -327,6 +333,7 @@ usort_attrs(_) ->
|
|||
|
||||
parse_options(Host) ->
|
||||
Eldap_ID = atom_to_list(gen_mod:get_module_proc(Host, ?MODULE)),
|
||||
Bind_Eldap_ID = atom_to_list(gen_mod:get_module_proc(Host, bind_ejabberd_auth_ldap)),
|
||||
LDAPServers = ejabberd_config:get_local_option({ldap_servers, Host}),
|
||||
LDAPPort = case ejabberd_config:get_local_option({ldap_port, Host}) of
|
||||
undefined -> 389;
|
||||
|
@ -363,6 +370,7 @@ parse_options(Host) ->
|
|||
end,
|
||||
#state{host = Host,
|
||||
eldap_id = Eldap_ID,
|
||||
bind_eldap_id = Bind_Eldap_ID,
|
||||
servers = LDAPServers,
|
||||
port = LDAPPort,
|
||||
dn = RootDN,
|
||||
|
|
|
@ -808,7 +808,7 @@ polish([], Res, Ref) ->
|
|||
%%-----------------------------------------------------------------------
|
||||
connect_bind(S) ->
|
||||
Host = next_host(S#eldap.host, S#eldap.hosts),
|
||||
TcpOpts = [{packet, asn1}, {active, true}, binary],
|
||||
TcpOpts = [{packet, asn1}, {active, true}, {keepalive, true}, binary],
|
||||
case gen_tcp:connect(Host, S#eldap.port, TcpOpts) of
|
||||
{ok, Socket} ->
|
||||
case bind_request(Socket, S) of
|
||||
|
|
|
@ -670,14 +670,9 @@ map_vcard_attr(VCardName, Attributes, Pattern, UD) ->
|
|||
_ -> ""
|
||||
end.
|
||||
|
||||
process_pattern(Str, {User, Domain}, Attrs) ->
|
||||
Res = lists:foldl(
|
||||
fun(X, Acc) ->
|
||||
{ok, NewStr, _} = regexp:sub(Acc, "%s", X),
|
||||
NewStr
|
||||
end,
|
||||
Str, Attrs),
|
||||
eldap_filter:do_sub(Res, [{"%u", User},{"%d", Domain}]).
|
||||
process_pattern(Str, {User, Domain}, AttrValues) ->
|
||||
eldap_filter:do_sub(Str,
|
||||
[{"%s", V, 1} || V <- AttrValues] ++ [{"%u", User},{"%d", Domain}]).
|
||||
|
||||
get_ldap_attr(LDAPAttr, Attributes) ->
|
||||
Res = lists:filter(
|
||||
|
|
Loading…
Reference in New Issue