diff options
Diffstat (limited to 'lib/eldap')
-rw-r--r-- | lib/eldap/doc/src/eldap.xml | 2 | ||||
-rw-r--r-- | lib/eldap/src/Makefile | 2 | ||||
-rw-r--r-- | lib/eldap/src/eldap.erl | 11 |
3 files changed, 10 insertions, 5 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/Makefile b/lib/eldap/src/Makefile index ad93e1087a..e7cbb776bd 100644 --- a/lib/eldap/src/Makefile +++ b/lib/eldap/src/Makefile @@ -59,7 +59,7 @@ APP_TARGET = $(EBIN)/$(APP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += -I../include -I../ebin +ERL_COMPILE_FLAGS += -I../include -I../ebin -Werror # ---------------------------------------------------- # Targets diff --git a/lib/eldap/src/eldap.erl b/lib/eldap/src/eldap.erl index 855a4086ad..d11f904996 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 |