aboutsummaryrefslogtreecommitdiffstats
path: root/lib/eldap/src
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-01-15 15:00:36 +0100
committerFredrik Gustafsson <[email protected]>2013-01-15 15:00:36 +0100
commit0862fb11693bd6e4c2fed8429447f6644425ecf9 (patch)
treebc5ec784dcb0e7ee5beebf05433e7ff91ea198e6 /lib/eldap/src
parentfa6771380931c7ded0ad4d36e6cd2554bb932dfc (diff)
downloadotp-0862fb11693bd6e4c2fed8429447f6644425ecf9.tar.gz
otp-0862fb11693bd6e4c2fed8429447f6644425ecf9.tar.bz2
otp-0862fb11693bd6e4c2fed8429447f6644425ecf9.zip
Configure the SSL options fully
Diffstat (limited to 'lib/eldap/src')
-rw-r--r--lib/eldap/src/eldap.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/eldap/src/eldap.erl b/lib/eldap/src/eldap.erl
index 5753cc4749..d030408770 100644
--- a/lib/eldap/src/eldap.erl
+++ b/lib/eldap/src/eldap.erl
@@ -42,7 +42,8 @@
log, % User provided log function
timeout = infinity, % Request timeout
anon_auth = false, % Allow anonymous authentication
- use_tls = false % LDAP/LDAPS
+ use_tls = false, % LDAP/LDAPS
+ tls_opts = [] % ssl:ssloptsion()
}).
%%% For debug purposes
@@ -353,6 +354,10 @@ parse_args([{ssl, true}|T], Cpid, Data) ->
parse_args(T, Cpid, Data#eldap{use_tls = true});
parse_args([{ssl, _}|T], Cpid, Data) ->
parse_args(T, Cpid, Data);
+parse_args([{sslopts, Opts}|T], Cpid, Data) when is_list(Opts) ->
+ parse_args(T, Cpid, Data#eldap{use_tls = true, tls_opts = Opts ++ Data#eldap.tls_opts});
+parse_args([{sslopts, _}|T], Cpid, Data) ->
+ parse_args(T, Cpid, Data);
parse_args([{log, F}|T], Cpid, Data) when is_function(F) ->
parse_args(T, Cpid, Data#eldap{log = F});
parse_args([{log, _}|T], Cpid, Data) ->
@@ -384,8 +389,8 @@ try_connect([],_) ->
do_connect(Host, Data, Opts) when Data#eldap.use_tls == false ->
gen_tcp:connect(Host, Data#eldap.port, Opts, Data#eldap.timeout);
do_connect(Host, Data, Opts) when Data#eldap.use_tls == true ->
- ssl:connect(Host, Data#eldap.port, [{verify,0}|Opts]).
-
+ SslOpts = [{verify,0} | Opts ++ Data#eldap.tls_opts],
+ ssl:connect(Host, Data#eldap.port, SslOpts).
loop(Cpid, Data) ->
receive