diff options
Diffstat (limited to 'lib/eldap')
-rw-r--r-- | lib/eldap/Makefile | 2 | ||||
-rw-r--r-- | lib/eldap/doc/src/book.xml | 2 | ||||
-rw-r--r-- | lib/eldap/doc/src/eldap.xml | 22 | ||||
-rw-r--r-- | lib/eldap/doc/src/notes.xml | 35 | ||||
-rw-r--r-- | lib/eldap/doc/src/ref_man.xml | 2 | ||||
-rw-r--r-- | lib/eldap/doc/src/release_notes.xml | 2 | ||||
-rw-r--r-- | lib/eldap/doc/src/usersguide.xml | 2 | ||||
-rw-r--r-- | lib/eldap/src/Makefile | 4 | ||||
-rw-r--r-- | lib/eldap/src/eldap.appup.src | 2 | ||||
-rw-r--r-- | lib/eldap/src/eldap.erl | 16 | ||||
-rw-r--r-- | lib/eldap/test/Makefile | 4 | ||||
-rw-r--r-- | lib/eldap/test/eldap.cover | 3 | ||||
-rw-r--r-- | lib/eldap/test/eldap_basic_SUITE.erl | 161 | ||||
-rw-r--r-- | lib/eldap/test/make_certs.erl | 2 | ||||
-rw-r--r-- | lib/eldap/vsn.mk | 2 |
15 files changed, 164 insertions, 97 deletions
diff --git a/lib/eldap/Makefile b/lib/eldap/Makefile index 4b12717692..28f995e068 100644 --- a/lib/eldap/Makefile +++ b/lib/eldap/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2012. All Rights Reserved. +# Copyright Ericsson AB 2012-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/eldap/doc/src/book.xml b/lib/eldap/doc/src/book.xml index 2d938fb074..56bd6e580c 100644 --- a/lib/eldap/doc/src/book.xml +++ b/lib/eldap/doc/src/book.xml @@ -4,7 +4,7 @@ <book xmlns:xi="http://www.w3.org/2001/XInclude"> <header titlestyle="normal"> <copyright> - <year>2012</year><year>2013</year> + <year>2012</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/eldap/doc/src/eldap.xml b/lib/eldap/doc/src/eldap.xml index 43873e44e2..f2c7889e58 100644 --- a/lib/eldap/doc/src/eldap.xml +++ b/lib/eldap/doc/src/eldap.xml @@ -197,7 +197,7 @@ </type> <desc> <p> Add an entry. The entry must not exist.</p> - <pre> + <code> add(Handle, "cn=Bill Valentine, ou=people, o=Example Org, dc=example, dc=com", [{"objectclass", ["person"]}, @@ -205,7 +205,7 @@ {"sn", ["Valentine"]}, {"telephoneNumber", ["545 555 00"]}] ) - </pre> + </code> </desc> </func> <func> @@ -216,9 +216,9 @@ </type> <desc> <p> Delete an entry.</p> - <pre> + <code> delete(Handle, "cn=Bill Valentine, ou=people, o=Example Org, dc=example, dc=com") - </pre> + </code> </desc> </func> @@ -259,11 +259,11 @@ </type> <desc> <p> Modify an entry.</p> - <pre> + <code> modify(Handle, "cn=Bill Valentine, ou=people, o=Example Org, dc=example, dc=com", [eldap:mod_replace("telephoneNumber", ["555 555 00"]), eldap:mod_add("description", ["LDAP Hacker"]) ]) - </pre> + </code> </desc> </func> <func> @@ -320,10 +320,10 @@ whether the current RDN should be removed from the attribute list after the after operation. <c>NewSupDN</c> is the new parent that the RDN shall be moved to. If the old parent should remain as parent, <c>NewSupDN</c> shall be "".</p> - <pre> + <code> modify_dn(Handle, "cn=Bill Valentine, ou=people, o=Example Org, dc=example, dc=com ", "cn=Bill Jr Valentine", true, "") - </pre> + </code> </desc> </func> <func> @@ -342,10 +342,10 @@ Default values: scope is <c>wholeSubtree()</c>, deref is <c>derefAlways()</c>, types_only is <c>false</c> and timeout is <c>0</c> (meaning infinity). </p> - <pre> + <code> Filter = eldap:substrings("cn", [{any,"V"}]), search(Handle, [{base, "dc=example, dc=com"}, {filter, Filter}, {attributes, ["cn"]}]), - </pre> + </code> <p>The <c>timeout</c> option in the <c>SearchOptions</c> is for the ldap server, while the timeout in <seealso marker="#open/2">eldap:open/2</seealso> is used for each individual request in the search operation. @@ -454,7 +454,7 @@ </type> <desc> <p>Creates an extensible match filter. For example, </p> <code> - eldap:extensibleMatch("Bar", [{type,"sn"}, {matchingRule,"caseExactMatch"}])) + eldap:extensibleMatch("Bar", [{type,"sn"}, {matchingRule,"caseExactMatch"}])) </code> <p>creates a filter which performs a <c>caseExactMatch</c> on the attribute <c>sn</c> and matches with the value <c>"Bar"</c>. The default value of <c>dnAttributes</c> is <c>false</c>.</p> </desc> </func> diff --git a/lib/eldap/doc/src/notes.xml b/lib/eldap/doc/src/notes.xml index 04b75f9e31..7aad745f67 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>2013</year> + <year>2012</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -31,6 +31,39 @@ </header> <p>This document describes the changes made to the Eldap application.</p> +<section><title>Eldap 1.2.2</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + If the underlying tcp connection is closed and an LDAP + operation returned tcp_error, the client applications + tend to close the ldap handle with eldap:close. This will + cause a <c>{nocatch, {gen_tcp_error, ...}}</c> exception.</p> + <p> + Such errors are now ignored during close, because the + socket will be closed anyway.</p> + <p> + Own Id: OTP-13590 Aux Id: PR-1048 </p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Modernize test suites</p> + <p> + Own Id: OTP-13566</p> + </item> + </list> + </section> + +</section> + <section><title>Eldap 1.2.1</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/eldap/doc/src/ref_man.xml b/lib/eldap/doc/src/ref_man.xml index b70529635f..8b18d5089b 100644 --- a/lib/eldap/doc/src/ref_man.xml +++ b/lib/eldap/doc/src/ref_man.xml @@ -4,7 +4,7 @@ <application xmlns:xi="http://www.w3.org/2001/XInclude"> <header> <copyright> - <year>2012</year><year>2013</year> + <year>2012</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/eldap/doc/src/release_notes.xml b/lib/eldap/doc/src/release_notes.xml index 65a277b657..dc78d2743c 100644 --- a/lib/eldap/doc/src/release_notes.xml +++ b/lib/eldap/doc/src/release_notes.xml @@ -4,7 +4,7 @@ <part> <header> <copyright> - <year>2012</year><year>2013</year> + <year>2012</year><year>2016</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/eldap/doc/src/usersguide.xml b/lib/eldap/doc/src/usersguide.xml index 38190c5a7b..0aea773457 100644 --- a/lib/eldap/doc/src/usersguide.xml +++ b/lib/eldap/doc/src/usersguide.xml @@ -4,7 +4,7 @@ <part xmlns:xi="http://www.w3.org/2001/XInclude"> <header> <copyright> - <year>2012</year><year>2013</year> + <year>2012</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/eldap/src/Makefile b/lib/eldap/src/Makefile index cd3c102f55..b79a537424 100644 --- a/lib/eldap/src/Makefile +++ b/lib/eldap/src/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2012-2013. All Rights Reserved. +# Copyright Ericsson AB 2012-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -98,7 +98,7 @@ include $(ERL_TOP)/make/otp_release_targets.mk release_spec: opt $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" + $(INSTALL_DATA) $(ASN1_HRL) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" $(INSTALL_DIR) "$(RELSYSDIR)/src" $(INSTALL_DATA) $(ERL_FILES) "$(RELSYSDIR)/src" $(INSTALL_DIR) "$(RELSYSDIR)/asn1" diff --git a/lib/eldap/src/eldap.appup.src b/lib/eldap/src/eldap.appup.src index f2a57fa945..06f8e15a71 100644 --- a/lib/eldap/src/eldap.appup.src +++ b/lib/eldap/src/eldap.appup.src @@ -1,7 +1,7 @@ %% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2014. All Rights Reserved. +%% Copyright Ericsson AB 2014-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/eldap/src/eldap.erl b/lib/eldap/src/eldap.erl index 0c03021bd0..625309271b 100644 --- a/lib/eldap/src/eldap.erl +++ b/lib/eldap/src/eldap.erl @@ -272,7 +272,7 @@ modify_dn(Handle, Entry, NewRDN, DelOldRDN, NewSup, Controls) %%% Sanity checks ! -bool_p(Bool) when Bool==true;Bool==false -> Bool. +bool_p(Bool) when is_boolean(Bool) -> Bool. optional([]) -> asn1_NOVALUE; optional(Value) -> Value. @@ -564,7 +564,12 @@ loop(Cpid, Data) -> ?MODULE:loop(Cpid, NewData); {_From, close} -> - {no_reply,_NewData} = do_unbind(Data), + % Ignore tcp error if connection is already closed. + try do_unbind(Data) of + {no_reply,_NewData} -> ok + catch + throw:{gen_tcp_error, _TcpErr} -> ok + end, unlink(Cpid), exit(closed); @@ -1101,10 +1106,13 @@ log(_, _, _, _) -> %%% Misc. routines %%% -------------------------------------------------------------------- -send(To,Msg) -> To ! {self(),Msg}. +send(To,Msg) -> + To ! {self(), Msg}, + ok. + recv(From) -> receive - {From,Msg} -> Msg; + {From, Msg} -> Msg; {'EXIT', From, Reason} -> {error, {internal_error, Reason}} end. diff --git a/lib/eldap/test/Makefile b/lib/eldap/test/Makefile index b8598546c4..81fa8f187a 100644 --- a/lib/eldap/test/Makefile +++ b/lib/eldap/test/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2012. All Rights Reserved. +# Copyright Ericsson AB 2012-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ TARGET_FILES= \ SPEC_FILES = eldap.spec -# COVER_FILE = eldap.cover +COVER_FILE = eldap.cover # ---------------------------------------------------- diff --git a/lib/eldap/test/eldap.cover b/lib/eldap/test/eldap.cover new file mode 100644 index 0000000000..8c15956e72 --- /dev/null +++ b/lib/eldap/test/eldap.cover @@ -0,0 +1,3 @@ +{incl_app,eldap,details}. + +{excl_mods, eldap, ['ELDAPv3']}. diff --git a/lib/eldap/test/eldap_basic_SUITE.erl b/lib/eldap/test/eldap_basic_SUITE.erl index 8414ca6e46..ac3447cfe6 100644 --- a/lib/eldap/test/eldap_basic_SUITE.erl +++ b/lib/eldap/test/eldap_basic_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012-2014. All Rights Reserved. +%% Copyright Ericsson AB 2012-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -23,17 +23,16 @@ -compile(export_all). %%-include_lib("common_test/include/ct.hrl"). --include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("eldap/include/eldap.hrl"). -include_lib("eldap/ebin/ELDAPv3.hrl"). --define(TIMEOUT, 120000). % 2 min - - %% Control to delete a referral object: -define(manageDsaIT, {control,"2.16.840.1.113730.3.4.2",false,asn1_NOVALUE}). +suite() -> + [{timetrap,{seconds,360}}]. all() -> [app, @@ -94,7 +93,8 @@ connection_tests() -> client_side_start_tls_timeout, client_side_bind_timeout, client_side_add_timeout, - client_side_search_timeout + client_side_search_timeout, + close_after_tcp_error ]. @@ -123,7 +123,7 @@ end_per_suite(_Config) -> init_per_group(return_values, Config) -> - case ?config(ldap_server,Config) of + case proplists:get_value(ldap_server,Config) of undefined -> {skip, "LDAP server not availble"}; {Host,Port} -> @@ -131,7 +131,7 @@ init_per_group(return_values, Config) -> Config end; init_per_group(plain_api, Config0) -> - case ?config(ldap_server,Config0) of + case proplists:get_value(ldap_server,Config0) of undefined -> {skip, "LDAP server not availble"}; Server = {Host,Port} -> @@ -139,7 +139,7 @@ init_per_group(plain_api, Config0) -> initialize_db([{server,Server}, {ssl_flag,false}, {start_tls,false} | Config0]) end; init_per_group(ssl_api, Config0) -> - case ?config(ldaps_server,Config0) of + case proplists:get_value(ldaps_server,Config0) of undefined -> {skip, "LDAPS server not availble"}; Server = {Host,Port} -> @@ -147,7 +147,7 @@ init_per_group(ssl_api, Config0) -> initialize_db([{server,Server}, {ssl_flag,true}, {start_tls,false} | Config0]) end; init_per_group(start_tls_api, Config0) -> - case {?config(ldap_server,Config0), ?config(ssl_available,Config0)} of + case {proplists:get_value(ldap_server,Config0), proplists:get_value(ssl_available,Config0)} of {undefined,true} -> {skip, "LDAP server not availble"}; {_,false} -> @@ -186,18 +186,18 @@ end_per_group(_Group, Config) -> Config. init_per_testcase(ssl_connection, Config) -> - case ?config(ssl_available,Config) of + case proplists:get_value(ssl_available,Config) of true -> SSL_Port = 9999, - CertFile = filename:join(?config(data_dir,Config), "certs/server/cert.pem"), - KeyFile = filename:join(?config(data_dir,Config), "certs/server/key.pem"), + CertFile = filename:join(proplists:get_value(data_dir,Config), "certs/server/cert.pem"), + KeyFile = filename:join(proplists:get_value(data_dir,Config), "certs/server/key.pem"), Parent = self(), Listener = spawn_link( fun() -> case ssl:listen(SSL_Port, [{certfile, CertFile}, {keyfile, KeyFile} - | ?config(tcp_listen_opts,Config) + | proplists:get_value(tcp_listen_opts,Config) ]) of {ok,SSL_LSock} -> Parent ! {ok,self()}, @@ -244,7 +244,7 @@ init_per_testcase(TC, Config) -> end; false -> - case proplists:get_value(name,?config(tc_group_properties, Config)) of + case proplists:get_value(name,proplists:get_value(tc_group_properties, Config)) of api_not_bound -> {ok,H} = open(Config), [{handle,H} | Config]; @@ -281,7 +281,7 @@ appup(Config) when is_list(Config) -> %%%---------------------------------------------------------------- open_ret_val_success(Config) -> - {Host,Port} = ?config(ldap_server,Config), + {Host,Port} = proplists:get_value(ldap_server,Config), {ok,H} = eldap:open([Host], [{port,Port}]), catch eldap:close(H). @@ -291,7 +291,7 @@ open_ret_val_error(_Config) -> %%%---------------------------------------------------------------- close_ret_val(Config) -> - {Host,Port} = ?config(ldap_server,Config), + {Host,Port} = proplists:get_value(ldap_server,Config), {ok,H} = eldap:open([Host], [{port,Port}]), ok = eldap:close(H). @@ -312,6 +312,29 @@ tcp_connection(Config) -> end. %%%---------------------------------------------------------------- +close_after_tcp_error(Config) -> + Host = proplists:get_value(listen_host, Config), + Port = proplists:get_value(listen_port, Config), + Opts = proplists:get_value(tcp_connect_opts, Config), + T = 1000, + case eldap:open([Host], [{timeout,T},{port,Port}|Opts]) of + {ok,H} -> + Sl = proplists:get_value(listen_socket, Config), + gen_tcp:close(Sl), + {error,{gen_tcp_error,closed}} = eldap:simple_bind(H, anon, anon), + ok = eldap:close(H), + wait_for_close(H); + Other -> ct:fail("eldap:open failed: ~p",[Other]) + end. + +wait_for_close(H) -> + case erlang:is_process_alive(H) of + true -> timer:sleep(100), + wait_for_close(H); + false -> ok + end. + +%%%---------------------------------------------------------------- ssl_connection(Config) -> Host = proplists:get_value(listen_host, Config), Port = proplists:get_value(ssl_listen_port, Config), @@ -411,37 +434,37 @@ tcp_connection_option(Config) -> %%%---------------------------------------------------------------- elementary_search(Config) -> {ok, #eldap_search_result{entries=[_]}} = - eldap:search(?config(handle,Config), - #eldap_search{base = ?config(eldap_path, Config), + eldap:search(proplists:get_value(handle,Config), + #eldap_search{base = proplists:get_value(eldap_path, Config), filter= eldap:present("objectclass"), scope = eldap:wholeSubtree()}). %%%---------------------------------------------------------------- search_non_existant(Config) -> {error, noSuchObject} = - eldap:search(?config(handle,Config), - #eldap_search{base = "cn=Bar," ++ ?config(eldap_path, Config), + eldap:search(proplists:get_value(handle,Config), + #eldap_search{base = "cn=Bar," ++ proplists:get_value(eldap_path, Config), filter= eldap:present("objectclass"), scope = eldap:wholeSubtree()}). %%%---------------------------------------------------------------- add_when_not_bound(Config) -> - {error, _} = eldap:add(?config(handle,Config), - "cn=Jonas Jonsson," ++ ?config(eldap_path, Config), + {error, _} = eldap:add(proplists:get_value(handle,Config), + "cn=Jonas Jonsson," ++ proplists:get_value(eldap_path, Config), [{"objectclass", ["person"]}, {"cn", ["Jonas Jonsson"]}, {"sn", ["Jonsson"]}]). %%%---------------------------------------------------------------- bind(Config) -> - ok = eldap:simple_bind(?config(handle,Config), + ok = eldap:simple_bind(proplists:get_value(handle,Config), "cn=Manager,dc=ericsson,dc=se", "hejsan"). %%%---------------------------------------------------------------- add_when_bound(Config) -> - ok = eldap:add(?config(handle, Config), - "cn=Jonas Jonsson," ++ ?config(eldap_path, Config), + ok = eldap:add(proplists:get_value(handle, Config), + "cn=Jonas Jonsson," ++ proplists:get_value(eldap_path, Config), [{"objectclass", ["person"]}, {"cn", ["Jonas Jonsson"]}, {"sn", ["Jonsson"]}]). @@ -449,16 +472,16 @@ add_when_bound(Config) -> %%%---------------------------------------------------------------- add_already_exists(Config) -> {error, entryAlreadyExists} = - eldap:add(?config(handle, Config), - "cn=Jonas Jonsson," ++ ?config(eldap_path, Config), + eldap:add(proplists:get_value(handle, Config), + "cn=Jonas Jonsson," ++ proplists:get_value(eldap_path, Config), [{"objectclass", ["person"]}, {"cn", ["Jonas Jonsson"]}, {"sn", ["Jonsson"]}]). %%%---------------------------------------------------------------- more_add(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), ok = eldap:add(H, "cn=Foo Bar," ++ BasePath, [{"objectclass", ["person"]}, {"cn", ["Foo Bar"]}, @@ -470,8 +493,8 @@ more_add(Config) -> %%%---------------------------------------------------------------- add_referral(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), {ok,{referral,["ldap://nowhere.example.com"++_]}} = eldap:add(H, "cn=Foo Bar,dc=notHere," ++ BasePath, [{"objectclass", ["person"]}, @@ -481,28 +504,28 @@ add_referral(Config) -> %%%---------------------------------------------------------------- search_filter_equalityMatch(Config) -> - BasePath = ?config(eldap_path, Config), + BasePath = proplists:get_value(eldap_path, Config), ExpectedDN = "cn=Jonas Jonsson," ++ BasePath, {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = - eldap:search(?config(handle, Config), + eldap:search(proplists:get_value(handle, Config), #eldap_search{base = BasePath, filter = eldap:equalityMatch("sn", "Jonsson"), scope=eldap:singleLevel()}). %%%---------------------------------------------------------------- search_filter_substring_any(Config) -> - BasePath = ?config(eldap_path, Config), + BasePath = proplists:get_value(eldap_path, Config), ExpectedDN = "cn=Jonas Jonsson," ++ BasePath, {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = - eldap:search(?config(handle, Config), + eldap:search(proplists:get_value(handle, Config), #eldap_search{base = BasePath, filter = eldap:substrings("sn", [{any, "ss"}]), scope=eldap:singleLevel()}). %%%---------------------------------------------------------------- search_filter_initial(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), ExpectedDN = "cn=Foo Bar," ++ BasePath, {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = eldap:search(H, @@ -512,8 +535,8 @@ search_filter_initial(Config) -> %%%---------------------------------------------------------------- search_filter_final(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), ExpectedDN = "cn=Foo Bar," ++ BasePath, {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = eldap:search(H, @@ -523,8 +546,8 @@ search_filter_final(Config) -> %%%---------------------------------------------------------------- search_filter_and(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), ExpectedDN = "cn=Foo Bar," ++ BasePath, {ok, #eldap_search_result{entries=[#eldap_entry{object_name=ExpectedDN}]}} = eldap:search(H, @@ -535,8 +558,8 @@ search_filter_and(Config) -> %%%---------------------------------------------------------------- search_filter_or(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), ExpectedDNs = lists:sort(["cn=Foo Bar," ++ BasePath, "ou=Team," ++ BasePath]), {ok, #eldap_search_result{entries=Es}} = @@ -549,8 +572,8 @@ search_filter_or(Config) -> %%%---------------------------------------------------------------- search_filter_and_not(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), {ok, #eldap_search_result{entries=[]}} = eldap:search(H, #eldap_search{base = BasePath, @@ -562,8 +585,8 @@ search_filter_and_not(Config) -> %%%---------------------------------------------------------------- search_two_hits(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), DN1 = "cn=Santa Claus," ++ BasePath, DN2 = "cn=Jultomten," ++ BasePath, %% Add two objects: @@ -594,8 +617,8 @@ search_two_hits(Config) -> %%%---------------------------------------------------------------- search_referral(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), DN = "cn=Santa Claus,dc=notHere," ++ BasePath, {ok,{referral,["ldap://nowhere.example.com"++_]}} = eldap:search(H, #eldap_search{base = DN, @@ -604,8 +627,8 @@ search_referral(Config) -> %%%---------------------------------------------------------------- modify(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), %% The object to modify DN = "cn=Foo Bar," ++ BasePath, @@ -637,8 +660,8 @@ modify(Config) -> %%%---------------------------------------------------------------- modify_referral(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), %% The object to modify DN = "cn=Foo Bar,dc=notHere," ++ BasePath, @@ -650,8 +673,8 @@ modify_referral(Config) -> %%%---------------------------------------------------------------- delete(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), %% The element to play with: DN = "cn=Jonas Jonsson," ++ BasePath, @@ -668,16 +691,16 @@ delete(Config) -> %%%---------------------------------------------------------------- delete_referral(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), %% The element to play with: DN = "cn=Jonas Jonsson,dc=notHere," ++ BasePath, {ok,{referral,["ldap://nowhere.example.com"++_]}} = eldap:delete(H, DN). %%%---------------------------------------------------------------- modify_dn_delete_old(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), OrigCN = "Foo Bar", OriginalRDN = "cn="++OrigCN, DN = OriginalRDN ++ "," ++ BasePath, @@ -722,8 +745,8 @@ modify_dn_delete_old(Config) -> %%%---------------------------------------------------------------- modify_dn_keep_old(Config) -> - H = ?config(handle, Config), - BasePath = ?config(eldap_path, Config), + H = proplists:get_value(handle, Config), + BasePath = proplists:get_value(eldap_path, Config), OriginalRDN = "cn=Foo Bar", DN = OriginalRDN ++ "," ++ BasePath, NewCN = "Niclas Andre", @@ -862,7 +885,7 @@ initialize_db(Config) -> clear_db(Config) -> {ok,H} = open_bind(Config), - Path = ?config(eldap_path, Config), + Path = proplists:get_value(eldap_path, Config), delete_old_contents(H, Path), eldap:close(H), Config. @@ -914,20 +937,20 @@ ok(MODULE, LINE, X) -> cond_start_tls(H, Config) -> - case ?config(start_tls,Config) of + case proplists:get_value(start_tls,Config) of true -> start_tls(H,Config); _ -> Config end. start_tls(H, Config) -> - KeyFile = filename:join([?config(data_dir,Config), + KeyFile = filename:join([proplists:get_value(data_dir,Config), "certs/client/key.pem" ]), case eldap:start_tls(H, [{keyfile, KeyFile}]) of ok -> [{start_tls_success,true} | Config]; Error -> - ct:log("Start_tls on ~p failed: ~p",[?config(url,Config) ,Error]), + ct:log("Start_tls on ~p failed: ~p",[proplists:get_value(url,Config) ,Error]), ct:fail("start_tls failed") end. @@ -939,8 +962,8 @@ open_bind(Config) -> {ok,H}. open(Config) -> - {Host,Port} = ?config(server,Config), - SSLflag = ?config(ssl_flag,Config), + {Host,Port} = proplists:get_value(server,Config), + SSLflag = proplists:get_value(ssl_flag,Config), {ok,H} = eldap:open([Host], [{port,Port},{ssl,SSLflag}]), cond_start_tls(H, Config), {ok,H}. @@ -998,7 +1021,7 @@ init_ssl_certs_et_al(Config) -> of R when R==ok ; R=={error,{already_started,ssl}} -> try make_certs:all("/dev/null", - filename:join(?config(data_dir,Config), "certs")) + filename:join(proplists:get_value(data_dir,Config), "certs")) of {ok,_} -> true; Other -> diff --git a/lib/eldap/test/make_certs.erl b/lib/eldap/test/make_certs.erl index 74ee04a361..cfa43289e1 100644 --- a/lib/eldap/test/make_certs.erl +++ b/lib/eldap/test/make_certs.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2012. All Rights Reserved. +%% Copyright Ericsson AB 2007-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. diff --git a/lib/eldap/vsn.mk b/lib/eldap/vsn.mk index 99c474d588..721387d97d 100644 --- a/lib/eldap/vsn.mk +++ b/lib/eldap/vsn.mk @@ -1 +1 @@ -ELDAP_VSN = 1.2.1 +ELDAP_VSN = 1.2.2 |