Permit use of SSL options for LDAP client connections.

This commit is contained in:
Simon MacMullen 2013-10-24 14:49:10 +01:00
parent bbeaeb1b73
commit 053f8ad87d
2 changed files with 14 additions and 5 deletions

View File

@ -48,6 +48,7 @@
resource_access_query,
tag_queries,
use_ssl,
ssl_options,
log,
port }).
@ -235,11 +236,18 @@ with_ldap(_Creds, _Fun, #state{servers = undefined}) ->
%% TODO - ATM we create and destroy a new LDAP connection on every
%% call. This could almost certainly be more efficient.
with_ldap(Creds, Fun, State = #state{servers = Servers,
use_ssl = SSL,
log = Log,
port = Port}) ->
Opts0 = [{ssl, SSL}, {port, Port}],
with_ldap(Creds, Fun, State = #state{servers = Servers,
use_ssl = SSL,
ssl_options = SSLOpts,
log = Log,
port = Port}) ->
%% We can't just pass through [] as sslopts in the old case, eldap
%% exit()s when you do that.
Opts0 = case {SSLOpts, erlang:system_info(otp_release) < "R16A"} of
{[], _} -> [{ssl, SSL}, {port, Port}];
{_, false} -> [{ssl, SSL}, {port, Port}, {sslopts, SSLOpts}];
{_, true} -> exit({ssl_options_requires_min_r16a})
end,
Opts = case Log of
network ->
Pre = " LDAP network traffic: ",

View File

@ -14,6 +14,7 @@
{resource_access_query, {constant, true}},
{tag_queries, [{administrator, {constant, false}}]},
{use_ssl, false},
{ssl_options, []},
{port, 389},
{log, false} ] },
{applications, [kernel, stdlib, eldap, rabbit]}]}.