diff options
author | Fredrik Gustafsson <[email protected]> | 2013-01-22 09:50:18 +0100 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-01-22 09:50:18 +0100 |
commit | f9ffedd3d89ad7a826dbf4be99dc08788019dc0a (patch) | |
tree | 30a47515d293a35d37b61f54ced23a1c1029d1f4 /lib | |
parent | 67c18614b81183cc74446a8a1e8bba88b74c4034 (diff) | |
parent | ee05e6bf90e2d818def6e5826723736375da0ec6 (diff) | |
download | otp-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')
-rw-r--r-- | lib/eldap/doc/src/eldap.xml | 2 | ||||
-rw-r--r-- | lib/eldap/src/eldap.erl | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/eldap/doc/src/eldap.xml b/lib/eldap/doc/src/eldap.xml index 04dad2eee7..bd6f00af1f 100644 --- a/lib/eldap/doc/src/eldap.xml +++ b/lib/eldap/doc/src/eldap.xml @@ -68,7 +68,7 @@ filter() See present/1, substrings/2, <fsummary>Open a connection to an LDAP server.</fsummary> <type> <v>Handle = handle()</v> - <v>Option = {port, integer()} | {log, function()} | {timeout, integer()} | {ssl, boolean()}</v> + <v>Option = {port, integer()} | {log, function()} | {timeout, integer()} | {ssl, boolean()} | {sslopts, list()}</v> </type> <desc> <p>Setup a connection to an LDAP server, the <c>HOST</c>'s are tried in order.</p> 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 |