diff options
Diffstat (limited to 'lib/eldap')
-rw-r--r-- | lib/eldap/doc/src/eldap.xml | 4 | ||||
-rw-r--r-- | lib/eldap/doc/src/notes.xml | 25 | ||||
-rw-r--r-- | lib/eldap/src/Makefile | 10 | ||||
-rw-r--r-- | lib/eldap/src/eldap.erl | 33 | ||||
-rw-r--r-- | lib/eldap/vsn.mk | 2 |
5 files changed, 41 insertions, 33 deletions
diff --git a/lib/eldap/doc/src/eldap.xml b/lib/eldap/doc/src/eldap.xml index 04dad2eee7..30767abd7e 100644 --- a/lib/eldap/doc/src/eldap.xml +++ b/lib/eldap/doc/src/eldap.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2012</year> + <year>2012</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -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/doc/src/notes.xml b/lib/eldap/doc/src/notes.xml index d9b11875de..2cdba83bcd 100644 --- a/lib/eldap/doc/src/notes.xml +++ b/lib/eldap/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2012</year> + <year>2012</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -30,7 +30,28 @@ </header> <p>This document describes the changes made to the Eldap application.</p> - <section> + <section><title>Eldap 1.0.1</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Fixed various dialyzer warnings</p> + <p> + Own Id: OTP-10403 Aux Id: kunagi-258 [169] </p> + </item> + <item> + <p> + Configure the SSL options fully in eldap.</p> + <p> + Own Id: OTP-10728</p> + </item> + </list> + </section> + +</section> + +<section> <title>Eldap 1.0</title> <p>New application. </p> </section> diff --git a/lib/eldap/src/Makefile b/lib/eldap/src/Makefile index 39a41d08e2..ebb7967e11 100644 --- a/lib/eldap/src/Makefile +++ b/lib/eldap/src/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2012. All Rights Reserved. +# Copyright Ericsson AB 2012-2013. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -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 @@ -75,10 +75,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ docs: @@ -88,7 +88,7 @@ $(TARGET_FILES): $(HRL_FILES) # Special Build Targets # ---------------------------------------------------- $(ASN1_HRL): ../asn1/$(ASN1_FILES) - $(ERLC) -o $(EBIN) -bber_bin +optimize +nif $(ERL_COMPILE_FLAGS) ../asn1/ELDAPv3.asn1 + $(asn_verbose)$(ERLC) -o $(EBIN) -bber $(ERL_COMPILE_FLAGS) ../asn1/ELDAPv3.asn1 # ---------------------------------------------------- # Release Target diff --git a/lib/eldap/src/eldap.erl b/lib/eldap/src/eldap.erl index 699dfc8791..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 @@ -320,7 +321,7 @@ present(Attribute) when is_list(Attribute) -> %%% will match entries containing: 'sn: Tornkvist' %%% substrings(Type, SubStr) when is_list(Type), is_list(SubStr) -> - Ss = {'SubstringFilter_substrings',v_substr(SubStr)}, + Ss = v_substr(SubStr), {substrings,#'SubstringFilter'{type = Type, substrings = Ss}}. @@ -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 @@ -694,26 +699,12 @@ do_recv(S, #eldap{use_tls=true, timeout=Timeout}, Len) -> recv_response(S, Data) -> case do_recv(S, Data, 0) of {ok, Packet} -> - check_tag(Packet), case asn1rt:decode('ELDAPv3', 'LDAPMessage', Packet) of {ok,Resp} -> {ok,Resp}; Error -> throw(Error) end; {error,Reason} -> - throw({gen_tcp_error, Reason}); - Error -> - throw(Error) - end. - -%%% Sanity check of received packet -check_tag(Data) -> - case asn1rt_ber_bin:decode_tag(l2b(Data)) of - {_Tag, Data1, _Rb} -> - case asn1rt_ber_bin:decode_length(l2b(Data1)) of - {{_Len, _Data2}, _Rb2} -> ok; - _ -> throw({error,decoded_tag_length}) - end; - _ -> throw({error,decoded_tag}) + throw({gen_tcp_error, Reason}) end. %%% Check for expected kind of reply @@ -1108,7 +1099,3 @@ get_head(Str,Tail) -> %%% Should always succeed ! get_head([H|Tail],Tail,Rhead) -> lists:reverse([H|Rhead]); get_head([H|Rest],Tail,Rhead) -> get_head(Rest,Tail,[H|Rhead]). - -l2b(B) when is_binary(B) -> B; -l2b(L) when is_list(L) -> list_to_binary(L). - diff --git a/lib/eldap/vsn.mk b/lib/eldap/vsn.mk index c9d6e4e324..4d05d3d1e3 100644 --- a/lib/eldap/vsn.mk +++ b/lib/eldap/vsn.mk @@ -1 +1 @@ -ELDAP_VSN = 1.0 +ELDAP_VSN = 1.0.1 |