aboutsummaryrefslogtreecommitdiffstats
path: root/lib/eldap/src/eldap.erl
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-01-22 09:50:18 +0100
committerFredrik Gustafsson <[email protected]>2013-01-22 09:50:18 +0100
commitf9ffedd3d89ad7a826dbf4be99dc08788019dc0a (patch)
tree30a47515d293a35d37b61f54ced23a1c1029d1f4 /lib/eldap/src/eldap.erl
parent67c18614b81183cc74446a8a1e8bba88b74c4034 (diff)
parentee05e6bf90e2d818def6e5826723736375da0ec6 (diff)
downloadotp-f9ffedd3d89ad7a826dbf4be99dc08788019dc0a.tar.gz
otp-f9ffedd3d89ad7a826dbf4be99dc08788019dc0a.tar.bz2
otp-f9ffedd3d89ad7a826dbf4be99dc08788019dc0a.zip
Merge branch 'fredrik/eldap/ssl-opts/OTP-10728'
* fredrik/eldap/ssl-opts/OTP-10728: Added doc for sslopts Configure the SSL options fully
Diffstat (limited to 'lib/eldap/src/eldap.erl')
-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