* src/ejabberd_auth_ldap.erl: Added listing of users support
SVN Revision: 332
This commit is contained in:
parent
b695656631
commit
916c7c6639
|
@ -1,5 +1,9 @@
|
|||
2005-04-27 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/ejabberd_auth_ldap.erl: Added listing of users support
|
||||
|
||||
* src/ejabberd.cfg.example: Updated LDAP options
|
||||
|
||||
* src/ejabberd_ctl.erl: Better spelling, now prints full file
|
||||
paths, fixed checking of mnesia:install_fallback result, now
|
||||
"dump" command dumps only persistent tables
|
||||
|
|
|
@ -79,7 +79,9 @@
|
|||
%{auth_method, ldap}.
|
||||
%{ldap_servers, ["localhost"]}. % List of LDAP servers
|
||||
%{ldap_uidattr, "uid"}. % LDAP attribute that holds user ID
|
||||
%{ldap_base, "dc=example,dc=com"}. % Base of LDAP directory
|
||||
%{ldap_base, "dc=example,dc=com"}. % Search base of LDAP directory
|
||||
%{ldap_rootdn, "dc=example,dc=com"}. % LDAP manager
|
||||
%{ldap_password, "******"}. % Password to LDAP manager
|
||||
|
||||
% For authentification via external script use the following:
|
||||
%{auth_method, external}.
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
plain_password_required/0
|
||||
]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
-include("eldap/eldap.hrl").
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
|
@ -65,10 +66,34 @@ try_register(_User, _Server, _Password) ->
|
|||
{error, not_allowed}.
|
||||
|
||||
dirty_get_registered_users() ->
|
||||
[].
|
||||
get_vh_registered_users(?MYNAME).
|
||||
|
||||
get_vh_registered_users(_Server) ->
|
||||
[].
|
||||
get_vh_registered_users(Server) ->
|
||||
LServer = jlib:nameprep(Server),
|
||||
Attr = ejabberd_config:get_local_option(ldap_uidattr),
|
||||
Filter = eldap:present(Attr),
|
||||
Base = ejabberd_config:get_local_option(ldap_base),
|
||||
case eldap:search("ejabberd", [{base, Base},
|
||||
{filter, Filter},
|
||||
{attributes, [Attr]}]) of
|
||||
#eldap_search_result{entries = Es} ->
|
||||
lists:flatmap(
|
||||
fun(E) ->
|
||||
case lists:keysearch(Attr, 1, E#eldap_entry.attributes) of
|
||||
{value, {_, [U]}} ->
|
||||
case jlib:nodeprep(U) of
|
||||
error ->
|
||||
[];
|
||||
LU ->
|
||||
[{LU, LServer}]
|
||||
end;
|
||||
_ ->
|
||||
[]
|
||||
end
|
||||
end, Es);
|
||||
_ ->
|
||||
[]
|
||||
end.
|
||||
|
||||
get_password(_User, _Server) ->
|
||||
false.
|
||||
|
|
Loading…
Reference in New Issue