diff options
Diffstat (limited to 'lib')
93 files changed, 3311 insertions, 2706 deletions
diff --git a/lib/common_test/doc/src/ct_hooks_chapter.xml b/lib/common_test/doc/src/ct_hooks_chapter.xml index bac0c4eaa8..8505ee8469 100644 --- a/lib/common_test/doc/src/ct_hooks_chapter.xml +++ b/lib/common_test/doc/src/ct_hooks_chapter.xml @@ -108,9 +108,10 @@ </section> <section> - <title>CTH Priority</title> + <title>CTH Execution order</title> <p>By default each CTH installed will be executed in the order which - they are installed. This is not always wanted so common_test allows + they are installed for init calls, and then reversed for end calls. + This is not always wanted so common_test allows the user to specify a priority for each hook. The priority can either be specified in the CTH <seealso marker="ct_hooks#Module:init-2">init/2 </seealso> function or when installing the hook. The priority given at diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl index ffafc582cf..c42adbbdd9 100644 --- a/lib/common_test/src/ct_hooks.erl +++ b/lib/common_test/src/ct_hooks.erl @@ -178,8 +178,9 @@ call_generic(#ct_hook_config{ module = Mod, state = State} = Hook, call(Fun, Config, Meta) -> maybe_lock(), Hooks = get_hooks(), - Res = call(get_new_hooks(Config, Fun) ++ - [{HookId,Fun} || #ct_hook_config{id = HookId} <- Hooks], + Calls = get_new_hooks(Config, Fun) ++ + [{HookId,Fun} || #ct_hook_config{id = HookId} <- Hooks], + Res = call(resort(Calls,Hooks,Meta), remove(?config_name,Config), Meta, Hooks), maybe_unlock(), Res. @@ -205,7 +206,7 @@ call([{Hook, call_id, NextFun} | Rest], Config, Meta, Hooks) -> {Hooks ++ [NewHook], [{NewId, call_init}, {NewId,NextFun} | Rest]} end, - call(resort(NewRest,NewHooks), Config, Meta, NewHooks) + call(resort(NewRest,NewHooks,Meta), Config, Meta, NewHooks) catch Error:Reason -> Trace = erlang:get_stacktrace(), ct_logs:log("Suite Hook","Failed to start a CTH: ~p:~p", @@ -221,7 +222,7 @@ call([{HookId, Fun} | Rest], Config, Meta, Hooks) -> {NewConf, NewHook} = Fun(Hook, Config, Meta), NewCalls = get_new_hooks(NewConf, Fun), NewHooks = lists:keyreplace(HookId, #ct_hook_config.id, Hooks, NewHook), - call(resort(NewCalls ++ Rest,NewHooks), %% Resort if call_init changed prio + call(resort(NewCalls ++ Rest,NewHooks,Meta), %% Resort if call_init changed prio remove(?config_name, NewConf), Meta, terminate_if_scope_ends(HookId, Meta, NewHooks)) catch throw:{error_in_cth_call,Reason} -> @@ -308,6 +309,18 @@ get_hooks() -> %% call_id < call_init < ctfirst < Priority 1 < .. < Priority N < ctlast %% If Hook Priority is equal, check when it has been installed and %% sort on that instead. +%% If we are doing a cleanup call i.e. {post,pre}_end_per_*, all priorities +%% are reversed. Probably want to make this sorting algorithm pluginable +%% as some point... +resort(Calls,Hooks,[F|_R]) when F == post_end_per_testcase; + F == pre_end_per_group; + F == post_end_per_group; + F == pre_end_per_suite; + F == post_end_per_suite -> + lists:reverse(resort(Calls,Hooks)); +resort(Calls,Hooks,_Meta) -> + resort(Calls,Hooks). + resort(Calls, Hooks) -> lists:sort( fun({_,_,_},_) -> diff --git a/lib/common_test/test/ct_hooks_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE.erl index 5c99f0f9f7..2c519f08b5 100644 --- a/lib/common_test/test/ct_hooks_SUITE.erl +++ b/lib/common_test/test/ct_hooks_SUITE.erl @@ -1046,29 +1046,34 @@ test_events(prio_cth) -> [900],[900,900],[500,900],[1000],[1200,1050], [1100],[1200]]) ++ GenPost(post_end_per_testcase, - [[1100,100],[600,200],[600,600],[600],[700],[800], - [900],[900,900],[500,900],[1000],[1200,1050], - [1100],[1200]]) ++ + lists:reverse( + [[1100,100],[600,200],[600,600],[600],[700],[800], + [900],[900,900],[500,900],[1000],[1200,1050], + [1100],[1200]])) ++ [{?eh,tc_done,{ct_cth_prio_SUITE,test_case,ok}}, {?eh,tc_start,{ct_cth_prio_SUITE,{end_per_group,'_',[]}}}] ++ GenPre(pre_end_per_group, - [[1100,100],[600,200],[600,600],[600],[700],[800], - [900],[900,900],[500,900],[1000],[1200,1050], - [1100],[1200]]) ++ + lists:reverse( + [[1100,100],[600,200],[600,600],[600],[700],[800], + [900],[900,900],[500,900],[1000],[1200,1050], + [1100],[1200]])) ++ GenPost(post_end_per_group, - [[1100,100],[600,200],[600,600],[600],[700],[800], - [900],[900,900],[500,900],[1000],[1200,1050], - [1100],[1200]]) ++ + lists:reverse( + [[1100,100],[600,200],[600,600],[600],[700],[800], + [900],[900,900],[500,900],[1000],[1200,1050], + [1100],[1200]])) ++ [{?eh,tc_done,{ct_cth_prio_SUITE,{end_per_group,'_',[]},ok}}], {?eh,tc_start,{ct_cth_prio_SUITE,end_per_suite}}] ++ GenPre(pre_end_per_suite, - [[1100,100],[600,200],[600,600],[700],[800],[900],[1000], - [1200,1050],[1100],[1200]]) ++ + lists:reverse( + [[1100,100],[600,200],[600,600],[700],[800],[900],[1000], + [1200,1050],[1100],[1200]])) ++ GenPost(post_end_per_suite, - [[1100,100],[600,200],[600,600],[700],[800],[900],[1000], - [1200,1050],[1100],[1200]]) ++ + lists:reverse( + [[1100,100],[600,200],[600,600],[700],[800],[900],[1000], + [1200,1050],[1100],[1200]])) ++ [{?eh,tc_done,{ct_cth_prio_SUITE,end_per_suite,ok}}, {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]}]; diff --git a/lib/compiler/src/Makefile b/lib/compiler/src/Makefile index 1238d113e1..7a237608ad 100644 --- a/lib/compiler/src/Makefile +++ b/lib/compiler/src/Makefile @@ -59,6 +59,7 @@ MODULES = \ beam_opcodes \ beam_peep \ beam_receive \ + beam_split \ beam_trim \ beam_type \ beam_utils \ diff --git a/lib/compiler/src/beam_dead.erl b/lib/compiler/src/beam_dead.erl index 9f81a6ab43..5f12a98f09 100644 --- a/lib/compiler/src/beam_dead.erl +++ b/lib/compiler/src/beam_dead.erl @@ -131,10 +131,9 @@ -import(lists, [mapfoldl/3,reverse/1]). module({Mod,Exp,Attr,Fs0,_}, _Opts) -> - Fs1 = [split_blocks(F) || F <- Fs0], - {Fs2,Lc1} = beam_clean:clean_labels(Fs1), - {Fs,Lc} = mapfoldl(fun function/2, Lc1, Fs2), - %%{Fs,Lc} = {Fs2,Lc1}, + {Fs1,Lc1} = beam_clean:clean_labels(Fs0), + {Fs,Lc} = mapfoldl(fun function/2, Lc1, Fs1), + %%{Fs,Lc} = {Fs1,Lc1}, {ok,{Mod,Exp,Attr,Fs,Lc}}. function({function,Name,Arity,CLabel,Is0}, Lc0) -> @@ -160,64 +159,6 @@ function({function,Name,Arity,CLabel,Is0}, Lc0) -> erlang:raise(Class, Error, Stack) end. -%% We must split the basic block when we encounter instructions with labels, -%% such as catches and BIFs. All labels must be visible outside the blocks. - -split_blocks({function,Name,Arity,CLabel,Is0}) -> - Is = split_blocks(Is0, []), - {function,Name,Arity,CLabel,Is}. - -split_blocks([{block,Bl}|Is], Acc0) -> - Acc = split_block(Bl, [], Acc0), - split_blocks(Is, Acc); -split_blocks([I|Is], Acc) -> - split_blocks(Is, [I|Acc]); -split_blocks([], Acc) -> reverse(Acc). - -split_block([{set,[R],[_,_,_]=As,{bif,is_record,{f,Lbl}}}|Is], Bl, Acc) -> - %% is_record/3 must be translated by beam_clean; therefore, - %% it must be outside of any block. - split_block(Is, [], [{bif,is_record,{f,Lbl},As,R}|make_block(Bl, Acc)]); -split_block([{set,[R],As,{bif,N,{f,Lbl}=Fail}}|Is], Bl, Acc) when Lbl =/= 0 -> - split_block(Is, [], [{bif,N,Fail,As,R}|make_block(Bl, Acc)]); -split_block([{set,[R],As,{alloc,Live,{gc_bif,N,{f,Lbl}=Fail}}}|Is], Bl, Acc) - when Lbl =/= 0 -> - split_block(Is, [], [{gc_bif,N,Fail,Live,As,R}|make_block(Bl, Acc)]); -split_block([{set,[R],[],{'catch',L}}|Is], Bl, Acc) -> - split_block(Is, [], [{'catch',R,L}|make_block(Bl, Acc)]); -split_block([{set,[],[],{line,_}=Line}|Is], Bl, Acc) -> - split_block(Is, [], [Line|make_block(Bl, Acc)]); -split_block([I|Is], Bl, Acc) -> - split_block(Is, [I|Bl], Acc); -split_block([], Bl, Acc) -> make_block(Bl, Acc). - -make_block([], Acc) -> Acc; -make_block([{set,[D],Ss,{bif,Op,Fail}}|Bl]=Bl0, Acc) -> - %% If the last instruction in the block is a comparison or boolean operator - %% (such as '=:='), move it out of the block to facilitate further - %% optimizations. - Arity = length(Ss), - case erl_internal:comp_op(Op, Arity) orelse - erl_internal:new_type_test(Op, Arity) orelse - erl_internal:bool_op(Op, Arity) of - false -> - [{block,reverse(Bl0)}|Acc]; - true -> - I = {bif,Op,Fail,Ss,D}, - case Bl =:= [] of - true -> [I|Acc]; - false -> [I,{block,reverse(Bl)}|Acc] - end - end; -make_block([{set,[Dst],[Src],move}|Bl], Acc) -> - %% Make optimization of {move,Src,Dst}, {jump,...} possible. - I = {move,Src,Dst}, - case Bl =:= [] of - true -> [I|Acc]; - false -> [I,{block,reverse(Bl)}|Acc] - end; -make_block(Bl, Acc) -> [{block,reverse(Bl)}|Acc]. - %% 'move' instructions outside of blocks may thwart the jump optimizer. %% Move them back into the block. diff --git a/lib/compiler/src/beam_split.erl b/lib/compiler/src/beam_split.erl new file mode 100644 index 0000000000..cacaaebffe --- /dev/null +++ b/lib/compiler/src/beam_split.erl @@ -0,0 +1,85 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2011. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +-module(beam_split). +-export([module/2]). + +-import(lists, [reverse/1]). + +module({Mod,Exp,Attr,Fs0,Lc}, _Opts) -> + Fs = [split_blocks(F) || F <- Fs0], + {ok,{Mod,Exp,Attr,Fs,Lc}}. + +%% We must split the basic block when we encounter instructions with labels, +%% such as catches and BIFs. All labels must be visible outside the blocks. + +split_blocks({function,Name,Arity,CLabel,Is0}) -> + Is = split_blocks(Is0, []), + {function,Name,Arity,CLabel,Is}. + +split_blocks([{block,Bl}|Is], Acc0) -> + Acc = split_block(Bl, [], Acc0), + split_blocks(Is, Acc); +split_blocks([I|Is], Acc) -> + split_blocks(Is, [I|Acc]); +split_blocks([], Acc) -> reverse(Acc). + +split_block([{set,[R],[_,_,_]=As,{bif,is_record,{f,Lbl}}}|Is], Bl, Acc) -> + %% is_record/3 must be translated by beam_clean; therefore, + %% it must be outside of any block. + split_block(Is, [], [{bif,is_record,{f,Lbl},As,R}|make_block(Bl, Acc)]); +split_block([{set,[R],As,{bif,N,{f,Lbl}=Fail}}|Is], Bl, Acc) when Lbl =/= 0 -> + split_block(Is, [], [{bif,N,Fail,As,R}|make_block(Bl, Acc)]); +split_block([{set,[R],As,{alloc,Live,{gc_bif,N,{f,Lbl}=Fail}}}|Is], Bl, Acc) + when Lbl =/= 0 -> + split_block(Is, [], [{gc_bif,N,Fail,Live,As,R}|make_block(Bl, Acc)]); +split_block([{set,[R],[],{'catch',L}}|Is], Bl, Acc) -> + split_block(Is, [], [{'catch',R,L}|make_block(Bl, Acc)]); +split_block([{set,[],[],{line,_}=Line}|Is], Bl, Acc) -> + split_block(Is, [], [Line|make_block(Bl, Acc)]); +split_block([I|Is], Bl, Acc) -> + split_block(Is, [I|Bl], Acc); +split_block([], Bl, Acc) -> make_block(Bl, Acc). + +make_block([], Acc) -> Acc; +make_block([{set,[D],Ss,{bif,Op,Fail}}|Bl]=Bl0, Acc) -> + %% If the last instruction in the block is a comparison or boolean operator + %% (such as '=:='), move it out of the block to facilitate further + %% optimizations. + Arity = length(Ss), + case erl_internal:comp_op(Op, Arity) orelse + erl_internal:new_type_test(Op, Arity) orelse + erl_internal:bool_op(Op, Arity) of + false -> + [{block,reverse(Bl0)}|Acc]; + true -> + I = {bif,Op,Fail,Ss,D}, + case Bl =:= [] of + true -> [I|Acc]; + false -> [I,{block,reverse(Bl)}|Acc] + end + end; +make_block([{set,[Dst],[Src],move}|Bl], Acc) -> + %% Make optimization of {move,Src,Dst}, {jump,...} possible. + I = {move,Src,Dst}, + case Bl =:= [] of + true -> [I|Acc]; + false -> [I,{block,reverse(Bl)}|Acc] + end; +make_block(Bl, Acc) -> [{block,reverse(Bl)}|Acc]. diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index fe3b1680d9..95f12df40d 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -670,10 +670,20 @@ valfun_4({get_tuple_element,Src,I,Dst}, Vst) -> valfun_4({test,bs_start_match2,{f,Fail},Live,[Ctx,NeedSlots],Ctx}, Vst0) -> %% If source and destination registers are the same, match state %% is OK as input. - _ = get_move_term_type(Ctx, Vst0), + CtxType = get_move_term_type(Ctx, Vst0), verify_live(Live, Vst0), Vst1 = prune_x_regs(Live, Vst0), - Vst = branch_state(Fail, Vst1), + BranchVst = case CtxType of + {match_context,_,_} -> + %% The failure branch will never be taken when Ctx + %% is a match context. Therefore, the type for Ctx + %% at the failure label must not be match_context + %% (or we could reject legal code). + set_type_reg(term, Ctx, Vst1); + _ -> + Vst1 + end, + Vst = branch_state(Fail, BranchVst), set_type_reg(bsm_match_state(NeedSlots), Ctx, Vst); valfun_4({test,bs_start_match2,{f,Fail},Live,[Src,Slots],Dst}, Vst0) -> assert_term(Src, Vst0), diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index 8815cfb26f..a17a10046e 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -633,7 +633,9 @@ asm_passes() -> {iff,dbool,{listing,"bool"}}, {unless,no_topt,{pass,beam_type}}, {iff,dtype,{listing,"type"}}, - {pass,beam_dead}, %Must always run since it splits blocks. + {pass,beam_split}, + {iff,dsplit,{listing,"split"}}, + {unless,no_dead,{pass,beam_dead}}, {iff,ddead,{listing,"dead"}}, {unless,no_jopt,{pass,beam_jump}}, {iff,djmp,{listing,"jump"}}, diff --git a/lib/compiler/src/compiler.app.src b/lib/compiler/src/compiler.app.src index 4ac879c9a4..efa25fe039 100644 --- a/lib/compiler/src/compiler.app.src +++ b/lib/compiler/src/compiler.app.src @@ -34,6 +34,7 @@ beam_opcodes, beam_peep, beam_receive, + beam_split, beam_trim, beam_type, beam_utils, diff --git a/lib/compiler/test/inline_SUITE.erl b/lib/compiler/test/inline_SUITE.erl index 086fba2649..2e17d3fde6 100644 --- a/lib/compiler/test/inline_SUITE.erl +++ b/lib/compiler/test/inline_SUITE.erl @@ -33,7 +33,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> test_lib:recompile(?MODULE), [attribute, bsdecode, bsdes, barnes2, decode1, smith, - itracer, pseudoknot, lists, really_inlined, otp_7223, + itracer, pseudoknot, comma_splitter, lists, really_inlined, otp_7223, coverage]. groups() -> @@ -78,6 +78,7 @@ attribute(Config) when is_list(Config) -> ?comp(smith). ?comp(itracer). ?comp(pseudoknot). +?comp(comma_splitter). try_inline(Mod, Config) -> ?line Src = filename:join(?config(data_dir, Config), atom_to_list(Mod)), diff --git a/lib/compiler/test/inline_SUITE_data/comma_splitter.erl b/lib/compiler/test/inline_SUITE_data/comma_splitter.erl new file mode 100644 index 0000000000..eaa89e0edc --- /dev/null +++ b/lib/compiler/test/inline_SUITE_data/comma_splitter.erl @@ -0,0 +1,18 @@ +-module(comma_splitter). +-export([?MODULE/0]). + +?MODULE() -> + {<<"def">>,<<"cba">>} = split_at_comma(<<"abc, def">>, <<>>), + ok. + +strip_leading_ws(<<N, Rest/binary>>) when N =< $\s -> + strip_leading_ws(Rest); +strip_leading_ws(B) -> + B. + +split_at_comma(<<>>, Accu) -> + {<<>>, Accu}; +split_at_comma(<<$,, Rest/binary>>, Accu) -> + {strip_leading_ws(Rest), Accu}; +split_at_comma(<<C, Rest/binary>>, Accu) -> + split_at_comma(Rest, <<C, Accu/binary>>). diff --git a/lib/configure.in.src b/lib/configure.in.src index 792a7f932a..609bb62308 100644 --- a/lib/configure.in.src +++ b/lib/configure.in.src @@ -17,7 +17,7 @@ dnl dnl %CopyrightEnd% dnl -dnl Turn of caching +dnl Turn off caching define([AC_CACHE_LOAD], )dnl define([AC_CACHE_SAVE], )dnl diff --git a/lib/cosFileTransfer/test/fileTransfer_SUITE.erl b/lib/cosFileTransfer/test/fileTransfer_SUITE.erl index e94c307ef8..79a234bd28 100644 --- a/lib/cosFileTransfer/test/fileTransfer_SUITE.erl +++ b/lib/cosFileTransfer/test/fileTransfer_SUITE.erl @@ -131,10 +131,10 @@ end_per_testcase(_Case, Config) -> ok. init_per_suite(Config) -> - case code:which(crypto) of - Res when is_atom(Res) -> + case crypto_works() of + false -> {skip,"Could not start crypto!"}; - _Else -> + true -> orber:jump_start(), cosProperty:install(), cosProperty:start(), @@ -165,6 +165,15 @@ init_per_suite(Config) -> end end. +crypto_works() -> + try crypto:start() of + {error,{already_started,crypto}} -> true; + ok -> true + catch + error:_ -> + false + end. + end_per_suite(Config) -> ssl:stop(), crypto:stop(), diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c index 802c1991de..4dc62421d2 100644 --- a/lib/crypto/c_src/crypto.c +++ b/lib/crypto/c_src/crypto.c @@ -53,6 +53,17 @@ #include <openssl/evp.h> #include <openssl/hmac.h> +#if OPENSSL_VERSION_NUMBER >= 0x00908000L && !defined(OPENSSL_NO_SHA256) && defined(NID_sha256) +# define HAVE_SHA256 +#endif +#if OPENSSL_VERSION_NUMBER >= 0x00908000L && !defined(OPENSSL_NO_SHA384) && defined(NID_sha384)\ + && !defined(OPENSSL_NO_SHA512) /* disabled like this in my sha.h (?) */ +# define HAVE_SHA384 +#endif +#if OPENSSL_VERSION_NUMBER >= 0x00908000L && !defined(OPENSSL_NO_SHA512) && defined(NID_sha512) +# define HAVE_SHA512 +#endif + #ifdef VALGRIND # include <valgrind/memcheck.h> @@ -124,6 +135,14 @@ static ERL_NIF_TERM sha(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM sha_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM sha_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM sha_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +static ERL_NIF_TERM sha256_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +static ERL_NIF_TERM sha256_init_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +static ERL_NIF_TERM sha256_update_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +static ERL_NIF_TERM sha256_final_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +static ERL_NIF_TERM sha512_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +static ERL_NIF_TERM sha512_init_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +static ERL_NIF_TERM sha512_update_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +static ERL_NIF_TERM sha512_final_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM md4(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM md4_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM md4_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); @@ -148,7 +167,7 @@ static ERL_NIF_TERM strong_rand_mpint_nif(ErlNifEnv* env, int argc, const ERL_NI static ERL_NIF_TERM rand_uniform_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM mod_exp_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM dss_verify(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); -static ERL_NIF_TERM rsa_verify(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +static ERL_NIF_TERM rsa_verify_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM aes_cbc_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM exor(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM rc4_encrypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); @@ -201,6 +220,14 @@ static ErlNifFunc nif_funcs[] = { {"sha_init", 0, sha_init}, {"sha_update", 2, sha_update}, {"sha_final", 1, sha_final}, + {"sha256_nif", 1, sha256_nif}, + {"sha256_init_nif", 0, sha256_init_nif}, + {"sha256_update_nif", 2, sha256_update_nif}, + {"sha256_final_nif", 1, sha256_final_nif}, + {"sha512_nif", 1, sha512_nif}, + {"sha512_init_nif", 0, sha512_init_nif}, + {"sha512_update_nif", 2, sha512_update_nif}, + {"sha512_final_nif", 1, sha512_final_nif}, {"md4", 1, md4}, {"md4_init", 0, md4_init}, {"md4_update", 2, md4_update}, @@ -228,7 +255,7 @@ static ErlNifFunc nif_funcs[] = { {"rand_uniform_nif", 2, rand_uniform_nif}, {"mod_exp_nif", 3, mod_exp_nif}, {"dss_verify", 4, dss_verify}, - {"rsa_verify", 4, rsa_verify}, + {"rsa_verify_nif", 4, rsa_verify_nif}, {"aes_cbc_crypt", 4, aes_cbc_crypt}, {"exor", 2, exor}, {"rc4_encrypt", 2, rc4_encrypt}, @@ -260,6 +287,9 @@ ERL_NIF_INIT(crypto,nif_funcs,load,reload,upgrade,unload) #define SHA_CTX_LEN (sizeof(SHA_CTX)) #define SHA_LEN 20 #define SHA_LEN_96 12 +#define SHA256_LEN (256/8) +#define SHA384_LEN (384/8) +#define SHA512_LEN (512/8) #define HMAC_INT_LEN 64 #define HMAC_IPAD 0x36 @@ -270,6 +300,9 @@ static ErlNifRWLock** lock_vec = NULL; /* Static locks used by openssl */ static ERL_NIF_TERM atom_true; static ERL_NIF_TERM atom_false; static ERL_NIF_TERM atom_sha; +static ERL_NIF_TERM atom_sha256; +static ERL_NIF_TERM atom_sha384; +static ERL_NIF_TERM atom_sha512; static ERL_NIF_TERM atom_md5; static ERL_NIF_TERM atom_ripemd160; static ERL_NIF_TERM atom_error; @@ -286,6 +319,7 @@ static ERL_NIF_TERM atom_not_suitable_generator; static ERL_NIF_TERM atom_check_failed; static ERL_NIF_TERM atom_unknown; static ERL_NIF_TERM atom_none; +static ERL_NIF_TERM atom_notsup; static int is_ok_load_info(ErlNifEnv* env, ERL_NIF_TERM load_info) @@ -340,6 +374,9 @@ static int load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info) atom_true = enif_make_atom(env,"true"); atom_false = enif_make_atom(env,"false"); atom_sha = enif_make_atom(env,"sha"); + atom_sha256 = enif_make_atom(env,"sha256"); + atom_sha384 = enif_make_atom(env,"sha384"); + atom_sha512 = enif_make_atom(env,"sha512"); atom_md5 = enif_make_atom(env,"md5"); atom_ripemd160 = enif_make_atom(env,"ripemd160"); atom_error = enif_make_atom(env,"error"); @@ -355,6 +392,7 @@ static int load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info) atom_check_failed = enif_make_atom(env,"check_failed"); atom_unknown = enif_make_atom(env,"unknown"); atom_none = enif_make_atom(env,"none"); + atom_notsup = enif_make_atom(env,"notsup"); *priv_data = NULL; library_refc++; @@ -519,6 +557,129 @@ static ERL_NIF_TERM sha_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[ return ret; } +static ERL_NIF_TERM sha256_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{/* (Data) */ +#ifdef HAVE_SHA256 + ErlNifBinary ibin; + ERL_NIF_TERM ret; + + if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) { + return enif_make_badarg(env); + } + SHA256((unsigned char *) ibin.data, ibin.size, + enif_make_new_binary(env,SHA256_LEN, &ret)); + return ret; +#else + return atom_notsup; +#endif +} +static ERL_NIF_TERM sha256_init_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{/* () */ +#ifdef HAVE_SHA256 + ERL_NIF_TERM ret; + SHA256_Init((SHA256_CTX *) enif_make_new_binary(env, sizeof(SHA256_CTX), &ret)); + return ret; +#else + return atom_notsup; +#endif +} +static ERL_NIF_TERM sha256_update_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{/* (Context, Data) */ +#ifdef HAVE_SHA256 + SHA256_CTX* new_ctx; + ErlNifBinary ctx_bin, data_bin; + ERL_NIF_TERM ret; + if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA256_CTX) + || !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) { + return enif_make_badarg(env); + } + new_ctx = (SHA256_CTX*) enif_make_new_binary(env,sizeof(SHA256_CTX), &ret); + memcpy(new_ctx, ctx_bin.data, sizeof(SHA256_CTX)); + SHA256_Update(new_ctx, data_bin.data, data_bin.size); + return ret; +#else + return atom_notsup; +#endif +} +static ERL_NIF_TERM sha256_final_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{/* (Context) */ +#ifdef HAVE_SHA256 + ErlNifBinary ctx_bin; + SHA256_CTX ctx_clone; + ERL_NIF_TERM ret; + if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA256_CTX)) { + return enif_make_badarg(env); + } + memcpy(&ctx_clone, ctx_bin.data, sizeof(SHA256_CTX)); /* writable */ + SHA256_Final(enif_make_new_binary(env, SHA256_LEN, &ret), &ctx_clone); + return ret; +#else + return atom_notsup; +#endif +} + +static ERL_NIF_TERM sha512_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{/* (Data) */ +#ifdef HAVE_SHA512 + ErlNifBinary ibin; + ERL_NIF_TERM ret; + + if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) { + return enif_make_badarg(env); + } + SHA512((unsigned char *) ibin.data, ibin.size, + enif_make_new_binary(env,SHA512_LEN, &ret)); + return ret; +#else + return atom_notsup; +#endif +} +static ERL_NIF_TERM sha512_init_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{/* () */ +#ifdef HAVE_SHA512 + ERL_NIF_TERM ret; + SHA512_Init((SHA512_CTX *) enif_make_new_binary(env, sizeof(SHA512_CTX), &ret)); + return ret; +#else + return atom_notsup; +#endif +} +static ERL_NIF_TERM sha512_update_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{/* (Context, Data) */ +#ifdef HAVE_SHA512 + SHA512_CTX* new_ctx; + ErlNifBinary ctx_bin, data_bin; + ERL_NIF_TERM ret; + if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA512_CTX) + || !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) { + return enif_make_badarg(env); + } + new_ctx = (SHA512_CTX*) enif_make_new_binary(env,sizeof(SHA512_CTX), &ret); + memcpy(new_ctx, ctx_bin.data, sizeof(SHA512_CTX)); + SHA512_Update(new_ctx, data_bin.data, data_bin.size); + return ret; +#else + return atom_notsup; +#endif +} +static ERL_NIF_TERM sha512_final_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{/* (Context) */ +#ifdef HAVE_SHA512 + ErlNifBinary ctx_bin; + SHA512_CTX ctx_clone; + ERL_NIF_TERM ret; + if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA512_CTX)) { + return enif_make_badarg(env); + } + memcpy(&ctx_clone, ctx_bin.data, sizeof(SHA512_CTX)); /* writable */ + SHA512_Final(enif_make_new_binary(env, SHA512_LEN, &ret), &ctx_clone); + return ret; +#else + return atom_notsup; +#endif +} + + static ERL_NIF_TERM md4(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {/* (Data) */ ErlNifBinary ibin; @@ -1095,17 +1256,14 @@ static ERL_NIF_TERM dss_verify(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv return(i > 0) ? atom_true : atom_false; } -static ERL_NIF_TERM rsa_verify(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +static ERL_NIF_TERM rsa_verify_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {/* (Type, Data, Signature, Key=[E,N]) */ ErlNifBinary data_bin, sign_bin; - unsigned char hmacbuf[SHA_DIGEST_LENGTH]; + unsigned char hmacbuf[SHA512_LEN]; ERL_NIF_TERM head, tail, ret; - int i, is_sha; + int i; RSA* rsa = RSA_new(); - - if (argv[0] == atom_sha) is_sha = 1; - else if (argv[0] == atom_md5) is_sha = 0; - else goto badarg; + const ERL_NIF_TERM type = argv[0]; if (!inspect_mpint(env, argv[1], &data_bin) || !inspect_mpint(env, argv[2], &sign_bin) @@ -1114,22 +1272,57 @@ static ERL_NIF_TERM rsa_verify(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv || !enif_get_list_cell(env, tail, &head, &tail) || !get_bn_from_mpint(env, head, &rsa->n) || !enif_is_empty_list(env, tail)) { - badarg: + ret = enif_make_badarg(env); } else { - if (is_sha) { + if (type == atom_sha) { SHA1(data_bin.data+4, data_bin.size-4, hmacbuf); i = RSA_verify(NID_sha1, hmacbuf, SHA_DIGEST_LENGTH, sign_bin.data+4, sign_bin.size-4, rsa); } - else { + else if (type == atom_sha256) { + #ifdef HAVE_SHA256 + SHA256(data_bin.data+4, data_bin.size-4, hmacbuf); + i = RSA_verify(NID_sha256, hmacbuf, SHA256_LEN, + sign_bin.data+4, sign_bin.size-4, rsa); + #else + ret = atom_notsup; + goto done; + #endif + } + else if (type == atom_sha384) { + #ifdef HAVE_SHA384 + SHA384(data_bin.data+4, data_bin.size-4, hmacbuf); + i = RSA_verify(NID_sha384, hmacbuf, SHA384_LEN, + sign_bin.data+4, sign_bin.size-4, rsa); + #else + ret = atom_notsup; + goto done; + #endif + } + else if (type == atom_sha512) { + #ifdef HAVE_SHA512 + SHA512(data_bin.data+4, data_bin.size-4, hmacbuf); + i = RSA_verify(NID_sha512, hmacbuf, SHA512_LEN, + sign_bin.data+4, sign_bin.size-4, rsa); + #else + ret = atom_notsup; + goto done; + #endif + } + else if (type == atom_md5) { MD5(data_bin.data+4, data_bin.size-4, hmacbuf); i = RSA_verify(NID_md5, hmacbuf, MD5_DIGEST_LENGTH, sign_bin.data+4, sign_bin.size-4, rsa); } + else { + ret = enif_make_badarg(env); + goto done; + } ret = (i==1 ? atom_true : atom_false); - } + } +done: RSA_free(rsa); return ret; } diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index 48243fd693..8cb893cd1c 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -896,7 +896,7 @@ Mpint() = <![CDATA[<<ByteLen:32/integer-big, Bytes:ByteLen/binary>>]]> <v>Key = [E, N]</v> <v>E, N = Mpint</v> <d>Where <c>E</c> is the public exponent and <c>N</c> is public modulus.</d> - <v>DigestType = md5 | sha</v> + <v>DigestType = md5 | sha | sha256 | sha384 | sha512</v> <d> The default <c>DigestType</c> is sha.</d> <v>Mpint = binary()</v> </type> @@ -905,6 +905,8 @@ Mpint() = <![CDATA[<<ByteLen:32/integer-big, Bytes:ByteLen/binary>>]]> and verifies that the digest matches the RSA signature using the signer's public key <c>Key</c>. </p> + <p>May throw exception <c>notsup</c> in case the chosen <c>DigestType</c> + is not supported by the underlying OpenSSL implementation.</p> </desc> </func> diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 0714cb686d..d7aac27825 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -25,8 +25,8 @@ -export([md4/1, md4_init/0, md4_update/2, md4_final/1]). -export([md5/1, md5_init/0, md5_update/2, md5_final/1]). -export([sha/1, sha_init/0, sha_update/2, sha_final/1]). -%-export([sha256/1, sha256_init/0, sha256_update/2, sha256_final/1]). -%-export([sha512/1, sha512_init/0, sha512_update/2, sha512_final/1]). +-export([sha256/1, sha256_init/0, sha256_update/2, sha256_final/1]). +-export([sha512/1, sha512_init/0, sha512_update/2, sha512_final/1]). -export([md5_mac/2, md5_mac_96/2, sha_mac/2, sha_mac/3, sha_mac_96/2]). -export([hmac_init/2, hmac_update/2, hmac_final/1, hmac_final_n/2]). -export([des_cbc_encrypt/3, des_cbc_decrypt/3, des_cbc_ivec/1]). @@ -64,8 +64,8 @@ -define(FUNC_LIST, [md4, md4_init, md4_update, md4_final, md5, md5_init, md5_update, md5_final, sha, sha_init, sha_update, sha_final, -%% sha256, sha256_init, sha256_update, sha256_final, -%% sha512, sha512_init, sha512_update, sha512_final, + sha256, sha256_init, sha256_update, sha256_final, + sha512, sha512_init, sha512_update, sha512_final, md5_mac, md5_mac_96, sha_mac, sha_mac_96, sha_mac_init, sha_mac_update, sha_mac_final, @@ -95,7 +95,7 @@ aes_ctr_stream_init, aes_ctr_stream_encrypt, aes_ctr_stream_decrypt, info_lib]). --type rsa_digest_type() :: 'md5' | 'sha'. +-type rsa_digest_type() :: 'md5' | 'sha' | 'sha256' | 'sha384' | 'sha512'. -type dss_digest_type() :: 'none' | 'sha'. -type crypto_integer() :: binary() | integer(). @@ -219,6 +219,73 @@ sha_init() -> ?nif_stub. sha_update(_Context, _Data) -> ?nif_stub. sha_final(_Context) -> ?nif_stub. +% +%% SHA256 +%% +-spec sha256(iodata()) -> binary(). +-spec sha256_init() -> binary(). +-spec sha256_update(binary(), iodata()) -> binary(). +-spec sha256_final(binary()) -> binary(). + +sha256(Data) -> + case sha256_nif(Data) of + notsup -> erlang:error(notsup); + Bin -> Bin + end. +sha256_init() -> + case sha256_init_nif() of + notsup -> erlang:error(notsup); + Bin -> Bin + end. +sha256_update(Context, Data) -> + case sha256_update_nif(Context, Data) of + notsup -> erlang:error(notsup); + Bin -> Bin + end. +sha256_final(Context) -> + case sha256_final_nif(Context) of + notsup -> erlang:error(notsup); + Bin -> Bin + end. + +sha256_nif(_Data) -> ?nif_stub. +sha256_init_nif() -> ?nif_stub. +sha256_update_nif(_Context, _Data) -> ?nif_stub. +sha256_final_nif(_Context) -> ?nif_stub. + +% +%% SHA512 +%% +-spec sha512(iodata()) -> binary(). +-spec sha512_init() -> binary(). +-spec sha512_update(binary(), iodata()) -> binary(). +-spec sha512_final(binary()) -> binary(). + +sha512(Data) -> + case sha512_nif(Data) of + notsup -> erlang:error(notsup); + Bin -> Bin + end. +sha512_init() -> + case sha512_init_nif() of + notsup -> erlang:error(notsup); + Bin -> Bin + end. +sha512_update(Context, Data) -> + case sha512_update_nif(Context, Data) of + notsup -> erlang:error(notsup); + Bin -> Bin + end. +sha512_final(Context) -> + case sha512_final_nif(Context) of + notsup -> erlang:error(notsup); + Bin -> Bin + end. + +sha512_nif(_Data) -> ?nif_stub. +sha512_init_nif() -> ?nif_stub. +sha512_update_nif(_Context, _Data) -> ?nif_stub. +sha512_final_nif(_Context) -> ?nif_stub. %% %% MESSAGE AUTHENTICATION CODES @@ -522,8 +589,14 @@ dss_verify(_Type,_Data,_Signature,_Key) -> ?nif_stub. % Key = [E,N] E=PublicExponent N=PublicModulus rsa_verify(Data,Signature,Key) -> - rsa_verify(sha, Data,Signature,Key). -rsa_verify(_Type,_Data,_Signature,_Key) -> ?nif_stub. + rsa_verify_nif(sha, Data,Signature,Key). +rsa_verify(Type, Data, Signature, Key) -> + case rsa_verify_nif(Type, Data, Signature, Key) of + notsup -> erlang:error(notsup); + Bool -> Bool + end. + +rsa_verify_nif(_Type, _Data, _Signature, _Key) -> ?nif_stub. %% diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index 86acdc27df..627c966dfb 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -68,30 +68,29 @@ rc4_test/1, rc4_stream_test/1, blowfish_cfb64/1, - smp/1, - cleanup/1]). + smp/1]). -export([hexstr2bin/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [link_test, md5, md5_update, md4, md4_update, md5_mac, - md5_mac_io, sha, sha_update, - hmac_update_sha, hmac_update_sha_n, hmac_update_md5_n, hmac_update_md5_io, hmac_update_md5, - %% sha256, sha256_update, sha512,sha512_update, - des_cbc, des_cfb, des3_cbc, des3_cfb, rc2_cbc, aes_cfb, aes_cbc, - aes_cbc_iter, aes_ctr, aes_ctr_stream, des_cbc_iter, des_cfb_iter, des_ecb, - des_cbc, rc2_cbc, aes_cfb, aes_cbc, - aes_cbc_iter, aes_ctr, aes_ctr_stream, des_cbc_iter, des_ecb, - rand_uniform_test, strong_rand_test, - rsa_verify_test, dsa_verify_test, rsa_sign_test, - dsa_sign_test, rsa_encrypt_decrypt, dh, exor_test, - rc4_test, rc4_stream_test, mod_exp_test, blowfish_cfb64, - smp]. - -groups() -> - []. + [link_test, {group, info}]. + +groups() -> + [{info, [sequence],[info, {group, rest}]}, + {rest, [], + [md5, md5_update, md4, md4_update, md5_mac, + md5_mac_io, sha, sha_update, + hmac_update_sha, hmac_update_sha_n, hmac_update_md5_n, + hmac_update_md5_io, hmac_update_md5, + des_cbc, aes_cfb, aes_cbc, + aes_cbc_iter, aes_ctr, aes_ctr_stream, des_cbc_iter, des_ecb, + rand_uniform_test, strong_rand_test, + rsa_verify_test, dsa_verify_test, rsa_sign_test, + dsa_sign_test, rsa_encrypt_decrypt, dh, exor_test, + rc4_test, rc4_stream_test, mod_exp_test, blowfish_cfb64, + smp]}]. init_per_suite(Config) -> Config. @@ -105,11 +104,15 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. +init_per_testcase(info, Config) -> + Config; init_per_testcase(_Name,Config) -> io:format("init_per_testcase\n"), ?line crypto:start(), Config. +end_per_testcase(info, Config) -> + Config; end_per_testcase(_Name,Config) -> io:format("end_per_testcase\n"), ?line crypto:stop(), @@ -197,13 +200,6 @@ info(Config) when is_list(Config) -> ?line crypto:stop() end. -cleanup(doc) -> - ["Cleanup (dummy)."]; -cleanup(suite) -> - []; -cleanup(Config) when is_list(Config) -> - Config. - %% %% md5(doc) -> diff --git a/lib/dialyzer/src/dialyzer_behaviours.erl b/lib/dialyzer/src/dialyzer_behaviours.erl index 56eb46d78a..900ddf28c5 100644 --- a/lib/dialyzer/src/dialyzer_behaviours.erl +++ b/lib/dialyzer/src/dialyzer_behaviours.erl @@ -144,15 +144,20 @@ check_all_callbacks(Module, Behaviour, [Cb|Rest], 'error' -> Acc1; {ok, {{File, Line}, Contract}} -> Acc10 = Acc1, - SpecReturnType = dialyzer_contracts:get_contract_return(Contract), - SpecArgTypes = dialyzer_contracts:get_contract_args(Contract), + SpecReturnType0 = dialyzer_contracts:get_contract_return(Contract), + SpecArgTypes0 = dialyzer_contracts:get_contract_args(Contract), + SpecReturnType = erl_types:subst_all_vars_to_any(SpecReturnType0), + SpecArgTypes = + [erl_types:subst_all_vars_to_any(ArgT0) || ArgT0 <- SpecArgTypes0], Acc11 = case erl_types:t_is_subtype(SpecReturnType, CbReturnType) of true -> Acc10; - false -> [{callback_spec_type_mismatch, - [File, Line, Behaviour, Function, Arity, - erl_types:t_to_string(SpecReturnType, Records), - erl_types:t_to_string(CbReturnType, Records)]}|Acc10] + false -> + ExtraType = erl_types:t_subtract(SpecReturnType, CbReturnType), + [{callback_spec_type_mismatch, + [File, Line, Behaviour, Function, Arity, + erl_types:t_to_string(ExtraType, Records), + erl_types:t_to_string(CbReturnType, Records)]}|Acc10] end, Acc12 = case erl_types:any_none( diff --git a/lib/dialyzer/src/dialyzer_cl.erl b/lib/dialyzer/src/dialyzer_cl.erl index 732bd4ac84..04a0db890f 100644 --- a/lib/dialyzer/src/dialyzer_cl.erl +++ b/lib/dialyzer/src/dialyzer_cl.erl @@ -29,10 +29,6 @@ -module(dialyzer_cl). -%% Avoid warning for local function error/1 clashing with autoimported BIF. --compile({no_auto_import,[error/1]}). -%% Avoid warning for local function error/2 clashing with autoimported BIF. --compile({no_auto_import,[error/2]}). -export([start/1]). -include("dialyzer.hrl"). @@ -88,7 +84,7 @@ init_opts_for_build(Opts) -> Plts -> Msg = io_lib:format("Could not build multiple PLT files: ~s\n", [format_plts(Plts)]), - error(Msg) + cl_error(Msg) end; false -> Opts#options{init_plts = []} end. @@ -110,7 +106,7 @@ init_opts_for_add(Opts) -> Plts -> Msg = io_lib:format("Could not add to multiple PLT files: ~s\n", [format_plts(Plts)]), - error(Msg) + cl_error(Msg) end; false -> case Opts#options.init_plts =:= [] of @@ -134,11 +130,12 @@ check_plt_aux([_] = Plt, Opts) -> report_check(Opts2), plt_common(Opts2, [], []); check_plt_aux([Plt|Plts], Opts) -> - Opts1 = Opts#options{init_plts = [Plt]}, - Opts2 = init_opts_for_check(Opts1), - report_check(Opts2), - plt_common(Opts2, [], []), - check_plt_aux(Plts, Opts). + case check_plt_aux([Plt], Opts) of + {?RET_NOTHING_SUSPICIOUS, []} -> check_plt_aux(Plts, Opts); + {?RET_DISCREPANCIES, Warns} -> + {_RET, MoreWarns} = check_plt_aux(Plts, Opts), + {?RET_DISCREPANCIES, Warns ++ MoreWarns} + end. init_opts_for_check(Opts) -> InitPlt = @@ -175,7 +172,7 @@ init_opts_for_remove(Opts) -> Plts -> Msg = io_lib:format("Could not remove from multiple PLT files: ~s\n", [format_plts(Plts)]), - error(Msg) + cl_error(Msg) end; false -> case Opts#options.init_plts =:= [] of @@ -193,7 +190,7 @@ plt_common(#options{init_plts = [InitPlt]} = Opts, RemoveFiles, AddFiles) -> none -> ok; OutPlt -> {ok, Binary} = file:read_file(InitPlt), - file:write_file(OutPlt, Binary) + ok = file:write_file(OutPlt, Binary) end, case Opts#options.report_mode of quiet -> ok; @@ -221,19 +218,19 @@ plt_common(#options{init_plts = [InitPlt]} = Opts, RemoveFiles, AddFiles) -> {error, no_such_file} -> Msg = io_lib:format("Could not find the PLT: ~s\n~s", [InitPlt, default_plt_error_msg()]), - error(Msg); + cl_error(Msg); {error, not_valid} -> Msg = io_lib:format("The file: ~s is not a valid PLT file\n~s", [InitPlt, default_plt_error_msg()]), - error(Msg); + cl_error(Msg); {error, read_error} -> Msg = io_lib:format("Could not read the PLT: ~s\n~s", [InitPlt, default_plt_error_msg()]), - error(Msg); + cl_error(Msg); {error, {no_file_to_remove, F}} -> Msg = io_lib:format("Could not remove the file ~s from the PLT: ~s\n", [F, InitPlt]), - error(Msg) + cl_error(Msg) end. default_plt_error_msg() -> @@ -426,7 +423,7 @@ assert_writable(PltFile) -> true -> ok; false -> Msg = io_lib:format(" The PLT file ~s is not writable", [PltFile]), - error(Msg) + cl_error(Msg) end. check_if_writable(PltFile) -> @@ -550,7 +547,7 @@ init_output(State0, #options{output_file = OutFile, {error, Reason} -> Msg = io_lib:format("Could not open output file ~p, Reason: ~p\n", [OutFile, Reason]), - error(State, lists:flatten(Msg)) + cl_error(State, lists:flatten(Msg)) end end. @@ -596,10 +593,10 @@ cl_loop(State, LogCache) -> cl_loop(NewState, LogCache); {'EXIT', BackendPid, {error, Reason}} -> Msg = failed_anal_msg(Reason, LogCache), - error(State, Msg); + cl_error(State, Msg); {'EXIT', BackendPid, Reason} when Reason =/= 'normal' -> Msg = failed_anal_msg(io_lib:format("~P", [Reason, 12]), LogCache), - error(State, Msg); + cl_error(State, Msg); _Other -> %% io:format("Received ~p\n", [_Other]), cl_loop(State, LogCache) @@ -632,14 +629,14 @@ store_warnings(#cl_state{stored_warnings = StoredWarnings} = St, Warnings) -> store_unknown_behaviours(#cl_state{unknown_behaviours = Behs} = St, Beh) -> St#cl_state{unknown_behaviours = Beh ++ Behs}. --spec error(string()) -> no_return(). +-spec cl_error(string()) -> no_return(). -error(Msg) -> +cl_error(Msg) -> throw({dialyzer_error, Msg}). --spec error(#cl_state{}, string()) -> no_return(). +-spec cl_error(#cl_state{}, string()) -> no_return(). -error(State, Msg) -> +cl_error(State, Msg) -> case State#cl_state.output of standard_io -> ok; Outfile -> io:format(Outfile, "\n~s\n", [Msg]) diff --git a/lib/dialyzer/src/dialyzer_typesig.erl b/lib/dialyzer/src/dialyzer_typesig.erl index 92868b6878..4268814859 100644 --- a/lib/dialyzer/src/dialyzer_typesig.erl +++ b/lib/dialyzer/src/dialyzer_typesig.erl @@ -2046,8 +2046,7 @@ lookup_type(Key, Map) -> %% case cerl:is_literal(Key) of %% true -> t_from_term(cerl:concrete(Key)); %% false -> - Subst = t_subst(Key, Map), - t_sup(Subst, Subst). + t_subst(Key, Map). %% end. mk_var(Var) -> diff --git a/lib/dialyzer/test/behaviour_SUITE_data/results/callbacks_and_specs b/lib/dialyzer/test/behaviour_SUITE_data/results/callbacks_and_specs index da498c225d..33d135048e 100644 --- a/lib/dialyzer/test/behaviour_SUITE_data/results/callbacks_and_specs +++ b/lib/dialyzer/test/behaviour_SUITE_data/results/callbacks_and_specs @@ -1,5 +1,5 @@ my_callbacks_wrong.erl:26: The return type #state{parent::'undefined' | pid(),status::'closed' | 'init' | 'open',subscribe::[{pid(),integer()}],counter::integer()} in the specification of callback_init/1 is not a subtype of {'ok',_}, which is the expected return type for the callback of my_behaviour behaviour my_callbacks_wrong.erl:28: The inferred return type of callback_init/1 (#state{parent::'undefined' | pid(),status::'init',subscribe::[],counter::1}) has nothing in common with {'ok',_}, which is the expected return type for the callback of my_behaviour behaviour -my_callbacks_wrong.erl:30: The return type {'noreply',#state{parent::'undefined' | pid(),status::'closed' | 'init' | 'open',subscribe::[{pid(),integer()}],counter::integer()}} | {'reply',#state{parent::'undefined' | pid(),status::'closed' | 'init' | 'open',subscribe::[{pid(),integer()}],counter::integer()}} in the specification of callback_cast/3 is not a subtype of {'noreply',_}, which is the expected return type for the callback of my_behaviour behaviour +my_callbacks_wrong.erl:30: The return type {'reply',#state{parent::'undefined' | pid(),status::'closed' | 'init' | 'open',subscribe::[{pid(),integer()}],counter::integer()}} in the specification of callback_cast/3 is not a subtype of {'noreply',_}, which is the expected return type for the callback of my_behaviour behaviour my_callbacks_wrong.erl:39: The specified type for the 2nd argument of callback_call/3 (atom()) is not a supertype of pid(), which is expected type for this argument in the callback of the my_behaviour behaviour diff --git a/lib/dialyzer/test/behaviour_SUITE_data/results/vars_in_beh_spec b/lib/dialyzer/test/behaviour_SUITE_data/results/vars_in_beh_spec new file mode 100644 index 0000000000..5284e412f0 --- /dev/null +++ b/lib/dialyzer/test/behaviour_SUITE_data/results/vars_in_beh_spec @@ -0,0 +1,6 @@ + +vars_in_beh_spec.erl:3: Undefined callback function handle_call/3 (behaviour 'gen_server') +vars_in_beh_spec.erl:3: Undefined callback function handle_cast/2 (behaviour 'gen_server') +vars_in_beh_spec.erl:3: Undefined callback function handle_info/2 (behaviour 'gen_server') +vars_in_beh_spec.erl:3: Undefined callback function init/1 (behaviour 'gen_server') +vars_in_beh_spec.erl:3: Undefined callback function terminate/2 (behaviour 'gen_server') diff --git a/lib/dialyzer/test/behaviour_SUITE_data/src/vars_in_beh_spec.erl b/lib/dialyzer/test/behaviour_SUITE_data/src/vars_in_beh_spec.erl new file mode 100644 index 0000000000..dc75b30d0e --- /dev/null +++ b/lib/dialyzer/test/behaviour_SUITE_data/src/vars_in_beh_spec.erl @@ -0,0 +1,10 @@ +-module(vars_in_beh_spec). + +-behaviour(gen_server). + +-export([code_change/3]). + +-spec code_change(_, State, _) -> {ok, State}. + +code_change(_, State, _) -> + {ok, State}. diff --git a/lib/dialyzer/test/small_SUITE_data/src/maybe_improper.erl b/lib/dialyzer/test/small_SUITE_data/src/maybe_improper.erl new file mode 100644 index 0000000000..1743d81493 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/maybe_improper.erl @@ -0,0 +1,7 @@ +-module(maybe_improper). + +-export([s/1]). + +-spec s(maybe_improper_list(X,Y)) -> {[X], maybe_improper_list(X,Y)}. +s(A) -> + lists:split(2,A). diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl index 7adcf1c265..a85dda216d 100644 --- a/lib/diameter/src/base/diameter_service.erl +++ b/lib/diameter/src/base/diameter_service.erl @@ -647,11 +647,6 @@ mod_state(Alias) -> mod_state(Alias, ModS) -> put({?MODULE, mod_state, Alias}, ModS). -%% have_transport/2 - -have_transport(SvcName, Ref) -> - [] /= diameter_config:have_transport(SvcName, Ref). - %%% --------------------------------------------------------------------------- %%% # shutdown/2 %%% --------------------------------------------------------------------------- @@ -1131,7 +1126,7 @@ start_tc(Tc, T, _) -> %% tc_timeout/2 tc_timeout({Ref, _Type, _Opts} = T, #state{service_name = SvcName} = S) -> - tc(have_transport(SvcName, Ref), T, S). + tc(diameter_config:have_transport(SvcName, Ref), T, S). tc(true, {Ref, Type, Opts}, #state{service_name = SvcName} = S) -> @@ -1159,7 +1154,7 @@ close(Pid, #state{service_name = SvcName, options = Opts} = fetch(PeerT, Pid), - c(Pid, have_transport(SvcName, Ref), Opts). + c(Pid, diameter_config:have_transport(SvcName, Ref), Opts). %% Tell watchdog to (maybe) die later ... c(Pid, true, Opts) -> diff --git a/lib/erl_docgen/priv/xsl/db_eix.xsl b/lib/erl_docgen/priv/xsl/db_eix.xsl index 55540317f6..249e6950f7 100644 --- a/lib/erl_docgen/priv/xsl/db_eix.xsl +++ b/lib/erl_docgen/priv/xsl/db_eix.xsl @@ -328,7 +328,7 @@ <xsl:choose> <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)"> <xsl:variable name="tmp2"> - <xsl:value-of select="substring-after($string, $end)"/> + <xsl:value-of select="substring-after(substring-after($string, $start), $end)"/> </xsl:variable> <xsl:variable name="retstring"> <xsl:call-template name="remove-paren"> diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index a9052f29e5..bdef7bfd3d 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -2184,7 +2184,7 @@ <xsl:choose> <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)"> <xsl:variable name="tmp2"> - <xsl:value-of select="substring-after($string, $end)"/> + <xsl:value-of select="substring-after(substring-after($string, $start), $end)"/> </xsl:variable> <xsl:variable name="retstring"> <xsl:call-template name="remove-paren"> diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index 48a7a026c1..4ed4fa14c4 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -1680,7 +1680,7 @@ <xsl:choose> <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)"> <xsl:variable name="tmp2"> - <xsl:value-of select="substring-after($string, $end)"/> + <xsl:value-of select="substring-after(substring-after($string, $start), $end)"/> </xsl:variable> <xsl:variable name="retstring"> <xsl:call-template name="remove-paren"> diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index 0ff827ac37..387690df43 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -2533,29 +2533,26 @@ findfirst(N1, N2, U1, B1, U2, B2) -> t_subst(T, Dict) -> case t_has_var(T) of - true -> t_subst(T, Dict, fun(X) -> X end); + true -> t_subst_aux(T, Dict); false -> T end. -spec subst_all_vars_to_any(erl_type()) -> erl_type(). subst_all_vars_to_any(T) -> - case t_has_var(T) of - true -> t_subst(T, dict:new(), fun(_) -> ?any end); - false -> T - end. + t_subst(T, dict:new()). -t_subst(?var(Id) = V, Dict, Fun) -> +t_subst_aux(?var(Id), Dict) -> case dict:find(Id, Dict) of - error -> Fun(V); + error -> ?any; {ok, Type} -> Type end; -t_subst(?list(Contents, Termination, Size), Dict, Fun) -> - case t_subst(Contents, Dict, Fun) of +t_subst_aux(?list(Contents, Termination, Size), Dict) -> + case t_subst_aux(Contents, Dict) of ?none -> ?none; NewContents -> %% Be careful here to make the termination collapse if necessary. - case t_subst(Termination, Dict, Fun) of + case t_subst_aux(Termination, Dict) of ?nil -> ?list(NewContents, ?nil, Size); ?any -> ?list(NewContents, ?any, Size); Other -> @@ -2563,17 +2560,17 @@ t_subst(?list(Contents, Termination, Size), Dict, Fun) -> ?list(NewContents, NewTermination, Size) end end; -t_subst(?function(Domain, Range), Dict, Fun) -> - ?function(t_subst(Domain, Dict, Fun), t_subst(Range, Dict, Fun)); -t_subst(?product(Types), Dict, Fun) -> - ?product([t_subst(T, Dict, Fun) || T <- Types]); -t_subst(?tuple(?any, ?any, ?any) = T, _Dict, _Fun) -> +t_subst_aux(?function(Domain, Range), Dict) -> + ?function(t_subst_aux(Domain, Dict), t_subst_aux(Range, Dict)); +t_subst_aux(?product(Types), Dict) -> + ?product([t_subst_aux(T, Dict) || T <- Types]); +t_subst_aux(?tuple(?any, ?any, ?any) = T, _Dict) -> T; -t_subst(?tuple(Elements, _Arity, _Tag), Dict, Fun) -> - t_tuple([t_subst(E, Dict, Fun) || E <- Elements]); -t_subst(?tuple_set(_) = TS, Dict, Fun) -> - t_sup([t_subst(T, Dict, Fun) || T <- t_tuple_subtypes(TS)]); -t_subst(T, _Dict, _Fun) -> +t_subst_aux(?tuple(Elements, _Arity, _Tag), Dict) -> + t_tuple([t_subst_aux(E, Dict) || E <- Elements]); +t_subst_aux(?tuple_set(_) = TS, Dict) -> + t_sup([t_subst_aux(T, Dict) || T <- t_tuple_subtypes(TS)]); +t_subst_aux(T, _Dict) -> T. %%----------------------------------------------------------------------------- diff --git a/lib/hipe/opt/hipe_schedule.erl b/lib/hipe/opt/hipe_schedule.erl index 4925b2927b..ca3abf8cc6 100644 --- a/lib/hipe/opt/hipe_schedule.erl +++ b/lib/hipe/opt/hipe_schedule.erl @@ -797,7 +797,7 @@ dep_arc(N, Lat, M, {Dag,Preds}) -> %% Returns : A dependence graph sorted by To. %% Description : A new arc that is added is sorted in the right place, and if %% there is already an arc between nodes A and B, the one with -%% the greatest latency is choosen. +%% the greatest latency is chosen. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% add_arc(Lat,To, []) -> {[{Lat, To}], added}; add_arc(Lat1, To, [{Lat2, To} | Arcs]) -> diff --git a/lib/hipe/tools/hipe_profile.erl b/lib/hipe/tools/hipe_profile.erl index 7566acb8f4..1284b64f13 100644 --- a/lib/hipe/tools/hipe_profile.erl +++ b/lib/hipe/tools/hipe_profile.erl @@ -89,7 +89,7 @@ calls() -> %% F(), %% %% Get result. %% R = res(), -%% %% Turn of profiling. +%% %% Turn off profiling. %% prof_off(), %% R. diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml index 730efb729f..48a2089605 100644 --- a/lib/inets/doc/src/httpc.xml +++ b/lib/inets/doc/src/httpc.xml @@ -408,6 +408,8 @@ apply(Module, Function, [ReplyInfo | Args]) <p>Defaults to the <c>pid()</c> of the process calling the request function (<c>self()</c>). </p> + + <marker id="ipv6_host_with_brackets"></marker> </item> <tag><c><![CDATA[ipv6_host_with_brackets]]></c></tag> diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml index c9944964e4..369762d0c6 100644 --- a/lib/inets/doc/src/notes.xml +++ b/lib/inets/doc/src/notes.xml @@ -50,6 +50,21 @@ <p>Own Id: OTP-9545</p> </item> + <item> + <p>[httpc] Wrong Host header in IPv6 HTTP requests. + When a URI with a IPv6 host is parsed, the brackets that encapsulates + the address part is removed. This value is then supplied as the host + header. This can cause problems with some servers. + A workaround for this is to use headers_as_is and provide the host + header with the requst call. + To solve this a new option has been added, + <seealso marker="httpc#ipv6_host_with_brackets">ipv6_host_with_brackets</seealso>. + This option specifies if the host value of the host header shall + include the brackets or not. By default, it does not (as before). + </p> + <p>Own Id: OTP-9628</p> + </item> + </list> </section> diff --git a/lib/inets/src/http_server/mod_responsecontrol.erl b/lib/inets/src/http_server/mod_responsecontrol.erl index 989f45db20..6af5f6211e 100644 --- a/lib/inets/src/http_server/mod_responsecontrol.erl +++ b/lib/inets/src/http_server/mod_responsecontrol.erl @@ -211,7 +211,7 @@ compare_etags(Tag,Etags) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% -%% Control if the file is modificated %% +%% Control if the file is modified %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/kernel/doc/src/code.xml b/lib/kernel/doc/src/code.xml index 6b89711924..ee687511a3 100644 --- a/lib/kernel/doc/src/code.xml +++ b/lib/kernel/doc/src/code.xml @@ -229,10 +229,10 @@ <c>-code_path_choice Choice</c>. If the flag is set to <c>relaxed</c>, the code server will instead choose a suitable directory depending on the actual file structure. If there exists a regular - application ebin directory,situation it will be choosen. But if it does - not exist, the ebin directory in the archive is choosen if it + application ebin directory,situation it will be chosen. But if it does + not exist, the ebin directory in the archive is chosen if it exists. If neither of them exists the original directory will be - choosen.</p> + chosen.</p> <p>The command line flag <c>-code_path_choice Choice</c> does also affect how <c>init</c> interprets the <c>boot script</c>. The diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml index c6a1f25dd9..719cbba2b8 100644 --- a/lib/kernel/doc/src/file.xml +++ b/lib/kernel/doc/src/file.xml @@ -539,7 +539,7 @@ <desc> <p>Makes a hard link from <c><anno>Existing</anno></c> to <c><anno>New</anno></c>, on - platforms that support links (Unix). This function returns + platforms that support links (Unix and Windows). This function returns <c>ok</c> if the link was successfully created, or <c>{error, <anno>Reason</anno>}</c>. On platforms that do not support links, <c>{error,enotsup}</c> is returned.</p> @@ -566,11 +566,12 @@ <name name="make_symlink" arity="2"/> <fsummary>Make a symbolic link to a file or directory</fsummary> <desc> - <p>This function creates a symbolic link <c><anno>Name2</anno></c> to - the file or directory <c><anno>Name1</anno></c>, on platforms that - support - symbolic links (most Unix systems). <c><anno>Name1</anno></c> need not - exist. This function returns <c>ok</c> if the link was + <p>This function creates a symbolic link <c><anno>New</anno></c> to + the file or directory <c><anno>Existing</anno></c>, on platforms that + support symbolic links (most Unix systems and Windows beginning with + Vista). + <c><anno>Existing</anno></c> need not exist. + This function returns <c>ok</c> if the link was successfully created, or <c>{error, <anno>Reason</anno>}</c>. On platforms that do not support symbolic links, <c>{error, enotsup}</c> @@ -580,11 +581,11 @@ <tag><c>eacces</c></tag> <item> <p>Missing read or write permissions for the parent directories - of <c><anno>Name1</anno></c> or <c><anno>Name2</anno></c>.</p> + of <c><anno>Existing</anno></c> or <c><anno>New</anno></c>.</p> </item> <tag><c>eexist</c></tag> <item> - <p><c><anno>Name2</anno></c> already exists.</p> + <p><c><anno>New</anno></c> already exists.</p> </item> <tag><c>enotsup</c></tag> <item> diff --git a/lib/kernel/doc/src/gen_sctp.xml b/lib/kernel/doc/src/gen_sctp.xml index 418bfae4b8..579b7f1f74 100644 --- a/lib/kernel/doc/src/gen_sctp.xml +++ b/lib/kernel/doc/src/gen_sctp.xml @@ -270,7 +270,7 @@ it is bound to.</p> <p>For type <c>seqpacket</c> sockets (the default) <c><anno>IsServer</anno></c> must be <c>true</c> or <c>false</c>. - In the contrast to TCP, in SCTP there is no listening queue length. + In contrast to TCP, in SCTP there is no listening queue length. If <c><anno>IsServer</anno></c> is <c>true</c> the socket accepts new associations, i.e. it will become an SCTP server socket.</p> <p>For type <c>stream</c> sockets <anno>Backlog</anno> defines diff --git a/lib/kernel/src/application.erl b/lib/kernel/src/application.erl index caac4d926c..c299fb085c 100644 --- a/lib/kernel/src/application.erl +++ b/lib/kernel/src/application.erl @@ -59,7 +59,7 @@ -callback start(StartType :: normal | {takeover, node()} | {failover, node()}, StartArgs :: term()) -> - {ok, pid()} | {ok, pid(), State :: term()} | {error, Reason :: term}. + {'ok', pid()} | {'ok', pid(), State :: term()} | {'error', Reason :: term()}. -callback stop(State :: term()) -> term(). diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index 0b0f91d86a..7793009bb9 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -267,9 +267,9 @@ read_file(Name) -> make_link(Old, New) -> check_and_call(make_link, [file_name(Old), file_name(New)]). --spec make_symlink(Name1, Name2) -> ok | {error, Reason} when - Name1 :: name(), - Name2 :: name(), +-spec make_symlink(Existing, New) -> ok | {error, Reason} when + Existing :: name(), + New :: name(), Reason :: posix() | badarg. make_symlink(Old, New) -> @@ -1103,8 +1103,9 @@ change_group(Name, GroupId) Mtime :: date_time(), Reason :: posix() | badarg. -change_time(Name, Time) - when is_tuple(Time) -> +change_time(Name, {{Y, M, D}, {H, Min, Sec}}=Time) + when is_integer(Y), is_integer(M), is_integer(D), + is_integer(H), is_integer(Min), is_integer(Sec)-> write_file_info(Name, #file_info{mtime=Time}). -spec change_time(Filename, Atime, Mtime) -> ok | {error, Reason} when @@ -1113,8 +1114,12 @@ change_time(Name, Time) Mtime :: date_time(), Reason :: posix() | badarg. -change_time(Name, Atime, Mtime) - when is_tuple(Atime), is_tuple(Mtime) -> +change_time(Name, {{AY, AM, AD}, {AH, AMin, ASec}}=Atime, + {{MY, MM, MD}, {MH, MMin, MSec}}=Mtime) + when is_integer(AY), is_integer(AM), is_integer(AD), + is_integer(AH), is_integer(AMin), is_integer(ASec), + is_integer(MY), is_integer(MM), is_integer(MD), + is_integer(MH), is_integer(MMin), is_integer(MSec)-> write_file_info(Name, #file_info{atime=Atime, mtime=Mtime}). %% diff --git a/lib/megaco/doc/src/megaco_run.xml b/lib/megaco/doc/src/megaco_run.xml index 9ed589b079..ca46983288 100644 --- a/lib/megaco/doc/src/megaco_run.xml +++ b/lib/megaco/doc/src/megaco_run.xml @@ -317,7 +317,7 @@ "in storage" (indicated by the transaction id) it is assumed to be a resend and everything stored is sent. This could happen if the values of the <c><![CDATA[trans_timer]]></c> and the - <c><![CDATA[request_timer]]></c> is not properly choosen.</p> + <c><![CDATA[request_timer]]></c> is not properly chosen.</p> </section> <section> diff --git a/lib/megaco/include/megaco_message_prev3a.hrl b/lib/megaco/include/megaco_message_prev3a.hrl index 7b7a60fdae..3e73f94761 100644 --- a/lib/megaco/include/megaco_message_prev3a.hrl +++ b/lib/megaco/include/megaco_message_prev3a.hrl @@ -563,7 +563,7 @@ %% This is the actual ASN.1 type and it is as this it will -%% be represented if the encoding config [native] is choosen. +%% be represented if the encoding config [native] is chosen. %% %% String of at least 1 character and at most 67 characters (ASN.1). %% %% 64 characters for name, 1 for "/", 2 for version to match ABNF %% -record('ServiceChangeProfile', diff --git a/lib/megaco/include/megaco_message_prev3b.hrl b/lib/megaco/include/megaco_message_prev3b.hrl index cfabb29941..b4bde2bb7e 100644 --- a/lib/megaco/include/megaco_message_prev3b.hrl +++ b/lib/megaco/include/megaco_message_prev3b.hrl @@ -563,7 +563,7 @@ %% This is the actual ASN.1 type and it is as this it will -%% be represented if the encoding config [native] is choosen. +%% be represented if the encoding config [native] is chosen. %% %% String of at least 1 character and at most 67 characters (ASN.1). %% %% 64 characters for name, 1 for "/", 2 for version to match ABNF %% -record('ServiceChangeProfile', diff --git a/lib/megaco/include/megaco_message_prev3c.hrl b/lib/megaco/include/megaco_message_prev3c.hrl index 32024c9a02..90612f66c8 100644 --- a/lib/megaco/include/megaco_message_prev3c.hrl +++ b/lib/megaco/include/megaco_message_prev3c.hrl @@ -748,7 +748,7 @@ %% This is the actual ASN.1 type and it is as this it will -%% be represented if the encoding config [native] is choosen. +%% be represented if the encoding config [native] is chosen. %% %% String of at least 1 character and at most 67 characters (ASN.1). %% %% 64 characters for name, 1 for "/", 2 for version to match ABNF %% -record('ServiceChangeProfile', diff --git a/lib/megaco/include/megaco_message_v1.hrl b/lib/megaco/include/megaco_message_v1.hrl index ba50b50c80..f196c26713 100644 --- a/lib/megaco/include/megaco_message_v1.hrl +++ b/lib/megaco/include/megaco_message_v1.hrl @@ -404,7 +404,7 @@ }). % with extension mark %% This is the actual ASN.1 type and it is as this it will -%% be represented if the encoding config [native] is choosen. +%% be represented if the encoding config [native] is chosen. % %% String of at least 1 character and at most 67 characters (ASN.1). % %% 64 characters for name, 1 for "/", 2 for version to match ABNF % -record('ServiceChangeProfile', diff --git a/lib/megaco/include/megaco_message_v2.hrl b/lib/megaco/include/megaco_message_v2.hrl index 6190ea7ac4..af79c4dc92 100644 --- a/lib/megaco/include/megaco_message_v2.hrl +++ b/lib/megaco/include/megaco_message_v2.hrl @@ -525,7 +525,7 @@ %% This is the actual ASN.1 type and it is as this it will -%% be represented if the encoding config [native] is choosen. +%% be represented if the encoding config [native] is chosen. %% %% String of at least 1 character and at most 67 characters (ASN.1). %% %% 64 characters for name, 1 for "/", 2 for version to match ABNF %% -record('ServiceChangeProfile', diff --git a/lib/megaco/include/megaco_message_v3.hrl b/lib/megaco/include/megaco_message_v3.hrl index 7a1bc80571..466cfa6856 100644 --- a/lib/megaco/include/megaco_message_v3.hrl +++ b/lib/megaco/include/megaco_message_v3.hrl @@ -743,7 +743,7 @@ %% This is the actual ASN.1 type and it is as this it will -%% be represented if the encoding config [native] is choosen. +%% be represented if the encoding config [native] is chosen. %% %% String of at least 1 character and at most 67 characters (ASN.1). %% %% 64 characters for name, 1 for "/", 2 for version to match ABNF %% -record('ServiceChangeProfile', diff --git a/lib/megaco/src/engine/megaco_digit_map.erl b/lib/megaco/src/engine/megaco_digit_map.erl index de28686d6d..a904bd565a 100644 --- a/lib/megaco/src/engine/megaco_digit_map.erl +++ b/lib/megaco/src/engine/megaco_digit_map.erl @@ -362,7 +362,7 @@ collect(Event, State, Timers, STL, Letters) -> "~n Timers2: ~p" "~n Letters2: ~p", [State2, Timers2, Letters2]), MaxWait = choose_timer(State2, Event, Timers2), - ?d("collect -> Timer choosen: " + ?d("collect -> Timer chosen: " "~n MaxWait: ~p", [MaxWait]), receive {?MODULE, _FromPid, Event2} -> @@ -737,7 +737,7 @@ compute_cont([Next | Cont] = All, Mode, GlobalMode, State, STL) -> "~n Mode: ~p" "~n GlobalMode: ~p", [Next, Mode, GlobalMode]), case Next of - %% Retain long timer if that has already been choosen + %% Retain long timer if that has already been chosen use_short_timer when GlobalMode =:= use_long_timer -> compute_cont(Cont, Mode, GlobalMode, State, STL); use_short_timer -> diff --git a/lib/mnesia/doc/src/mnesia.xml b/lib/mnesia/doc/src/mnesia.xml index 19ec70118f..20133cb6cb 100644 --- a/lib/mnesia/doc/src/mnesia.xml +++ b/lib/mnesia/doc/src/mnesia.xml @@ -813,6 +813,21 @@ mnesia:change_table_copy_type(person, node(), disc_copies) </p> </item> <item> + <p><c>{storage_properties, [{Backend, Properties}]</c>. + Forwards additional properties to the backend storage. + <c>Backend</c> can currently be <c>ets</c> or <c>dets</c> and + <c>Properties</c> is a list of options sent to the backend storage + during table creation. <c>Properties</c> may not contain properties + already used by mnesia such as <c>type</c> or <c>named_table</c>. + </p> + <p>For example:</p> + <code type="none"> +mnesia:create_table(table, [{ram_copies, [node()]}, {disc_only_copies, nodes()}, + {storage_properties, + [{ets, [compressed]}, {dets, [{auto_save, 5000}]} ]}]) + </code> + </item> + <item> <p><c>{type, Type}</c>, where <c>Type</c> must be either of the atoms <c>set</c>, <c>ordered_set</c> or <c>bag</c>. The default value is <c>set</c>. In a diff --git a/lib/mnesia/src/mnesia.appup.src b/lib/mnesia/src/mnesia.appup.src index e0954ad206..304a15242f 100644 --- a/lib/mnesia/src/mnesia.appup.src +++ b/lib/mnesia/src/mnesia.appup.src @@ -1,14 +1,16 @@ %% -*- erlang -*- {"%VSN%", [ - {"4.5", [{restart_application, mnesia}]}, + {"4.5.1", [{restart_application, mnesia}]}, + {"4.5", [{restart_application, mnesia}]}, {"4.4.19", [{restart_application, mnesia}]}, {"4.4.18", [{restart_application, mnesia}]}, {"4.4.17", [{restart_application, mnesia}]}, {"4.4.16", [{restart_application, mnesia}]} ], [ - {"4.5", [{restart_application, mnesia}]}, + {"4.5.1", [{restart_application, mnesia}]}, + {"4.5", [{restart_application, mnesia}]}, {"4.4.19", [{restart_application, mnesia}]}, {"4.4.18", [{restart_application, mnesia}]}, {"4.4.17", [{restart_application, mnesia}]}, diff --git a/lib/mnesia/src/mnesia.hrl b/lib/mnesia/src/mnesia.hrl index 2375b72d59..2855792646 100644 --- a/lib/mnesia/src/mnesia.hrl +++ b/lib/mnesia/src/mnesia.hrl @@ -70,6 +70,7 @@ attributes = [key, val], % [Atom] user_properties = [], % [Record] frag_properties = [], % [{Key, Val] + storage_properties = [], % [{Key, Val] cookie = ?unique_cookie, % Term version = {{2, 0}, []}}). % {{Integer, Integer}, [Node]} diff --git a/lib/mnesia/src/mnesia_controller.erl b/lib/mnesia/src/mnesia_controller.erl index 6a561394d5..836510a80d 100644 --- a/lib/mnesia/src/mnesia_controller.erl +++ b/lib/mnesia/src/mnesia_controller.erl @@ -279,11 +279,8 @@ rec_tabs([], _, _, Init) -> unlink(Init), ok. -%% New function that does exactly what get_cstructs() used to do. -%% When this function is called, we know that the calling node knows -%% how to convert cstructs on the receiving end (should they differ). get_remote_cstructs() -> - call(get_cstructs). + get_cstructs(). %% Sigh not forward compatible always check version %% Old function kept for backwards compatibility; converts cstructs before sending. get_cstructs() -> diff --git a/lib/mnesia/src/mnesia_dumper.erl b/lib/mnesia/src/mnesia_dumper.erl index f8d7664156..9e7e1ad1c6 100644 --- a/lib/mnesia/src/mnesia_dumper.erl +++ b/lib/mnesia/src/mnesia_dumper.erl @@ -604,15 +604,19 @@ insert_op(Tid, _, {op, restore_recreate, TabDef}, InPlace, InitBy) -> mnesia_checkpoint:tm_del_copy(Tab, node()) end end, + StorageProps = Cs#cstruct.storage_properties, + %% And create new ones.. if (InitBy == startup) or (Storage == unknown) -> ignore; Storage == ram_copies -> - Args = [{keypos, 2}, public, named_table, Type], + EtsProps = proplists:get_value(ets, StorageProps, []), + Args = [{keypos, 2}, public, named_table, Type | EtsProps], mnesia_monitor:mktab(Tab, Args); Storage == disc_copies -> - Args = [{keypos, 2}, public, named_table, Type], + EtsProps = proplists:get_value(ets, StorageProps, []), + Args = [{keypos, 2}, public, named_table, Type | EtsProps], mnesia_monitor:mktab(Tab, Args), File = mnesia_lib:tab2dcd(Tab), FArg = [{file, File}, {name, {mnesia,create}}, @@ -622,10 +626,12 @@ insert_op(Tid, _, {op, restore_recreate, TabDef}, InPlace, InitBy) -> Storage == disc_only_copies -> File = mnesia_lib:tab2dat(Tab), file:delete(File), + DetsProps = proplists:get_value(dets, StorageProps, []), Args = [{file, mnesia_lib:tab2dat(Tab)}, {type, mnesia_lib:disk_type(Tab, Type)}, {keypos, 2}, - {repair, mnesia_monitor:get_env(auto_repair)}], + {repair, mnesia_monitor:get_env(auto_repair)} + | DetsProps ], mnesia_monitor:open_dets(Tab, Args) end, insert_op(Tid, ignore, {op, create_table, TabDef}, InPlace, InitBy); @@ -635,6 +641,7 @@ insert_op(Tid, _, {op, create_table, TabDef}, InPlace, InitBy) -> insert_cstruct(Tid, Cs, false, InPlace, InitBy), Tab = Cs#cstruct.name, Storage = mnesia_lib:cs_to_storage_type(node(), Cs), + StorageProps = Cs#cstruct.storage_properties, case InitBy of startup -> case Storage of @@ -656,10 +663,13 @@ insert_op(Tid, _, {op, create_table, TabDef}, InPlace, InitBy) -> mnesia_log:unsafe_close_log(temp) end; _ -> + DetsProps = proplists:get_value(dets, StorageProps, []), + Args = [{file, mnesia_lib:tab2dat(Tab)}, {type, mnesia_lib:disk_type(Tab, Cs#cstruct.type)}, {keypos, 2}, - {repair, mnesia_monitor:get_env(auto_repair)}], + {repair, mnesia_monitor:get_env(auto_repair)} + | DetsProps ], case mnesia_monitor:open_dets(Tab, Args) of {ok, _} -> mnesia_monitor:unsafe_close_dets(Tab); @@ -671,7 +681,7 @@ insert_op(Tid, _, {op, create_table, TabDef}, InPlace, InitBy) -> Copies = mnesia_lib:copy_holders(Cs), Active = mnesia_lib:intersect(Copies, val({current, db_nodes})), [mnesia_controller:add_active_replica(Tab, N, Cs) || N <- Active], - + case Storage of unknown -> mnesia_lib:unset({Tab, create_table}), @@ -944,11 +954,14 @@ open_files(Tab, Storage, UpdateInPlace, InitBy) Bool = open_disc_copies(Tab, InitBy), Bool; _ -> + Props = val({Tab, storage_properties}), + DetsProps = proplists:get_value(dets, Props, []), Fname = prepare_open(Tab, UpdateInPlace), Args = [{file, Fname}, {keypos, 2}, {repair, mnesia_monitor:get_env(auto_repair)}, - {type, mnesia_lib:disk_type(Tab, Type)}], + {type, mnesia_lib:disk_type(Tab, Type)} + | DetsProps], {ok, _} = mnesia_monitor:open_dets(Tab, Args), put({?MODULE, Tab}, {opened_dumper, dat}), true diff --git a/lib/mnesia/src/mnesia_loader.erl b/lib/mnesia/src/mnesia_loader.erl index c4b22814a8..e443b54016 100644 --- a/lib/mnesia/src/mnesia_loader.erl +++ b/lib/mnesia/src/mnesia_loader.erl @@ -61,9 +61,11 @@ do_get_disc_copy2(Tab, _Reason, Storage, _Type) when Storage == unknown -> do_get_disc_copy2(Tab, Reason, Storage, Type) when Storage == disc_copies -> %% NOW we create the actual table Repair = mnesia_monitor:get_env(auto_repair), - Args = [{keypos, 2}, public, named_table, Type], + StorageProps = val({Tab, storage_properties}), + EtsOpts = proplists:get_value(ets, StorageProps, []), + Args = [{keypos, 2}, public, named_table, Type | EtsOpts], case Reason of - {dumper, _} -> %% Resources allready allocated + {dumper, _} -> %% Resources already allocated ignore; _ -> mnesia_monitor:mktab(Tab, Args), @@ -82,7 +84,9 @@ do_get_disc_copy2(Tab, Reason, Storage, Type) when Storage == disc_copies -> {loaded, ok}; do_get_disc_copy2(Tab, Reason, Storage, Type) when Storage == ram_copies -> - Args = [{keypos, 2}, public, named_table, Type], + StorageProps = val({Tab, storage_properties}), + EtsOpts = proplists:get_value(ets, StorageProps, []), + Args = [{keypos, 2}, public, named_table, Type | EtsOpts], case Reason of {dumper, _} -> %% Resources allready allocated ignore; @@ -115,10 +119,14 @@ do_get_disc_copy2(Tab, Reason, Storage, Type) when Storage == ram_copies -> {loaded, ok}; do_get_disc_copy2(Tab, Reason, Storage, Type) when Storage == disc_only_copies -> + StorageProps = val({Tab, storage_properties}), + DetsOpts = proplists:get_value(dets, StorageProps, []), + Args = [{file, mnesia_lib:tab2dat(Tab)}, {type, mnesia_lib:disk_type(Tab, Type)}, {keypos, 2}, - {repair, mnesia_monitor:get_env(auto_repair)}], + {repair, mnesia_monitor:get_env(auto_repair)} + | DetsOpts], case Reason of {dumper, _} -> mnesia_index:init_index(Tab, Storage), @@ -349,17 +357,21 @@ do_init_table(Tab,Storage,Cs,SenderPid, end. create_table(Tab, TabSize, Storage, Cs) -> + StorageProps = val({Tab, storage_properties}), if Storage == disc_only_copies -> mnesia_lib:lock_table(Tab), Tmp = mnesia_lib:tab2tmp(Tab), Size = lists:max([TabSize, 256]), + DetsOpts = lists:keydelete(estimated_no_objects, 1, + proplists:get_value(dets, StorageProps, [])), Args = [{file, Tmp}, {keypos, 2}, %% {ram_file, true}, {estimated_no_objects, Size}, {repair, mnesia_monitor:get_env(auto_repair)}, - {type, mnesia_lib:disk_type(Tab, Cs#cstruct.type)}], + {type, mnesia_lib:disk_type(Tab, Cs#cstruct.type)} + | DetsOpts], file:delete(Tmp), case mnesia_lib:dets_sync_open(Tab, Args) of {ok, _} -> @@ -370,7 +382,8 @@ create_table(Tab, TabSize, Storage, Cs) -> Else end; (Storage == ram_copies) or (Storage == disc_copies) -> - Args = [{keypos, 2}, public, named_table, Cs#cstruct.type], + EtsOpts = proplists:get_value(ets, StorageProps, []), + Args = [{keypos, 2}, public, named_table, Cs#cstruct.type | EtsOpts], case mnesia_monitor:unsafe_mktab(Tab, Args) of Tab -> {Storage, Tab}; @@ -516,10 +529,13 @@ handle_last({disc_only_copies, Tab}, Type, nobin) -> Dat = mnesia_lib:tab2dat(Tab), case file:rename(Tmp, Dat) of ok -> + StorageProps = val({Tab, storage_properties}), + DetsOpts = proplists:get_value(dets, StorageProps, []), + Args = [{file, mnesia_lib:tab2dat(Tab)}, {type, mnesia_lib:disk_type(Tab, Type)}, {keypos, 2}, - {repair, mnesia_monitor:get_env(auto_repair)}], + {repair, mnesia_monitor:get_env(auto_repair)} | DetsOpts], mnesia_monitor:open_dets(Tab, Args), ok; {error, Reason} -> diff --git a/lib/mnesia/src/mnesia_monitor.erl b/lib/mnesia/src/mnesia_monitor.erl index 8cb2e92c08..c08bbc879f 100644 --- a/lib/mnesia/src/mnesia_monitor.erl +++ b/lib/mnesia/src/mnesia_monitor.erl @@ -80,9 +80,9 @@ going_down = [], tm_started = false, early_connects = [], connecting, mq = []}). --define(current_protocol_version, {8,0}). +-define(current_protocol_version, {8,1}). --define(previous_protocol_version, {7,6}). +-define(previous_protocol_version, {8,0}). start() -> gen_server:start_link({local, ?MODULE}, ?MODULE, @@ -188,7 +188,7 @@ protocol_version() -> %% A sorted list of acceptable protocols the %% preferred protocols are first in the list acceptable_protocol_versions() -> - [protocol_version(), ?previous_protocol_version]. + [protocol_version(), ?previous_protocol_version, {7,6}]. needs_protocol_conversion(Node) -> case {?catch_val({protocol, Node}), protocol_version()} of @@ -417,6 +417,8 @@ handle_call({negotiate_protocol, Mon, Version, Protocols}, From, State) case hd(Protocols) of ?previous_protocol_version -> accept_protocol(Mon, MyVersion, ?previous_protocol_version, From, State); + {7,6} -> + accept_protocol(Mon, MyVersion, {7,6}, From, State); _ -> verbose("Connection with ~p rejected. " "version = ~p, protocols = ~p, " diff --git a/lib/mnesia/src/mnesia_schema.erl b/lib/mnesia/src/mnesia_schema.erl index 179e15197e..6e43052fb0 100644 --- a/lib/mnesia/src/mnesia_schema.erl +++ b/lib/mnesia/src/mnesia_schema.erl @@ -188,6 +188,7 @@ do_set_schema(Tab, Cs) -> [set({Tab, user_property, element(1, P)}, P) || P <- Cs#cstruct.user_properties], set({Tab, frag_properties}, Cs#cstruct.frag_properties), mnesia_frag:set_frag_hash(Tab, Cs#cstruct.frag_properties), + set({Tab, storage_properties}, Cs#cstruct.storage_properties), set({Tab, attributes}, Cs#cstruct.attributes), Arity = length(Cs#cstruct.attributes) + 1, set({Tab, arity}, Arity), @@ -644,6 +645,14 @@ cs2list(Cs) when is_record(Cs, cstruct) -> rec2list(Tags, Tags, 2, Cs); cs2list(CreateList) when is_list(CreateList) -> CreateList; +%% 4.6 +cs2list(Cs) when element(1, Cs) == cstruct, tuple_size(Cs) == 19 -> + Tags = [name,type,ram_copies,disc_copies,disc_only_copies, + load_order,access_mode,majority,index,snmp,local_content, + record_name,attributes, + user_properties,frag_properties,storage_properties, + cookie,version], + rec2list(Tags, Tags, 2, Cs); %% 4.4.19 cs2list(Cs) when element(1, Cs) == cstruct, tuple_size(Cs) == 18 -> Tags = [name,type,ram_copies,disc_copies,disc_only_copies, @@ -674,8 +683,17 @@ cs2list(ver4_4_19, Cs) -> load_order,access_mode,majority,index,snmp,local_content, record_name,attributes,user_properties,frag_properties, cookie,version], + rec2list(Tags, Orig, 2, Cs); +cs2list(ver4_6, Cs) -> + Orig = record_info(fields, cstruct), + Tags = [name,type,ram_copies,disc_copies,disc_only_copies, + load_order,access_mode,majority,index,snmp,local_content, + record_name,attributes, + user_properties,frag_properties,storage_properties, + cookie,version], rec2list(Tags, Orig, 2, Cs). + rec2list([Tag | Tags], [Tag | Orig], Pos, Rec) -> Val = element(Pos, Rec), [{Tag, Val} | rec2list(Tags, Orig, Pos + 1, Rec)]; @@ -728,6 +746,29 @@ list2cs(List) when is_list(List) -> Frag = pick(Name, frag_properties, List, []), verify({alt, [nil, list]}, mnesia_lib:etype(Frag), {badarg, Name, {frag_properties, Frag}}), + + BEProps = pick(Name, storage_properties, List, []), + verify({alt, [nil, list]}, mnesia_lib:etype(Ix), + {badarg, Name, {storage_properties, BEProps}}), + CheckProp = fun(Opt, Opts) when is_atom(Opt) -> + lists:member(Opt, Opts) + andalso mnesia:abort({badarg, Name, Opt}); + (Tuple, Opts) when is_tuple(Tuple) -> + lists:member(element(1,Tuple), Opts) + andalso mnesia:abort({badarg, Name, Tuple}); + (What,_) -> + mnesia:abort({badarg, Name, What}) + end, + BadEtsOpts = [set, ordered_set, bag, duplicate_bag, + public, private, protected, + keypos, named_table], + EtsOpts = proplists:get_value(ets, BEProps, []), + is_list(EtsOpts) orelse mnesia:abort({badarg, Name, {ets, EtsOpts}}), + [CheckProp(Prop, BadEtsOpts) || Prop <- EtsOpts], + BadDetsOpts = [type, keypos, repair, access, file], + DetsOpts = proplists:get_value(dets, BEProps, []), + is_list(DetsOpts) orelse mnesia:abort({badarg, Name, {dets, DetsOpts}}), + [CheckProp(Prop, BadDetsOpts) || Prop <- DetsOpts], #cstruct{name = Name, ram_copies = Rc, disc_copies = Dc, @@ -743,6 +784,7 @@ list2cs(List) when is_list(List) -> attributes = Attrs, user_properties = lists:sort(UserProps), frag_properties = lists:sort(Frag), + storage_properties = lists:sort(BEProps), cookie = Cookie, version = Version}. @@ -1881,18 +1923,18 @@ prepare_op(Tid, {op, create_table, TabDef}, _WaitFor) -> mnesia:abort(UseDirReason); ram_copies -> mnesia_lib:set({Tab, create_table},true), - create_ram_table(Tab, Cs#cstruct.type), + create_ram_table(Tab, Cs), insert_cstruct(Tid, Cs, false), {true, optional}; disc_copies -> mnesia_lib:set({Tab, create_table},true), - create_ram_table(Tab, Cs#cstruct.type), + create_ram_table(Tab, Cs), create_disc_table(Tab), insert_cstruct(Tid, Cs, false), {true, optional}; disc_only_copies -> mnesia_lib:set({Tab, create_table},true), - create_disc_only_table(Tab,Cs#cstruct.type), + create_disc_only_table(Tab,Cs), insert_cstruct(Tid, Cs, false), {true, optional}; unknown -> %% No replica on this node @@ -2044,7 +2086,7 @@ prepare_op(_Tid, {op, change_table_copy_type, N, FromS, ToS, TabDef}, _WaitFor) mnesia_dumper:raw_named_dump_table(Tab, dmp); FromS == disc_only_copies -> Type = Cs#cstruct.type, - create_ram_table(Tab, Type), + create_ram_table(Tab, Cs), Datname = mnesia_lib:tab2dat(Tab), Repair = mnesia_monitor:get_env(auto_repair), case mnesia_lib:dets_to_ets(Tab, Tab, Datname, Type, Repair, no) of @@ -2132,8 +2174,9 @@ prepare_op(_Tid, {op, merge_schema, TabDef}, _WaitFor) -> prepare_op(_Tid, _Op, _WaitFor) -> {true, optional}. -create_ram_table(Tab, Type) -> - Args = [{keypos, 2}, public, named_table, Type], +create_ram_table(Tab, #cstruct{type=Type, storage_properties=Props}) -> + EtsOpts = proplists:get_value(ets, Props, []), + Args = [{keypos, 2}, public, named_table, Type | EtsOpts], case mnesia_monitor:unsafe_mktab(Tab, Args) of Tab -> ok; @@ -2141,6 +2184,7 @@ create_ram_table(Tab, Type) -> Err = "Failed to create ets table", mnesia:abort({system_limit, Tab, {Err,Reason}}) end. + create_disc_table(Tab) -> File = mnesia_lib:tab2dcd(Tab), file:delete(File), @@ -2154,13 +2198,15 @@ create_disc_table(Tab) -> Err = "Failed to create disc table", mnesia:abort({system_limit, Tab, {Err,Reason}}) end. -create_disc_only_table(Tab,Type) -> +create_disc_only_table(Tab, #cstruct{type=Type, storage_properties=Props}) -> File = mnesia_lib:tab2dat(Tab), file:delete(File), + DetsOpts = proplists:get_value(dets, Props, []), Args = [{file, mnesia_lib:tab2dat(Tab)}, {type, mnesia_lib:disk_type(Tab, Type)}, {keypos, 2}, - {repair, mnesia_monitor:get_env(auto_repair)}], + {repair, mnesia_monitor:get_env(auto_repair)} + | DetsOpts], case mnesia_monitor:unsafe_open_dets(Tab, Args) of {ok, _} -> ok; @@ -2688,17 +2734,17 @@ restore_schema([{schema, Tab, List} | Schema], R) -> R2 = R#r{tables = [{Tab, undefined, Snmp, RecName} | R#r.tables]}, restore_schema(Schema, R2); recreate_tables -> - case ?catch_val({Tab, cstruct}) of - {'EXIT', _} -> - TidTs = {_Mod, Tid, Ts} = get(mnesia_activity_state), - RunningNodes = val({current, db_nodes}), - Nodes = mnesia_lib:intersect(mnesia_lib:cs_to_nodes(list2cs(List)), - RunningNodes), - mnesia_locker:wlock_no_exist(Tid, Ts#tidstore.store, Tab, Nodes), - TidTs; - _ -> - TidTs = get_tid_ts_and_lock(Tab, write) - end, + TidTs = case ?catch_val({Tab, cstruct}) of + {'EXIT', _} -> + TTs = {_Mod, Tid, Ts} = get(mnesia_activity_state), + RunningNodes = val({current, db_nodes}), + Nodes = mnesia_lib:intersect(mnesia_lib:cs_to_nodes(list2cs(List)), + RunningNodes), + mnesia_locker:wlock_no_exist(Tid, Ts#tidstore.store, Tab, Nodes), + TTs; + _ -> + get_tid_ts_and_lock(Tab, write) + end, NC = {cookie, ?unique_cookie}, List2 = lists:keyreplace(cookie, 1, List, NC), Where = where_to_commit(Tab, List2), @@ -2839,15 +2885,15 @@ do_merge_schema(LockTabs0) -> end. fetch_cstructs(Node) -> - case mnesia_monitor:needs_protocol_conversion(Node) of - true -> + case need_old_cstructs([Node]) of + false -> + rpc:call(Node, mnesia_controller, get_remote_cstructs, []); + _Ver -> case rpc:call(Node, mnesia_controller, get_cstructs, []) of {cstructs, Cs0, RR} -> {cstructs, [list2cs(cs2list(Cs)) || Cs <- Cs0], RR}; Err -> Err - end; - false -> - rpc:call(Node, mnesia_controller, get_remote_cstructs, []) + end end. need_old_cstructs() -> @@ -2868,7 +2914,9 @@ need_old_cstructs(Nodes) -> Cs when element(1, Cs) == cstruct, tuple_size(Cs) == 17 -> ver4_4_18; % Without majority Cs when element(1, Cs) == cstruct, tuple_size(Cs) == 18 -> - ver4_4_19 % With majority + ver4_4_19; % With majority + Cs when element(1, Cs) == cstruct, tuple_size(Cs) == 19 -> + ver4_6 % With storage_properties end end. diff --git a/lib/mnesia/test/mnesia_evil_coverage_test.erl b/lib/mnesia/test/mnesia_evil_coverage_test.erl index c1918071a1..64b61288ef 100644 --- a/lib/mnesia/test/mnesia_evil_coverage_test.erl +++ b/lib/mnesia/test/mnesia_evil_coverage_test.erl @@ -37,7 +37,8 @@ end_per_testcase(Func, Conf) -> all() -> [system_info, table_info, error_description, db_node_lifecycle, evil_delete_db_node, start_and_stop, - checkpoint, table_lifecycle, add_copy_conflict, + checkpoint, table_lifecycle, storage_options, + add_copy_conflict, add_copy_when_going_down, replica_management, schema_availability, local_content, {group, table_access_modifications}, replica_location, @@ -462,7 +463,7 @@ table_lifecycle(Config) when is_list(Config) -> ?match({atomic, ok}, mnesia:create_table([{name, already_exists}, {ram_copies, [Node1]}])), ?match({aborted, Reason23 } when element(1, Reason23) ==already_exists, - mnesia:create_table([{name, already_exists}, + mnesia:create_table([{name, already_exists}, {ram_copies, [Node1]}])), ?match({aborted, Reason21 } when element(1, Reason21) == bad_type, mnesia:create_table([{name, bad_node}, {ram_copies, ["foo"]}])), @@ -520,12 +521,57 @@ table_lifecycle(Config) when is_list(Config) -> ?match({atomic, ok}, mnesia:create_table([{name, create_with_index}, {index, [3]}, {ram_copies, [Node1]}])), - ets:new(ets_table, [named_table]), + ets:new(ets_table, [named_table]), ?match({aborted, _}, mnesia:create_table(ets_table, [{ram_copies, Nodes}])), + ?match({aborted, _}, mnesia:create_table(ets_table, [{ram_copies, [Node1]}])), + ets:delete(ets_table), + ?match({atomic, ok}, mnesia:create_table(ets_table, [{ram_copies, [Node1]}])), + ?match(Node1, rpc:call(Node1, mnesia_lib, val, [{ets_table,where_to_read}])), + ?match(Node1, rpc:call(Node2, mnesia_lib, val, [{ets_table,where_to_read}])), + ?match({atomic, ok}, mnesia:change_table_copy_type(ets_table, Node1, disc_only_copies)), + ?match(Node1, rpc:call(Node2, mnesia_lib, val, [{ets_table,where_to_read}])), + + ?verify_mnesia(Nodes, []). + + +storage_options(suite) -> []; +storage_options(Config) when is_list(Config) -> + [N1,N2,N3] = Nodes = ?acquire_nodes(3, Config), + + ?match({aborted,_}, mnesia:create_table(a, [{storage_properties, [{ets,foobar}]}])), + ?match({aborted,_}, mnesia:create_table(a, [{storage_properties, [{ets,[foobar]}]}])), + ?match({aborted,_}, mnesia:create_table(a, [{storage_properties, [{ets,[duplicate_bag]}]}])), + ?match({aborted,_}, mnesia:create_table(a, [{storage_properties, [{dets,[{type,bag}]}]}])), + + ?match({atomic, ok}, mnesia:create_table(a, [{ram_copies, [N1]}, + {disc_only_copies, [N2]}, + {storage_properties, + [{ets,[compressed]}, + {dets, [{auto_save, 5000}]} ]}])), + ?match(true, ets:info(a, compressed)), + ?match(5000, rpc:call(N2, dets, info, [a, auto_save])), + ?match(ok, mnesia:dirty_write({a,1,1})), + ?match([{a,1,1}], mnesia:dirty_read({a,1})), + mnesia:dump_log(), + W2C1 = [{N2, disc_only_copies}, {N1, ram_copies}], + ?match(W2C1, lists:sort(rpc:call(N2, mnesia_lib, val, [{a, where_to_commit}]))), + ?match(W2C1, lists:sort(rpc:call(N3, mnesia_lib, val, [{a, where_to_commit}]))), + ?match({atomic,ok}, mnesia:change_table_copy_type(a, N1, disc_only_copies)), + W2C2 = [{N2, disc_only_copies}, {N1, disc_only_copies}], + ?match(W2C2, lists:sort(rpc:call(N2, mnesia_lib, val, [{a, where_to_commit}]))), + ?match(W2C2, lists:sort(rpc:call(N3, mnesia_lib, val, [{a, where_to_commit}]))), + ?match(undefined, ets:info(a, compressed)), + ?match(5000, dets:info(a, auto_save)), + ?match({atomic,ok}, mnesia:change_table_copy_type(a, N1, disc_copies)), + ?match(true, ets:info(a, compressed)), ?verify_mnesia(Nodes, []). + + + + add_copy_conflict(suite) -> []; add_copy_conflict(doc) -> ["Verify that OTP-5065 doesn't happen again, whitebox testing"]; diff --git a/lib/orber/src/orber.erl b/lib/orber/src/orber.erl index 386c07d227..4e43d42638 100644 --- a/lib/orber/src/orber.erl +++ b/lib/orber/src/orber.erl @@ -36,6 +36,7 @@ -export([start/0, start/1, stop/0, install/1, install/2, orber_nodes/0, iiop_port/0, domain/0, iiop_ssl_port/0, iiop_out_ports/0, iiop_out_ports_random/0, iiop_out_ports_attempts/0, + ssl_server_opts/0, ssl_client_opts/0, set_ssl_client_opts/1, ssl_server_certfile/0, ssl_client_certfile/0, set_ssl_client_certfile/1, ssl_server_verify/0, ssl_client_verify/0, set_ssl_client_verify/1, ssl_server_depth/0, ssl_client_depth/0, set_ssl_client_depth/1, @@ -524,6 +525,15 @@ iiop_ssl_port() -> nat_iiop_ssl_port() -> orber_env:nat_iiop_ssl_port(). +ssl_server_opts() -> + orber_env:ssl_server_opts(). + +ssl_client_opts() -> + orber_env:ssl_client_opts(). + +set_ssl_client_opts(Value) -> + orber_env:set_ssl_client_opts(Value). + ssl_server_certfile() -> orber_env:ssl_server_certfile(). diff --git a/lib/orber/src/orber_env.erl b/lib/orber/src/orber_env.erl index d80edb4ee0..8fb3908710 100644 --- a/lib/orber/src/orber_env.erl +++ b/lib/orber/src/orber_env.erl @@ -20,7 +20,7 @@ %% %%----------------------------------------------------------------- %% File: orber_env.erl -%% +%% %% Description: %% Handling environment parameters for Orber. %% @@ -49,20 +49,22 @@ iiop_max_in_connections/0, iiop_backlog/0, objectkeys_gc_time/0, get_ORBInitRef/0, get_ORBDefaultInitRef/0, get_interceptors/0, get_local_interceptors/0, get_cached_interceptors/0, - set_interceptors/1, is_lightweight/0, get_lightweight_nodes/0, secure/0, + set_interceptors/1, is_lightweight/0, get_lightweight_nodes/0, secure/0, iiop_ssl_backlog/0, iiop_ssl_port/0, nat_iiop_ssl_port/0, nat_iiop_ssl_port/1, + ssl_server_opts/0, ssl_client_opts/0, set_ssl_client_opts/1, ssl_server_certfile/0, ssl_client_certfile/0, set_ssl_client_certfile/1, ssl_server_verify/0, ssl_client_verify/0, set_ssl_client_verify/1, ssl_server_depth/0, ssl_client_depth/0, set_ssl_client_depth/1, - ssl_server_cacertfile/0, ssl_client_cacertfile/0, + ssl_server_cacertfile/0, ssl_client_cacertfile/0, set_ssl_client_cacertfile/1, ssl_client_password/0, ssl_server_password/0, ssl_client_keyfile/0, ssl_server_keyfile/0, ssl_client_ciphers/0, ssl_server_ciphers/0, ssl_client_cachetimeout/0, - ssl_server_cachetimeout/0, get_flags/0, typechecking/0, + ssl_server_cachetimeout/0, + get_flags/0, typechecking/0, exclude_codeset_ctx/0, exclude_codeset_component/0, partial_security/0, use_CSIv2/0, use_FT/0, ip_version/0, light_ifr/0, bidir_context/0, get_debug_level/0, getaddrstr/2, addr2str/1, iiop_packet_size/0, - iiop_ssl_ip_address_local/0, ip_address_local/0, iiop_in_keepalive/0, + iiop_ssl_ip_address_local/0, ip_address_local/0, iiop_in_keepalive/0, iiop_out_keepalive/0, iiop_ssl_in_keepalive/0, iiop_ssl_out_keepalive/0, iiop_ssl_accept_timeout/0, ssl_generation/0]). @@ -87,38 +89,39 @@ [flags, iiop_port, nat_iiop_port, iiop_out_ports, domain, ip_address, nat_ip_address, giop_version, iiop_timeout, iiop_connection_timeout, iiop_setup_connection_timeout, iiop_in_connection_timeout, iiop_acl, - iiop_max_fragments, iiop_max_in_requests, iiop_max_in_connections, + iiop_max_fragments, iiop_max_in_requests, iiop_max_in_connections, iiop_backlog, objectkeys_gc_time, orbInitRef, orbDefaultInitRef, interceptors, local_interceptors, lightweight, ip_address_local, - secure, iiop_ssl_ip_address_local, iiop_ssl_backlog, - iiop_ssl_port, nat_iiop_ssl_port, ssl_server_certfile, - ssl_client_certfile, ssl_server_verify, ssl_client_verify, ssl_server_depth, - ssl_client_depth, ssl_server_cacertfile, ssl_client_cacertfile, - ssl_client_password, ssl_server_password, ssl_client_keyfile, - ssl_server_keyfile, ssl_client_ciphers, ssl_server_ciphers, + secure, iiop_ssl_ip_address_local, iiop_ssl_backlog, + iiop_ssl_port, nat_iiop_ssl_port, ssl_server_certfile, + ssl_client_certfile, ssl_server_verify, ssl_client_verify, ssl_server_depth, + ssl_client_depth, ssl_server_cacertfile, ssl_client_cacertfile, + ssl_client_password, ssl_server_password, ssl_client_keyfile, + ssl_server_keyfile, ssl_client_ciphers, ssl_server_ciphers, ssl_client_cachetimeout, ssl_server_cachetimeout, orber_debug_level, iiop_packet_size, iiop_in_keepalive, iiop_out_keepalive, - iiop_ssl_in_keepalive, iiop_ssl_out_keepalive, iiop_ssl_accept_timeout]). + iiop_ssl_in_keepalive, iiop_ssl_out_keepalive, iiop_ssl_accept_timeout, + ssl_server_opts, ssl_client_opts]). %% The 'flags' parameter must be first in the list. %-define(ENV_KEYS, -% [{flags, ?ORB_ENV_INIT_FLAGS}, {iiop_port, 4001}, nat_iiop_port, -% {iiop_out_ports, 0}, {domain, "ORBER"}, ip_address, nat_ip_address, -% {giop_version, {1, 1}}, {iiop_timeout, infinity}, -% {iiop_connection_timeout, infinity}, {iiop_setup_connection_timeout, infinity}, +% [{flags, ?ORB_ENV_INIT_FLAGS}, {iiop_port, 4001}, nat_iiop_port, +% {iiop_out_ports, 0}, {domain, "ORBER"}, ip_address, nat_ip_address, +% {giop_version, {1, 1}}, {iiop_timeout, infinity}, +% {iiop_connection_timeout, infinity}, {iiop_setup_connection_timeout, infinity}, % {iiop_in_connection_timeout, infinity}, {iiop_acl, []}, -% {iiop_max_fragments, infinity}, {iiop_max_in_requests, infinity}, -% {iiop_max_in_connections, infinity}, {iiop_backlog, 5}, -% {objectkeys_gc_time, infinity}, +% {iiop_max_fragments, infinity}, {iiop_max_in_requests, infinity}, +% {iiop_max_in_connections, infinity}, {iiop_backlog, 5}, +% {objectkeys_gc_time, infinity}, % {orbInitRef, undefined}, {orbDefaultInitRef, undefined}, % {interceptors, false}, {local_interceptors, false}, {lightweight, false}, -% {secure, no}, {iiop_ssl_backlog, 5}, {iiop_ssl_port, 4002}, +% {secure, no}, {iiop_ssl_backlog, 5}, {iiop_ssl_port, 4002}, % nat_iiop_ssl_port, {ssl_server_certfile, []}, {ssl_client_certfile, []}, -% {ssl_server_verify, 0}, {ssl_client_verify, 0}, {ssl_server_depth, 1}, -% {ssl_client_depth, 1}, {ssl_server_cacertfile, []}, +% {ssl_server_verify, 0}, {ssl_client_verify, 0}, {ssl_server_depth, 1}, +% {ssl_client_depth, 1}, {ssl_server_cacertfile, []}, % {ssl_client_cacertfile, []}, {ssl_client_password, []}, -% {ssl_server_password, []}, {ssl_client_keyfile, []}, -% {ssl_server_keyfile, []}, {ssl_client_ciphers, []}, +% {ssl_server_password, []}, {ssl_client_keyfile, []}, +% {ssl_server_keyfile, []}, {ssl_client_ciphers, []}, % {ssl_server_ciphers, []}, {ssl_client_cachetimeout, infinity}, % {ssl_server_cachetimeout, infinity}, {orber_debug_level, 0}]). @@ -129,33 +132,33 @@ %%----------------------------------------------------------------- %% External functions -%%----------------------------------------------------------------- %%----------------------------------------------------------------- -%% function : -%% Arguments: -%% Returns : -%% Exception: -%% Effect : +%%----------------------------------------------------------------- +%% function : +%% Arguments: +%% Returns : +%% Exception: +%% Effect : %%----------------------------------------------------------------- start(Opts) -> gen_server:start_link({local, orber_env}, ?MODULE, Opts, []). %%----------------------------------------------------------------- %% function : get_keys -%% Arguments: -%% Returns : -%% Exception: -%% Effect : +%% Arguments: +%% Returns : +%% Exception: +%% Effect : %%----------------------------------------------------------------- get_keys() -> ?ENV_KEYS. %%----------------------------------------------------------------- %% function : get_env -%% Arguments: -%% Returns : -%% Exception: -%% Effect : +%% Arguments: +%% Returns : +%% Exception: +%% Effect : %%----------------------------------------------------------------- get_env(Key) when is_atom(Key) -> case catch ets:lookup(?ENV_DB, Key) of @@ -164,13 +167,13 @@ get_env(Key) when is_atom(Key) -> _ -> undefined end. - + %%----------------------------------------------------------------- %% function : get_env -%% Arguments: -%% Returns : -%% Exception: -%% Effect : +%% Arguments: +%% Returns : +%% Exception: +%% Effect : %%----------------------------------------------------------------- set_env(Key, Value) when is_atom(Key) -> case catch ets:insert(?ENV_DB, #parameters{key = Key, value = Value}) of @@ -179,20 +182,20 @@ set_env(Key, Value) when is_atom(Key) -> _ -> undefined end. - + %%----------------------------------------------------------------- %% function : info %% Arguments: IoDervice - info_msg | string | io | {io, Dev} -%% Returns : -%% Exception: -%% Effect : +%% Returns : +%% Exception: +%% Effect : %%----------------------------------------------------------------- info() -> info(info_msg). info(IoDevice) -> - Info = + Info = case orber_tb:is_running() of true -> Info1 = create_main_info(), @@ -211,7 +214,7 @@ info(IoDevice) -> string -> Info; io -> - io:format("~s", [Info]); + io:format("~s", [Info]); {io, Dev} -> io:format(Dev, "~s", [Info]); _ -> @@ -220,14 +223,14 @@ info(IoDevice) -> create_main_info() -> {Major, Minor} = giop_version(), - [io_lib:format("======= Orber Execution Environment ======~n" + [io_lib:format("======= Orber Execution Environment ======~n" "Orber version.................: ~s~n" "Orber domain..................: ~s~n" "IIOP port number..............: ~p~n" "IIOP NAT port number..........: ~p~n" "Interface(s)..................: ~p~n" "Interface(s) NAT..............: ~p~n" - "Local Interface (default).....: ~p~n" + "Local Interface (default).....: ~p~n" "Nodes in domain...............: ~p~n" "GIOP version (default)........: ~p.~p~n" "IIOP out timeout..............: ~p msec~n" @@ -254,18 +257,18 @@ create_main_info() -> "Debug Level...................: ~p~n" "orbInitRef....................: ~p~n" "orbDefaultInitRef.............: ~p~n", - [?ORBVSN, domain(), iiop_port(), nat_iiop_port(), host(), + [?ORBVSN, domain(), iiop_port(), nat_iiop_port(), host(), nat_host(), ip_address_local(), orber:orber_nodes(), Major, Minor, - iiop_timeout(), iiop_connection_timeout(), + iiop_timeout(), iiop_connection_timeout(), iiop_setup_connection_timeout(), iiop_out_ports(), iiop_out_ports_attempts(), iiop_out_ports_random(), - orber:iiop_connections(out), orber:iiop_connections_pending(), - iiop_out_keepalive(), orber:iiop_connections(in), - iiop_in_connection_timeout(), iiop_in_keepalive(), - iiop_max_fragments(), iiop_max_in_requests(), + orber:iiop_connections(out), orber:iiop_connections_pending(), + iiop_out_keepalive(), orber:iiop_connections(in), + iiop_in_connection_timeout(), iiop_in_keepalive(), + iiop_max_fragments(), iiop_max_in_requests(), iiop_max_in_connections(), iiop_backlog(), iiop_acl(), - iiop_packet_size(), objectkeys_gc_time(), get_interceptors(), + iiop_packet_size(), objectkeys_gc_time(), get_interceptors(), get_local_interceptors(), get_debug_level(), get_ORBInitRef(), get_ORBDefaultInitRef()])]. @@ -277,7 +280,7 @@ create_flag_info(Info) -> FlagData = check_flags(?ORB_ENV_FLAGS, Flags, []), [Info, "System Flags Set..............: \n", FlagData, "\n"] end. - + check_flags([], _, Acc) -> Acc; check_flags([{Flag, Txt}|T], Flags, Acc) when ?ORB_FLAG_TEST(Flags, Flag) -> @@ -289,7 +292,7 @@ check_flags([_|T], Flags, Acc) -> create_security_info(no, Info) -> lists:flatten([Info, "=========================================\n"]); create_security_info(ssl, Info) -> - lists:flatten([Info, + lists:flatten([Info, io_lib:format("ORB security..................: ssl~n" "SSL generation................: ~p~n" "SSL IIOP in keepalive.........: ~p~n" @@ -316,26 +319,26 @@ create_security_info(ssl, Info) -> "SSL client ciphers............: ~p~n" "SSL client cachetimeout.......: ~p~n" "=========================================~n", - [ssl_generation(), iiop_ssl_port(), + [ssl_generation(), iiop_ssl_port(), iiop_ssl_in_keepalive(), iiop_ssl_out_keepalive(), - nat_iiop_ssl_port(), iiop_ssl_accept_timeout(), + nat_iiop_ssl_port(), iiop_ssl_accept_timeout(), iiop_ssl_backlog(), iiop_ssl_ip_address_local(), ssl_server_certfile(), ssl_server_verify(), - ssl_server_depth(), ssl_server_cacertfile(), - ssl_server_keyfile(), ssl_server_password(), + ssl_server_depth(), ssl_server_cacertfile(), + ssl_server_keyfile(), ssl_server_password(), ssl_server_ciphers(), ssl_server_cachetimeout(), - ssl_client_certfile(), ssl_client_verify(), - ssl_client_depth(), ssl_client_cacertfile(), + ssl_client_certfile(), ssl_client_verify(), + ssl_client_depth(), ssl_client_cacertfile(), ssl_client_keyfile(), ssl_client_password(), ssl_client_ciphers(), ssl_client_cachetimeout()])]). %%----------------------------------------------------------------- %% function : iiop_acl -%% Arguments: -%% Returns : -%% Exception: -%% Effect : +%% Arguments: +%% Returns : +%% Exception: +%% Effect : %%----------------------------------------------------------------- iiop_acl() -> case application:get_env(orber, iiop_acl) of @@ -352,7 +355,7 @@ iiop_packet_size() -> _ -> infinity end. - + iiop_port() -> case application:get_env(orber, iiop_port) of @@ -368,7 +371,7 @@ nat_iiop_port() -> Port; {ok, {local, Default, _NATList}} -> Default; - _ -> + _ -> iiop_port() end. @@ -378,7 +381,7 @@ nat_iiop_port(LocalPort) -> Port; {ok, {local, Default, NATList}} -> orber_tb:keysearch(LocalPort, NATList, Default); - _ -> + _ -> iiop_port() end. @@ -407,9 +410,9 @@ iiop_out_ports_attempts() -> _ -> 1 end. - -domain() -> + +domain() -> case application:get_env(orber, domain) of {ok, Domain} when is_list(Domain) -> Domain; @@ -449,7 +452,7 @@ nat_host([Host]) -> {ok,{multiple, [I|_] = IList}} when is_list(I) -> IList; {ok,{local, Default, NATList}} -> - [orber_tb:keysearch(Host, NATList, Default)]; + [orber_tb:keysearch(Host, NATList, Default)]; _ -> host() end. @@ -462,7 +465,7 @@ host() -> {ok,{multiple, [I|_] = IList}} when is_list(I) -> IList; %% IPv4. For IPv6 we only accept a string, but we must support this format - %% for IPv4 + %% for IPv4 {ok, {A1, A2, A3, A4}} when is_integer(A1+A2+A3+A4) -> [integer_to_list(A1) ++ "." ++ integer_to_list(A2) ++ "." ++ integer_to_list(A3) ++ "." ++ integer_to_list(A4)]; @@ -489,7 +492,7 @@ ip_address_local() -> _ -> [] end. - + ip_address() -> ip_address(ip_version()). @@ -526,7 +529,7 @@ addr2str({A1, A2, A3, A4, A5, A6, A7, A8}) -> int16_to_hex(A3) ++ ":" ++ int16_to_hex(A4) ++ ":" ++ int16_to_hex(A5) ++ ":" ++ int16_to_hex(A6) ++ ":" ++ int16_to_hex(A7) ++ ":" ++ int16_to_hex(A8). - + int16_to_hex(0) -> [$0]; @@ -613,7 +616,7 @@ iiop_max_fragments() -> _ -> infinity end. - + iiop_max_in_requests() -> case application:get_env(orber, iiop_max_in_requests) of {ok, Max} when is_integer(Max) andalso Max > 0 -> @@ -653,7 +656,7 @@ iiop_out_keepalive() -> _ -> false end. - + get_flags() -> @@ -706,9 +709,9 @@ bidir_context() -> ?ORB_FLAG_TEST(Flags, ?ORB_ENV_USE_BI_DIR_IIOP) -> [#'IOP_ServiceContext' {context_id=?IOP_BI_DIR_IIOP, - context_data = - #'IIOP_BiDirIIOPServiceContext'{listen_points = - [#'IIOP_ListenPoint'{host=host(), + context_data = + #'IIOP_BiDirIIOPServiceContext'{listen_points = + [#'IIOP_ListenPoint'{host=host(), port=iiop_port()}]}}]; true -> [] @@ -819,7 +822,7 @@ get_lightweight_nodes() -> _ -> false end. - + %%----------------------------------------------------------------- %% Security access operations (SSL) @@ -838,8 +841,8 @@ ssl_generation() -> V; _ -> 2 - end. - + end. + iiop_ssl_ip_address_local() -> case application:get_env(orber, iiop_ssl_ip_address_local) of {ok,I} when is_list(I) -> @@ -876,10 +879,10 @@ iiop_ssl_accept_timeout() -> case application:get_env(orber, iiop_ssl_accept_timeout) of {ok, N} when is_integer(N) -> N * 1000; - _ -> + _ -> infinity end. - + iiop_ssl_port() -> case application:get_env(orber, secure) of {ok, ssl} -> @@ -923,6 +926,52 @@ nat_iiop_ssl_port(LocalPort) -> -1 end. +ssl_server_opts() -> + case application:get_env(orber, ssl_server_opts) of + {ok, V1} when is_list(V1) -> + V1; + _ -> + [] + end. + +ssl_client_opts() -> + case application:get_env(orber, ssl_client_opts) of + {ok, V1} when is_list(V1) -> + V1; + _ -> + [] + end. + +check_ssl_opts(Value) -> + check_ssl_opts(Value, []). +check_ssl_opts([], []) -> + ok; +check_ssl_opts([], Acc) -> + {error, Acc}; +check_ssl_opts([{active, _} |T], Acc) -> + check_ssl_opts(T, [active |Acc]); +check_ssl_opts([{packet, _} |T], Acc) -> + check_ssl_opts(T, [packet |Acc]); +check_ssl_opts([{mode, _} |T], Acc) -> + check_ssl_opts(T, [mode |Acc]); +check_ssl_opts([list |T], Acc) -> + check_ssl_opts(T, [list |Acc]); +check_ssl_opts([binary |T], Acc) -> + check_ssl_opts(T, [binary |Acc]); +check_ssl_opts([_ |T], Acc) -> + check_ssl_opts(T, Acc). + +set_ssl_client_opts(Value) when is_list(Value) -> + case check_ssl_opts(Value) of + ok -> + ok; + {error, List} -> + exit(lists:flatten( + io_lib:format("TCP options ~p is not allowed in set_ssl_client_opts()", + [List]))) + end, + put(ssl_client_opts, Value), ok. + ssl_server_certfile() -> case application:get_env(orber, ssl_server_certfile) of {ok, V1} when is_list(V1) -> @@ -932,7 +981,7 @@ ssl_server_certfile() -> _ -> [] end. - + ssl_client_certfile() -> case get(ssl_client_certfile) of undefined -> @@ -950,7 +999,7 @@ ssl_client_certfile() -> set_ssl_client_certfile(Value) when is_list(Value) -> put(ssl_client_certfile, Value). - + ssl_server_verify() -> Verify = case application:get_env(orber, ssl_server_verify) of {ok, V} when is_integer(V) -> @@ -964,7 +1013,7 @@ ssl_server_verify() -> true -> 0 end. - + ssl_client_verify() -> Verify = case get(ssl_client_verify) of undefined -> @@ -986,7 +1035,7 @@ ssl_client_verify() -> set_ssl_client_verify(Value) when is_integer(Value) andalso Value =< 2 andalso Value >= 0 -> put(ssl_client_verify, Value), ok. - + ssl_server_depth() -> case application:get_env(orber, ssl_server_depth) of {ok, V1} when is_integer(V1) -> @@ -994,7 +1043,7 @@ ssl_server_depth() -> _ -> 1 end. - + ssl_client_depth() -> case get(ssl_client_depth) of undefined -> @@ -1010,7 +1059,7 @@ ssl_client_depth() -> set_ssl_client_depth(Value) when is_integer(Value) -> put(ssl_client_depth, Value), ok. - + ssl_server_cacertfile() -> @@ -1022,7 +1071,7 @@ ssl_server_cacertfile() -> _ -> [] end. - + ssl_client_cacertfile() -> case get(ssl_client_cacertfile) of undefined -> @@ -1040,7 +1089,7 @@ ssl_client_cacertfile() -> set_ssl_client_cacertfile(Value) when is_list(Value) -> put(ssl_client_cacertfile, Value), ok. - + ssl_client_password() -> case application:get_env(orber, ssl_client_password) of @@ -1108,10 +1157,10 @@ ssl_server_cachetimeout() -> %%----------------------------------------------------------------- %% function : configure -%% Arguments: -%% Returns : -%% Exception: -%% Effect : +%% Arguments: +%% Returns : +%% Exception: +%% Effect : %%----------------------------------------------------------------- configure(Key, Value) when is_atom(Key) -> configure(Key, Value, check); @@ -1125,10 +1174,10 @@ configure_override(Key, _) -> %%----------------------------------------------------------------- %% function : multi_configure -%% Arguments: -%% Returns : -%% Exception: -%% Effect : +%% Arguments: +%% Returns : +%% Exception: +%% Effect : %%----------------------------------------------------------------- multi_configure(KeyValueList) when is_list(KeyValueList) -> case orber_tb:is_loaded() of @@ -1144,7 +1193,7 @@ multi_configure(KeyValueList) when is_list(KeyValueList) -> end end; multi_configure(KeyValueList) -> - ?EFORMAT("Given configuration parameters not a Key-Value-pair list: ~p", + ?EFORMAT("Given configuration parameters not a Key-Value-pair list: ~p", [KeyValueList]). multi_configure_helper([], _) -> @@ -1237,7 +1286,7 @@ configure(iiop_port, Value, Status) when is_integer(Value) -> %% Set the NAT listen port configure(nat_iiop_port, Value, Status) when is_integer(Value) andalso Value > 0 -> do_safe_configure(nat_iiop_port, Value, Status); -configure(nat_iiop_port, {local, Value1, Value2}, Status) when is_integer(Value1) andalso +configure(nat_iiop_port, {local, Value1, Value2}, Status) when is_integer(Value1) andalso Value1 > 0 andalso is_list(Value2) -> do_safe_configure(nat_iiop_port, {local, Value1, Value2}, Status); @@ -1312,12 +1361,20 @@ configure(iiop_ssl_backlog, Value, Status) when is_integer(Value) andalso Value do_safe_configure(iiop_ssl_backlog, Value, Status); configure(nat_iiop_ssl_port, Value, Status) when is_integer(Value) andalso Value > 0 -> do_safe_configure(nat_iiop_ssl_port, Value, Status); -configure(nat_iiop_ssl_port, {local, Value1, Value2}, Status) when is_integer(Value1) andalso +configure(nat_iiop_ssl_port, {local, Value1, Value2}, Status) when is_integer(Value1) andalso Value1 > 0 andalso is_list(Value2) -> do_safe_configure(nat_iiop_ssl_port, {local, Value1, Value2}, Status); configure(iiop_ssl_port, Value, Status) when is_integer(Value) -> do_safe_configure(iiop_ssl_port, Value, Status); + +%% New SSL options +configure(ssl_server_opts, Value, Status) when is_list(Value) -> + do_safe_configure(ssl_server_opts, Value, Status); +configure(ssl_client_opts, Value, Status) when is_list(Value) -> + do_safe_configure(ssl_client_opts, Value, Status); + +%% Old SSL options configure(ssl_server_certfile, Value, Status) when is_list(Value) -> do_safe_configure(ssl_server_certfile, Value, Status); configure(ssl_server_certfile, Value, Status) when is_atom(Value) -> @@ -1434,9 +1491,9 @@ code_change(_OldVsn, State, _Extra) -> %%----------------------------------------------------------------- %% function : env -%% Arguments: -%% Returns : -%% Exception: +%% Arguments: +%% Returns : +%% Exception: %% Effect : Used when Key always exists (Default Value) %%----------------------------------------------------------------- env(Key) -> @@ -1445,10 +1502,10 @@ env(Key) -> %%----------------------------------------------------------------- %% function : init_env -%% Arguments: -%% Returns : -%% Exception: -%% Effect : +%% Arguments: +%% Returns : +%% Exception: +%% Effect : %%----------------------------------------------------------------- init_env() -> application:load(orber), diff --git a/lib/orber/src/orber_iiop_net.erl b/lib/orber/src/orber_iiop_net.erl index 58eba9f039..5620b5d94f 100644 --- a/lib/orber/src/orber_iiop_net.erl +++ b/lib/orber/src/orber_iiop_net.erl @@ -161,31 +161,51 @@ terminate(_Reason, _State) -> %%----------------------------------------------------------------- get_options(normal, _Options) -> []; -get_options(ssl, Options) -> - Verify = orber_tb:keysearch(ssl_server_verify, Options, - orber_env:ssl_server_verify()), - Depth = orber_tb:keysearch(ssl_server_depth, Options, - orber_env:ssl_server_depth()), - Cert = orber_tb:keysearch(ssl_server_certfile, Options, - orber_env:ssl_server_certfile()), - CaCert = orber_tb:keysearch(ssl_server_cacertfile, Options, - orber_env:ssl_server_cacertfile()), - Pwd = orber_tb:keysearch(ssl_server_password, Options, - orber_env:ssl_server_password()), - Key = orber_tb:keysearch(ssl_server_keyfile, Options, - orber_env:ssl_server_keyfile()), - Ciphers = orber_tb:keysearch(ssl_server_ciphers, Options, - orber_env:ssl_server_ciphers()), - Timeout = orber_tb:keysearch(ssl_server_cachetimeout, Options, - orber_env:ssl_server_cachetimeout()), - [{verify, Verify}, - {depth, Depth} | - ssl_server_extra_options([{certfile, Cert}, - {cacertfile, CaCert}, - {password, Pwd}, - {keyfile, Key}, - {ciphers, Ciphers}, - {cachetimeout, Timeout}], [])]. +get_options(ssl, Options) -> + SSLOpts = + case orber_tb:keysearch(ssl_server_opts, Options, + orber_env:ssl_server_opts()) of + [] -> + Verify = orber_tb:keysearch(ssl_server_verify, Options, + orber_env:ssl_server_verify()), + Depth = orber_tb:keysearch(ssl_server_depth, Options, + orber_env:ssl_server_depth()), + Cert = orber_tb:keysearch(ssl_server_certfile, Options, + orber_env:ssl_server_certfile()), + CaCert = orber_tb:keysearch(ssl_server_cacertfile, Options, + orber_env:ssl_server_cacertfile()), + Pwd = orber_tb:keysearch(ssl_server_password, Options, + orber_env:ssl_server_password()), + Key = orber_tb:keysearch(ssl_server_keyfile, Options, + orber_env:ssl_server_keyfile()), + Ciphers = orber_tb:keysearch(ssl_server_ciphers, Options, + orber_env:ssl_server_ciphers()), + Timeout = orber_tb:keysearch(ssl_server_cachetimeout, Options, + orber_env:ssl_server_cachetimeout()), + KeepAlive = orber_tb:keysearch(ssl_server_cachetimeout, Options, + orber_env:iiop_ssl_in_keepalive()), + [{verify, Verify}, + {depth, Depth}, + {certfile, Cert}, + {cacertfile, CaCert}, + {password, Pwd}, + {keyfile, Key}, + {ciphers, Ciphers}, + {cachetimeout, Timeout}, + {keepalive, KeepAlive}]; + Opts -> + case orber_tb:check_illegal_tcp_options(Opts) of + ok -> + check_old_ssl_server_options(Options), + Opts; + {error, IllegalOpts} -> + error_logger:error_report([{application, orber}, + "TCP options not allowed to set on a connection", + IllegalOpts]), + error("Illegal TCP option") + end + end, + ssl_server_extra_options(SSLOpts, []). %%----------------------------------------------------------------- %% Func: parse_options/2 @@ -266,23 +286,28 @@ handle_call({add, IP, Type, Port, AllOptions}, _From, State) -> Family = orber_env:ip_version(), case inet:getaddr(IP, Family) of {ok, IPTuple} -> - Options = [{ip, IPTuple}|get_options(Type, AllOptions)], - Ref = make_ref(), - ProxyOptions = filter_options(AllOptions, []), - case orber_socket:listen(Type, Port, Options, false) of - {ok, Listen, NewPort} -> - {ok, Pid} = orber_iiop_socketsup:start_accept(Type, Listen, Ref, - ProxyOptions), - link(Pid), - ets:insert(?CONNECTION_DB, #listen{pid = Pid, - socket = Listen, - port = NewPort, - type = Type, ref = Ref, - options = Options, - proxy_options = ProxyOptions}), - {reply, {ok, Ref}, State}; - Error -> - {reply, Error, State} + try [{ip, IPTuple} |get_options(Type, AllOptions)] of + Options -> + Ref = make_ref(), + ProxyOptions = filter_options(AllOptions, []), + case orber_socket:listen(Type, Port, Options, false) of + {ok, Listen, NewPort} -> + {ok, Pid} = orber_iiop_socketsup:start_accept(Type, Listen, Ref, + ProxyOptions), + link(Pid), + ets:insert(?CONNECTION_DB, #listen{pid = Pid, + socket = Listen, + port = NewPort, + type = Type, ref = Ref, + options = Options, + proxy_options = ProxyOptions}), + {reply, {ok, Ref}, State}; + Error -> + {reply, Error, State} + end + catch + error:Reason -> + {reply, {error, Reason}, State} end; Other -> {reply, Other, State} @@ -461,3 +486,31 @@ update_counter(#state{max_connections = infinity} = State, _) -> update_counter(State, Value) -> State#state{counter = State#state.counter + Value}. + +check_old_ssl_server_options(Options) -> + try + 0 = orber_tb:keysearch(ssl_server_verify, Options, + orber_env:ssl_server_verify()), + 1 = orber_tb:keysearch(ssl_server_depth, Options, + orber_env:ssl_server_depth()), + [] = orber_tb:keysearch(ssl_server_certfile, Options, + orber_env:ssl_server_certfile()), + [] = orber_tb:keysearch(ssl_server_cacertfile, Options, + orber_env:ssl_server_cacertfile()), + [] = orber_tb:keysearch(ssl_server_password, Options, + orber_env:ssl_server_password()), + [] = orber_tb:keysearch(ssl_server_keyfile, Options, + orber_env:ssl_server_keyfile()), + [] = orber_tb:keysearch(ssl_server_ciphers, Options, + orber_env:ssl_server_ciphers()), + infinity = orber_tb:keysearch(ssl_server_cachetimeout, Options, + orber_env:ssl_server_cachetimeout()), + false = orber_tb:keysearch(iiop_ssl_in_keepalive, Options, + orber_env:iiop_ssl_in_keepalive()) + catch + _:_ -> + io:format("hej\n",[]), + error_logger:warning_report([{application, orber}, + "Ignoring deprecated ssl server options used together with the ssl_server_opts"]) + end. + diff --git a/lib/orber/src/orber_iiop_pm.erl b/lib/orber/src/orber_iiop_pm.erl index bf36b353bc..d86de36939 100644 --- a/lib/orber/src/orber_iiop_pm.erl +++ b/lib/orber/src/orber_iiop_pm.erl @@ -108,44 +108,82 @@ connect(Host, Port, SocketType, Timeout, Chars, Wchars, Ctx) end. get_ssl_socket_options([]) -> - [{verify, orber:ssl_client_verify()}, - {depth, orber:ssl_client_depth()} | - ssl_client_extra_options([{certfile, orber:ssl_client_certfile()}, - {cacertfile, orber:ssl_client_cacertfile()}, - {password, orber:ssl_client_password()}, - {keyfile, orber:ssl_client_keyfile()}, - {ciphers, orber:ssl_client_ciphers()}, - {cachetimeout, orber:ssl_client_cachetimeout()}], [])]; + SSLOpts = + case orber_env:ssl_client_opts() of + [] -> + [{verify, orber_env:ssl_client_verify()}, + {depth, orber_env:ssl_client_depth()}, + {certfile, orber_env:ssl_client_certfile()}, + {cacertfile, orber_env:ssl_client_cacertfile()}, + {password, orber_env:ssl_client_password()}, + {keyfile, orber_env:ssl_client_keyfile()}, + {ciphers, orber_env:ssl_client_ciphers()}, + {cachetimeout, orber_env:ssl_client_cachetimeout()}, + {keepalive, orber_env:iiop_ssl_out_keepalive()}]; + Opts -> + case orber_tb:check_illegal_tcp_options(Opts) of + ok -> + check_old_ssl_client_options([]), + Opts; + {error, IllegalOpts} -> + error_logger:error_report([{application, orber}, + "TCP options not allowed to set on a connection", + IllegalOpts]), + error("Illegal TCP option") + end + end, + ssl_client_extra_options(SSLOpts, []); get_ssl_socket_options([#'IOP_ServiceContext' {context_id=?ORBER_GENERIC_CTX_ID, context_data = {configuration, Options}}|_]) -> - Verify = orber_tb:keysearch(ssl_client_verify, Options, - orber_env:ssl_client_verify()), - Depth = orber_tb:keysearch(ssl_client_depth, Options, - orber_env:ssl_client_depth()), - Cert = orber_tb:keysearch(ssl_client_certfile, Options, - orber_env:ssl_client_certfile()), - CaCert = orber_tb:keysearch(ssl_client_cacertfile, Options, - orber_env:ssl_client_cacertfile()), - Pwd = orber_tb:keysearch(ssl_client_password, Options, - orber_env:ssl_client_password()), - Key = orber_tb:keysearch(ssl_client_keyfile, Options, - orber_env:ssl_client_keyfile()), - Ciphers = orber_tb:keysearch(ssl_client_ciphers, Options, - orber_env:ssl_client_ciphers()), - Timeout = orber_tb:keysearch(ssl_client_cachetimeout, Options, - orber_env:ssl_client_cachetimeout()), - [{verify, Verify}, - {depth, Depth} | - ssl_client_extra_options([{certfile, Cert}, - {cacertfile, CaCert}, - {password, Pwd}, - {keyfile, Key}, - {ciphers, Ciphers}, - {cachetimeout, Timeout}], [])]; + SSLOpts = + case orber_tb:keysearch(ssl_client_opts, Options, + orber_env:ssl_client_opts()) of + [] -> + Verify = orber_tb:keysearch(ssl_client_verify, Options, + orber_env:ssl_client_verify()), + Depth = orber_tb:keysearch(ssl_client_depth, Options, + orber_env:ssl_client_depth()), + Cert = orber_tb:keysearch(ssl_client_certfile, Options, + orber_env:ssl_client_certfile()), + CaCert = orber_tb:keysearch(ssl_client_cacertfile, Options, + orber_env:ssl_client_cacertfile()), + Pwd = orber_tb:keysearch(ssl_client_password, Options, + orber_env:ssl_client_password()), + Key = orber_tb:keysearch(ssl_client_keyfile, Options, + orber_env:ssl_client_keyfile()), + Ciphers = orber_tb:keysearch(ssl_client_ciphers, Options, + orber_env:ssl_client_ciphers()), + Timeout = orber_tb:keysearch(ssl_client_cachetimeout, Options, + orber_env:ssl_client_cachetimeout()), + KeepAlive = orber_tb:keysearch(ssl_server_cachetimeout, Options, + orber_env:iiop_ssl_out_keepalive()), + [{verify, Verify}, + {depth, Depth}, + {certfile, Cert}, + {cacertfile, CaCert}, + {password, Pwd}, + {keyfile, Key}, + {ciphers, Ciphers}, + {cachetimeout, Timeout}, + {keepalive, KeepAlive}]; + Opts -> + case orber_tb:check_illegal_tcp_options(Opts) of + ok -> + check_old_ssl_client_options(Options), + Opts; + {error, IllegalOpts} -> + error_logger:error_report([{application, orber}, + "TCP options not allowed to set on a connection", + IllegalOpts]), + error("Illegal TCP option") + end + end, + ssl_client_extra_options(SSLOpts, []); get_ssl_socket_options([_|T]) -> get_ssl_socket_options(T). + ssl_client_extra_options([], Acc) -> Acc; ssl_client_extra_options([{_Type, []}|T], Acc) -> @@ -814,6 +852,36 @@ init_interceptors(Host, Port, {SHost, SPort}) -> %% Either 'false' or {Type, PIs}. Other end. + + +check_old_ssl_client_options(Options) -> + try + 0 = orber_tb:keysearch(ssl_client_verify, Options, + orber_env:ssl_client_verify()), + 1 = orber_tb:keysearch(ssl_client_depth, Options, + orber_env:ssl_client_depth()), + [] = orber_tb:keysearch(ssl_client_certfile, Options, + orber_env:ssl_client_certfile()), + [] = orber_tb:keysearch(ssl_client_cacertfile, Options, + orber_env:ssl_client_cacertfile()), + [] = orber_tb:keysearch(ssl_client_password, Options, + orber_env:ssl_client_password()), + [] = orber_tb:keysearch(ssl_client_keyfile, Options, + orber_env:ssl_client_keyfile()), + [] = orber_tb:keysearch(ssl_client_ciphers, Options, + orber_env:ssl_client_ciphers()), + infinity = orber_tb:keysearch(ssl_client_cachetimeout, Options, + orber_env:ssl_client_cachetimeout()), + false = orber_tb:keysearch(iiop_ssl_out_keepalive, Options, + orber_env:iiop_ssl_out_keepalive()) + + catch + _:_ -> + error_logger:warning_report([{application, orber}, + "Ignoring deprecated ssl client options used together with the ssl_client_opts"]) + end. + + %%----------------------------------------------------------------- diff --git a/lib/orber/src/orber_socket.erl b/lib/orber/src/orber_socket.erl index ec2cf8f42a..07a0e09ccc 100644 --- a/lib/orber/src/orber_socket.erl +++ b/lib/orber/src/orber_socket.erl @@ -14,8 +14,7 @@ %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% -%% %CopyrightEnd% +%%%% %CopyrightEnd% %% %% %%----------------------------------------------------------------- @@ -37,7 +36,7 @@ %%----------------------------------------------------------------- -export([start/0, connect/4, listen/3, listen/4, accept/2, accept/3, write/3, controlling_process/3, close/2, peername/2, sockname/2, - peerdata/2, peercert/2, sockdata/2, setopts/3, + peerdata/2, peercert/2, sockdata/2, setopts/3, clear/2, shutdown/3, post_accept/2, post_accept/3]). %%----------------------------------------------------------------- @@ -75,8 +74,6 @@ connect(Type, Host, Port, Options) -> case Type of normal -> [{keepalive, orber_env:iiop_out_keepalive()}|Options1]; - _ when Generation > 2 -> - [{keepalive, orber_env:iiop_ssl_out_keepalive()}|Options1]; _ -> Options1 end, @@ -251,8 +248,7 @@ listen(ssl, Port, Options, Exception) -> end, Options4 = if Generation > 2 -> - [{reuseaddr, true}, - {keepalive, orber_env:iiop_ssl_in_keepalive()}|Options3]; + [{reuseaddr, true} |Options3]; true -> Options3 end, @@ -362,8 +358,8 @@ peercert(ssl, Socket) -> ssl:peercert(Socket); peercert(Type, _Socket) -> orber:dbg("[~p] orber_socket:peercert(~p);~n" - "Only available for SSL sockets.", - [?LINE, Type], ?DEBUG_LEVEL), + "Only available for SSL sockets.", + [?LINE, Type], ?DEBUG_LEVEL), {error, ebadsocket}. %%----------------------------------------------------------------- diff --git a/lib/orber/src/orber_tb.erl b/lib/orber/src/orber_tb.erl index e6d5ee4400..cce95f7237 100644 --- a/lib/orber/src/orber_tb.erl +++ b/lib/orber/src/orber_tb.erl @@ -39,7 +39,8 @@ -compile({no_auto_import,[error/2]}). -export([wait_for_tables/1, wait_for_tables/2, wait_for_tables/3, is_loaded/0, is_loaded/1, is_running/0, is_running/1, - info/2, error/2, unique/1, keysearch/2, keysearch/3]). + info/2, error/2, unique/1, keysearch/2, keysearch/3, + check_illegal_tcp_options/1]). %%---------------------------------------------------------------------- %% Internal exports @@ -179,6 +180,38 @@ error(Format, Args) -> Args). + + + +%%---------------------------------------------------------------------- +%% function : check_illegal_tcp_options/1 +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%---------------------------------------------------------------------- +check_illegal_tcp_options(Options) -> + check_illegal_tcp_options(Options, []). + +check_illegal_tcp_options([],[]) -> + ok; +check_illegal_tcp_options([],IllegalOpts) -> + {error, IllegalOpts}; +check_illegal_tcp_options([{active, V} |T], IllegalOpts) -> + check_illegal_tcp_options(T,[{active, V} |IllegalOpts]); +check_illegal_tcp_options([{packet, V} |T], IllegalOpts) -> + check_illegal_tcp_options(T,[{packet, V} |IllegalOpts]); +check_illegal_tcp_options([{mode, V} |T], IllegalOpts) -> + check_illegal_tcp_options(T,[{mode, V} |IllegalOpts]); +check_illegal_tcp_options([list |T], IllegalOpts) -> + check_illegal_tcp_options(T,[list |IllegalOpts]); +check_illegal_tcp_options([binary |T], IllegalOpts) -> + check_illegal_tcp_options(T,[binary |IllegalOpts]); +check_illegal_tcp_options([{reuseaddr, V} |T], IllegalOpts) -> + check_illegal_tcp_options(T,[{reuseaddr, V} |IllegalOpts]); +check_illegal_tcp_options([H|T], IllegalOpts) -> + check_illegal_tcp_options(T, IllegalOpts). + %%---------------------------------------------------------------------- %% Internal functions %%---------------------------------------------------------------------- diff --git a/lib/orber/test/csiv2_SUITE.erl b/lib/orber/test/csiv2_SUITE.erl index 406a8ea693..60ffa1eb09 100644 --- a/lib/orber/test/csiv2_SUITE.erl +++ b/lib/orber/test/csiv2_SUITE.erl @@ -70,46 +70,46 @@ profiles = [#'IOP_TaggedProfile' {tag = ?TAG_INTERNET_IOP, - profile_data = + profile_data = #'IIOP_ProfileBody_1_1'{ iiop_version = #'IIOP_Version'{major = 1, minor = 2}, host = "127.0.0.1", port = 0, object_key = [0,86,66,1,0,0,0,24,47,70,77,65,95,67,73,82,80,77,65,78,95,80,79,65,95,83,69,67,85,82,69,0,0,0,0,4,0,0,4,186,0,0,2,10,81,218,65,185], - components = + components = [#'IOP_TaggedComponent'{tag = ?TAG_SSL_SEC_TRANS, component_data = #'SSLIOP_SSL'{ target_supports = 102, target_requires = 66, port = 49934}}, #'IOP_TaggedComponent'{tag = ?TAG_CSI_SEC_MECH_LIST, - component_data = + component_data = #'CSIIOP_CompoundSecMechList'{stateful = true, - mechanism_list = + mechanism_list = [#'CSIIOP_CompoundSecMech' {target_requires = 66, transport_mech = #'IOP_TaggedComponent'{ tag = ?TAG_TLS_SEC_TRANS, - component_data = + component_data = #'CSIIOP_TLS_SEC_TRANS'{ target_supports = 102, target_requires = 66, - addresses = + addresses = [#'CSIIOP_TransportAddress' {host_name = "127.0.0.1", port = 49934}]}}, - as_context_mech = + as_context_mech = #'CSIIOP_AS_ContextSec'{ target_supports = 0, target_requires = 0, client_authentication_mech = [], target_name = []}, - sas_context_mech = + sas_context_mech = #'CSIIOP_SAS_ContextSec'{ target_supports = 1024, target_requires = 0, - privilege_authorities = + privilege_authorities = [#'CSIIOP_ServiceConfiguration' {syntax = 1447174401, name = "Borland"}], @@ -124,7 +124,7 @@ supported_identity_types = 15}}]}}, #'IOP_TaggedComponent' {tag = ?TAG_CODE_SETS, - component_data = + component_data = #'CONV_FRAME_CodeSetComponentInfo'{'ForCharData' = #'CONV_FRAME_CodeSetComponent'{ native_code_set = 65537, @@ -151,15 +151,15 @@ -ifdef(false). %% PKIX1Explicit88 --define(AlgorithmIdentifier, +-define(AlgorithmIdentifier, #'AlgorithmIdentifier'{algorithm = ?OID, parameters = ?ANY}). -define(Validity, #'Validity'{notBefore = {utcTime, "19820102070533.8"}, notAfter = {generalTime, "19820102070533.8"}}). --define(SubjectPublicKeyInfo, - #'SubjectPublicKeyInfo'{algorithm = ?AlgorithmIdentifier, +-define(SubjectPublicKeyInfo, + #'SubjectPublicKeyInfo'{algorithm = ?AlgorithmIdentifier, subjectPublicKey = ?BIT_STR}). -define(AttributeTypeAndValue, @@ -178,26 +178,26 @@ -define(UniqueIdentifier, ?BIT_STR). --define(Extension, #'Extension'{extnID = ?OID, - critical = ?BOOLEAN, +-define(Extension, #'Extension'{extnID = ?OID, + critical = ?BOOLEAN, extnValue = ?OCTET_STR}). -define(Extensions, [?Extension]). -define(TBSCertificate, - #'TBSCertificate'{version = ?Version, - serialNumber = ?CertificateSerialNumber, - signature = ?AlgorithmIdentifier, - issuer = ?Name, - validity = ?Validity, - subject = ?Name, - subjectPublicKeyInfo = ?SubjectPublicKeyInfo, - issuerUniqueID = ?UniqueIdentifier, - subjectUniqueID = ?UniqueIdentifier, + #'TBSCertificate'{version = ?Version, + serialNumber = ?CertificateSerialNumber, + signature = ?AlgorithmIdentifier, + issuer = ?Name, + validity = ?Validity, + subject = ?Name, + subjectPublicKeyInfo = ?SubjectPublicKeyInfo, + issuerUniqueID = ?UniqueIdentifier, + subjectUniqueID = ?UniqueIdentifier, extensions = ?Extensions}). --define(Certificate, #'Certificate'{tbsCertificate = ?TBSCertificate, - signatureAlgorithm = ?AlgorithmIdentifier, +-define(Certificate, #'Certificate'{tbsCertificate = ?TBSCertificate, + signatureAlgorithm = ?AlgorithmIdentifier, signature = ?BIT_STR}). %% PKIX1Implicit88 @@ -206,66 +206,66 @@ -define(GeneralNames, [?GeneralName]). -%% PKIXAttributeCertificate --define(AttCertValidityPeriod, - #'AttCertValidityPeriod'{notBeforeTime = "19820102070533.8", +%% PKIXAttributeCertificate +-define(AttCertValidityPeriod, + #'AttCertValidityPeriod'{notBeforeTime = "19820102070533.8", notAfterTime = "19820102070533.8"}). --define(Attribute, #'Attribute'{type = ?OID, +-define(Attribute, #'Attribute'{type = ?OID, values = []}). -define(Attributes, [?Attribute]). --define(IssuerSerial, #'IssuerSerial'{issuer = ?GeneralNames, - serial = ?CertificateSerialNumber, +-define(IssuerSerial, #'IssuerSerial'{issuer = ?GeneralNames, + serial = ?CertificateSerialNumber, issuerUID = ?UniqueIdentifier}). -define(DigestedObjectType, publicKey). %% Enum --define(ObjectDigestInfo, - #'ObjectDigestInfo'{digestedObjectType = ?DigestedObjectType, - otherObjectTypeID = ?OID, - digestAlgorithm = ?AlgorithmIdentifier, +-define(ObjectDigestInfo, + #'ObjectDigestInfo'{digestedObjectType = ?DigestedObjectType, + otherObjectTypeID = ?OID, + digestAlgorithm = ?AlgorithmIdentifier, objectDigest = ?BIT_STR}). --define(V2Form, #'V2Form'{issuerName = ?GeneralNames, - baseCertificateID = ?IssuerSerial, +-define(V2Form, #'V2Form'{issuerName = ?GeneralNames, + baseCertificateID = ?IssuerSerial, objectDigestInfo = ?ObjectDigestInfo}). -define(AttCertVersion, v2). --define(Holder, #'Holder'{baseCertificateID = ?IssuerSerial, - entityName = ?GeneralNames, +-define(Holder, #'Holder'{baseCertificateID = ?IssuerSerial, + entityName = ?GeneralNames, objectDigestInfo = ?ObjectDigestInfo}). -define(AttCertIssuer, {v2Form, ?V2Form}). -define(AttributeCertificateInfo, - #'AttributeCertificateInfo'{version = ?AttCertVersion, - holder = ?Holder, - issuer = ?AttCertIssuer, - signature = ?AlgorithmIdentifier, - serialNumber = ?CertificateSerialNumber, + #'AttributeCertificateInfo'{version = ?AttCertVersion, + holder = ?Holder, + issuer = ?AttCertIssuer, + signature = ?AlgorithmIdentifier, + serialNumber = ?CertificateSerialNumber, attrCertValidityPeriod = ?AttCertValidityPeriod, - attributes = ?Attributes, - issuerUniqueID = ?UniqueIdentifier, + attributes = ?Attributes, + issuerUniqueID = ?UniqueIdentifier, extensions = ?Extensions}). --define(AttributeCertificate, - #'AttributeCertificate'{acinfo = ?AttributeCertificateInfo, - signatureAlgorithm = ?AlgorithmIdentifier, +-define(AttributeCertificate, + #'AttributeCertificate'{acinfo = ?AttributeCertificateInfo, + signatureAlgorithm = ?AlgorithmIdentifier, signatureValue = ?BIT_STR}). %% OrberCSIv2 --define(AttributeCertChain, - #'AttributeCertChain'{attributeCert = ?AttributeCertificate, +-define(AttributeCertChain, + #'AttributeCertChain'{attributeCert = ?AttributeCertificate, certificateChain = ?CertificateChain}). -define(CertificateChain, [?Certificate]). --define(VerifyingCertChain, [?Certificate]). +-define(VerifyingCertChain, [?Certificate]). -endif. @@ -314,15 +314,15 @@ %%----------------------------------------------------------------- %% Func: all/1 -%% Args: -%% Returns: +%% Args: +%% Returns: %%----------------------------------------------------------------- suite() -> [{ct_hooks,[ts_install_cth]}]. -all() -> +all() -> cases(). -groups() -> +groups() -> []. init_per_group(_GroupName, Config) -> @@ -335,7 +335,7 @@ end_per_group(_GroupName, Config) -> %% NOTE - the fragment test cases must bu first since we explicitly set a request %% id. Otherwise, the request-id counter would be increased and we cannot know %% what it is. -cases() -> +cases() -> [ssl_server_peercert_api, ssl_client_peercert_api]. %%----------------------------------------------------------------- @@ -361,14 +361,20 @@ end_per_testcase(_Case, Config) -> ok. init_per_suite(Config) -> - case orber_test_lib:ssl_version() of - no_ssl -> - {skip,"SSL is not installed!"}; - _ -> - Config + try crypto:start() of + ok -> + case orber_test_lib:ssl_version() of + no_ssl -> + {skip, "SSL is not installed!"}; + _ -> + Config + end + catch _:_ -> + {skip, "Crypto did not start"} end. end_per_suite(Config) -> + application:stop(crypto), Config. %%----------------------------------------------------------------- @@ -385,272 +391,272 @@ end_per_suite(Config) -> code_CertificateChain_api(doc) -> ["Code CertificateChain"]; code_CertificateChain_api(suite) -> []; code_CertificateChain_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('CertificateChain', ?CertificateChain)), - ?match({ok, [#'Certificate'{}]}, + ?match({ok, [#'Certificate'{}]}, 'OrberCSIv2':decode('CertificateChain', list_to_binary(Enc))), ok. code_AttributeCertChain_api(doc) -> ["Code AttributeCertChain"]; code_AttributeCertChain_api(suite) -> []; code_AttributeCertChain_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('AttributeCertChain', ?AttributeCertChain)), - ?match({ok, #'AttributeCertChain'{}}, - 'OrberCSIv2':decode('AttributeCertChain', list_to_binary(Enc))), + ?match({ok, #'AttributeCertChain'{}}, + 'OrberCSIv2':decode('AttributeCertChain', list_to_binary(Enc))), ok. code_VerifyingCertChain_api(doc) -> ["Code VerifyingCertChain"]; code_VerifyingCertChain_api(suite) -> []; code_VerifyingCertChain_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('VerifyingCertChain', ?VerifyingCertChain)), - ?match({ok, [#'Certificate'{}]}, - 'OrberCSIv2':decode('VerifyingCertChain', list_to_binary(Enc))), + ?match({ok, [#'Certificate'{}]}, + 'OrberCSIv2':decode('VerifyingCertChain', list_to_binary(Enc))), ok. %% PKIXAttributeCertificate code_AttributeCertificate_api(doc) -> ["Code AttributeCertificate"]; code_AttributeCertificate_api(suite) -> []; code_AttributeCertificate_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('AttributeCertificate', ?AttributeCertificate)), - ?match({ok, #'AttributeCertificate'{}}, - 'OrberCSIv2':decode('AttributeCertificate', list_to_binary(Enc))), + ?match({ok, #'AttributeCertificate'{}}, + 'OrberCSIv2':decode('AttributeCertificate', list_to_binary(Enc))), ok. code_AttributeCertificateInfo_api(doc) -> ["Code AttributeCertificateInfo"]; code_AttributeCertificateInfo_api(suite) -> []; code_AttributeCertificateInfo_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('AttributeCertificateInfo', ?AttributeCertificateInfo)), - ?match({ok, #'AttributeCertificateInfo'{}}, - 'OrberCSIv2':decode('AttributeCertificateInfo', list_to_binary(Enc))), + ?match({ok, #'AttributeCertificateInfo'{}}, + 'OrberCSIv2':decode('AttributeCertificateInfo', list_to_binary(Enc))), ok. code_AttCertVersion_api(doc) -> ["Code AttCertVersion"]; code_AttCertVersion_api(suite) -> []; code_AttCertVersion_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('AttCertVersion', ?AttCertVersion)), - ?match({ok, ?AttCertVersion}, - 'OrberCSIv2':decode('AttCertVersion', list_to_binary(Enc))), + ?match({ok, ?AttCertVersion}, + 'OrberCSIv2':decode('AttCertVersion', list_to_binary(Enc))), ok. code_Holder_api(doc) -> ["Code Holder"]; code_Holder_api(suite) -> []; code_Holder_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('Holder', ?Holder)), - ?match({ok, #'Holder'{}}, - 'OrberCSIv2':decode('Holder', list_to_binary(Enc))), + ?match({ok, #'Holder'{}}, + 'OrberCSIv2':decode('Holder', list_to_binary(Enc))), ok. code_AttCertIssuer_api(doc) -> ["Code AttCertIssuer"]; code_AttCertIssuer_api(suite) -> []; code_AttCertIssuer_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('AttCertIssuer', ?AttCertIssuer)), - ?match({ok, {v2Form, _}}, - 'OrberCSIv2':decode('AttCertIssuer', list_to_binary(Enc))), + ?match({ok, {v2Form, _}}, + 'OrberCSIv2':decode('AttCertIssuer', list_to_binary(Enc))), ok. code_AttCertValidityPeriod_api(doc) -> ["Code AttCertValidityPeriod"]; code_AttCertValidityPeriod_api(suite) -> []; code_AttCertValidityPeriod_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('AttCertValidityPeriod', ?AttCertValidityPeriod)), - ?match({ok, #'AttCertValidityPeriod'{}}, - 'OrberCSIv2':decode('AttCertValidityPeriod', list_to_binary(Enc))), + ?match({ok, #'AttCertValidityPeriod'{}}, + 'OrberCSIv2':decode('AttCertValidityPeriod', list_to_binary(Enc))), ok. code_V2Form_api(doc) -> ["Code V2Form"]; code_V2Form_api(suite) -> []; code_V2Form_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('V2Form', ?V2Form)), - ?match({ok, #'V2Form'{}}, - 'OrberCSIv2':decode('V2Form', list_to_binary(Enc))), + ?match({ok, #'V2Form'{}}, + 'OrberCSIv2':decode('V2Form', list_to_binary(Enc))), ok. code_IssuerSerial_api(doc) -> ["Code IssuerSerial"]; code_IssuerSerial_api(suite) -> []; code_IssuerSerial_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('IssuerSerial', ?IssuerSerial)), - ?match({ok, #'IssuerSerial'{}}, - 'OrberCSIv2':decode('IssuerSerial', list_to_binary(Enc))), + ?match({ok, #'IssuerSerial'{}}, + 'OrberCSIv2':decode('IssuerSerial', list_to_binary(Enc))), ok. code_ObjectDigestInfo_api(doc) -> ["Code ObjectDigestInfo"]; code_ObjectDigestInfo_api(suite) -> []; code_ObjectDigestInfo_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('ObjectDigestInfo', ?ObjectDigestInfo)), - ?match({ok, #'ObjectDigestInfo'{}}, - 'OrberCSIv2':decode('ObjectDigestInfo', list_to_binary(Enc))), + ?match({ok, #'ObjectDigestInfo'{}}, + 'OrberCSIv2':decode('ObjectDigestInfo', list_to_binary(Enc))), ok. %% PKIX1Explicit88 code_Certificate_api(doc) -> ["Code Certificate"]; code_Certificate_api(suite) -> []; code_Certificate_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('Certificate', ?Certificate)), - ?match({ok, #'Certificate'{}}, - 'OrberCSIv2':decode('Certificate', list_to_binary(Enc))), + ?match({ok, #'Certificate'{}}, + 'OrberCSIv2':decode('Certificate', list_to_binary(Enc))), ok. code_TBSCertificate_api(doc) -> ["Code TBSCertificate"]; code_TBSCertificate_api(suite) -> []; code_TBSCertificate_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('TBSCertificate', ?TBSCertificate)), - ?match({ok, #'TBSCertificate'{}}, - 'OrberCSIv2':decode('TBSCertificate', list_to_binary(Enc))), + ?match({ok, #'TBSCertificate'{}}, + 'OrberCSIv2':decode('TBSCertificate', list_to_binary(Enc))), ok. code_CertificateSerialNumber_api(doc) -> ["Code CertificateSerialNumber"]; code_CertificateSerialNumber_api(suite) -> []; code_CertificateSerialNumber_api(_Config) -> - {ok, Enc} = - ?match({ok, _}, + {ok, Enc} = + ?match({ok, _}, 'OrberCSIv2':encode('CertificateSerialNumber', ?CertificateSerialNumber)), - ?match({ok, ?CertificateSerialNumber}, - 'OrberCSIv2':decode('CertificateSerialNumber', list_to_binary(Enc))), + ?match({ok, ?CertificateSerialNumber}, + 'OrberCSIv2':decode('CertificateSerialNumber', list_to_binary(Enc))), ok. code_Version_api(doc) -> ["Code Version"]; code_Version_api(suite) -> []; code_Version_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('Version', ?Version)), - ?match({ok, ?Version}, 'OrberCSIv2':decode('Version', list_to_binary(Enc))), + ?match({ok, ?Version}, 'OrberCSIv2':decode('Version', list_to_binary(Enc))), ok. code_AlgorithmIdentifier_api(doc) -> ["Code AlgorithmIdentifier"]; code_AlgorithmIdentifier_api(suite) -> []; code_AlgorithmIdentifier_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('AlgorithmIdentifier', ?AlgorithmIdentifier)), - ?match({ok, #'AlgorithmIdentifier'{}}, - 'OrberCSIv2':decode('AlgorithmIdentifier', list_to_binary(Enc))), + ?match({ok, #'AlgorithmIdentifier'{}}, + 'OrberCSIv2':decode('AlgorithmIdentifier', list_to_binary(Enc))), ok. code_Name_api(doc) -> ["Code Name"]; code_Name_api(suite) -> []; code_Name_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('Name', ?Name)), - ?match({ok, {rdnSequence,_}}, - 'OrberCSIv2':decode('Name', list_to_binary(Enc))), + ?match({ok, {rdnSequence,_}}, + 'OrberCSIv2':decode('Name', list_to_binary(Enc))), ok. code_RDNSequence_api(doc) -> ["Code RDNSequence"]; code_RDNSequence_api(suite) -> []; code_RDNSequence_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('RDNSequence', ?RDNSequence)), - ?match({ok, [[#'AttributeTypeAndValue'{}]]}, - 'OrberCSIv2':decode('RDNSequence', list_to_binary(Enc))), + ?match({ok, [[#'AttributeTypeAndValue'{}]]}, + 'OrberCSIv2':decode('RDNSequence', list_to_binary(Enc))), ok. code_RelativeDistinguishedName_api(doc) -> ["Code RelativeDistinguishedName"]; code_RelativeDistinguishedName_api(suite) -> []; code_RelativeDistinguishedName_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('RelativeDistinguishedName', ?RelativeDistinguishedName)), - ?match({ok, [#'AttributeTypeAndValue'{}]}, - 'OrberCSIv2':decode('RelativeDistinguishedName', list_to_binary(Enc))), + ?match({ok, [#'AttributeTypeAndValue'{}]}, + 'OrberCSIv2':decode('RelativeDistinguishedName', list_to_binary(Enc))), ok. code_AttributeTypeAndValue_api(doc) -> ["Code AttributeTypeAndValue"]; code_AttributeTypeAndValue_api(suite) -> []; code_AttributeTypeAndValue_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('AttributeTypeAndValue', ?AttributeTypeAndValue)), - ?match({ok, #'AttributeTypeAndValue'{}}, - 'OrberCSIv2':decode('AttributeTypeAndValue', list_to_binary(Enc))), + ?match({ok, #'AttributeTypeAndValue'{}}, + 'OrberCSIv2':decode('AttributeTypeAndValue', list_to_binary(Enc))), ok. code_Attribute_api(doc) -> ["Code Attribute"]; code_Attribute_api(suite) -> []; code_Attribute_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('Attribute', ?Attribute)), - ?match({ok, #'Attribute'{}}, - 'OrberCSIv2':decode('Attribute', list_to_binary(Enc))), + ?match({ok, #'Attribute'{}}, + 'OrberCSIv2':decode('Attribute', list_to_binary(Enc))), ok. code_Validity_api(doc) -> ["Code Validity"]; code_Validity_api(suite) -> []; code_Validity_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('Validity', ?Validity)), - ?match({ok, #'Validity'{}}, - 'OrberCSIv2':decode('Validity', list_to_binary(Enc))), + ?match({ok, #'Validity'{}}, + 'OrberCSIv2':decode('Validity', list_to_binary(Enc))), ok. code_SubjectPublicKeyInfo_api(doc) -> ["Code SubjectPublicKeyInfo"]; code_SubjectPublicKeyInfo_api(suite) -> []; code_SubjectPublicKeyInfo_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('SubjectPublicKeyInfo', ?SubjectPublicKeyInfo)), - ?match({ok, #'SubjectPublicKeyInfo'{}}, - 'OrberCSIv2':decode('SubjectPublicKeyInfo', list_to_binary(Enc))), + ?match({ok, #'SubjectPublicKeyInfo'{}}, + 'OrberCSIv2':decode('SubjectPublicKeyInfo', list_to_binary(Enc))), ok. code_UniqueIdentifier_api(doc) -> ["Code UniqueIdentifier"]; code_UniqueIdentifier_api(suite) -> []; code_UniqueIdentifier_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('UniqueIdentifier', ?UniqueIdentifier)), - ?match({ok, _}, 'OrberCSIv2':decode('UniqueIdentifier', list_to_binary(Enc))), + ?match({ok, _}, 'OrberCSIv2':decode('UniqueIdentifier', list_to_binary(Enc))), ok. code_Extensions_api(doc) -> ["Code Extensions"]; code_Extensions_api(suite) -> []; code_Extensions_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('Extensions', ?Extensions)), - ?match({ok, [#'Extension'{}]}, - 'OrberCSIv2':decode('Extensions', list_to_binary(Enc))), + ?match({ok, [#'Extension'{}]}, + 'OrberCSIv2':decode('Extensions', list_to_binary(Enc))), ok. code_Extension_api(doc) -> ["Code Extension"]; code_Extension_api(suite) -> []; code_Extension_api(_Config) -> - {ok, Enc} = + {ok, Enc} = ?match({ok, _}, 'OrberCSIv2':encode('Extension', ?Extension)), - ?match({ok, #'Extension'{}}, - 'OrberCSIv2':decode('Extension', list_to_binary(Enc))), + ?match({ok, #'Extension'{}}, + 'OrberCSIv2':decode('Extension', list_to_binary(Enc))), ok. %% OpenSSL generated x509 Certificate code_OpenSSL509_api(doc) -> ["Code OpenSSL generated x509 Certificate"]; code_OpenSSL509_api(suite) -> []; code_OpenSSL509_api(_Config) -> - {ok, Cert} = - ?match({ok, #'Certificate'{}}, + {ok, Cert} = + ?match({ok, #'Certificate'{}}, 'OrberCSIv2':decode('Certificate', ?X509DER)), - AttrCertChain = #'AttributeCertChain'{attributeCert = ?AttributeCertificate, + AttrCertChain = #'AttributeCertChain'{attributeCert = ?AttributeCertificate, certificateChain = [Cert]}, - {ok, EAttrCertChain} = + {ok, EAttrCertChain} = ?match({ok, _}, 'OrberCSIv2':encode('AttributeCertChain', AttrCertChain)), - ?match({ok, #'AttributeCertChain'{}}, + ?match({ok, #'AttributeCertChain'{}}, 'OrberCSIv2':decode('AttributeCertChain', list_to_binary(EAttrCertChain))), ok. @@ -663,65 +669,65 @@ ssl_server_peercert_api(doc) -> ["Test ssl:peercert (server side)"]; ssl_server_peercert_api(suite) -> []; ssl_server_peercert_api(_Config) -> case os:type() of - vxworks -> - {skipped, "No SSL-support for VxWorks."}; - _ -> - Options = orber_test_lib:get_options(iiop_ssl, server, - 2, [{iiop_ssl_port, 0}]), - {ok, ServerNode, ServerHost} = - ?match({ok,_,_}, orber_test_lib:js_node(Options)), - ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), - SSLOptions = orber_test_lib:get_options(ssl, client), - {ok, Socket} = - ?match({ok, _}, fake_client_ORB(ssl, ServerHost, ServerPort, SSLOptions)), - {ok, _PeerCert} = ?match({ok, _}, orber_socket:peercert(ssl, Socket)), -%% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])), -%% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])), -% ?match({ok, #'Certificate'{}}, -% 'OrberCSIv2':decode('Certificate', PeerCert)), - destroy_fake_ORB(ssl, Socket), - ok + vxworks -> + {skipped, "No SSL-support for VxWorks."}; + _ -> + Options = orber_test_lib:get_options(iiop_ssl, server, + 2, [{iiop_ssl_port, 0}]), + {ok, ServerNode, ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node(Options)), + ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), + SSLOptions = orber_test_lib:get_options(ssl, client), + {ok, Socket} = + ?match({ok, _}, fake_client_ORB(ssl, ServerHost, ServerPort, SSLOptions)), + {ok, _PeerCert} = ?match({ok, _}, orber_socket:peercert(ssl, Socket)), + %% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])), + %% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])), + % ?match({ok, #'Certificate'{}}, + % 'OrberCSIv2':decode('Certificate', PeerCert)), + destroy_fake_ORB(ssl, Socket), + ok end. ssl_client_peercert_api(doc) -> ["Test ssl:peercert (client side)"]; ssl_client_peercert_api(suite) -> []; ssl_client_peercert_api(_Config) -> case os:type() of - vxworks -> - {skipped, "No SSL-support for VxWorks."}; - _ -> - Options = orber_test_lib:get_options(iiop_ssl, client, - 2, [{iiop_ssl_port, 0}]), - {ok, ClientNode, _ClientHost} = - ?match({ok,_,_}, orber_test_lib:js_node(Options)), - crypto:start(), - ssl:start(), - SSLOptions = orber_test_lib:get_options(ssl, server), - {ok, LSock} = ?match({ok, _}, ssl:listen(0, SSLOptions)), - {ok, {_Address, LPort}} = ?match({ok, {_, _}}, ssl:sockname(LSock)), - IOR = ?match({'IOP_IOR',_,_}, - iop_ior:create_external({1, 2}, "IDL:FAKE:1.0", - "localhost", 6004, "FAKE", - [#'IOP_TaggedComponent' - {tag=?TAG_SSL_SEC_TRANS, - component_data=#'SSLIOP_SSL' - {target_supports = 2, - target_requires = 2, - port = LPort}}])), - spawn(orber_test_lib, remote_apply, - [ClientNode, corba_object, non_existent, [IOR]]), - {ok, Socket} = ?match({ok, _}, ssl:transport_accept(LSock)), - ?match(ok, ssl:ssl_accept(Socket)), - - {ok, _PeerCert} = ?match({ok, _}, orber_socket:peercert(ssl, Socket)), -%% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])), -%% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])), -% ?match({ok, #'Certificate'{}}, -% 'OrberCSIv2':decode('Certificate', PeerCert)), - ssl:close(Socket), - ssl:close(LSock), - ssl:stop(), - ok + vxworks -> + {skipped, "No SSL-support for VxWorks."}; + _ -> + Options = orber_test_lib:get_options(iiop_ssl, client, + 2, [{iiop_ssl_port, 0}]), + {ok, ClientNode, _ClientHost} = + ?match({ok,_,_}, orber_test_lib:js_node(Options)), + crypto:start(), + ssl:start(), + SSLOptions = orber_test_lib:get_options(ssl, server), + {ok, LSock} = ?match({ok, _}, ssl:listen(0, SSLOptions)), + {ok, {_Address, LPort}} = ?match({ok, {_, _}}, ssl:sockname(LSock)), + IOR = ?match({'IOP_IOR',_,_}, + iop_ior:create_external({1, 2}, "IDL:FAKE:1.0", + "localhost", 6004, "FAKE", + [#'IOP_TaggedComponent' + {tag=?TAG_SSL_SEC_TRANS, + component_data=#'SSLIOP_SSL' + {target_supports = 2, + target_requires = 2, + port = LPort}}])), + spawn(orber_test_lib, remote_apply, + [ClientNode, corba_object, non_existent, [IOR]]), + {ok, Socket} = ?match({ok, _}, ssl:transport_accept(LSock)), + ?match(ok, ssl:ssl_accept(Socket)), + + {ok, _PeerCert} = ?match({ok, _}, orber_socket:peercert(ssl, Socket)), + %% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])), + %% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])), + % ?match({ok, #'Certificate'{}}, + % 'OrberCSIv2':decode('Certificate', PeerCert)), + ssl:close(Socket), + ssl:close(LSock), + ssl:stop(), + ok end. %%----------------------------------------------------------------- @@ -730,105 +736,105 @@ ssl_client_peercert_api(_Config) -> -ifdef(false). %% Not used yet. context_test(Obj) -> - IDToken1 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAbsent, + IDToken1 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAbsent, value = true}, - IDToken2 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAnonymous, + IDToken2 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAnonymous, value = false}, - IDToken3 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTPrincipalName, + IDToken3 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTPrincipalName, value = [0,255]}, - IDToken4 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTX509CertChain, + IDToken4 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTX509CertChain, value = [1,255]}, - IDToken5 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTDistinguishedName, + IDToken5 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTDistinguishedName, value = [2,255]}, - IDToken6 = #'CSI_IdentityToken'{label = ?ULONGMAX, + IDToken6 = #'CSI_IdentityToken'{label = ?ULONGMAX, value = [3,255]}, MTEstablishContext1 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken1, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken1, client_authentication_token = [1, 255]}}, MTEstablishContext2 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken2, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken2, client_authentication_token = [1, 255]}}, MTEstablishContext3 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken3, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken3, client_authentication_token = [1, 255]}}, MTEstablishContext4 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken4, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken4, client_authentication_token = [1, 255]}}, MTEstablishContext5 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken5, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken5, client_authentication_token = [1, 255]}}, MTEstablishContext6 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken6, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken6, client_authentication_token = [1, 255]}}, MTCompleteEstablishContext = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTCompleteEstablishContext, - value = #'CSI_CompleteEstablishContext'{client_context_id = ?ULONGLONGMAX, + {label = ?CSI_MsgType_MTCompleteEstablishContext, + value = #'CSI_CompleteEstablishContext'{client_context_id = ?ULONGLONGMAX, context_stateful = false, final_context_token = [1, 255]}}, MTContextError = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTContextError, + {label = ?CSI_MsgType_MTContextError, value = #'CSI_ContextError'{client_context_id = ?ULONGLONGMAX, - major_status = 1, - minor_status = 2, + major_status = 1, + minor_status = 2, error_token = [2,255]}}, MTMessageInContext = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTMessageInContext, - value = #'CSI_MessageInContext'{client_context_id = ?ULONGLONGMAX, + {label = ?CSI_MsgType_MTMessageInContext, + value = #'CSI_MessageInContext'{client_context_id = ?ULONGLONGMAX, discard_context = true}}, - Ctx = [#'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + Ctx = [#'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext1}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext2}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext3}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext4}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext5}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext6}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTCompleteEstablishContext}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTContextError}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTMessageInContext}], ?line ?match(ok, orber_test_server:testing_iiop_context(Obj, [{context, Ctx}])). @@ -836,7 +842,7 @@ context_test(Obj) -> fake_server_ORB(Type, Port, Options) -> start_ssl(Type), {ok, ListenSocket, NewPort} = - orber_socket:listen(Type, Port, + orber_socket:listen(Type, Port, [{active, false}|Options]), Socket = orber_socket:accept(Type, ListenSocket), orber_socket:post_accept(Type, Socket), @@ -846,7 +852,7 @@ fake_server_ORB(Type, Port, Options) -> fake_server_ORB(Type, Port, Options, Action, Data) -> start_ssl(Type), - {ok, ListenSocket, _NewPort} = + {ok, ListenSocket, _NewPort} = orber_socket:listen(Type, Port, [{active, false}|Options]), Socket = orber_socket:accept(Type, ListenSocket), orber_socket:post_accept(Type, Socket), @@ -885,13 +891,13 @@ fake_client_ORB(Type, Host, Port, Options, Action, Data) -> do_client_action(Type, Socket, fragments, FragList) -> ok = send_data(Type, Socket, FragList), {ok, Bytes} = gen_tcp:recv(Socket, 0), - {#reply_header{request_id = ?REQUEST_ID, reply_status = no_exception}, ok, [Par]} = + {#reply_header{request_id = ?REQUEST_ID, reply_status = no_exception}, ok, [Par]} = cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes), Par; do_client_action(Type, Socket, fragments_max, FragList) -> ok = send_data(Type, Socket, FragList), {ok, Bytes} = gen_tcp:recv(Socket, 0), - {#reply_header{request_id = ?REQUEST_ID, reply_status = system_exception}, Exc, []} = + {#reply_header{request_id = ?REQUEST_ID, reply_status = system_exception}, Exc, []} = cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes), Exc; do_client_action(Type, Socket, message_error, Data) -> @@ -916,4 +922,4 @@ send_data(_Type, _Socket, []) -> send_data(Type, Socket, [H|T]) -> orber_socket:write(Type, Socket, H), send_data(Type, Socket, T). - + diff --git a/lib/orber/test/multi_ORB_SUITE.erl b/lib/orber/test/multi_ORB_SUITE.erl index b9453663c3..3c1ffd59d3 100644 --- a/lib/orber/test/multi_ORB_SUITE.erl +++ b/lib/orber/test/multi_ORB_SUITE.erl @@ -50,30 +50,33 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, init_per_suite/1, end_per_suite/1, basic_PI_api/1, multi_orber_api/1, - init_per_testcase/2, end_per_testcase/2, multi_pseudo_orber_api/1, - light_orber_api/1, light_orber2_api/1, + init_per_testcase/2, end_per_testcase/2, multi_pseudo_orber_api/1, + light_orber_api/1, light_orber2_api/1, ssl_1_multi_orber_api/1, ssl_2_multi_orber_api/1, ssl_reconfigure_api/1, iiop_timeout_api/1, iiop_timeout_added_api/1, setup_connection_timeout_api/1, setup_multi_connection_timeout_api/1, setup_multi_connection_timeout_random_api/1, setup_multi_connection_timeout_attempts_api/1, - fragments_server_api/1, fragments_max_server_api/1, + fragments_server_api/1, fragments_max_server_api/1, fragments_max_server_added_api/1, fragments_client_api/1, light_ifr_api/1, max_requests_api/1, max_requests_added_api/1, - max_connections_api/1, max_packet_size_exceeded_api/1, + max_connections_api/1, max_packet_size_exceeded_api/1, max_packet_size_ok_api/1, proxy_interface_api/1, proxy_interface_ipv6_api/1, multiple_accept_api/1, implicit_context_api/1, - pseudo_implicit_context_api/1, pseudo_two_implicit_context_api/1, + pseudo_implicit_context_api/1, pseudo_two_implicit_context_api/1, oneway_implicit_context_api/1, implicit_context_roundtrip_api/1, oneway_pseudo_implicit_context_api/1, flags_added_api/1, - oneway_pseudo_two_implicit_context_api/1, + oneway_pseudo_two_implicit_context_api/1, local_interface_api/1, local_interface_ctx_override_api/1, local_interface_acl_override_api/1, bad_giop_header_api/1, bad_fragment_id_client_api/1, bad_id_cancel_request_api/1, close_connections_api/1, close_connections_local_interface_api/1, - close_connections_local_interface_ctx_override_api/1, ssl_reconfigure_generation_3_api/1, + close_connections_local_interface_ctx_override_api/1, ssl_1_multi_orber_generation_3_api/1, ssl_2_multi_orber_generation_3_api/1, + ssl_reconfigure_generation_3_api/1, + ssl_1_multi_orber_generation_3_api_old/1, ssl_2_multi_orber_generation_3_api_old/1, + ssl_reconfigure_generation_3_api_old/1, close_connections_alt_iiop_addr_api/1, close_connections_multiple_profiles_api/1]). @@ -84,15 +87,15 @@ %%----------------------------------------------------------------- %% Func: all/1 -%% Args: -%% Returns: +%% Args: +%% Returns: %%----------------------------------------------------------------- suite() -> [{ct_hooks,[ts_install_cth]}]. -all() -> +all() -> cases(). -groups() -> +groups() -> []. init_per_group(_GroupName, Config) -> @@ -105,7 +108,7 @@ end_per_group(_GroupName, Config) -> %% NOTE - the fragment test cases must be first since we explicitly set a request %% id. Otherwise, the request-id counter would be increased and we cannot know %% what it is. -cases() -> +cases() -> [fragments_server_api, fragments_max_server_api, fragments_max_server_added_api, fragments_client_api, flags_added_api, bad_fragment_id_client_api, @@ -134,21 +137,28 @@ cases() -> setup_multi_connection_timeout_attempts_api, setup_multi_connection_timeout_random_api, ssl_1_multi_orber_api, + ssl_1_multi_orber_generation_3_api_old, ssl_1_multi_orber_generation_3_api, ssl_2_multi_orber_api, + ssl_2_multi_orber_generation_3_api_old, ssl_2_multi_orber_generation_3_api, - ssl_reconfigure_generation_3_api, ssl_reconfigure_api]. + ssl_reconfigure_api, + ssl_reconfigure_generation_3_api_old, + ssl_reconfigure_generation_3_api]. %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- -init_per_testcase(TC,Config) +init_per_testcase(TC,Config) when TC =:= ssl_1_multi_orber_api; TC =:= ssl_2_multi_orber_api; TC =:= ssl_reconfigure_api -> init_ssl(Config); -init_per_testcase(TC,Config) - when TC =:= ssl_1_multi_orber_generation_3_api; +init_per_testcase(TC,Config) + when TC =:= ssl_1_multi_orber_generation_3_api_old; + TC =:= ssl_2_multi_orber_generation_3_api_old; + TC =:= ssl_reconfigure_generation_3_api_old; + TC =:= ssl_1_multi_orber_generation_3_api; TC =:= ssl_2_multi_orber_generation_3_api; TC =:= ssl_reconfigure_generation_3_api -> init_ssl_3(Config); @@ -156,21 +166,31 @@ init_per_testcase(_Case, Config) -> init_all(Config). init_ssl(Config) -> - case orber_test_lib:ssl_version() of - no_ssl -> - {skip,"SSL is not installed!"}; - _ -> - init_all(Config) + case ?config(crypto_started, Config) of + true -> + case orber_test_lib:ssl_version() of + no_ssl -> + {skip, "SSL is not installed!"}; + _ -> + init_all(Config) + end; + false -> + {skip, "Crypto did not start"} end. init_ssl_3(Config) -> - case orber_test_lib:ssl_version() of - 3 -> - init_all(Config); - 2 -> - {skip,"Could not find the correct SSL version!"}; - no_ssl -> - {skip,"SSL is not installed!"} + case ?config(crypto_started, Config) of + true -> + case orber_test_lib:ssl_version() of + 3 -> + init_all(Config); + 2 -> + {skip, "Could not find the correct SSL version!"}; + no_ssl -> + {skip, "SSL is not installed!"} + end; + false -> + {skip, "Crypto did not start"} end. init_all(Config) -> @@ -194,12 +214,18 @@ end_per_testcase(_Case, Config) -> init_per_suite(Config) -> if is_list(Config) -> - Config; + try crypto:start() of + ok -> + [{crypto_started, true} | Config] + catch _:_ -> + [{crypto_started, false} | Config] + end; true -> exit("Config not a list") end. end_per_suite(Config) -> + application:stop(crypto), Config. %%----------------------------------------------------------------- @@ -211,238 +237,238 @@ implicit_context_api(suite) -> []; implicit_context_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}, {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), %% Create a remote server - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")), - + Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([])), - ?match(ok, + ?match(ok, orber_test_server: - relay_call(Relay, + relay_call(Relay, [{context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {interface, Loopback}}]}], IOR)), - + ?match([_,_], orber:iiop_connections(out)), - Conns = ?match([_,_], + Conns = ?match([_,_], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ?match(true, lists:keymember(Loopback, 1, Conns)), ok. -implicit_context_roundtrip_api(doc) -> +implicit_context_roundtrip_api(doc) -> ["IIOP Implicit Contex roundtrip tests"]; implicit_context_roundtrip_api(suite) -> []; implicit_context_roundtrip_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}, {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), %% Create a remote server - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), Relay = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")), - + IOR = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [])), - ?match(ok, + ?match(ok, orber_test_server: - relay_call(Relay, + relay_call(Relay, [{context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {interface, Loopback}}]}], IOR)), ?match([_,_], orber:iiop_connections(out)), - Conns = ?match([_,_], + Conns = ?match([_,_], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ?match(true, lists:keymember(Loopback, 1, Conns)), ok. - - + + oneway_implicit_context_api(doc) -> ["IIOP Implicit Contex oneway tests"]; oneway_implicit_context_api(suite) -> []; oneway_implicit_context_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}, {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), %% Create a remote server - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")), - + Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([])), - ?match(ok, + ?match(ok, orber_test_server: - relay_cast(Relay, + relay_cast(Relay, [{context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {interface, Loopback}}]}], IOR)), - %% We must wait for a few seconds for the client to be able to set up the + %% We must wait for a few seconds for the client to be able to set up the %% connection (since it's a oneway operation). timer:sleep(5000), ?match([_,_], orber:iiop_connections(out)), - Conns = ?match([_,_], + Conns = ?match([_,_], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ?match(true, lists:keymember(Loopback, 1, Conns)), ok. - + pseudo_implicit_context_api(doc) -> ["IIOP Implicit Contex tests (via pseudo object)"]; pseudo_implicit_context_api(suite) -> []; pseudo_implicit_context_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}, {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), %% Create a remote server - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")), - + Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])), - ?match(ok, + ?match(ok, orber_test_server: - relay_call(Relay, + relay_call(Relay, [{context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {interface, Loopback}}]}], IOR)), ?match([_,_], orber:iiop_connections(out)), - Conns = ?match([_,_], + Conns = ?match([_,_], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ?match(true, lists:keymember(Loopback, 1, Conns)), ok. - -pseudo_two_implicit_context_api(doc) -> + +pseudo_two_implicit_context_api(doc) -> ["IIOP two Implicit Contex tests (via pseudo object)"]; pseudo_two_implicit_context_api(suite) -> []; pseudo_two_implicit_context_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}, {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), %% Create a remote server - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")), - + Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])), - put(oe_server_in_context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + put(oe_server_in_context, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, context_data = {interface, IP}}]), - ?match(ok, + ?match(ok, orber_test_server: - relay_call(Relay, + relay_call(Relay, [{context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {interface, Loopback}}]}], IOR)), ?match([_,_], orber:iiop_connections(out)), - Conns = ?match([_,_], + Conns = ?match([_,_], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ?match(true, lists:keymember(Loopback, 1, Conns)), ok. - + oneway_pseudo_implicit_context_api(doc) -> ["IIOP Implicit Contex tests (via pseudo object oneway)"]; oneway_pseudo_implicit_context_api(suite) -> []; oneway_pseudo_implicit_context_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}, {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), %% Create a remote server - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")), - + Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])), - ?match(ok, + ?match(ok, orber_test_server: - relay_cast(Relay, + relay_cast(Relay, [{context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {interface, Loopback}}]}], IOR)), ?match([_,_], orber:iiop_connections(out)), - Conns = ?match([_,_], + Conns = ?match([_,_], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ?match(true, lists:keymember(Loopback, 1, Conns)), ok. - -oneway_pseudo_two_implicit_context_api(doc) -> + +oneway_pseudo_two_implicit_context_api(doc) -> ["IIOP two Implicit Contex tests (via pseudo object oneway)"]; oneway_pseudo_two_implicit_context_api(suite) -> []; oneway_pseudo_two_implicit_context_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}, {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), %% Create a remote server - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")), - + Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])), %% Add incoming implicit context which must be removed. - put(oe_server_in_context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + put(oe_server_in_context, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, context_data = {interface, IP}}]), - ?match(ok, + ?match(ok, orber_test_server: - relay_cast(Relay, + relay_cast(Relay, [{context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {interface, Loopback}}]}], IOR)), ?match([_,_], orber:iiop_connections(out)), - Conns = ?match([_,_], + Conns = ?match([_,_], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ?match(true, lists:keymember(Loopback, 1, Conns)), ok. - + multiple_accept_api(doc) -> ["IIOP Multiple Accept tests"]; @@ -450,7 +476,7 @@ multiple_accept_api(suite) -> []; multiple_accept_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}, {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), @@ -461,84 +487,84 @@ multiple_accept_api(_Config) -> IOR1 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR1)), ?match([_], orber:iiop_connections(out)), {ok, Ref1} = ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, [Loopback, normal])), IOR2 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR2)), ?match([_,_], orber:iiop_connections(out)), {ok, Ref2} = ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, [Loopback, normal, 9543])), ?match({error, eaddrinuse}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, [Loopback, normal, 9543])), IOR3 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++Loopback++":9543/NameService")), - ?match({'external', {Loopback, 9543, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {Loopback, 9543, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR3)), ?match([_,_,_], orber:iiop_connections(out)), - ?match(ok, - orber_test_lib:remote_apply(ServerNode, orber, + ?match(ok, + orber_test_lib:remote_apply(ServerNode, orber, remove_listen_interface, [Ref1])), %% Wait a few seconds to be sure that the connections really has been removed. timer:sleep(4000), ?match([_,_], orber:iiop_connections(out)), - - ?match(ok, - orber_test_lib:remote_apply(ServerNode, orber, + + ?match(ok, + orber_test_lib:remote_apply(ServerNode, orber, remove_listen_interface, [Ref2])), %% Wait a few seconds to be sure that the connections really has been removed. timer:sleep(4000), ?match([_], orber:iiop_connections(out)), - + ?match({'EXCEPTION',_}, corba:string_to_object("corbaloc::1.2@"++Loopback++":9543/NameService")), ?match({'EXCEPTION',_}, corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")), - + IOR4 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR4)), ok. -proxy_interface_api(doc) -> ["IIOP Proxy Interface tests", +proxy_interface_api(doc) -> ["IIOP Proxy Interface tests", "This case test if the server ORB use the correct", "interface when exporting IOR:s"]; proxy_interface_api(suite) -> []; proxy_interface_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IOR1 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR1)), IOR2 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR2)), ok. -proxy_interface_ipv6_api(doc) -> ["IIOP Proxy Interface tests", +proxy_interface_ipv6_api(doc) -> ["IIOP Proxy Interface tests", "This case test if the server ORB use the correct", "IPv6 interface when exporting IOR:s"]; proxy_interface_ipv6_api(suite) -> []; @@ -550,103 +576,103 @@ proxy_interface_ipv6_api(_Config) -> Reason end. -proxy_interface_ipv6_api2() -> +proxy_interface_ipv6_api2() -> Loopback = orber_test_lib:get_loopback_interface(inet6), - {ok, ServerNode, _ServerHost} = - ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor ?ORB_ENV_LOCAL_INTERFACE)}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_IPV6}])), - + IP = orber_test_lib:remote_apply(ClientNode, orber_test_lib, get_host, []), IOR1 = ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, string_to_object, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])), - ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, orber_test_lib:remote_apply(ClientNode, iop_ior, get_key, [IOR1])), IOR2 = ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, string_to_object, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService"])), - ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, orber_test_lib:remote_apply(ClientNode, iop_ior, get_key, [IOR2])), ok. -local_interface_api(doc) -> ["IIOP Local Interface tests", +local_interface_api(doc) -> ["IIOP Local Interface tests", "This case test if the server ORB use the correct", "local interface when connecting to another ORB"]; local_interface_api(suite) -> []; local_interface_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, Loopback}])), Port = orber:iiop_port(), ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, string_to_object, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService"])), - [{Loopback, RemotePort}] = + [{Loopback, RemotePort}] = ?match([{Loopback,_RemotePort}], orber:iiop_connections(in)), - ?match([{IP, Port}], - orber_test_lib:remote_apply(ClientNode, orber, + ?match([{IP, Port}], + orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [out])), ?match([{IP, Port}], orber:find_sockname_by_peername(Loopback,RemotePort)), ?match([{Loopback, RemotePort}], orber:find_peername_by_sockname(IP, Port)), - ?match([{Loopback, RemotePort}], - orber_test_lib:remote_apply(ClientNode, orber, - find_sockname_by_peername, + ?match([{Loopback, RemotePort}], + orber_test_lib:remote_apply(ClientNode, orber, + find_sockname_by_peername, [IP, Port])), - ?match([{IP, Port}], - orber_test_lib:remote_apply(ClientNode, orber, - find_peername_by_sockname, + ?match([{IP, Port}], + orber_test_lib:remote_apply(ClientNode, orber, + find_peername_by_sockname, [Loopback,RemotePort])), ok. -local_interface_ctx_override_api(doc) -> - ["IIOP Local Interface tests", +local_interface_ctx_override_api(doc) -> + ["IIOP Local Interface tests", "This case test if the server ORB use the correct", "local interface when connecting to another ORB"]; local_interface_ctx_override_api(suite) -> []; local_interface_ctx_override_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, IP}])), Port = orber:iiop_port(), ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, string_to_object, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService", [#'IOP_ServiceContext' - {context_id=?ORBER_GENERIC_CTX_ID, + {context_id=?ORBER_GENERIC_CTX_ID, context_data = {interface, Loopback}}]])), - [{Loopback, RemotePort}] = + [{Loopback, RemotePort}] = ?match([{Loopback,_RemotePort}], orber:iiop_connections(in)), - ?match([{IP, Port, Loopback}], - orber_test_lib:remote_apply(ClientNode, orber, + ?match([{IP, Port, Loopback}], + orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [out])), ?match([{IP, Port}], orber:find_sockname_by_peername(Loopback,RemotePort)), ?match([{Loopback, RemotePort}], orber:find_peername_by_sockname(IP, Port)), - ?match([{Loopback, RemotePort}], - orber_test_lib:remote_apply(ClientNode, orber, - find_sockname_by_peername, + ?match([{Loopback, RemotePort}], + orber_test_lib:remote_apply(ClientNode, orber, + find_sockname_by_peername, [IP, Port])), - ?match([{IP, Port}], - orber_test_lib:remote_apply(ClientNode, orber, - find_peername_by_sockname, + ?match([{IP, Port}], + orber_test_lib:remote_apply(ClientNode, orber, + find_peername_by_sockname, [Loopback,RemotePort])), ok. -local_interface_acl_override_api(doc) -> - ["IIOP Local Interface tests", +local_interface_acl_override_api(doc) -> + ["IIOP Local Interface tests", "This case test if the server ORB use the correct", "local interface when connecting to another ORB"]; local_interface_acl_override_api(suite) -> []; @@ -654,74 +680,74 @@ local_interface_acl_override_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), ACL = [{tcp_out, IP ++ "/18", [Loopback]}], - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, IP}, {iiop_acl, ACL}, {flags, ?ORB_ENV_USE_ACL_OUTGOING}])), Port = orber:iiop_port(), ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, string_to_object, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService", [#'IOP_ServiceContext' - {context_id=?ORBER_GENERIC_CTX_ID, + {context_id=?ORBER_GENERIC_CTX_ID, context_data = {interface, IP}}]])), ?match([{Loopback,_RemotePort}], orber:iiop_connections(in)), ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, string_to_object, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService"])), - [{Loopback, RemotePort}] = + [{Loopback, RemotePort}] = ?match([{Loopback,_RemotePort}], orber:iiop_connections(in)), - ?match([{IP, Port, IP}], orber_test_lib:remote_apply(ClientNode, orber, + ?match([{IP, Port, IP}], orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [out])), ?match([{IP, Port}], orber:find_sockname_by_peername(Loopback,RemotePort)), ?match([{Loopback, RemotePort}], orber:find_peername_by_sockname(IP, Port)), - ?match([{Loopback, RemotePort}], - orber_test_lib:remote_apply(ClientNode, orber, - find_sockname_by_peername, + ?match([{Loopback, RemotePort}], + orber_test_lib:remote_apply(ClientNode, orber, + find_sockname_by_peername, [IP, Port])), - ?match([{IP, Port}], - orber_test_lib:remote_apply(ClientNode, orber, - find_peername_by_sockname, + ?match([{IP, Port}], + orber_test_lib:remote_apply(ClientNode, orber, + find_peername_by_sockname, [Loopback,RemotePort])), ok. -iiop_timeout_api(doc) -> ["IIOP TIMEOUT API tests", +iiop_timeout_api(doc) -> ["IIOP TIMEOUT API tests", "This case test if timeout configuration behaves correctly"]; iiop_timeout_api(suite) -> []; iiop_timeout_api(_Config) -> - + %% Install two secure orber. - {ok, ClientNode, ClientHost} = + {ok, ClientNode, ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node([{iiop_timeout, 6}, {iiop_connection_timeout, 3}, {iiop_in_connection_timeout, 3}])), ClientPort = orber_test_lib:remote_apply(ClientNode, orber, iiop_port, []), - - {ok, ServerNode, ServerHost} = + + {ok, ServerNode, ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{iiop_timeout, 6}, {iiop_connection_timeout, 3}, {iiop_in_connection_timeout, 12}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [timeout])), - %% Tell client_orb to interoperate with server_orb. - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, + %% Tell client_orb to interoperate with server_orb. + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, lookup, [ServerHost, ServerPort])), %% Interop worked fine, perform delay tests. - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, timeouts, [ServerHost, ServerPort, 6000])), - + %% Create a connection to the "client_orb", which will now act as server. - ?match({'IOP_IOR',_,_}, + ?match({'IOP_IOR',_,_}, corba:string_to_object("corbaloc::1.2@"++ClientHost++":"++integer_to_list(ClientPort)++"/NameService")), %% Check that the connection is established. ?match([{_, ClientPort}], orber:iiop_connections(out)), @@ -729,13 +755,13 @@ iiop_timeout_api(_Config) -> %% have been closed. timer:sleep(8000), ?match([], orber:iiop_connections(out)), - - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - uninstall_test_data, + + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, [timeout])), ok. -iiop_timeout_added_api(doc) -> ["IIOP TIMEOUT API tests", +iiop_timeout_added_api(doc) -> ["IIOP TIMEOUT API tests", "This case test if timeout configuration behaves correctly"]; iiop_timeout_added_api(suite) -> []; iiop_timeout_added_api(_Config) -> @@ -743,18 +769,18 @@ iiop_timeout_added_api(_Config) -> {ok, Node, _Host} = ?match({ok,_,_}, orber_test_lib:js_node([])), Port = 1 + orber_test_lib:remote_apply(Node, orber, iiop_port, []), ?match({ok, _}, - orber_test_lib:remote_apply(Node, orber, - add_listen_interface, - [IP, normal, + orber_test_lib:remote_apply(Node, orber, + add_listen_interface, + [IP, normal, [{iiop_in_connection_timeout, 3}, {flags, ?ORB_ENV_LOCAL_INTERFACE}, {iiop_port, Port}]])), - - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - install_test_data, + + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + install_test_data, [timeout])), - ?match({'IOP_IOR',_,_}, + ?match({'IOP_IOR',_,_}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService")), %% Check that the connection is established. ?match([{_, Port}], orber:iiop_connections(out)), @@ -762,9 +788,9 @@ iiop_timeout_added_api(_Config) -> %% have been closed. timer:sleep(8000), ?match([], orber:iiop_connections(out)), - - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - uninstall_test_data, + + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + uninstall_test_data, [timeout])), ok. @@ -772,27 +798,27 @@ iiop_timeout_added_api(_Config) -> %% API tests for ORB to ORB using pseudo call/cast, no security %%----------------------------------------------------------------- -multi_pseudo_orber_api(doc) -> - ["MULTI ORB PSEUDO API tests", +multi_pseudo_orber_api(doc) -> + ["MULTI ORB PSEUDO API tests", "This case test if data encode/decode (IIOP) for pseudo objects", "produce the correct result, i.e., the test_server echos", "the input parameter or an exception is raised (MARSHAL)."]; multi_pseudo_orber_api(suite) -> []; multi_pseudo_orber_api(_Config) -> %% --- Create a slave-node --- - {ok, Node, Host} = - ?match({ok,_,_}, orber_test_lib:js_node()), + {ok, Node, Host} = + ?match({ok,_,_}, orber_test_lib:js_node()), Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []), - - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - install_test_data, + + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + install_test_data, [pseudo])), - + NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_}, corba:string_to_object("corbaloc::1.1@"++Host++":"++ integer_to_list(Port)++"/NameService")), - Obj = - ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + Obj = + ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))), orber_test_lib:corba_object_tests(Obj, NSR), @@ -809,11 +835,11 @@ multi_pseudo_orber_api(_Config) -> orber_test_lib:test_coding(Obj), %% Test if exit is handled properly. - ?match({'EXCEPTION',{'TRANSIENT',_,_,_}}, + ?match({'EXCEPTION',{'TRANSIENT',_,_,_}}, orber_test_server:stop_brutal(Obj)), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + uninstall_test_data, [pseudo])), ok. @@ -821,77 +847,77 @@ multi_pseudo_orber_api(_Config) -> %%----------------------------------------------------------------- %% API tests for ORB to ORB with local flags definition set. %%----------------------------------------------------------------- -flags_added_api(doc) -> +flags_added_api(doc) -> ["MULTI ORB PSEUDO with local flags definition set"]; flags_added_api(suite) -> []; flags_added_api(_Config) -> %% --- Create a slave-node --- IP = orber_test_lib:get_host(), - {ok, Node, _Host} = - ?match({ok,_,_}, orber_test_lib:js_node([])), + {ok, Node, _Host} = + ?match({ok,_,_}, orber_test_lib:js_node([])), Port = 1 + orber_test_lib:remote_apply(Node, orber, iiop_port, []), ?match({ok, _}, - orber_test_lib:remote_apply(Node, orber, - add_listen_interface, - [IP, normal, + orber_test_lib:remote_apply(Node, orber, + add_listen_interface, + [IP, normal, [{flags, (?ORB_ENV_LOCAL_INTERFACE bor ?ORB_ENV_EXCLUDE_CODESET_COMPONENT)}, {iiop_port, Port}]])), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + install_test_data, [pseudo])), Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, corba:string_to_object("corbaname::1.1@"++IP++":"++ integer_to_list(Port)++"/NameService#mamba")), - ?match({'external', {IP, Port, _ObjectKey, _Counter, - #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, - profile_data= - #'IIOP_ProfileBody_1_1'{components=[]}}, - _NewHD}}, + ?match({'external', {IP, Port, _ObjectKey, _Counter, + #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, + profile_data= + #'IIOP_ProfileBody_1_1'{components=[]}}, + _NewHD}}, iop_ior:get_key(Obj)), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + uninstall_test_data, [pseudo])), ok. - + %%----------------------------------------------------------------- %% API tests for ORB to ORB with limited concurrent requests %%----------------------------------------------------------------- -max_requests_api(doc) -> +max_requests_api(doc) -> ["MULTI ORB PSEUDO with limited concurrent requests tests"]; max_requests_api(suite) -> []; max_requests_api(_Config) -> %% --- Create a slave-node --- - {ok, Node, Host} = - ?match({ok,_,_}, orber_test_lib:js_node([{iiop_max_in_requests, 1}])), + {ok, Node, Host} = + ?match({ok,_,_}, orber_test_lib:js_node([{iiop_max_in_requests, 1}])), Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []), max_requests(Node, Host, Port). -max_requests_added_api(doc) -> +max_requests_added_api(doc) -> ["MULTI ORB PSEUDO with limited concurrent requests tests"]; max_requests_added_api(suite) -> []; max_requests_added_api(_Config) -> %% --- Create a slave-node --- [IP] = ?match([_], orber:host()), - {ok, Node, _Host} = - ?match({ok,_,_}, orber_test_lib:js_node([])), + {ok, Node, _Host} = + ?match({ok,_,_}, orber_test_lib:js_node([])), Port = 1 + orber_test_lib:remote_apply(Node, orber, iiop_port, []), ?match({ok, _}, - orber_test_lib:remote_apply(Node, orber, - add_listen_interface, - [IP, normal, + orber_test_lib:remote_apply(Node, orber, + add_listen_interface, + [IP, normal, [{iiop_max_in_requests, 1}, {flags, ?ORB_ENV_LOCAL_INTERFACE}, {iiop_port, Port}]])), max_requests(Node, IP, Port). -max_requests(Node, Host, Port) -> - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - install_test_data, +max_requests(Node, Host, Port) -> + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + install_test_data, [pseudo])), Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, corba:string_to_object("corbaname::1.1@"++Host++":"++ @@ -899,7 +925,7 @@ max_requests(Node, Host, Port) -> %% Can we even contact the object? ?match(ok, orber_test_server:print(Obj)), - + %% Invoke one blocking call followed by several invokations. spawn(orber_test_server, pseudo_call_delay, [Obj, 15000]), %% Wait for a second to be sure that the previous request has been sent @@ -912,8 +938,8 @@ max_requests(Node, Host, Port) -> %% allow one request at a time to the target ORB. ?match(true, (MegaSecsB + (Before+8)*1000000) < (MegaSecsA + After*1000000)), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + uninstall_test_data, [pseudo])), ok. @@ -921,17 +947,17 @@ max_requests(Node, Host, Port) -> %%----------------------------------------------------------------- %% API tests for ORB to ORB with limited concurrent connections %%----------------------------------------------------------------- -max_connections_api(doc) -> +max_connections_api(doc) -> ["MULTI ORB PSEUDO with limited concurrent connections tests"]; max_connections_api(suite) -> []; max_connections_api(_Config) -> %% --- Create a slave-node --- - {ok, ServerNode, ServerHost} = + {ok, ServerNode, ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{iiop_backlog, 0}, {iiop_max_in_connections, 2}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), %% Claim connection 1 & 2 @@ -939,26 +965,26 @@ max_connections_api(_Config) -> corba:string_to_object("corbaname::1.2@"++ServerHost++":"++ integer_to_list(ServerPort)++"/NameService#mamba")), %% Claim backlog - {ok, ClientNode, _ClientHost} = - ?match({ok,_,_}, orber_test_lib:js_node()), + {ok, ClientNode, _ClientHost} = + ?match({ok,_,_}, orber_test_lib:js_node()), spawn(ClientNode, orber_test_server, print, [Obj]), timer:sleep(5000), ?match([_], orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [])), - + %% Try to connect. Should fail. Due to the behavior of different TCP stacks, backlog 1 %% might not be the precise value. Hence, we also need to define the iiop_timeout. Otherwise %% this test case will fail. For the same reason we must GC this connection. - {ok, ClientNodeII, _ClientHostII} = + {ok, ClientNodeII, _ClientHostII} = ?match({ok,_,_}, orber_test_lib:js_node([{iiop_setup_connection_timeout, 5}, {iiop_timeout, 5}, {iiop_connection_timeout, 8}])), - ?match({'EXCEPTION', _}, - orber_test_lib:remote_apply(ClientNodeII, orber_test_server, + ?match({'EXCEPTION', _}, + orber_test_lib:remote_apply(ClientNodeII, orber_test_server, testing_iiop_string, [Obj, "Fail"])), - + %% Remove 2 connections. We need to wait a moment so that both sides has detected it. timer:sleep(5000), ?match([_,_], orber:iiop_connections()), @@ -968,23 +994,23 @@ max_connections_api(_Config) -> ?match(ok, orber_iiop_pm:close_connection([{Host, Port}])), timer:sleep(5000), ?match([], orber:iiop_connections()), - + ?match([_], orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [])), ?match([], orber_test_lib:remote_apply(ClientNodeII, orber, iiop_connections, [])), - ?match({ok, "OK"}, - orber_test_lib:remote_apply(ClientNodeII, orber_test_server, + ?match({ok, "OK"}, + orber_test_lib:remote_apply(ClientNodeII, orber_test_server, testing_iiop_string, [Obj, "OK"])), - + timer:sleep(4000), ?match([_], orber_test_lib:remote_apply(ClientNodeII, orber, iiop_connections, [])), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, [pseudo])), ok. @@ -993,18 +1019,18 @@ max_connections_api(_Config) -> %%----------------------------------------------------------------- %% API tests for terminating connection by using an IOR. %%----------------------------------------------------------------- -close_connections_api(doc) -> +close_connections_api(doc) -> ["Close outgoing connection "]; close_connections_api(suite) -> []; close_connections_api(_Config) -> %% --- Create a slave-node --- IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IP = orber_test_lib:get_host(), @@ -1028,108 +1054,108 @@ close_connections_api(_Config) -> ok. -close_connections_local_interface_api(doc) -> - ["IIOP Local Interface disconnect tests", +close_connections_local_interface_api(doc) -> + ["IIOP Local Interface disconnect tests", "This case test if the server ORB use the correct", "local interface when connecting to another ORB"]; close_connections_local_interface_api(suite) -> []; close_connections_local_interface_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, Loopback}])), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{ip_address, IP}])), Port = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IOR = ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, string_to_object, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService"])), %% Check that the connnection is up and running using the default interface - ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber, + ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), - ?match([{IP, Port}], - orber_test_lib:remote_apply(ClientNode, orber, + ?match([{IP, Port}], + orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [out])), %% Try to close the connection - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber, close_connection, [IOR])), %% Wait a moment so that both sides has detected it. timer:sleep(5000), %% Now the connection shall be gone. - ?match([], orber_test_lib:remote_apply(ClientNode, orber, + ?match([], orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [out])), - ?match([], orber_test_lib:remote_apply(ServerNode, orber, + ?match([], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ok. -close_connections_local_interface_ctx_override_api(doc) -> - ["IIOP Local Interface disconnect tests", +close_connections_local_interface_ctx_override_api(doc) -> + ["IIOP Local Interface disconnect tests", "This case test if the server ORB use the correct", "local interface when connecting to another ORB"]; close_connections_local_interface_ctx_override_api(suite) -> []; close_connections_local_interface_ctx_override_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, IP}, {ip_address, IP}])), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{ip_address, IP}])), Port = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IOR = ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, string_to_object, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService", [#'IOP_ServiceContext' - {context_id=?ORBER_GENERIC_CTX_ID, + {context_id=?ORBER_GENERIC_CTX_ID, context_data = {interface, Loopback}}]])), timer:sleep(2000), %% Check that the connnection is up and running using the default interface - ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber, + ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), - - ?match([{IP, Port, Loopback}], - orber_test_lib:remote_apply(ClientNode, orber, + + ?match([{IP, Port, Loopback}], + orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [out])), %% Try to close not supplying the interface. - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber, close_connection, [IOR])), - + timer:sleep(2000), %% The connection shall still be up and running - ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber, + ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), - ?match([{IP, Port, Loopback}], - orber_test_lib:remote_apply(ClientNode, orber, + ?match([{IP, Port, Loopback}], + orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [out])), %% Try to close not supplying the interface. - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber, close_connection, [IOR, IP])), - timer:sleep(2000), + timer:sleep(2000), %% The connection shall still be up and running - ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber, + ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), - ?match([{IP, Port, Loopback}], - orber_test_lib:remote_apply(ClientNode, orber, + ?match([{IP, Port, Loopback}], + orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [out])), - + %% Try to close supplying the correct interface. - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber, close_connection, [IOR, Loopback])), %% Wait a moment so that both sides has detected it. timer:sleep(5000), %% Now the connection shall be gone. - ?match([], orber_test_lib:remote_apply(ServerNode, orber, + ?match([], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), - ?match([], orber_test_lib:remote_apply(ClientNode, orber, + ?match([], orber_test_lib:remote_apply(ClientNode, orber, iiop_connections, [out])), ok. -close_connections_alt_iiop_addr_api(doc) -> - ["IIOP alternate address disconnect tests", +close_connections_alt_iiop_addr_api(doc) -> + ["IIOP alternate address disconnect tests", "This case test if the server ORB use the correct", "local interface when connecting to another ORB"]; close_connections_alt_iiop_addr_api(suite) -> []; @@ -1137,12 +1163,12 @@ close_connections_alt_iiop_addr_api(_Config) -> %% --- Create a slave-node --- Loopback = orber_test_lib:get_loopback_interface(), IP = orber_test_lib:get_host(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{giop_version, {1, 2}}, {ip_address, {multiple, [IP, Loopback]}}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [{nameservice, Loopback, ServerPort}])), %% Create two connections Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, @@ -1151,25 +1177,25 @@ close_connections_alt_iiop_addr_api(_Config) -> ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, corba:string_to_object("corbaname::1.2@"++Loopback++":"++ integer_to_list(ServerPort)++"/NameService#mamba")), - timer:sleep(2000), + timer:sleep(2000), %% The connection shall still be up and running ?match([{_,_}, {_,_}], orber:iiop_connections(out)), ?match([{_,_}, {_,_}], - orber_test_lib:remote_apply(ServerNode, orber, + orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), - + %% Try to close the connection ?match(ok, orber:close_connection(Obj)), %% Wait a moment so that both sides has detected it. timer:sleep(5000), %% Now the connections shall be gone. ?match([], orber:iiop_connections(out)), - ?match([], orber_test_lib:remote_apply(ServerNode, orber, + ?match([], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ok. -close_connections_multiple_profiles_api(doc) -> - ["IIOP alternate address disconnect tests", +close_connections_multiple_profiles_api(doc) -> + ["IIOP alternate address disconnect tests", "This case test if the server ORB use the correct", "local interface when connecting to another ORB"]; close_connections_multiple_profiles_api(suite) -> []; @@ -1177,11 +1203,11 @@ close_connections_multiple_profiles_api(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), %% --- Create a slave-node --- - {ok, ServerNode, _ServerHost} = - ?match({ok,_,_}, orber_test_lib:js_node([{ip_address, + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node([{ip_address, {multiple, [Loopback, IP]}}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, install_test_data, [nameservice])), %% Create two connections Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, @@ -1193,23 +1219,23 @@ close_connections_multiple_profiles_api(_Config) -> %% The connection shall still be up and running ?match([{_,_}, {_,_}], orber:iiop_connections(out)), ?match([{_,_}, {_,_}], - orber_test_lib:remote_apply(ServerNode, orber, + orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), - + %% Try to close the connection ?match(ok, orber:close_connection(Obj)), %% Wait a moment so that both sides has detected it. timer:sleep(5000), %% Now the connections shall be gone. ?match([], orber:iiop_connections(out)), - ?match([], orber_test_lib:remote_apply(ServerNode, orber, + ?match([], orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])), ok. %%----------------------------------------------------------------- %% API tests for ORB to ORB with iiop_packet_size set %%----------------------------------------------------------------- -max_packet_size_exceeded_api(doc) -> +max_packet_size_exceeded_api(doc) -> ["Exceed the maximum request size"]; max_packet_size_exceeded_api(suite) -> []; max_packet_size_exceeded_api(_Config) -> @@ -1219,11 +1245,11 @@ max_packet_size_exceeded_api(_Config) -> {ok, LS} -> (catch gen_tcp:close(LS)), %% --- Create a slave-node --- - {ok, ServerNode, ServerHost} = + {ok, ServerNode, ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{iiop_packet_size, 1}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}}, + ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}}, corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")), ok end. @@ -1231,7 +1257,7 @@ max_packet_size_exceeded_api(_Config) -> %%----------------------------------------------------------------- %% API tests for ORB to ORB with iiop_packet_size set %%----------------------------------------------------------------- -max_packet_size_ok_api(doc) -> +max_packet_size_ok_api(doc) -> ["Not exceed the maximum request size"]; max_packet_size_ok_api(suite) -> []; max_packet_size_ok_api(_Config) -> @@ -1241,7 +1267,7 @@ max_packet_size_ok_api(_Config) -> {ok, LS} -> (catch gen_tcp:close(LS)), %% --- Create a slave-node --- - {ok, ServerNode, ServerHost} = + {ok, ServerNode, ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{iiop_packet_size, 5000}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), @@ -1251,7 +1277,7 @@ max_packet_size_ok_api(_Config) -> end. - + %%----------------------------------------------------------------- %% API tests for ORB to ORB, no security %%----------------------------------------------------------------- @@ -1259,49 +1285,49 @@ max_packet_size_ok_api(_Config) -> light_ifr_api(doc) -> ["LIGHT IFR ORB API tests"]; light_ifr_api(suite) -> []; light_ifr_api(_Config) -> - - {ok, ClientNode, _ClientHost} = + + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, 128}])), ?match([_,_,_,_], orber_test_lib:remote_apply(ClientNode, orber, get_tables, [])), - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, + install_test_data, [nameservice])), - {ok, ServerNode, ServerHost} = - ?match({ok,_,_}, orber_test_lib:js_node([{flags, 128}])), + {ok, ServerNode, ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node([{flags, 128}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), ?match([_,_,_,_], orber_test_lib:remote_apply(ServerNode, orber, get_tables, [])), - Obj = ?match({'IOP_IOR',_,_}, + Obj = ?match({'IOP_IOR',_,_}, corba:string_to_object("corbaname::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService#mamba")), ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, test_coding, [Obj])), ?match(0, orber_test_lib:remote_apply(ClientNode, orber_diagnostics, missing_modules, [])), - ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, + ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, [#orber_light_ifr{id = "FakeId1", - module=non_existing, + module=non_existing, type=?IFR_StructDef}])), - ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, + ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, [#orber_light_ifr{id = "FakeId2", - module=non_existing, + module=non_existing, type=?IFR_UnionDef}])), - ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, + ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, [#orber_light_ifr{id = "FakeId3", - module=non_existing, + module=non_existing, type=?IFR_ExceptionDef}])), - ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, + ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, [#orber_light_ifr{id = "FakeId4", - module=non_existing, + module=non_existing, type=?IFR_InterfaceDef}])), - ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, + ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write, [#orber_light_ifr{id = "FakeId5", - module=orber_test_lib, + module=orber_test_lib, type=?IFR_InterfaceDef}])), ?match(5, orber_test_lib:remote_apply(ClientNode, orber_diagnostics, missing_modules, [])), @@ -1316,14 +1342,14 @@ light_ifr_api(_Config) -> absolute_name="::Module::NonExisting"})), ?match(ok, mnesia:dirty_write(#ir_InterfaceDef{ir_Internal_ID = "FakedIId5", absolute_name="::orber::test::lib"})), - + ?match(5, orber_diagnostics:missing_modules()), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, [nameservice])), - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, + uninstall_test_data, [nameservice])), ok. @@ -1331,23 +1357,23 @@ light_ifr_api(_Config) -> %% API tests for ORB to ORB, no security %%----------------------------------------------------------------- -light_orber_api(doc) -> ["LIGHT ORB API tests", +light_orber_api(doc) -> ["LIGHT ORB API tests", "This case test if a light Orber can communicate correctly", "with an fully installed Orber."]; light_orber_api(suite) -> []; light_orber_api(_Config) -> %% --- Create a slave-node --- LocalHost = net_adm:localhost(), - {ok, Node, _Host} = + {ok, Node, _Host} = ?match({ok,_,_}, orber_test_lib:js_node([{lightweight, ["iiop://"++LocalHost++":"++integer_to_list(orber:iiop_port())]}], lightweight)), ?match(ok, orber:info(io)), ?match([_], orber_test_lib:remote_apply(Node, orber_env, get_lightweight_nodes,[])), - - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - install_test_data, + + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + install_test_data, [light])), - + Obj1=(catch orber_test_server:oe_create(state,[{pseudo,true}])), ?match({_,pseudo,orber_test_server_impl, _,_, _}, Obj1), Obj2=(catch orber_test_server:oe_create(state,[])), @@ -1357,11 +1383,11 @@ light_orber_api(_Config) -> 'CosNaming_NamingContext':bind(NS, lname:new(["mamba"]), Obj1), 'CosNaming_NamingContext':bind(NS, lname:new(["viper"]), Obj2), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, light_tests, [LocalHost, orber:iiop_port(), "viper"])), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, light_tests, [LocalHost, orber:iiop_port(), "mamba"])), @@ -1370,17 +1396,17 @@ light_orber_api(_Config) -> catch corba:dispose(Obj1), catch corba:dispose(Obj2), - catch 'CosNaming_NamingContext':destroy(NS), + catch 'CosNaming_NamingContext':destroy(NS), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + uninstall_test_data, [light])), ok. %%----------------------------------------------------------------- %% API tests for ORB to ORB, no security %%----------------------------------------------------------------- -light_orber2_api(doc) -> ["LIGHT ORB API tests", +light_orber2_api(doc) -> ["LIGHT ORB API tests", "This case test if a light Orber can communicate correctly", "with an fully installed Orber. This case test if we can", "start as lightweight without first setting the environment", @@ -1389,16 +1415,16 @@ light_orber2_api(suite) -> []; light_orber2_api(_Config) -> %% --- Create a slave-node --- LocalHost = net_adm:localhost(), - {ok, Node, _Host} = - ?match({ok,_,_}, orber_test_lib:js_node([], + {ok, Node, _Host} = + ?match({ok,_,_}, orber_test_lib:js_node([], {lightweight, ["iiop://"++LocalHost++":"++integer_to_list(orber:iiop_port())]})), ?match(ok, orber:info(io)), ?match([_], orber_test_lib:remote_apply(Node, orber_env, get_lightweight_nodes,[])), - - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - install_test_data, + + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + install_test_data, [light])), - + Obj1=(catch orber_test_server:oe_create(state,[{pseudo,true}])), ?match({_,pseudo,orber_test_server_impl, _,_, _}, Obj1), Obj2=(catch orber_test_server:oe_create(state,[])), @@ -1407,12 +1433,12 @@ light_orber2_api(_Config) -> NS = corba:resolve_initial_references("NameService"), 'CosNaming_NamingContext':bind(NS, lname:new(["mamba"]), Obj1), 'CosNaming_NamingContext':bind(NS, lname:new(["viper"]), Obj2), - - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, light_tests, [LocalHost, orber:iiop_port(), "viper"])), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, light_tests, [LocalHost, orber:iiop_port(), "mamba"])), @@ -1421,10 +1447,10 @@ light_orber2_api(_Config) -> catch corba:dispose(Obj1), catch corba:dispose(Obj2), - catch 'CosNaming_NamingContext':destroy(NS), + catch 'CosNaming_NamingContext':destroy(NS), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + uninstall_test_data, [light])), ok. @@ -1432,13 +1458,13 @@ light_orber2_api(_Config) -> %% API tests for ORB to ORB, no security %%----------------------------------------------------------------- -multi_orber_api(doc) -> ["MULTI ORB API tests", +multi_orber_api(doc) -> ["MULTI ORB API tests", "This case test if data encode/decode (IIOP)", "produce the correct result, i.e., the test_server echos", "the input parameter or an exception is raised (MARSHAL)."]; multi_orber_api(suite) -> []; multi_orber_api(_Config) -> - + NewICObj1 = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([])), NewICObj2 = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{regname, {local, newic2}}])), NewICObj3 = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{regname, {global, newic3}}])), @@ -1448,34 +1474,34 @@ multi_orber_api(_Config) -> catch corba:dispose(NewICObj1), catch corba:dispose(NewICObj2), catch corba:dispose(NewICObj3), - + %% --- Create a slave-node --- - {ok, Node, Host} = - ?match({ok,_,_}, orber_test_lib:js_node()), + {ok, Node, Host} = + ?match({ok,_,_}, orber_test_lib:js_node()), Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []), - - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - install_test_data, + + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + install_test_data, [nameservice])), - + NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_}, corba:string_to_object("corbaloc::1.2@"++Host++":"++ integer_to_list(Port)++"/NameService")), - + ?match({'EXCEPTION',{'CosNaming_NamingContext_NotFound',_,_,_}}, 'CosNaming_NamingContext':resolve(NSR, lname:new(["not_exist"]))), - Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))), ?match(ok, orber_test_server:print(Obj)), - Obj12B = ?match({'IOP_IOR',_,_}, + Obj12B = ?match({'IOP_IOR',_,_}, corba:string_to_object("corbaloc::1.2@"++Host++":"++integer_to_list(Port)++"/Mamba")), - - Obj11B = ?match({'IOP_IOR',_,_}, + + Obj11B = ?match({'IOP_IOR',_,_}, corba:string_to_object("corbaloc::1.1@"++Host++":"++integer_to_list(Port)++"/Mamba")), - Obj10B = ?match({'IOP_IOR',_,_}, + Obj10B = ?match({'IOP_IOR',_,_}, corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Mamba")), context_test(Obj12B), @@ -1484,7 +1510,7 @@ multi_orber_api(_Config) -> ?match(ok, orber_test_server:print(Obj12B)), ?match(ok, orber_test_server:print(Obj11B)), ?match(ok, orber_test_server:print(Obj10B)), - ?match({'EXCEPTION',{'CosNaming_NamingContextExt_InvalidAddress',_}}, + ?match({'EXCEPTION',{'CosNaming_NamingContextExt_InvalidAddress',_}}, corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Wrong")), ?match(ok, orber_test_lib:corba_object_tests(Obj12B, NSR)), @@ -1493,22 +1519,22 @@ multi_orber_api(_Config) -> %%--- Testing code and decode arguments --- orber_test_lib:test_coding(Obj), - - ?match({'EXCEPTION',#'BAD_CONTEXT'{}}, + + ?match({'EXCEPTION',#'BAD_CONTEXT'{}}, orber_test_server: - print(Obj12B, + print(Obj12B, [{context, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, + [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {interface, {127,0,0,1}}}]}])), - - ?match({'EXCEPTION',{'TRANSIENT',_,_,_}}, + + ?match({'EXCEPTION',{'TRANSIENT',_,_,_}}, orber_test_server:stop_brutal(Obj12B)), - ?match({'EXCEPTION',{'TRANSIENT',_,_,_}}, + ?match({'EXCEPTION',{'TRANSIENT',_,_,_}}, orber_test_server:print(Obj12B)), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + uninstall_test_data, [nameservice])), ok. @@ -1516,9 +1542,9 @@ multi_orber_api(_Config) -> %%----------------------------------------------------------------- %% API tests for ORB to ORB, no security, using basic interceptors %%----------------------------------------------------------------- -basic_PI_api(doc) -> ["MULTI ORB API tests", +basic_PI_api(doc) -> ["MULTI ORB API tests", "This case test if data encode/decode (IIOP)", - "produce the correct result when using basic interceptors,", + "produce the correct result when using basic interceptors,", "i.e., the test_server echos", "the input parameter or an exception is raised (MARSHAL)."]; basic_PI_api(suite) -> []; @@ -1526,21 +1552,21 @@ basic_PI_api(_Config) -> %% Change configuration to use Basic Interceptors. orber:configure_override(interceptors, {native, [orber_test_lib]}), %% --- Create a slave-node --- - {ok, Node, Host} = - ?match({ok,_,_}, orber_test_lib:js_node([{interceptors, {native, [orber_test_lib]}}])), + {ok, Node, Host} = + ?match({ok,_,_}, orber_test_lib:js_node([{interceptors, {native, [orber_test_lib]}}])), Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []), - - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - install_test_data, + + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + install_test_data, [nameservice])), - - Obj12 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + + Obj12 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, corba:string_to_object("corbaname::1.2@"++Host++":"++integer_to_list(Port)++"/NameService#mamba")), - - Obj11 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + + Obj11 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, corba:string_to_object("corbaname::1.1@"++Host++":"++integer_to_list(Port)++"/NameService#mamba")), - - Obj10 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + + Obj10 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, corba:string_to_object("corbaname::1.0@"++Host++":"++integer_to_list(Port)++"/NameService#mamba")), ?match(ok, corba:print_object(Obj12)), @@ -1552,13 +1578,13 @@ basic_PI_api(_Config) -> ?match(ok, orber_test_server:print(Obj10)), - Obj12B = ?match({'IOP_IOR',_,_}, + Obj12B = ?match({'IOP_IOR',_,_}, corba:string_to_object("corbaloc::1.2@"++Host++":"++integer_to_list(Port)++"/Mamba")), - - Obj11B = ?match({'IOP_IOR',_,_}, + + Obj11B = ?match({'IOP_IOR',_,_}, corba:string_to_object("corbaloc::1.1@"++Host++":"++integer_to_list(Port)++"/Mamba")), - - Obj10B = ?match({'IOP_IOR',_,_}, + + Obj10B = ?match({'IOP_IOR',_,_}, corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Mamba")), ?match(ok, corba:print_object(Obj12B, info_msg)), @@ -1568,7 +1594,7 @@ basic_PI_api(_Config) -> ?match(ok, orber_test_server:print(Obj12B)), ?match(ok, orber_test_server:print(Obj11B)), ?match(ok, orber_test_server:print(Obj10B)), - ?match({'EXCEPTION',{'CosNaming_NamingContextExt_InvalidAddress',_}}, + ?match({'EXCEPTION',{'CosNaming_NamingContextExt_InvalidAddress',_}}, corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Wrong")), ?match(ok, orber_test_lib:alternate_iiop_address(Host, Port)), @@ -1583,8 +1609,8 @@ basic_PI_api(_Config) -> application:set_env(orber, interceptors, false), - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + uninstall_test_data, [nameservice])), ok. @@ -1593,62 +1619,95 @@ basic_PI_api(_Config) -> %% API tests for ORB to ORB, ssl security depth 1 %%----------------------------------------------------------------- -ssl_1_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", +ssl_1_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", "This case set up two secure orbs and test if they can", "communicate. The case also test to access one of the", "secure orbs which must raise a NO_PERMISSION exception."]; ssl_1_multi_orber_api(suite) -> []; ssl_1_multi_orber_api(_Config) -> - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server, 1, [{iiop_ssl_port, 0}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client, 1, [{iiop_ssl_port, 0}]), ssl_suite(ServerOptions, ClientOptions). - -ssl_1_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", + + +ssl_1_multi_orber_generation_3_api_old(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", + "This case set up two secure orbs and test if they can", + "communicate. The case also test to access one of the", + "secure orbs which must raise a NO_PERMISSION exception."]; +ssl_1_multi_orber_generation_3_api_old(suite) -> []; +ssl_1_multi_orber_generation_3_api_old(_Config) -> + + ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server, + 1, [{ssl_generation, 3}, + {iiop_ssl_port, 0}]), + ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client, + 1, [{ssl_generation, 3}, + {iiop_ssl_port, 0}]), + ssl_suite(ServerOptions, ClientOptions). + + +ssl_1_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", "This case set up two secure orbs and test if they can", "communicate. The case also test to access one of the", "secure orbs which must raise a NO_PERMISSION exception."]; ssl_1_multi_orber_generation_3_api(suite) -> []; ssl_1_multi_orber_generation_3_api(_Config) -> - - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, 1, [{ssl_generation, 3}, {iiop_ssl_port, 0}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, 1, [{ssl_generation, 3}, {iiop_ssl_port, 0}]), ssl_suite(ServerOptions, ClientOptions). - %%----------------------------------------------------------------- %% API tests for ORB to ORB, ssl security depth 2 %%----------------------------------------------------------------- -ssl_2_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", +ssl_2_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", "This case set up two secure orbs and test if they can", "communicate. The case also test to access one of the", "secure orbs which must raise a NO_PERMISSION exception."]; ssl_2_multi_orber_api(suite) -> []; -ssl_2_multi_orber_api(_Config) -> - - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, +ssl_2_multi_orber_api(_Config) -> + + ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server, 2, [{iiop_ssl_port, 0}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client, 2, [{iiop_ssl_port, 0}]), ssl_suite(ServerOptions, ClientOptions). -ssl_2_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", + +ssl_2_multi_orber_generation_3_api_old(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", + "This case set up two secure orbs and test if they can", + "communicate. The case also test to access one of the", + "secure orbs which must raise a NO_PERMISSION exception."]; +ssl_2_multi_orber_generation_3_api_old(suite) -> []; +ssl_2_multi_orber_generation_3_api_old(_Config) -> + + ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server, + 2, [{ssl_generation, 3}, + {iiop_ssl_port, 0}]), + ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client, + 2, [{ssl_generation, 3}, + {iiop_ssl_port, 0}]), + ssl_suite(ServerOptions, ClientOptions). + + +ssl_2_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", "This case set up two secure orbs and test if they can", "communicate. The case also test to access one of the", "secure orbs which must raise a NO_PERMISSION exception."]; ssl_2_multi_orber_generation_3_api(suite) -> []; -ssl_2_multi_orber_generation_3_api(_Config) -> - - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, +ssl_2_multi_orber_generation_3_api(_Config) -> + + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, 2, [{ssl_generation, 3}, {iiop_ssl_port, 0}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, 2, [{ssl_generation, 3}, {iiop_ssl_port, 0}]), ssl_suite(ServerOptions, ClientOptions). @@ -1656,77 +1715,135 @@ ssl_2_multi_orber_generation_3_api(_Config) -> %% API tests for ORB to ORB, ssl security depth 2 %%----------------------------------------------------------------- -ssl_reconfigure_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", +ssl_reconfigure_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", "This case set up two secure orbs and test if they can", "communicate. The case also test to access one of the", "secure orbs which must raise a NO_PERMISSION exception."]; ssl_reconfigure_api(suite) -> []; -ssl_reconfigure_api(_Config) -> - ssl_reconfigure([]). +ssl_reconfigure_api(_Config) -> + ssl_reconfigure_old([]). + -ssl_reconfigure_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", +ssl_reconfigure_generation_3_api_old(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", + "This case set up two secure orbs and test if they can", + "communicate. The case also test to access one of the", + "secure orbs which must raise a NO_PERMISSION exception."]; +ssl_reconfigure_generation_3_api_old(suite) -> []; +ssl_reconfigure_generation_3_api_old(_Config) -> + ssl_reconfigure_old([{ssl_generation, 3}]). + +ssl_reconfigure_old(ExtraSSLOptions) -> + + IP = orber_test_lib:get_host(), + Loopback = orber_test_lib:get_loopback_interface(), + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, + orber_test_lib:js_node([{iiop_port, 0}, + {flags, ?ORB_ENV_LOCAL_INTERFACE}, + {ip_address, IP}|ExtraSSLOptions])), + orber_test_lib:remote_apply(ServerNode, ssl, start, []), + orber_test_lib:remote_apply(ServerNode, crypto, start, []), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, + [ssl])), + ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, + [Loopback, normal, [{iiop_port, 5648}, + {iiop_ssl_port, 5649}, + {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]])), + ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server, + 2, [{flags, ?ORB_ENV_LOCAL_INTERFACE}, + {iiop_port, 5648}, + {iiop_ssl_port, 5649}, + {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]), + ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, + [Loopback, ssl, ServerOptions])), + + ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client, + 2, [{iiop_ssl_port, 0}|ExtraSSLOptions]), + {ok, ClientNode, _ClientHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), + + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, + install_test_data, + [ssl])), + orber_test_lib:remote_apply(ClientNode, ssl, start, []), + orber_test_lib:remote_apply(ServerNode, crypto, start, []), + Obj = ?match(#'IOP_IOR'{}, + orber_test_lib:remote_apply(ClientNode, corba, + string_to_object, ["corbaname:iiop:1.1@"++Loopback++":5648/NameService#mamba", + [{context, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + context_data = {configuration, ClientOptions}}]}]])), + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_server, + print, [Obj])). + + +ssl_reconfigure_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)", "This case set up two secure orbs and test if they can", "communicate. The case also test to access one of the", "secure orbs which must raise a NO_PERMISSION exception."]; ssl_reconfigure_generation_3_api(suite) -> []; -ssl_reconfigure_generation_3_api(_Config) -> +ssl_reconfigure_generation_3_api(_Config) -> ssl_reconfigure([{ssl_generation, 3}]). + ssl_reconfigure(ExtraSSLOptions) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = - ?match({ok,_,_}, - orber_test_lib:js_node([{iiop_port, 0}, - {flags, ?ORB_ENV_LOCAL_INTERFACE}, + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, + orber_test_lib:js_node([{iiop_port, 0}, + {flags, ?ORB_ENV_LOCAL_INTERFACE}, {ip_address, IP}|ExtraSSLOptions])), orber_test_lib:remote_apply(ServerNode, ssl, start, []), orber_test_lib:remote_apply(ServerNode, crypto, start, []), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [ssl])), - ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, + ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, [Loopback, normal, [{iiop_port, 5648}, {iiop_ssl_port, 5649}, {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]])), - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, - 2, [{flags, ?ORB_ENV_LOCAL_INTERFACE}, + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + 2, [{flags, ?ORB_ENV_LOCAL_INTERFACE}, {iiop_port, 5648}, {iiop_ssl_port, 5649}, {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]), - ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, + ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, [Loopback, ssl, ServerOptions])), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, 2, [{iiop_ssl_port, 0}|ExtraSSLOptions]), - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, + install_test_data, [ssl])), orber_test_lib:remote_apply(ClientNode, ssl, start, []), orber_test_lib:remote_apply(ServerNode, crypto, start, []), - Obj = ?match(#'IOP_IOR'{}, + Obj = ?match(#'IOP_IOR'{}, orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaname:iiop:1.1@"++Loopback++":5648/NameService#mamba", - [{context, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + [{context, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, context_data = {configuration, ClientOptions}}]}]])), - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_server, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_server, print, [Obj])). - %%----------------------------------------------------------------- %% API tests for Orber to Java ORB, no security %%----------------------------------------------------------------- -%orber_java_api(doc) -> ["ERLANG-ORB <-> JAVA-ORB API tests", +%orber_java_api(doc) -> ["ERLANG-ORB <-> JAVA-ORB API tests", % "This case test if data encode/decode (IIOP)", % "produce the correct result, i.e., the test_server echos", % "the input parameter or an exception is raised (MARSHAL)."]; @@ -1739,38 +1856,38 @@ ssl_reconfigure(ExtraSSLOptions) -> %% Arguments: Config %% Depth %% Returns : ok -%% Effect : +%% Effect : %%------------------------------------------------------------ ssl_suite(ServerOptions, ClientOptions) -> - {ok, ServerNode, ServerHost} = + {ok, ServerNode, ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), - - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [ssl])), %% Tell the client to interoperate with the server. The purpose of this %% operation is to look up, using NameService, an object reference and %% use it to contact the object. - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, lookup, [ServerHost, ServerPort])), - - ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, + + ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, alternate_ssl_iiop_address, [ServerHost, ServerPort, SSLServerPort])), - + %% 'This' node is not secure. Contact the server. Must refuse connection. NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_}, corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++ integer_to_list(ServerPort)++"/NameService")), - + %% Should be 'NO_PERMISSION'?? ?match({'EXCEPTION',{'COMM_FAILURE',_,_,_}}, 'CosNaming_NamingContext':resolve(NSR, lname:new(["not_exist"]))), @@ -1780,8 +1897,8 @@ ssl_suite(ServerOptions, ClientOptions) -> 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))), %% Uninstall. - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, [ssl])), ok. @@ -1793,7 +1910,7 @@ setup_connection_timeout_api(suite) -> []; setup_connection_timeout_api(_Config) -> ?match(ok, application:set_env(orber, iiop_backlog, 0)), %% Wait to be sure that the configuration has kicked in. - timer:sleep(2000), + timer:sleep(2000), {ok, Ref, Port} = create_fake_server_ORB(normal, 0, [], listen, []), ?match(ok, orber:configure(iiop_setup_connection_timeout, 5)), ?match(ok, orber:info(io)), @@ -1813,7 +1930,7 @@ setup_connection_timeout_api(_Config) -> %%----------------------------------------------------------------- %% iiop_setup_connection_timeout API tests for ORB to ORB. %%----------------------------------------------------------------- -setup_multi_connection_timeout_api(doc) -> +setup_multi_connection_timeout_api(doc) -> ["iiop_multi_setup_connection_timeout API tests for ORB to ORB."]; setup_multi_connection_timeout_api(suite) -> []; setup_multi_connection_timeout_api(_Config) -> @@ -1838,7 +1955,7 @@ setup_multi_connection_timeout_api(_Config) -> ?match(ok, application:set_env(orber, iiop_out_ports, undefined)), ok. -setup_multi_connection_timeout_attempts_api(doc) -> +setup_multi_connection_timeout_attempts_api(doc) -> ["iiop_multi_setup_connection_timeout API tests for ORB to ORB."]; setup_multi_connection_timeout_attempts_api(suite) -> []; setup_multi_connection_timeout_attempts_api(_Config) -> @@ -1864,7 +1981,7 @@ setup_multi_connection_timeout_attempts_api(_Config) -> ?match(ok, application:set_env(orber, iiop_out_ports, undefined)), ok. -setup_multi_connection_timeout_random_api(doc) -> +setup_multi_connection_timeout_random_api(doc) -> ["iiop_multi_setup_connection_timeout API tests for ORB to ORB."]; setup_multi_connection_timeout_random_api(suite) -> []; setup_multi_connection_timeout_random_api(_Config) -> @@ -1899,17 +2016,17 @@ bad_giop_header_api(_Config) -> orber:configure_override(interceptors, {native,[orber_iiop_tracer]}), orber:configure(orber_debug_level, 10), ?match(ok, orber:info(io)), - {ok, ServerNode, ServerHost} = + {ok, ServerNode, ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node()), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), Req = <<"GIOP",1,2,0,100,0,0,0,5,0,0,0,10,50>> , - ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], + ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], message_error, [Req])), - + application:set_env(orber, interceptors, false), orber:configure(orber_debug_level, 0), ok. - + %%----------------------------------------------------------------- %% Fragmented IIOP tests (Server-side). @@ -1927,34 +2044,34 @@ fragments_server_api(doc) -> ["fragments API tests for server-side ORB."]; fragments_server_api(suite) -> []; fragments_server_api(_Config) -> %% --- Create a slave-node --- - {ok, Node, Host} = - ?match({ok,_,_}, orber_test_lib:js_node()), + {ok, Node, Host} = + ?match({ok,_,_}, orber_test_lib:js_node()), Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []), - - ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, - install_test_data, + + ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib, + install_test_data, [nameservice])), - + NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_}, corba:string_to_object("corbaloc::1.2@"++Host++":"++ integer_to_list(Port)++"/NameService")), - - Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + + Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))), Any = #any{typecode = {tk_string,0}, value = "123"}, - Target = #'GIOP_TargetAddress'{label = ?GIOP_KeyAddr, + Target = #'GIOP_TargetAddress'{label = ?GIOP_KeyAddr, value = iop_ior:get_objkey(Obj)}, - %% Fix a request header. + %% Fix a request header. {Hdr, Body, HdrLen, _What, _Flags} = cdr_encode:enc_request_split( - #giop_env{version = {1,2}, objkey = Target, + #giop_env{version = {1,2}, objkey = Target, request_id = ?REQUEST_ID, - response_expected = true, - op = testing_iiop_any, - parameters = [49], ctx = [], - tc = {tk_void,[tk_char],[]}, + response_expected = true, + op = testing_iiop_any, + parameters = [49], ctx = [], + tc = {tk_void,[tk_char],[]}, host = [orber_test_lib:get_host()], iiop_port = orber:iiop_port(), iiop_ssl_port = orber:iiop_ssl_port(), @@ -1969,11 +2086,11 @@ fragments_server_api(_Config) -> <<AligmnetData:Aligned/binary,49>> = Body, list_to_binary([AligmnetData, <<0,0,0,18,0,0,0,0,0,0,0,4,49>> ]) end, - + MessSize = HdrLen+size(NewBody), ReqFrag = list_to_binary([ <<"GIOP",1:8,2:8,2:8,0:8, MessSize:32/big-unsigned-integer>> , Hdr |NewBody]), - ?match(Any, fake_client_ORB(normal, Host, Port, [], fragments, + ?match(Any, fake_client_ORB(normal, Host, Port, [], fragments, [ReqFrag, ?FRAG_2, ?FRAG_3, ?FRAG_4])), ok. @@ -1986,9 +2103,9 @@ fragments_max_server_api(suite) -> []; fragments_max_server_api(_Config) -> %% --- Create a slave-node --- IP = orber_test_lib:get_host(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{iiop_max_fragments, 2}, - {ip_address, IP}])), + {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), fragments_max_server(ServerNode, IP, ServerPort). @@ -1997,37 +2114,37 @@ fragments_max_server_added_api(suite) -> []; fragments_max_server_added_api(_Config) -> %% --- Create a slave-node --- IP = orber_test_lib:get_host(), - {ok, ServerNode, _ServerHost} = - ?match({ok,_,_}, orber_test_lib:js_node([])), + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node([])), ServerPort = 1 + orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, - [IP, normal, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, + [IP, normal, [{iiop_max_fragments, 2}, {flags, ?ORB_ENV_LOCAL_INTERFACE}, {iiop_port, ServerPort}]])), fragments_max_server(ServerNode, IP, ServerPort). fragments_max_server(ServerNode, ServerHost, ServerPort) -> - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [nameservice])), Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, corba:string_to_object("corbaname::1.2@"++ServerHost++":"++ integer_to_list(ServerPort)++"/NameService#mamba")), - Target = #'GIOP_TargetAddress'{label = ?GIOP_KeyAddr, + Target = #'GIOP_TargetAddress'{label = ?GIOP_KeyAddr, value = iop_ior:get_objkey(Obj)}, - %% Fix a request header. + %% Fix a request header. {Hdr, Body, HdrLen, _What, _Flags} = cdr_encode:enc_request_split( - #giop_env{version = {1,2}, - objkey = Target, - request_id = ?REQUEST_ID, - response_expected = true, - op = testing_iiop_any, - parameters = [49], ctx = [], - tc = {tk_void,[tk_char],[]}, + #giop_env{version = {1,2}, + objkey = Target, + request_id = ?REQUEST_ID, + response_expected = true, + op = testing_iiop_any, + parameters = [49], ctx = [], + tc = {tk_void,[tk_char],[]}, host = [orber_test_lib:get_host()], iiop_port = orber:iiop_port(), iiop_ssl_port = orber:iiop_ssl_port(), @@ -2046,8 +2163,8 @@ fragments_max_server(ServerNode, ServerHost, ServerPort) -> MessSize = HdrLen+size(NewBody), ReqFrag = list_to_binary([ <<"GIOP",1:8,2:8,2:8,0:8, MessSize:32/big-unsigned-integer>> , Hdr |NewBody]), - ?match(#'IMP_LIMIT'{}, - fake_client_ORB(normal, ServerHost, ServerPort, [], fragments_max, + ?match(#'IMP_LIMIT'{}, + fake_client_ORB(normal, ServerHost, ServerPort, [], fragments_max, [ReqFrag, ?FRAG_2, ?FRAG_3, ?FRAG_4])), ok. @@ -2063,11 +2180,11 @@ fragments_client_api(_Config) -> application:set_env(orber, interceptors, {native,[orber_iiop_tracer]}), orber:configure(orber_debug_level, 10), orber:info(), - IOR = ?match({'IOP_IOR',_,_}, - iop_ior:create_external({1, 2}, "IDL:FAKE:1.0", + IOR = ?match({'IOP_IOR',_,_}, + iop_ior:create_external({1, 2}, "IDL:FAKE:1.0", "localhost", 6004, "FAKE", [])), - spawn(?MODULE, create_fake_server_ORB, [normal, 6004, [], fragments, - [?REPLY_FRAG_1, ?FRAG_2, + spawn(?MODULE, create_fake_server_ORB, [normal, 6004, [], fragments, + [?REPLY_FRAG_1, ?FRAG_2, ?FRAG_3, ?FRAG_4]]), ?match({ok, Any}, orber_test_server:testing_iiop_any(IOR, Any)), application:set_env(orber, interceptors, false), @@ -2083,16 +2200,16 @@ bad_fragment_id_client_api(_Config) -> application:set_env(orber, interceptors, {native,[orber_iiop_tracer]}), orber:configure(orber_debug_level, 10), orber:info(), - {ok, ServerNode, ServerHost} = + {ok, ServerNode, ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node()), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), Req = <<71,73,79,80,1,2,2,7,0,0,0,5,0,0,0,100,50>> , - ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], + ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], message_error, [Req])), - + application:set_env(orber, interceptors, false), orber:configure(orber_debug_level, 0), - + ok. %%----------------------------------------------------------------- @@ -2100,22 +2217,22 @@ bad_fragment_id_client_api(_Config) -> %%----------------------------------------------------------------- bad_id_cancel_request_api(doc) -> ["Description", "more description"]; bad_id_cancel_request_api(suite) -> []; -bad_id_cancel_request_api(Config) when is_list(Config) -> - Req10 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 0}, +bad_id_cancel_request_api(Config) when is_list(Config) -> + Req10 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 0}, request_id = 556}), - Req11 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 1}, + Req11 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 1}, request_id = 556}), - Req12 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 2}, + Req12 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 2}, request_id = 556}), - {ok, ServerNode, ServerHost} = + {ok, ServerNode, ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node()), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), - ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], - message_error, [Req10])), - ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], - message_error, [Req11])), - ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], - message_error, [Req12])), + ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], + message_error, [Req10])), + ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], + message_error, [Req11])), + ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [], + message_error, [Req12])), ok. %%----------------------------------------------------------------- @@ -2131,141 +2248,141 @@ pseudo_calls(0, _) -> pseudo_calls(Times, Obj) -> orber_test_server:pseudo_call(Obj), New = Times - 1, - pseudo_calls(New, Obj). + pseudo_calls(New, Obj). pseudo_casts(0, _) -> ok; pseudo_casts(Times, Obj) -> orber_test_server:pseudo_cast(Obj), New = Times - 1, - pseudo_casts(New, Obj). + pseudo_casts(New, Obj). context_test(Obj) -> - CodeSetCtx = #'CONV_FRAME_CodeSetContext'{char_data = 65537, + CodeSetCtx = #'CONV_FRAME_CodeSetContext'{char_data = 65537, wchar_data = 65801}, FTGrp = #'FT_FTGroupVersionServiceContext'{object_group_ref_version = ?ULONGMAX}, - FTReq = #'FT_FTRequestServiceContext'{client_id = "ClientId", - retention_id = ?LONGMAX, + FTReq = #'FT_FTRequestServiceContext'{client_id = "ClientId", + retention_id = ?LONGMAX, expiration_time = ?ULONGLONGMAX}, - IDToken1 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAbsent, + IDToken1 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAbsent, value = true}, - IDToken2 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAnonymous, + IDToken2 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAnonymous, value = false}, - IDToken3 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTPrincipalName, + IDToken3 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTPrincipalName, value = [0,255]}, - IDToken4 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTX509CertChain, + IDToken4 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTX509CertChain, value = [1,255]}, - IDToken5 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTDistinguishedName, + IDToken5 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTDistinguishedName, value = [2,255]}, - IDToken6 = #'CSI_IdentityToken'{label = ?ULONGMAX, + IDToken6 = #'CSI_IdentityToken'{label = ?ULONGMAX, value = [3,255]}, MTEstablishContext1 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken1, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken1, client_authentication_token = [1, 255]}}, MTEstablishContext2 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken2, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken2, client_authentication_token = [1, 255]}}, MTEstablishContext3 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken3, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken3, client_authentication_token = [1, 255]}}, MTEstablishContext4 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken4, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken4, client_authentication_token = [1, 255]}}, MTEstablishContext5 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken5, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken5, client_authentication_token = [1, 255]}}, MTEstablishContext6 = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, - authorization_token = + {label = ?CSI_MsgType_MTEstablishContext, + value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX, + authorization_token = [#'CSI_AuthorizationElement' - {the_type = ?ULONGMAX, - the_element = [0,255]}], - identity_token = IDToken6, + {the_type = ?ULONGMAX, + the_element = [0,255]}], + identity_token = IDToken6, client_authentication_token = [1, 255]}}, MTCompleteEstablishContext = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTCompleteEstablishContext, - value = #'CSI_CompleteEstablishContext'{client_context_id = ?ULONGLONGMAX, + {label = ?CSI_MsgType_MTCompleteEstablishContext, + value = #'CSI_CompleteEstablishContext'{client_context_id = ?ULONGLONGMAX, context_stateful = false, final_context_token = [1, 255]}}, MTContextError = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTContextError, + {label = ?CSI_MsgType_MTContextError, value = #'CSI_ContextError'{client_context_id = ?ULONGLONGMAX, - major_status = 1, - minor_status = 2, + major_status = 1, + minor_status = 2, error_token = [2,255]}}, MTMessageInContext = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTMessageInContext, - value = #'CSI_MessageInContext'{client_context_id = ?ULONGLONGMAX, + {label = ?CSI_MsgType_MTMessageInContext, + value = #'CSI_MessageInContext'{client_context_id = ?ULONGLONGMAX, discard_context = true}}, - Ctx = [#'IOP_ServiceContext'{context_id=?IOP_CodeSets, + Ctx = [#'IOP_ServiceContext'{context_id=?IOP_CodeSets, context_data = CodeSetCtx}, - #'IOP_ServiceContext'{context_id=?IOP_FT_GROUP_VERSION, + #'IOP_ServiceContext'{context_id=?IOP_FT_GROUP_VERSION, context_data = FTGrp}, - #'IOP_ServiceContext'{context_id=?IOP_FT_REQUEST, + #'IOP_ServiceContext'{context_id=?IOP_FT_REQUEST, context_data = FTReq}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext1}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext2}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext3}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext4}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext5}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTEstablishContext6}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTCompleteEstablishContext}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTContextError}, - #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, + #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, context_data = MTMessageInContext}, - #'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, + #'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, context_data = {any_kind_of_data, {127,0,0,1}, 4001}}], ?match(ok, orber_test_server:testing_iiop_context(Obj, [{context, Ctx}])). create_fake_server_ORB(Type, Port, Options, listen, _Data) -> {ok, _ListenSocket, NewPort} = - orber_socket:listen(Type, Port, + orber_socket:listen(Type, Port, [{backlog, 0}, {active, false}|Options]), Socket = orber_socket:connect(Type, 'localhost', NewPort, [{active, false}|Options]), {ok, {Type, Socket}, NewPort}; create_fake_server_ORB(Type, Port, Options, Action, Data) -> - {ok, ListenSocket, _NewPort} = + {ok, ListenSocket, _NewPort} = orber_socket:listen(Type, Port, [{active, false}|Options]), Socket = orber_socket:accept(Type, ListenSocket), do_server_action(Type, Socket, Action, Data), @@ -2299,14 +2416,14 @@ do_client_action(Type, Socket, fragments, FragList) -> ok = send_data(Type, Socket, FragList), timer:sleep(3000), {ok, Bytes} = gen_tcp:recv(Socket, 0), - {#reply_header{request_id = ?REQUEST_ID, reply_status = no_exception}, ok, [Par]} = + {#reply_header{request_id = ?REQUEST_ID, reply_status = no_exception}, ok, [Par]} = cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes), Par; do_client_action(Type, Socket, fragments_max, FragList) -> ok = send_data(Type, Socket, FragList), timer:sleep(3000), {ok, Bytes} = gen_tcp:recv(Socket, 0), - {#reply_header{request_id = ?REQUEST_ID, reply_status = system_exception}, Exc, []} = + {#reply_header{request_id = ?REQUEST_ID, reply_status = system_exception}, Exc, []} = cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes), Exc; do_client_action(Type, Socket, message_error, Data) -> @@ -2323,4 +2440,4 @@ send_data(_Type, _Socket, []) -> send_data(Type, Socket, [H|T]) -> orber_socket:write(Type, Socket, H), send_data(Type, Socket, T). - + diff --git a/lib/orber/test/orber_nat_SUITE.erl b/lib/orber/test/orber_nat_SUITE.erl index 625f168520..ee31b162c2 100644 --- a/lib/orber/test/orber_nat_SUITE.erl +++ b/lib/orber/test/orber_nat_SUITE.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% +%% %% Copyright Ericsson AB 2006-2011. 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 %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% %% @@ -50,14 +50,15 @@ %%----------------------------------------------------------------- %% External exports %%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, +-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, end_per_testcase/2, + init_per_testcase/2, end_per_testcase/2, nat_ip_address/1, nat_ip_address_multiple/1, nat_ip_address_local/1, nat_ip_address_local_local/1, nat_iiop_port/1, nat_iiop_port_local/1, - nat_iiop_port_local_local/1, nat_iiop_ssl_port/1, - nat_iiop_ssl_port_local/1]). + nat_iiop_port_local_local/1, + nat_iiop_ssl_port_old/1, nat_iiop_ssl_port_local_old/1, + nat_iiop_ssl_port/1, nat_iiop_ssl_port_local/1]). %%----------------------------------------------------------------- @@ -66,15 +67,15 @@ %%----------------------------------------------------------------- %% Func: all/1 -%% Args: -%% Returns: +%% Args: +%% Returns: %%----------------------------------------------------------------- suite() -> [{ct_hooks,[ts_install_cth]}]. -all() -> +all() -> cases(). -groups() -> +groups() -> []. init_per_group(_GroupName, Config) -> @@ -84,25 +85,38 @@ end_per_group(_GroupName, Config) -> Config. -cases() -> - [nat_ip_address, nat_ip_address_multiple, - nat_ip_address_local, nat_iiop_port, - nat_iiop_port_local, nat_ip_address_local_local, - nat_iiop_port_local_local, nat_iiop_ssl_port, +cases() -> + [nat_ip_address, + nat_ip_address_multiple, + nat_ip_address_local, + nat_iiop_port, + nat_iiop_port_local, + nat_ip_address_local_local, + nat_iiop_port_local_local, + nat_iiop_ssl_port_old, + nat_iiop_ssl_port_local_old, + nat_iiop_ssl_port, nat_iiop_ssl_port_local]. %%----------------------------------------------------------------- %% Init and cleanup functions. %%----------------------------------------------------------------- -init_per_testcase(TC, Config) +init_per_testcase(TC, Config) when TC =:= nat_iiop_ssl_port; - TC =:= nat_iiop_ssl_port_local -> - case orber_test_lib:ssl_version() of - no_ssl -> - {skip,"SSL not installed!"}; - _ -> - init_per_testcase(dummy_tc, Config) - end; + TC =:= nat_iiop_ssl_port_local; + TC =:= nat_iiop_ssl_port_old; + TC =:= nat_iiop_ssl_port_local_old -> + case ?config(crypto_started, Config) of + true -> + case orber_test_lib:ssl_version() of + no_ssl -> + {skip,"SSL not installed!"}; + _ -> + init_per_testcase(dummy_tc, Config) + end; + false -> + {skip, "Crypto did not start"} + end; init_per_testcase(_Case, Config) -> Path = code:which(?MODULE), code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), @@ -125,12 +139,18 @@ end_per_testcase(_Case, Config) -> init_per_suite(Config) -> if is_list(Config) -> - Config; + try crypto:start() of + ok -> + [{crypto_started, true} | Config] + catch _:_ -> + [{crypto_started, false} | Config] + end; true -> exit("Config not a list") end. end_per_suite(Config) -> + application:stop(crypto), Config. %%----------------------------------------------------------------- @@ -143,13 +163,13 @@ nat_ip_address(suite) -> []; nat_ip_address(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT}, {nat_ip_address, Loopback}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR)), ok. @@ -158,14 +178,14 @@ nat_ip_address_multiple(doc) -> ["This case test if the server ORB use the corre nat_ip_address_multiple(suite) -> []; nat_ip_address_multiple(_Config) -> IP = orber_test_lib:get_host(), - - {ok, ServerNode, _ServerHost} = + + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT}, {nat_ip_address, {multiple, ["10.0.0.1"]}}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {"10.0.0.1", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {"10.0.0.1", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR)), ok. @@ -174,13 +194,13 @@ nat_ip_address_local(doc) -> ["This case test if the server ORB use the correct" nat_ip_address_local(suite) -> []; nat_ip_address_local(_Config) -> IP = orber_test_lib:get_host(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT}, {nat_ip_address, {local, "10.0.0.1", [{IP, "127.0.0.1"}]}}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {"10.0.0.1", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {"10.0.0.1", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR)), ok. @@ -190,19 +210,19 @@ nat_ip_address_local_local(suite) -> []; nat_ip_address_local_local(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = - ?match({ok,_,_}, orber_test_lib:js_node([{flags, - (?ORB_ENV_LOCAL_INTERFACE bor + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node([{flags, + (?ORB_ENV_LOCAL_INTERFACE bor ?ORB_ENV_ENABLE_NAT)}, {nat_ip_address, {local, "10.0.0.1", [{IP, "10.0.0.2"}]}}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IOR1 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {"10.0.0.2", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {"10.0.0.2", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR1)), IOR2 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {"10.0.0.1", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {"10.0.0.1", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR2)), ok. @@ -211,13 +231,13 @@ nat_iiop_port(doc) -> ["This case test if the server ORB use the correct", nat_iiop_port(suite) -> []; nat_iiop_port(_Config) -> IP = orber_test_lib:get_host(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT}, {nat_iiop_port, 42}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {_IP, 42, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {_IP, 42, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR)), ok. @@ -226,13 +246,13 @@ nat_iiop_port_local(doc) -> ["This case test if the server ORB use the correct", nat_iiop_port_local(suite) -> []; nat_iiop_port_local(_Config) -> IP = orber_test_lib:get_host(), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT}, {nat_iiop_port, {local, 42, [{4001, 43}]}}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), IOR = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {_IP, 42, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {_IP, 42, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR)), ok. @@ -242,27 +262,27 @@ nat_iiop_port_local_local(suite) -> []; nat_iiop_port_local_local(_Config) -> IP = orber_test_lib:get_host(), Loopback = orber_test_lib:get_loopback_interface(), - {ok, ServerNode, _ServerHost} = - ?match({ok,_,_}, orber_test_lib:js_node([{flags, - (?ORB_ENV_LOCAL_INTERFACE bor + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node([{flags, + (?ORB_ENV_LOCAL_INTERFACE bor ?ORB_ENV_ENABLE_NAT)}, {ip_address, IP}])), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, [nat_iiop_port, {local, 42, [{ServerPort, 43}]}]), IOR1 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")), - ?match({'external', {IP, 43, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {IP, 43, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR1)), {ok, Ref} = ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, [Loopback, normal, 10088])), IOR2 = ?match(#'IOP_IOR'{}, corba:string_to_object("corbaloc::1.2@"++Loopback++":10088/NameService")), - ?match({'external', {IP, 42, _ObjectKey, _Counter, _TP, _NewHD}}, + ?match({'external', {IP, 42, _ObjectKey, _Counter, _TP, _NewHD}}, iop_ior:get_key(IOR2)), - ?match(ok, - orber_test_lib:remote_apply(ServerNode, orber, + ?match(ok, + orber_test_lib:remote_apply(ServerNode, orber, remove_listen_interface, [Ref])), ok. @@ -271,103 +291,204 @@ nat_iiop_port_local_local(_Config) -> %% API tests for ORB to ORB, ssl security depth 1 %%----------------------------------------------------------------- -nat_iiop_ssl_port(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", +nat_iiop_ssl_port_old(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", + "Make sure NAT works for SSL"]; +nat_iiop_ssl_port_old(suite) -> []; +nat_iiop_ssl_port_old(_Config) -> + + IP = orber_test_lib:get_host(), + ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server, + 1, [{iiop_ssl_port, 0}, + {flags, ?ORB_ENV_ENABLE_NAT}, + {ip_address, IP}]), + ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client, + 1, [{iiop_ssl_port, 0}]), + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)), + ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), + SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), + NATSSLServerPort = SSLServerPort+1, + {ok, Ref} = ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, + [IP, ssl, NATSSLServerPort])), + orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, + [nat_iiop_ssl_port, + {local, NATSSLServerPort, [{4001, 43}]}]), + + {ok, ClientNode, _ClientHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, + [ssl])), + + IOR1 = ?match(#'IOP_IOR'{}, + orber_test_lib:remote_apply(ClientNode, corba, + string_to_object, + ["corbaname::1.2@"++IP++":"++ + integer_to_list(ServerPort)++"/NameService#mamba"])), + + ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, + #host_data{protocol = ssl, + ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, + iop_ior:get_key(IOR1)), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, + [ssl])), + ?match(ok, + orber_test_lib:remote_apply(ServerNode, orber, + remove_listen_interface, [Ref])), + ok. + +nat_iiop_ssl_port_local_old(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", + "Make sure NAT works for SSL"]; +nat_iiop_ssl_port_local_old(suite) -> []; +nat_iiop_ssl_port_local_old(_Config) -> + + IP = orber_test_lib:get_host(), + ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server, + 1, [{iiop_ssl_port, 0}, + {flags, + (?ORB_ENV_LOCAL_INTERFACE bor + ?ORB_ENV_ENABLE_NAT)}, + {ip_address, IP}]), + ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client, + 1, [{iiop_ssl_port, 0}]), + {ok, ServerNode, _ServerHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)), + ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), + SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), + NATSSLServerPort = SSLServerPort+1, + {ok, Ref} = ?match({ok, _}, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, + [IP, ssl, NATSSLServerPort])), + orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, + [nat_iiop_ssl_port, + {local, NATSSLServerPort, [{NATSSLServerPort, NATSSLServerPort}]}]), + + {ok, ClientNode, _ClientHost} = + ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, + [ssl])), + + IOR1 = ?match(#'IOP_IOR'{}, + orber_test_lib:remote_apply(ClientNode, corba, + string_to_object, + ["corbaname::1.2@"++IP++":"++ + integer_to_list(ServerPort)++"/NameService#mamba"])), + + ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, + #host_data{protocol = ssl, + ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, + iop_ior:get_key(IOR1)), + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, + [ssl])), + ?match(ok, + orber_test_lib:remote_apply(ServerNode, orber, + remove_listen_interface, [Ref])), + ok. + + +nat_iiop_ssl_port(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", "Make sure NAT works for SSL"]; nat_iiop_ssl_port(suite) -> []; nat_iiop_ssl_port(_Config) -> IP = orber_test_lib:get_host(), - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, 1, [{iiop_ssl_port, 0}, {flags, ?ORB_ENV_ENABLE_NAT}, {ip_address, IP}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, 1, [{iiop_ssl_port, 0}]), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), NATSSLServerPort = SSLServerPort+1, {ok, Ref} = ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, [IP, ssl, NATSSLServerPort])), - orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, - [nat_iiop_ssl_port, + orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, + [nat_iiop_ssl_port, {local, NATSSLServerPort, [{4001, 43}]}]), - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [ssl])), - IOR1 = ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, + IOR1 = ?match(#'IOP_IOR'{}, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaname::1.2@"++IP++":"++ integer_to_list(ServerPort)++"/NameService#mamba"])), - ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, + ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, + #host_data{protocol = ssl, + ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, iop_ior:get_key(IOR1)), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, [ssl])), - ?match(ok, - orber_test_lib:remote_apply(ServerNode, orber, + ?match(ok, + orber_test_lib:remote_apply(ServerNode, orber, remove_listen_interface, [Ref])), ok. -nat_iiop_ssl_port_local(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", +nat_iiop_ssl_port_local(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)", "Make sure NAT works for SSL"]; nat_iiop_ssl_port_local(suite) -> []; nat_iiop_ssl_port_local(_Config) -> IP = orber_test_lib:get_host(), - ServerOptions = orber_test_lib:get_options(iiop_ssl, server, + ServerOptions = orber_test_lib:get_options(iiop_ssl, server, 1, [{iiop_ssl_port, 0}, - {flags, - (?ORB_ENV_LOCAL_INTERFACE bor + {flags, + (?ORB_ENV_LOCAL_INTERFACE bor ?ORB_ENV_ENABLE_NAT)}, {ip_address, IP}]), - ClientOptions = orber_test_lib:get_options(iiop_ssl, client, + ClientOptions = orber_test_lib:get_options(iiop_ssl, client, 1, [{iiop_ssl_port, 0}]), - {ok, ServerNode, _ServerHost} = + {ok, ServerNode, _ServerHost} = ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)), ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []), SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []), NATSSLServerPort = SSLServerPort+1, {ok, Ref} = ?match({ok, _}, - orber_test_lib:remote_apply(ServerNode, orber, - add_listen_interface, + orber_test_lib:remote_apply(ServerNode, orber, + add_listen_interface, [IP, ssl, NATSSLServerPort])), - orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, - [nat_iiop_ssl_port, + orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, + [nat_iiop_ssl_port, {local, NATSSLServerPort, [{NATSSLServerPort, NATSSLServerPort}]}]), - {ok, ClientNode, _ClientHost} = + {ok, ClientNode, _ClientHost} = ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - install_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + install_test_data, [ssl])), - IOR1 = ?match(#'IOP_IOR'{}, - orber_test_lib:remote_apply(ClientNode, corba, + IOR1 = ?match(#'IOP_IOR'{}, + orber_test_lib:remote_apply(ClientNode, corba, string_to_object, ["corbaname::1.2@"++IP++":"++ integer_to_list(ServerPort)++"/NameService#mamba"])), - ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, + ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP, + #host_data{protocol = ssl, + ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}}, iop_ior:get_key(IOR1)), - ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, - uninstall_test_data, + ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib, + uninstall_test_data, [ssl])), - ?match(ok, - orber_test_lib:remote_apply(ServerNode, orber, + ?match(ok, + orber_test_lib:remote_apply(ServerNode, orber, remove_listen_interface, [Ref])), ok. diff --git a/lib/orber/test/orber_test_lib.erl b/lib/orber/test/orber_test_lib.erl index 903ab1d771..3119bcf281 100644 --- a/lib/orber/test/orber_test_lib.erl +++ b/lib/orber/test/orber_test_lib.erl @@ -41,28 +41,31 @@ end end()). --export([js_node/2, +-export([js_node/2, js_node/1, js_node/0, - slave_sup/0, - remote_apply/4, + slave_sup/0, + remote_apply/4, install_test_data/1, light_tests/3, - uninstall_test_data/1, - destroy_node/2, + uninstall_test_data/1, + destroy_node/2, lookup/2, alternate_iiop_address/2, create_alternate_iiop_address/2, alternate_ssl_iiop_address/3, create_alternate_ssl_iiop_address/3, - test_coding/1, - test_coding/2, - corba_object_tests/2, + test_coding/1, + test_coding/2, + corba_object_tests/2, timeouts/3, precond/3, postcond/4, oe_get_interface/0, create_components_IOR/1, + get_options_old/2, + get_options_old/3, + get_options_old/4, get_options/2, get_options/3, get_options/4, @@ -89,13 +92,13 @@ %%------------------------------------------------------------ %% function : ssl_version -%% Arguments: +%% Arguments: %% Returns : integer() -%% Effect : -%% +%% Effect : +%% %%------------------------------------------------------------ ssl_version() -> - try + try ssl:module_info(), case catch erlang:system_info(otp_release) of Version when is_list(Version) -> @@ -114,10 +117,10 @@ ssl_version() -> %%------------------------------------------------------------ %% function : version_ok -%% Arguments: +%% Arguments: %% Returns : true | {skipped, Reason} -%% Effect : -%% +%% Effect : +%% %%------------------------------------------------------------ version_ok() -> {ok, Hostname} = inet:gethostname(), @@ -151,8 +154,8 @@ version_ok() -> %% function : get_host %% Arguments: Family - inet | inet6 %% Returns : string() -%% Effect : -%% +%% Effect : +%% %%------------------------------------------------------------ get_host() -> get_host(inet). @@ -172,13 +175,13 @@ get_host(Family) -> [IP] = ?match([_], orber:host()), IP end. - + %%------------------------------------------------------------ %% function : get_loopback_interface %% Arguments: Family - inet | inet6 %% Returns : string() -%% Effect : -%% +%% Effect : +%% %%------------------------------------------------------------ get_loopback_interface() -> get_loopback_interface(inet). @@ -193,12 +196,12 @@ get_loopback_interface(Family) -> _ when Family == inet -> "127.0.0.1"; _ -> - "0:0:0:0:0:FFFF:7F00:0001" + "0:0:0:0:0:FFFF:7F00:0001" end; _ when Family == inet -> "127.0.0.1"; _ -> - "0:0:0:0:0:FFFF:7F00:0001" + "0:0:0:0:0:FFFF:7F00:0001" end. %%------------------------------------------------------------ @@ -220,7 +223,7 @@ js_node(InitOptions, StartOptions) when is_list(InitOptions) -> {A,B,C} = erlang:now(), [_, Host] = string:tokens(atom_to_list(node()), [$@]), _NewInitOptions = check_options(InitOptions), - js_node_helper(Host, 0, lists:concat([A,'_',B,'_',C]), + js_node_helper(Host, 0, lists:concat([A,'_',B,'_',C]), InitOptions, 10, StartOptions). js_node_helper(Host, Port, Name, Options, Retries, StartOptions) -> @@ -234,8 +237,8 @@ js_node_helper(Host, Port, Name, Options, Retries, StartOptions) -> ok = rpc:call(NewNode, file, set_cwd, [Cwd]), true = rpc:call(NewNode, code, set_path, [Path]), rpc:call(NewNode, application, load, [orber]), - ok = rpc:call(NewNode, corba, orb_init, - [[{iiop_port, Port}, + ok = rpc:call(NewNode, corba, orb_init, + [[{iiop_port, Port}, {orber_debug_level, 10}|Options]]), start_orber(StartOptions, NewNode), spawn_link(NewNode, ?MODULE, slave_sup, []), @@ -247,8 +250,8 @@ js_node_helper(Host, Port, Name, Options, Retries, StartOptions) -> end; {error, Reason} when Retries == 0 -> {error, Reason}; - {error, Reason} -> - io:format("Could not start slavenode ~p:~p due to: ~p~n", + {error, Reason} -> + io:format("Could not start slavenode ~p:~p due to: ~p~n", [Host, Port, Reason]), timer:sleep(500), js_node_helper(Host, Port, Name, Options, Retries-1, StartOptions) @@ -285,7 +288,7 @@ starter(Host, Name, Args) -> slave_sup() -> process_flag(trap_exit, true), receive - {'EXIT', _, _} -> + {'EXIT', _, _} -> case os:type() of vxworks -> erlang:halt(); @@ -309,68 +312,106 @@ start_orber(lightweight, Node) -> start_orber(_, Node) -> ok = rpc:call(Node, orber, jump_start, []). - %%----------------------------------------------------------------- %% Type - ssl | iiop_ssl %% Role - 'server' | 'client' %% Options - [{Key, Value}] %%----------------------------------------------------------------- -get_options(Type, Role) -> - get_options(Type, Role, 2, []). +get_options_old(Type, Role) -> + get_options_old(Type, Role, 2, []). -get_options(ssl, Role, Level) -> - get_options(ssl, Role, Level, []). +get_options_old(ssl, Role, Level) -> + get_options_old(ssl, Role, Level, []). -get_options(ssl, Role, 2, Options) -> +get_options_old(ssl, Role, 2, Options) -> Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), [{depth, 2}, {verify, 2}, {keyfile, filename:join([Dir, Role, "key.pem"])}, - {cacertfile, filename:join([Dir, Role, "cacerts.pem"])}, - {certfile, filename:join([Dir, Role, "cert.pem"])}|Options]; -get_options(iiop_ssl, _Role, 2, Options) -> + {cacertfile, filename:join([Dir, Role, "cacerts.pem"])}, + {certfile, filename:join([Dir, Role, "cert.pem"])} |Options]; +get_options_old(iiop_ssl, _Role, 2, Options) -> Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), [{ssl_server_depth, 2}, {ssl_server_verify, 2}, {ssl_server_certfile, filename:join([Dir, "server", "cert.pem"])}, - {ssl_server_cacertfile, filename:join([Dir, "server", "cacerts.pem"])}, + {ssl_server_cacertfile, filename:join([Dir, "server", "cacerts.pem"])}, {ssl_server_keyfile, filename:join([Dir, "server", "key.pem"])}, {ssl_client_depth, 2}, {ssl_client_verify, 2}, {ssl_client_certfile, filename:join([Dir, "client", "cert.pem"])}, - {ssl_client_cacertfile, filename:join([Dir, "client", "cacerts.pem"])}, + {ssl_client_cacertfile, filename:join([Dir, "client", "cacerts.pem"])}, {ssl_client_keyfile, filename:join([Dir, "client", "key.pem"])}, - {secure, ssl}|Options]; -get_options(iiop_ssl, _Role, 1, Options) -> + {secure, ssl} |Options]; +get_options_old(iiop_ssl, _Role, 1, Options) -> Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), [{ssl_server_depth, 1}, {ssl_server_verify, 0}, {ssl_server_certfile, filename:join([Dir, "server", "cert.pem"])}, - {ssl_server_cacertfile, filename:join([Dir, "server", "cacerts.pem"])}, + {ssl_server_cacertfile, filename:join([Dir, "server", "cacerts.pem"])}, {ssl_server_keyfile, filename:join([Dir, "server", "key.pem"])}, {ssl_client_depth, 1}, {ssl_client_verify, 0}, {ssl_client_certfile, filename:join([Dir, "client", "cert.pem"])}, - {ssl_client_cacertfile, filename:join([Dir, "client", "cacerts.pem"])}, + {ssl_client_cacertfile, filename:join([Dir, "client", "cacerts.pem"])}, {ssl_client_keyfile, filename:join([Dir, "client", "key.pem"])}, - {secure, ssl}|Options]. + {secure, ssl} |Options]. +get_options(Type, Role) -> + get_options(Type, Role, 2, []). + +get_options(ssl, Role, Level) -> + get_options(ssl, Role, Level, []). + +get_options(ssl, Role, 2, Options) -> + Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), + [{depth, 2}, + {verify, 2}, + {keyfile, filename:join([Dir, Role, "key.pem"])}, + {cacertfile, filename:join([Dir, Role, "cacerts.pem"])}, + {certfile, filename:join([Dir, Role, "cert.pem"])} |Options]; +get_options(iiop_ssl, _Role, 2, Options) -> + Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), + [{ssl_server_opts, [{depth, 2}, + {verify, 2}, + {certfile, filename:join([Dir, "server", "cert.pem"])}, + {cacertfile, filename:join([Dir, "server", "cacerts.pem"])}, + {keyfile, filename:join([Dir, "server", "key.pem"])}]}, + {ssl_client_opts, [{depth, 2}, + {verify, 2}, + {certfile, filename:join([Dir, "client", "cert.pem"])}, + {cacertfile, filename:join([Dir, "client", "cacerts.pem"])}, + {keyfile, filename:join([Dir, "client", "key.pem"])}]}, + {secure, ssl} |Options]; +get_options(iiop_ssl, _Role, 1, Options) -> + Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), + [{ssl_server_opts, [{depth, 1}, + {verify, 0}, + {certfile, filename:join([Dir, "server", "cert.pem"])}, + {cacertfile, filename:join([Dir, "server", "cacerts.pem"])}, + {keyfile, filename:join([Dir, "server", "key.pem"])}]}, + {ssl_client_opts, [{depth, 1}, + {verify, 0}, + {certfile, filename:join([Dir, "client", "cert.pem"])}, + {cacertfile, filename:join([Dir, "client", "cacerts.pem"])}, + {keyfile, filename:join([Dir, "client", "key.pem"])}]}, + {secure, ssl} |Options]. create_paths() -> Path = filename:dirname(code:which(?MODULE)), " -pa " ++ Path ++ " -pa " ++ - filename:join(Path, "idl_output") ++ + filename:join(Path, "idl_output") ++ " -pa " ++ - filename:join(Path, "all_SUITE_data") ++ - " -pa " ++ + filename:join(Path, "all_SUITE_data") ++ + " -pa " ++ filename:dirname(code:which(orber)). %%------------------------------------------------------------ %% function : destroy_node %% Arguments: Node - which node to destroy. %% Type - normal | ssl -%% Returns : -%% Effect : +%% Returns : +%% Effect : %%------------------------------------------------------------ destroy_node(Node, Type) -> @@ -384,13 +425,13 @@ stopper(Node, _Type) -> slave:stop(Node) end. - + %%------------------------------------------------------------ %% function : remote_apply %% Arguments: N - Node, M - Module, %% F - Function, A - Arguments (list) -%% Returns : -%% Effect : +%% Returns : +%% Effect : %%------------------------------------------------------------ remote_apply(N, M,F,A) -> case rpc:call(N, M, F, A) of @@ -411,7 +452,7 @@ remote_apply(N, M,F,A) -> install_test_data(nameservice) -> oe_orber_test_server:oe_register(), - Mamba = orber_test_server:oe_create([], [{regname, {local, mamba}}]), + Mamba = orber_test_server:oe_create([], [{regname, {local, mamba}}]), true = corba:add_initial_service("Mamba", Mamba), NS = corba:resolve_initial_references("NameService"), NC1 = lname_component:set_id(lname_component:create(), "mamba"), @@ -420,7 +461,7 @@ install_test_data(nameservice) -> install_test_data({nameservice, AltAddr, AltPort}) -> oe_orber_test_server:oe_register(), - Obj = orber_test_server:oe_create([], [{regname, {local, mamba}}]), + Obj = orber_test_server:oe_create([], [{regname, {local, mamba}}]), Mamba = corba:add_alternate_iiop_address(Obj, AltAddr, AltPort), true = corba:add_initial_service("Mamba", Mamba), NS = corba:resolve_initial_references("NameService"), @@ -430,8 +471,8 @@ install_test_data({nameservice, AltAddr, AltPort}) -> install_test_data(timeout) -> oe_orber_test_server:oe_register(), - Mamba = orber_test_server:oe_create([], {local, mamba}), - Viper = orber_test_timeout_server:oe_create([], {local, viper}), + Mamba = orber_test_server:oe_create([], {local, mamba}), + Viper = orber_test_timeout_server:oe_create([], {local, viper}), NS = corba:resolve_initial_references("NameService"), NC1 = lname_component:set_id(lname_component:create(), "mamba"), N1 = lname:insert_component(lname:create(), 1, NC1), @@ -450,7 +491,7 @@ install_test_data(pseudo) -> install_test_data(ssl) -> oe_orber_test_server:oe_register(), - Mamba = orber_test_server:oe_create([], [{regname, {local, mamba}}]), + Mamba = orber_test_server:oe_create([], [{regname, {local, mamba}}]), NS = corba:resolve_initial_references("NameService"), NC1 = lname_component:set_id(lname_component:create(), "mamba"), N = lname:insert_component(lname:create(), 1, NC1), @@ -458,7 +499,7 @@ install_test_data(ssl) -> install_test_data(ssl_simple) -> oe_orber_test_server:oe_register(); - + install_test_data(light) -> %% Nothing to do at the moment but we might in the future ok; @@ -479,7 +520,7 @@ uninstall_test_data(pseudo) -> NC1 = lname_component:set_id(lname_component:create(), "mamba"), N = lname:insert_component(lname:create(), 1, NC1), _Obj = (catch 'CosNaming_NamingContext':resolve(NS, N)), - catch 'CosNaming_NamingContext':destroy(NS), + catch 'CosNaming_NamingContext':destroy(NS), oe_orber_test_server:oe_unregister(); uninstall_test_data(timeout) -> @@ -493,7 +534,7 @@ uninstall_test_data(timeout) -> Viper = (catch 'CosNaming_NamingContext':resolve(NS, N2)), catch corba:dispose(Mamba), catch corba:dispose(Viper), - catch 'CosNaming_NamingContext':destroy(NS), + catch 'CosNaming_NamingContext':destroy(NS), oe_orber_test_server:oe_unregister(); uninstall_test_data(nameservice) -> @@ -503,7 +544,7 @@ uninstall_test_data(nameservice) -> N = lname:insert_component(lname:create(), 1, NC1), Obj = (catch 'CosNaming_NamingContext':resolve(NS, N)), catch corba:dispose(Obj), - catch 'CosNaming_NamingContext':destroy(NS), + catch 'CosNaming_NamingContext':destroy(NS), oe_orber_test_server:oe_unregister(); uninstall_test_data(ssl) -> @@ -512,7 +553,7 @@ uninstall_test_data(ssl) -> N = lname:insert_component(lname:create(), 1, NC1), Obj = (catch 'CosNaming_NamingContext':resolve(NS, N)), catch corba:dispose(Obj), - catch 'CosNaming_NamingContext':destroy(NS), + catch 'CosNaming_NamingContext':destroy(NS), oe_orber_test_server:oe_unregister(); uninstall_test_data(ssl_simple) -> @@ -530,27 +571,27 @@ uninstall_test_data(_) -> %% Arguments: TestServerObj a orber_test_server ref %% OtherObj - any other Orber object. %% Returns : term() -%% Effect : +%% Effect : %%------------------------------------------------------------ corba_object_tests(TestServerObj, OtherObj) -> - ?match(false, + ?match(false, corba_object:is_a(TestServerObj, "IDL:orber_parent/inherrit:1.0")), - ?match(true, + ?match(true, corba_object:is_a(TestServerObj, "IDL:omg.org/orber_parent/inherrit:1.0")), - ?match(true, + ?match(true, corba_object:is_a(TestServerObj, "IDL:omg.org/orber_test/server:1.0")), - ?match(false, + ?match(false, corba_object:is_a(TestServerObj, "IDL:orber_test/server:1.0")), - ?match(false, + ?match(false, corba_object:is_a(TestServerObj, "IDL:omg.org/orber_parent/inherrit:1.1")), - ?match(false, + ?match(false, corba_object:is_a(TestServerObj, "NotValidIFRID")), - ?match(false, + ?match(false, corba_object:is_nil(TestServerObj)), - ?match(false, + ?match(false, corba_object:is_equivalent(OtherObj,TestServerObj)), - ?match(true, + ?match(true, corba_object:is_equivalent(TestServerObj,TestServerObj)), ?match(false, corba_object:non_existent(TestServerObj)), ?match(false, corba_object:not_existent(TestServerObj)), @@ -562,32 +603,32 @@ corba_object_tests(TestServerObj, OtherObj) -> %% function : lookup %% Arguments: Port - which port the other orb uses. %% Returns : term() -%% Effect : +%% Effect : %%------------------------------------------------------------ lookup(Host, Port) -> Key = Host++":"++integer_to_list(Port), - NSR = corba:resolve_initial_references_remote("NameService", + NSR = corba:resolve_initial_references_remote("NameService", ["iiop://"++Key]), NC1 = lname_component:set_id(lname_component:create(), "not_exist"), N1 = lname:insert_component(lname:create(), 1, NC1), ?match({'EXCEPTION',{'CosNaming_NamingContext_NotFound',_,_,_}}, 'CosNaming_NamingContext':resolve(NSR, N1)), - + NC2 = lname_component:set_id(lname_component:create(), "mamba"), N2 = lname:insert_component(lname:create(), 1, NC2), - Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, 'CosNaming_NamingContext':resolve(NSR, N2)), orber_test_server:print(Obj), - Obj2 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + Obj2 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, corba:string_to_object("corbaname:iiop:1.1@"++Key++"/NameService#mamba")), - + orber_test_server:print(Obj2), - NSR2 = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_}, + NSR2 = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_}, corba:string_to_object("corbaloc:iiop:1.1@"++Key++"/NameService")), - Obj3 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + Obj3 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, 'CosNaming_NamingContext':resolve(NSR2, N2)), orber_test_server:print(Obj3). @@ -595,11 +636,11 @@ lookup(Host, Port) -> %% function : alternate_iiop_address %% Arguments: Port - which port the other orb uses. %% Returns : term() -%% Effect : +%% Effect : %%------------------------------------------------------------ alternate_iiop_address(Host, Port) -> IOR = create_alternate_iiop_address(Host, Port), - + ?match(false, corba_object:non_existent(IOR)), ?match({'object_forward',_}, corba:locate(IOR)), ?match({'object_forward',_}, corba:locate(IOR, 10000)), @@ -609,145 +650,145 @@ alternate_iiop_address(Host, Port) -> %% function : create_alternate_iiop_address %% Arguments: Port - which port the other orb uses. %% Returns : term() -%% Effect : +%% Effect : %%------------------------------------------------------------ create_alternate_iiop_address(Host, Port) -> - MC = [#'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE, + MC = [#'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE, component_data = ?ORBER_ORB_TYPE_1}, - #'IOP_TaggedComponent'{tag = ?TAG_CODE_SETS, + #'IOP_TaggedComponent'{tag = ?TAG_CODE_SETS, component_data = ?DEFAULT_CODESETS}, - #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, + #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, component_data = #'ALTERNATE_IIOP_ADDRESS'{ - 'HostID' = Host, + 'HostID' = Host, 'Port' = Port}}, - #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, + #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, component_data = #'ALTERNATE_IIOP_ADDRESS'{ - 'HostID' = Host, + 'HostID' = Host, 'Port' = 8000}}, - #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, + #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, component_data = #'ALTERNATE_IIOP_ADDRESS'{ - 'HostID' = Host, + 'HostID' = Host, 'Port' = 8000}}], #'IOP_IOR'{type_id=TypeID, - profiles=P1} = _IORA = iop_ior:create({1,2}, + profiles=P1} = _IORA = iop_ior:create({1,2}, "IDL:omg.org/CosNaming/NamingContextExt:1.0", - [Host], 8000, -1, + [Host], 8000, -1, "NameService", MC, 0, 0), - #'IOP_IOR'{profiles=P2} = _IORB = iop_ior:create({1,1}, + #'IOP_IOR'{profiles=P2} = _IORB = iop_ior:create({1,1}, "IDL:omg.org/CosNaming/NamingContextExt:1.0", [Host], 8000, -1, "NameService", [], 0, 0), #'IOP_IOR'{type_id=TypeID, profiles=P2++P1}. - + %%------------------------------------------------------------ %% function : create_components_IOR -%% Arguments: +%% Arguments: %% Returns : term() -%% Effect : +%% Effect : %%------------------------------------------------------------ create_components_IOR(Version) -> - MC = [#'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE, + MC = [#'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE, component_data = ?ORBER_ORB_TYPE_1}, - #'IOP_TaggedComponent'{tag = ?TAG_CODE_SETS, + #'IOP_TaggedComponent'{tag = ?TAG_CODE_SETS, component_data = ?DEFAULT_CODESETS}, - #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, + #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, component_data = #'ALTERNATE_IIOP_ADDRESS'{ - 'HostID' = "127.0.0.1", + 'HostID' = "127.0.0.1", 'Port' = 4001}}, - #'IOP_TaggedComponent'{tag = ?TAG_SSL_SEC_TRANS, - component_data = #'SSLIOP_SSL'{target_supports = 0, + #'IOP_TaggedComponent'{tag = ?TAG_SSL_SEC_TRANS, + component_data = #'SSLIOP_SSL'{target_supports = 0, target_requires = 1, port = 2}}, - #'IOP_TaggedComponent'{tag = ?TAG_FT_GROUP, - component_data = + #'IOP_TaggedComponent'{tag = ?TAG_FT_GROUP, + component_data = #'FT_TagFTGroupTaggedComponent' - {version = #'GIOP_Version'{major = 1, - minor = 2}, - ft_domain_id = "FT_FTDomainId", + {version = #'GIOP_Version'{major = 1, + minor = 2}, + ft_domain_id = "FT_FTDomainId", object_group_id = ?ULONGLONGMAX, object_group_ref_version = ?LONGMAX}}, - #'IOP_TaggedComponent'{tag = ?TAG_FT_PRIMARY, - component_data = + #'IOP_TaggedComponent'{tag = ?TAG_FT_PRIMARY, + component_data = #'FT_TagFTPrimaryTaggedComponent'{primary = true}}, - #'IOP_TaggedComponent'{tag = ?TAG_FT_HEARTBEAT_ENABLED, - component_data = + #'IOP_TaggedComponent'{tag = ?TAG_FT_HEARTBEAT_ENABLED, + component_data = #'FT_TagFTHeartbeatEnabledTaggedComponent'{heartbeat_enabled = true}}, - #'IOP_TaggedComponent'{tag = ?TAG_CSI_SEC_MECH_LIST, - component_data = + #'IOP_TaggedComponent'{tag = ?TAG_CSI_SEC_MECH_LIST, + component_data = #'CSIIOP_CompoundSecMechList' {stateful = false, - mechanism_list = + mechanism_list = [#'CSIIOP_CompoundSecMech' - {target_requires = 6, - transport_mech = + {target_requires = 6, + transport_mech = #'IOP_TaggedComponent' {tag=?TAG_TLS_SEC_TRANS, component_data=#'CSIIOP_TLS_SEC_TRANS' - {target_supports = 7, - target_requires = 8, - addresses = - [#'CSIIOP_TransportAddress'{host_name = "127.0.0.1", + {target_supports = 7, + target_requires = 8, + addresses = + [#'CSIIOP_TransportAddress'{host_name = "127.0.0.1", port = 6001}]}}, - as_context_mech = + as_context_mech = #'CSIIOP_AS_ContextSec' {target_supports = 9, target_requires = 10, - client_authentication_mech = [1, 255], - target_name = [2,255]}, - sas_context_mech = + client_authentication_mech = [1, 255], + target_name = [2,255]}, + sas_context_mech = #'CSIIOP_SAS_ContextSec' {target_supports = 11, target_requires = 12, - privilege_authorities = + privilege_authorities = [#'CSIIOP_ServiceConfiguration' - {syntax = ?ULONGMAX, - name = [3,255]}], + {syntax = ?ULONGMAX, + name = [3,255]}], supported_naming_mechanisms = [[4,255],[5,255]], supported_identity_types = ?ULONGMAX}}, #'CSIIOP_CompoundSecMech' - {target_requires = 6, - transport_mech = + {target_requires = 6, + transport_mech = #'IOP_TaggedComponent' {tag=?TAG_NULL_TAG, component_data=[]}, - as_context_mech = + as_context_mech = #'CSIIOP_AS_ContextSec' {target_supports = 9, target_requires = 10, - client_authentication_mech = [1, 255], - target_name = [2,255]}, - sas_context_mech = + client_authentication_mech = [1, 255], + target_name = [2,255]}, + sas_context_mech = #'CSIIOP_SAS_ContextSec' {target_supports = 11, target_requires = 12, - privilege_authorities = + privilege_authorities = [#'CSIIOP_ServiceConfiguration' - {syntax = ?ULONGMAX, - name = [3,255]}], + {syntax = ?ULONGMAX, + name = [3,255]}], supported_naming_mechanisms = [[4,255],[5,255]], supported_identity_types = ?ULONGMAX}}, #'CSIIOP_CompoundSecMech' - {target_requires = 6, - transport_mech = + {target_requires = 6, + transport_mech = #'IOP_TaggedComponent' {tag=?TAG_SECIOP_SEC_TRANS, component_data=#'CSIIOP_SECIOP_SEC_TRANS' - {target_supports = 7, - target_requires = 8, + {target_supports = 7, + target_requires = 8, mech_oid = [0,255], target_name = [0,255], - addresses = - [#'CSIIOP_TransportAddress'{host_name = "127.0.0.1", + addresses = + [#'CSIIOP_TransportAddress'{host_name = "127.0.0.1", port = 6001}]}}, - as_context_mech = + as_context_mech = #'CSIIOP_AS_ContextSec' {target_supports = 9, target_requires = 10, - client_authentication_mech = [1, 255], - target_name = [2,255]}, - sas_context_mech = + client_authentication_mech = [1, 255], + target_name = [2,255]}, + sas_context_mech = #'CSIIOP_SAS_ContextSec' {target_supports = 11, target_requires = 12, - privilege_authorities = + privilege_authorities = [#'CSIIOP_ServiceConfiguration' - {syntax = ?ULONGMAX, - name = [3,255]}], + {syntax = ?ULONGMAX, + name = [3,255]}], supported_naming_mechanisms = [[4,255],[5,255]], supported_identity_types = ?ULONGMAX}}]}}], iop_ior:create(Version, "IDL:omg.org/CosNaming/NamingContextExt:1.0", @@ -759,11 +800,11 @@ create_components_IOR(Version) -> %% function : alternate_ssl_iiop_address %% Arguments: Port - which port the other orb uses. %% Returns : term() -%% Effect : +%% Effect : %%------------------------------------------------------------ alternate_ssl_iiop_address(Host, Port, SSLPort) -> IOR = create_alternate_ssl_iiop_address(Host, Port, SSLPort), - + ?match(false, corba_object:non_existent(IOR)), ?match({'object_forward',_}, corba:locate(IOR)), ?match({'object_forward',_}, corba:locate(IOR, 10000)), @@ -774,37 +815,37 @@ alternate_ssl_iiop_address(Host, Port, SSLPort) -> %% function : create_alternate_ssl_iiop_address %% Arguments: Port - which port the other orb uses. %% Returns : term() -%% Effect : +%% Effect : %%------------------------------------------------------------ create_alternate_ssl_iiop_address(Host, Port, SSLPort) -> - MC = [#'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE, + MC = [#'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE, component_data = ?ORBER_ORB_TYPE_1}, - #'IOP_TaggedComponent'{tag = ?TAG_CODE_SETS, + #'IOP_TaggedComponent'{tag = ?TAG_CODE_SETS, component_data = ?DEFAULT_CODESETS}, - #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, + #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, component_data = #'ALTERNATE_IIOP_ADDRESS'{ - 'HostID' = Host, + 'HostID' = Host, 'Port' = Port}}, - #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, + #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, component_data = #'ALTERNATE_IIOP_ADDRESS'{ - 'HostID' = Host, + 'HostID' = Host, 'Port' = 8000}}, - #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, + #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, component_data = #'ALTERNATE_IIOP_ADDRESS'{ - 'HostID' = Host, + 'HostID' = Host, 'Port' = 8000}}, - #'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, - component_data=#'SSLIOP_SSL'{target_supports = 2, - target_requires = 2, + #'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, + component_data=#'SSLIOP_SSL'{target_supports = 2, + target_requires = 2, port = SSLPort}}], #'IOP_IOR'{type_id=TypeID, - profiles=P1} = _IORA = iop_ior:create_external({1,2}, + profiles=P1} = _IORA = iop_ior:create_external({1,2}, "IDL:omg.org/CosNaming/NamingContextExt:1.0", - Host, 8000, + Host, 8000, "NameService", MC), - #'IOP_IOR'{profiles=P2} = _IORB = iop_ior:create_external({1,1}, + #'IOP_IOR'{profiles=P2} = _IORB = iop_ior:create_external({1,1}, "IDL:omg.org/CosNaming/NamingContextExt:1.0", - Host, 8000, + Host, 8000, "NameService", []), #'IOP_IOR'{type_id=TypeID, profiles=P2++P1}. @@ -813,11 +854,11 @@ create_alternate_ssl_iiop_address(Host, Port, SSLPort) -> %% function : timeouts %% Arguments: Port - which port the other orb uses. %% Returns : term() -%% Effect : +%% Effect : %%------------------------------------------------------------ timeouts(Host, Port, ReqT) -> - NSR = corba:resolve_initial_references_remote("NameService", + NSR = corba:resolve_initial_references_remote("NameService", ["iiop://"++Host++":"++integer_to_list(Port)]), NC1 = lname_component:set_id(lname_component:create(), "mamba"), N1 = lname:insert_component(lname:create(), 1, NC1), @@ -827,21 +868,21 @@ timeouts(Host, Port, ReqT) -> Viper = 'CosNaming_NamingContext':resolve(NSR, N2), ?match({'EXCEPTION',{'TIMEOUT',_,_,_}}, - orber_test_timeout_server:twoway_function(Viper, ReqT, ReqT*2)), - ?match(ok, orber_test_timeout_server:oneway_function(Viper, ReqT*2)), + orber_test_timeout_server:twoway_function(Viper, ReqT, ReqT*2)), + ?match(ok, orber_test_timeout_server:oneway_function(Viper, ReqT*2)), ?match({'EXCEPTION',{'TIMEOUT',_,_,_}}, - orber_test_server:testing_iiop_twoway_delay(Mamba, ReqT)), + orber_test_server:testing_iiop_twoway_delay(Mamba, ReqT)), ?match(ok, orber_test_server:testing_iiop_oneway_delay(Mamba, ReqT)), - + %% Since the objects are stalled we must wait until they are available again %% to be able to run any more tests and get the correct results. timer:sleep(ReqT*4), - - ?match(ok, orber_test_timeout_server:twoway_function(Viper, ReqT*2, ReqT)), - ?match(ok, orber_test_timeout_server:oneway_function(Viper, ReqT*2)), - - ?match(ok, orber_test_server:testing_iiop_twoway_delay(Mamba, 0)), + + ?match(ok, orber_test_timeout_server:twoway_function(Viper, ReqT*2, ReqT)), + ?match(ok, orber_test_timeout_server:oneway_function(Viper, ReqT*2)), + + ?match(ok, orber_test_server:testing_iiop_twoway_delay(Mamba, 0)), ?match(ok, orber_test_server:testing_iiop_oneway_delay(Mamba, 0)), timer:sleep(ReqT*4), @@ -852,11 +893,11 @@ timeouts(Host, Port, ReqT) -> %% Arguments: Host - which node to contact. %% Port - which port the other orb uses. %% Returns : term() -%% Effect : +%% Effect : %%------------------------------------------------------------ light_tests(Host, Port, ObjName) -> - NSR = corba:resolve_initial_references_remote("NameService", + NSR = corba:resolve_initial_references_remote("NameService", ["iiop://"++Host++":"++integer_to_list(Port)]), NC1 = lname_component:set_id(lname_component:create(), "not_exist"), N1 = lname:insert_component(lname:create(), 1, NC1), @@ -867,7 +908,7 @@ light_tests(Host, Port, ObjName) -> 'CosNaming_NamingContext':resolve(NSR, N1)), NC2 = lname_component:set_id(lname_component:create(), ObjName), N2 = lname:insert_component(lname:create(), 1, NC2), - Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, + Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_}, 'CosNaming_NamingContext':resolve(NSR, N2)), Nodes = orber:get_lightweight_nodes(), io:format("Light Nodes: ~p~n", [Nodes]), @@ -889,165 +930,165 @@ test_coding(Obj) -> test_coding(Obj, Local) -> %%--- Testing code and decode arguments --- ?match({ok, 1.5}, orber_test_server:testing_iiop_float(Obj, 1.5)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_float(Obj, atom)), ?match({ok,1.0}, orber_test_server:testing_iiop_double(Obj, 1.0)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_double(Obj, "wrong")), - + ?match({ok,0}, orber_test_server:testing_iiop_short(Obj, 0)), ?match({ok,?SHORTMAX}, orber_test_server:testing_iiop_short(Obj, ?SHORTMAX)), ?match({ok,?SHORTMIN}, orber_test_server:testing_iiop_short(Obj, ?SHORTMIN)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_short(Obj, atomic)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_short(Obj, ?SHORTMAX+1)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_short(Obj, ?SHORTMIN-1)), - + ?match({ok,0}, orber_test_server:testing_iiop_ushort(Obj, 0)), ?match({ok,?USHORTMAX}, orber_test_server:testing_iiop_ushort(Obj, ?USHORTMAX)), ?match({ok,?USHORTMIN}, orber_test_server:testing_iiop_ushort(Obj, ?USHORTMIN)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_ushort(Obj, ?USHORTMAX+1)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_ushort(Obj, ?USHORTMIN-1)), - + ?match({ok,0}, orber_test_server:testing_iiop_long(Obj, 0)), ?match({ok,?LONGMAX}, orber_test_server:testing_iiop_long(Obj, ?LONGMAX)), ?match({ok,?LONGMIN}, orber_test_server:testing_iiop_long(Obj, ?LONGMIN)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_long(Obj, "wrong")), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_long(Obj, ?LONGMAX+1)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_long(Obj, ?LONGMIN-1)), - + ?match({ok,0}, orber_test_server:testing_iiop_longlong(Obj, 0)), ?match({ok,?LONGLONGMAX}, orber_test_server:testing_iiop_longlong(Obj, ?LONGLONGMAX)), ?match({ok,?LONGLONGMIN}, orber_test_server:testing_iiop_longlong(Obj, ?LONGLONGMIN)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_longlong(Obj, "wrong")), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_longlong(Obj, ?LONGLONGMAX+1)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_longlong(Obj, ?LONGLONGMIN-1)), - + ?match({ok,0}, orber_test_server:testing_iiop_ulong(Obj, 0)), ?match({ok,?ULONGMAX}, orber_test_server:testing_iiop_ulong(Obj, ?ULONGMAX)), ?match({ok,?ULONGMIN}, orber_test_server:testing_iiop_ulong(Obj, ?ULONGMIN)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_ulong(Obj, ?ULONGMAX+1)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_ulong(Obj, ?ULONGMIN-1)), - + ?match({ok,0}, orber_test_server:testing_iiop_ulonglong(Obj, 0)), ?match({ok,?ULONGLONGMAX}, orber_test_server:testing_iiop_ulonglong(Obj, ?ULONGLONGMAX)), ?match({ok,?ULONGLONGMIN}, orber_test_server:testing_iiop_ulonglong(Obj, ?ULONGLONGMIN)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_ulonglong(Obj, ?ULONGLONGMAX+1)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_ulonglong(Obj, ?ULONGLONGMIN-1)), - + ?match({ok,98}, orber_test_server:testing_iiop_char(Obj, 98)), ?match({ok,$b}, orber_test_server:testing_iiop_char(Obj, $b)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_char(Obj, atomic)), ?match({ok,65535}, orber_test_server:testing_iiop_wchar(Obj, 65535)), ?match({ok,$b}, orber_test_server:testing_iiop_wchar(Obj, $b)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_wchar(Obj, atomic)), - + ?match({ok,true}, orber_test_server:testing_iiop_bool(Obj, true)), ?match({ok,false}, orber_test_server:testing_iiop_bool(Obj, false)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_bool(Obj, atom)), - + ?match({ok,1}, orber_test_server:testing_iiop_octet(Obj, 1)), % No real guards for this case. -% ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, +% ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, % orber_test_server:testing_iiop_octet(Obj, 1.5)), IOR12 = create_components_IOR({1,2}), ?match({ok,Obj}, orber_test_server:testing_iiop_obj(Obj, Obj)), ?match({ok,IOR12}, orber_test_server:testing_iiop_obj(Obj, IOR12)), PObj = orber_test_server:oe_create([], [{pseudo,true}]), ?match({ok, _}, orber_test_server:testing_iiop_obj(Obj, PObj)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_obj(Obj, "no_object")), ?match({ok,"string"}, orber_test_server:testing_iiop_string(Obj, "string")), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_string(Obj, "ToLongString")), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_string(Obj, atomic)), ?match({ok,[65535]}, orber_test_server:testing_iiop_wstring(Obj, [65535])), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_wstring(Obj, "ToLongWstring")), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_wstring(Obj, atomic)), - ?match({ok, one}, + ?match({ok, one}, orber_test_server:testing_iiop_enum(Obj, one)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_enum(Obj, three)), - ?match({ok,[1,2,3]}, + ?match({ok,[1,2,3]}, orber_test_server:testing_iiop_seq(Obj, [1,2,3])), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_seq(Obj, [1,2,3,4])), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_seq(Obj, false)), - ?match({ok,[#orber_test_server_struc{a=1, b=2}]}, - orber_test_server:testing_iiop_struc_seq(Obj, + ?match({ok,[#orber_test_server_struc{a=1, b=2}]}, + orber_test_server:testing_iiop_struc_seq(Obj, [#orber_test_server_struc{a=1, b=2}])), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_struc_seq(Obj, false)), - ?match({ok,[#orber_test_server_uni{label=1, value=66}]}, - orber_test_server:testing_iiop_uni_seq(Obj, + ?match({ok,[#orber_test_server_uni{label=1, value=66}]}, + orber_test_server:testing_iiop_uni_seq(Obj, [#orber_test_server_uni{label=1, value=66}])), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_uni_seq(Obj, false)), - ?match({ok,{"one", "two"}}, + ?match({ok,{"one", "two"}}, orber_test_server:testing_iiop_array(Obj, {"one", "two"})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_array(Obj, {"one", "two", "three"})), - ?match({ok,#orber_test_server_struc{a=1, b=2}}, - orber_test_server:testing_iiop_struct(Obj, + ?match({ok,#orber_test_server_struc{a=1, b=2}}, + orber_test_server:testing_iiop_struct(Obj, #orber_test_server_struc{a=1, b=2})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_struct(Obj, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_struct(Obj, #orber_test_server_struc{a="WRONG", b=2})), - ?match({ok,#orber_test_server_uni{label=1, value=66}}, - orber_test_server:testing_iiop_union(Obj, + ?match({ok,#orber_test_server_uni{label=1, value=66}}, + orber_test_server:testing_iiop_union(Obj, #orber_test_server_uni{label=1, value=66})), - ?match({ok,#orber_test_server_uni_d{label=1, value=66}}, - orber_test_server:testing_iiop_union_d(Obj, + ?match({ok,#orber_test_server_uni_d{label=1, value=66}}, + orber_test_server:testing_iiop_union_d(Obj, #orber_test_server_uni_d{label=1, value=66})), - ?match({ok,#orber_test_server_uni_d{label=2, value=true}}, - orber_test_server:testing_iiop_union_d(Obj, + ?match({ok,#orber_test_server_uni_d{label=2, value=true}}, + orber_test_server:testing_iiop_union_d(Obj, #orber_test_server_uni_d{label=2, value=true})), ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_union_d(Obj, + orber_test_server:testing_iiop_union_d(Obj, #orber_test_server_uni_d{label=2, value=66})), case Local of true -> - ?match({ok,#orber_test_server_uni{label=2, value=66}}, - orber_test_server:testing_iiop_union(Obj, + ?match({ok,#orber_test_server_uni{label=2, value=66}}, + orber_test_server:testing_iiop_union(Obj, #orber_test_server_uni{label=2, value=66})); false -> - ?match({ok,#orber_test_server_uni{label=2, value=undefined}}, - orber_test_server:testing_iiop_union(Obj, + ?match({ok,#orber_test_server_uni{label=2, value=undefined}}, + orber_test_server:testing_iiop_union(Obj, #orber_test_server_uni{label=2, value=66})) end, @@ -1058,258 +1099,258 @@ test_coding(Obj, Local) -> C4 = orber_test_server:fixed52negconst1(), C5 = orber_test_server:fixed52negconst2(), C6 = orber_test_server:fixed52negconst3(), - + ?match({ok,C1}, orber_test_server:testing_iiop_fixed(Obj, C1)), ?match({ok,C2}, orber_test_server:testing_iiop_fixed(Obj, C2)), ?match({ok,C3}, orber_test_server:testing_iiop_fixed(Obj, C3)), ?match({ok,C4}, orber_test_server:testing_iiop_fixed(Obj, C4)), ?match({ok,C5}, orber_test_server:testing_iiop_fixed(Obj, C5)), ?match({ok,C6}, orber_test_server:testing_iiop_fixed(Obj, C6)), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_fixed(Obj, #fixed{digits = 5, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_fixed(Obj, #fixed{digits = 5, scale = 2, value = 123450})), ?match(ok, orber_test_server:testing_iiop_void(Obj)), - ?match({'EXCEPTION',{'BAD_QOS',_,_,_}}, + ?match({'EXCEPTION',{'BAD_QOS',_,_,_}}, orber_test_server:pseudo_call_raise_exc(Obj, 1)), - ?match({'EXCEPTION',{'BAD_QOS',_,_,_}}, + ?match({'EXCEPTION',{'BAD_QOS',_,_,_}}, orber_test_server:pseudo_call_raise_exc(Obj, 2)), - ?match({'EXCEPTION',{'orber_test_server_UserDefinedException',_}}, + ?match({'EXCEPTION',{'orber_test_server_UserDefinedException',_}}, orber_test_server:raise_local_exception(Obj)), ?match({'EXCEPTION',{'orber_test_server_ComplexUserDefinedException',_, - [#orber_test_server_struc{a=1, b=2}]}}, + [#orber_test_server_struc{a=1, b=2}]}}, orber_test_server:raise_complex_local_exception(Obj)), %% Test all TypeCodes - ?match({ok, #any{typecode = tk_long, value = 1}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, + ?match({ok, #any{typecode = tk_long, value = 1}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, value = 1})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, value = "wrong"})), - ?match({ok, #any{typecode = tk_float, value = 1.5}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_float, + ?match({ok, #any{typecode = tk_float, value = 1.5}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_float, value = 1.5})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, value = "wrong"})), - ?match({ok, #any{typecode = tk_double}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_double, + ?match({ok, #any{typecode = tk_double}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_double, value = 1.0})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_double, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_double, value = "wrong"})), - ?match({ok, #any{typecode = tk_short, value = -1}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_short, + ?match({ok, #any{typecode = tk_short, value = -1}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_short, value = -1})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_short, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_short, value = atomic})), - ?match({ok, #any{typecode = tk_ushort, value = 1}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ushort, + ?match({ok, #any{typecode = tk_ushort, value = 1}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ushort, value = 1})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ushort, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ushort, value = -1})), - ?match({ok, #any{typecode = tk_long, value = 1}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, + ?match({ok, #any{typecode = tk_long, value = 1}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, value = 1})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long, value = "wrong"})), - ?match({ok, #any{typecode = tk_longlong, value = 1}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_longlong, + ?match({ok, #any{typecode = tk_longlong, value = 1}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_longlong, value = 1})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_longlong, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_longlong, value = "wrong"})), - ?match({ok, #any{typecode = tk_ulong, value = 1}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong, + ?match({ok, #any{typecode = tk_ulong, value = 1}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong, value = 1})), - ?match({ok, #any{typecode = tk_ulong, value = 4294967295}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong, + ?match({ok, #any{typecode = tk_ulong, value = 4294967295}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong, value = 4294967295})), ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong, value = 4294967296})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong, value = -1})), - ?match({ok, #any{typecode = tk_ulonglong, value = 1}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulonglong, + ?match({ok, #any{typecode = tk_ulonglong, value = 1}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulonglong, value = 1})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulonglong, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulonglong, value = -1})), - ?match({ok, #any{typecode = tk_char, value = 98}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_char, + ?match({ok, #any{typecode = tk_char, value = 98}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_char, value = 98})), - ?match({ok, #any{typecode = tk_char, value = $b}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_char, + ?match({ok, #any{typecode = tk_char, value = $b}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_char, value = $b})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_char, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_char, value = atomic})), - ?match({ok, #any{typecode = tk_wchar, value = 65535}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_wchar, + ?match({ok, #any{typecode = tk_wchar, value = 65535}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_wchar, value = 65535})), - ?match({ok, #any{typecode = tk_wchar, value = $b}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_wchar, + ?match({ok, #any{typecode = tk_wchar, value = $b}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_wchar, value = $b})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_wchar, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_wchar, value = atomic})), - ?match({ok, #any{typecode = tk_boolean, value = true}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_boolean, + ?match({ok, #any{typecode = tk_boolean, value = true}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_boolean, value = true})), - ?match({ok, #any{typecode = tk_boolean, value = false}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_boolean, + ?match({ok, #any{typecode = tk_boolean, value = false}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_boolean, value = false})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_boolean, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_boolean, value = 1})), - ?match({ok, #any{typecode = tk_octet, value = 1}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_octet, + ?match({ok, #any{typecode = tk_octet, value = 1}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_octet, value = 1})), - ?match({ok, #any{typecode = {tk_objref, "IDL:omg.org/orber_test/server:1.0", "server"}, value = Obj}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_objref, "IDL:omg.org/orber_test/server:1.0", "server"}, + ?match({ok, #any{typecode = {tk_objref, "IDL:omg.org/orber_test/server:1.0", "server"}, value = Obj}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_objref, "IDL:omg.org/orber_test/server:1.0", "server"}, value = Obj})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_objref, "IDL:omg.org/orber_test/server:1.0", "server"}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_objref, "IDL:omg.org/orber_test/server:1.0", "server"}, value = "No Object"})), - ?match({ok, #any{typecode = {tk_string, 6}, value = "string"}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_string, 6}, + ?match({ok, #any{typecode = {tk_string, 6}, value = "string"}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_string, 6}, value = "string"})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_string, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_string, value = atomic})), - ?match({ok, #any{typecode = {tk_wstring, 1}, value = [65535]}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_wstring, 1}, + ?match({ok, #any{typecode = {tk_wstring, 1}, value = [65535]}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_wstring, 1}, value = [65535]})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_wstring, 1}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_wstring, 1}, value = atomic})), - ?match({ok, #any{typecode = {tk_enum, "IDL:omg.org/orber_test/server/enumerant:1.0", "enumerant", ["one","two"]}, - value = two}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_enum, "IDL:omg.org/orber_test/server/enumerant:1.0", "enumerant", ["one","two"]}, + ?match({ok, #any{typecode = {tk_enum, "IDL:omg.org/orber_test/server/enumerant:1.0", "enumerant", ["one","two"]}, + value = two}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_enum, "IDL:omg.org/orber_test/server/enumerant:1.0", "enumerant", ["one","two"]}, value = two})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_enum, "IDL:omg.org/orber_test/server/enumerant:1.0", "enumerant", ["one","two"]}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_enum, "IDL:omg.org/orber_test/server/enumerant:1.0", "enumerant", ["one","two"]}, value = three})), - ?match({ok, #any{typecode = {tk_sequence, tk_long, 3}, - value = [1,2,3]}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_sequence, tk_long, 3}, + ?match({ok, #any{typecode = {tk_sequence, tk_long, 3}, + value = [1,2,3]}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_sequence, tk_long, 3}, value = [1,2,3]})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_sequence, tk_long, 3}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_sequence, tk_long, 3}, value = false})), - ?match({ok, #any{typecode = {tk_array,{tk_string,0},2}, - value = {"one", "two"}}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_array,{tk_string,0},2}, + ?match({ok, #any{typecode = {tk_array,{tk_string,0},2}, + value = {"one", "two"}}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_array,{tk_string,0},2}, value = {"one", "two"}})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_array,{tk_string,0},2}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_array,{tk_string,0},2}, value = {"one", "two", "three"}})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_array,{tk_string,0},2}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_array,{tk_string,0},2}, value = {1, 2}})), ?match({ok, #any{typecode = {tk_struct,"IDL:omg.org/orber_test/server/struc:1.0", "struc", - [{"a",tk_long},{"b",tk_short}]}, - value = #orber_test_server_struc{a=1, b=2}}}, + [{"a",tk_long},{"b",tk_short}]}, + value = #orber_test_server_struc{a=1, b=2}}}, orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_struct,"IDL:omg.org/orber_test/server/struc:1.0", "struc", [{"a",tk_long},{"b",tk_short}]}, value = #orber_test_server_struc{a=1, b=2}})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_struct,"IDL:omg.org/orber_test/server/struc:1.0", "struc", - [{"a",tk_long},{"b",tk_short}]}, + [{"a",tk_long},{"b",tk_short}]}, value = #orber_test_server_struc{a=1, b="string"}})), - ?match({ok, #any{typecode = + ?match({ok, #any{typecode = {tk_union,"IDL:omg.org/orber_test/server/uni:1.0", - "uni", tk_long, -1, [{1,"a",tk_long}]}, - value = #orber_test_server_uni{label=1, value=66}}}, + "uni", tk_long, -1, [{1,"a",tk_long}]}, + value = #orber_test_server_uni{label=1, value=66}}}, orber_test_server: - testing_iiop_any(Obj, - #any{typecode = + testing_iiop_any(Obj, + #any{typecode = {tk_union,"IDL:omg.org/orber_test/server/uni:1.0", - "uni", tk_long, -1, [{1,"a",tk_long}]}, + "uni", tk_long, -1, [{1,"a",tk_long}]}, value = #orber_test_server_uni{label=1, value=66}})), case Local of true -> - ?match({ok, #any{typecode = + ?match({ok, #any{typecode = {tk_union,"IDL:omg.org/orber_test/server/uni:1.0", - "uni", tk_long, -1, [{1,"a",tk_long}]}, - value = #orber_test_server_uni{label=2, value=66}}}, + "uni", tk_long, -1, [{1,"a",tk_long}]}, + value = #orber_test_server_uni{label=2, value=66}}}, orber_test_server: testing_iiop_any(Obj, - #any{typecode = + #any{typecode = {tk_union,"IDL:omg.org/orber_test/server/uni:1.0", - "uni", tk_long, -1, [{1,"a",tk_long}]}, + "uni", tk_long, -1, [{1,"a",tk_long}]}, value = #orber_test_server_uni{label=2, value=66}})); false -> - ?match({ok, #any{typecode = + ?match({ok, #any{typecode = {tk_union,"IDL:omg.org/orber_test/server/uni:1.0", - "uni", tk_long, -1, [{1,"a",tk_long}]}, - value = #orber_test_server_uni{label=2, value=undefined}}}, + "uni", tk_long, -1, [{1,"a",tk_long}]}, + value = #orber_test_server_uni{label=2, value=undefined}}}, orber_test_server: testing_iiop_any(Obj, - #any{typecode = + #any{typecode = {tk_union,"IDL:omg.org/orber_test/server/uni:1.0", - "uni", tk_long, -1, [{1,"a",tk_long}]}, + "uni", tk_long, -1, [{1,"a",tk_long}]}, value = #orber_test_server_uni{label=2, value=66}})) end, - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server: - testing_iiop_any(Obj, - #any{typecode = + testing_iiop_any(Obj, + #any{typecode = {tk_union,"IDL:omg.org/orber_test/server/uni:1.0", - "uni", tk_long, -1, [{1,"a",tk_long}]}, + "uni", tk_long, -1, [{1,"a",tk_long}]}, value = #orber_test_server_uni{label=1, value="string"}})), - ?match({ok, #any{typecode = {tk_fixed,5,2}, - value = #fixed{digits = 5, scale = 2, value = 12345}}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_fixed,5,2}, - value = #fixed{digits = 5, - scale = 2, + ?match({ok, #any{typecode = {tk_fixed,5,2}, + value = #fixed{digits = 5, scale = 2, value = 12345}}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_fixed,5,2}, + value = #fixed{digits = 5, + scale = 2, value = 12345}})), - ?match({ok, #any{typecode = {tk_fixed,10,2}, - value = #fixed{digits = 10, scale = 2, value = 1234567890}}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_fixed,10,2}, - value = #fixed{digits = 10, - scale = 2, + ?match({ok, #any{typecode = {tk_fixed,10,2}, + value = #fixed{digits = 10, scale = 2, value = 1234567890}}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_fixed,10,2}, + value = #fixed{digits = 10, + scale = 2, value = 1234567890}})), - ?match({ok, #any{typecode = {tk_fixed,6,2}, - value = #fixed{digits = 6, scale = 2, value = 300000}}}, - orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_fixed,6,2}, - value = #fixed{digits = 6, - scale = 2, + ?match({ok, #any{typecode = {tk_fixed,6,2}, + value = #fixed{digits = 6, scale = 2, value = 300000}}}, + orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_fixed,6,2}, + value = #fixed{digits = 6, + scale = 2, value = 300000}})), - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, + ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, orber_test_server: testing_iiop_server_marshal(Obj, "string")), - + RecS = #orber_test_server_rec_struct{chain = [#orber_test_server_rec_struct{chain = []}]}, ?match(RecS, orber_test_server:testing_iiop_rec_struct(Obj, RecS)), - - RecU = #orber_test_server_rec_union{label = 'RecursiveType', + + RecU = #orber_test_server_rec_union{label = 'RecursiveType', value = [#orber_test_server_rec_union{label = 'RecursiveType', value = []}]}, ?match(RecU, orber_test_server:testing_iiop_rec_union(Obj, RecU)), %% RecA1 = #any{typecode = unsupported, value = RecS}, %% RecA2 = #any{typecode = unsupported, value = RecU}, -%% ?match(RecA1, -%% orber_test_server:testing_iiop_rec_any(Obj, RecA1)), -%% ?match(RecA2, -%% orber_test_server:testing_iiop_rec_any(Obj, RecA2)), +%% ?match(RecA1, +%% orber_test_server:testing_iiop_rec_any(Obj, RecA1)), +%% ?match(RecA2, +%% orber_test_server:testing_iiop_rec_any(Obj, RecA2)), ok. @@ -1332,14 +1373,14 @@ Result : ~p ok. %%--------------- Testing Missing Module --------------------- -oe_get_interface() -> +oe_get_interface() -> non_existing_module:tc(foo). %%--------------- INTERCEPTOR FUNCTIONS ---------------------- %%------------------------------------------------------------ %% function : new_in_connection -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ new_in_connection(Arg, CHost, Port) -> Host = node(), @@ -1353,14 +1394,14 @@ To Host : ~p To Port : ~p Peers : ~p Arg : ~p -==========================================~n", +==========================================~n", [Host, CHost, Port, SHost, SPort, Peers, Arg]), {Host}. %%------------------------------------------------------------ %% function : new_out_connection -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ new_out_connection(Arg, SHost, Port) -> Host = node(), @@ -1369,73 +1410,73 @@ Node : ~p To Host : ~p To Port : ~p Arg : ~p -==========================================~n", +==========================================~n", [Host, SHost, Port, Arg]), {Host}. %%------------------------------------------------------------ %% function : closed_in_connection -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ closed_in_connection(Arg) -> error_logger:info_msg("=============== closed_in_connection ===== Node : ~p Connection: ~p -==========================================~n", +==========================================~n", [node(), Arg]), Arg. %%------------------------------------------------------------ %% function : closed_out_connection -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ closed_out_connection(Arg) -> error_logger:info_msg("=============== closed_out_connection ==== Node : ~p Connection: ~p -==========================================~n", +==========================================~n", [node(), Arg]), Arg. %%------------------------------------------------------------ %% function : in_request_encoded -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ -in_request_encoded(Ref, _ObjKey, Ctx, Op, +in_request_encoded(Ref, _ObjKey, Ctx, Op, <<100:8,101:8,102:8,103:8,104:8,105:8,106:8,107:8,108:8,109:8,110:8,T/binary>>, _Args) -> error_logger:info_msg("=============== in_request_encoded ======= Connection: ~p Operation : ~p Body : ~p Context : ~p -==========================================~n", +==========================================~n", [Ref, Op, T, Ctx]), {T, "NewArgs"}. %%------------------------------------------------------------ %% function : in_reply_encoded -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ in_reply_encoded(Ref, _ObjKey, Ctx, Op, - <<100:8,101:8,102:8,103:8,104:8,105:8,106:8,107:8,108:8,109:8,110:8,T/binary>>, + <<100:8,101:8,102:8,103:8,104:8,105:8,106:8,107:8,108:8,109:8,110:8,T/binary>>, _Args) -> error_logger:info_msg("============== in_reply_encoded ========== Connection: ~p Operation : ~p Body : ~p Context : ~p -==========================================~n", +==========================================~n", [Ref, Op, T, Ctx]), {T, "NewArgs"}. %%------------------------------------------------------------ %% function : out_reply_encoded -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ out_reply_encoded(Ref, _ObjKey, Ctx, Op, List, _Args) -> error_logger:info_msg("============== out_reply_encoded ========= @@ -1443,14 +1484,14 @@ Connection: ~p Operation : ~p Body : ~p Context : ~p -==========================================~n", +==========================================~n", [Ref, Op, List, Ctx]), {list_to_binary([<<100:8,101:8,102:8,103:8,104:8,105:8,106:8,107:8,108:8,109:8,110:8>>|List]), "NewArgs"}. %%------------------------------------------------------------ %% function : out_request_encoded -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ out_request_encoded(Ref, _ObjKey, Ctx, Op, List, _Args) -> error_logger:info_msg("============== out_request_encoded ======= @@ -1458,14 +1499,14 @@ Connection: ~p Operation : ~p Body : ~p Context : ~p -==========================================~n", +==========================================~n", [Ref, Op, List, Ctx]), {list_to_binary([<<100:8,101:8,102:8,103:8,104:8,105:8,106:8,107:8,108:8,109:8,110:8>>|List]), "NewArgs"}. %%------------------------------------------------------------ %% function : in_request -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ in_request(Ref, _ObjKey, Ctx, Op, Params, _Args) -> error_logger:info_msg("=============== in_request =============== @@ -1473,14 +1514,14 @@ Connection: ~p Operation : ~p Parameters: ~p Context : ~p -==========================================~n", +==========================================~n", [Ref, Op, Params, Ctx]), {Params, "NewArgs"}. %%------------------------------------------------------------ %% function : in_reply -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ in_reply(Ref, _ObjKey, Ctx, Op, Reply, _Args) -> error_logger:info_msg("=============== in_reply ================= @@ -1488,14 +1529,14 @@ Connection: ~p Operation : ~p Reply : ~p Context : ~p -==========================================~n", +==========================================~n", [Ref, Op, Reply, Ctx]), {Reply, "NewArgs"}. %%------------------------------------------------------------ %% function : postinvoke -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ out_reply(Ref, _ObjKey, Ctx, Op, Reply, _Args) -> error_logger:info_msg("=============== out_reply ================ @@ -1503,14 +1544,14 @@ Connection: ~p Operation : ~p Reply : ~p Context : ~p -==========================================~n", +==========================================~n", [Ref, Op, Reply, Ctx]), {Reply, "NewArgs"}. %%------------------------------------------------------------ %% function : postinvoke -%% Arguments: -%% Returns : +%% Arguments: +%% Returns : %%------------------------------------------------------------ out_request(Ref, _ObjKey, Ctx, Op, Params, _Args) -> error_logger:info_msg("=============== out_request ============== @@ -1518,7 +1559,7 @@ Connection: ~p Operation : ~p Parameters: ~p Context : ~p -==========================================~n", +==========================================~n", [Ref, Op, Params, Ctx]), {Params, "NewArgs"}. diff --git a/lib/public_key/asn1/InformationFramework.asn1 b/lib/public_key/asn1/InformationFramework.asn1 deleted file mode 100644 index 40fbd11a2a..0000000000 --- a/lib/public_key/asn1/InformationFramework.asn1 +++ /dev/null @@ -1,682 +0,0 @@ -InformationFramework {joint-iso-itu-t ds(5) module(1) informationFramework(1) - 6} DEFINITIONS ::= -BEGIN - --- EXPORTS All --- The types and values defined in this module are exported for use in the other ASN.1 modules contained --- within the Directory Specifications, and for the use of other applications which will use them to access --- Directory services. Other applications may use them for their own purposes, but this will not constrain --- extensions and modifications needed to maintain or improve the Directory service. -IMPORTS - -- from ITU-T Rec. X.501 | ISO/IEC 9594-2 - directoryAbstractService, id-ar, id-at, id-mr, id-nf, id-oa, id-oc, - id-sc, selectedAttributeTypes, serviceAdministration - FROM UsefulDefinitions {joint-iso-itu-t ds(5) module(1) - usefulDefinitions(0) 6} - SearchRule - FROM ServiceAdministration serviceAdministration - -- from ITU-T Rec. X.511 | ISO/IEC 9594-3 - TypeAndContextAssertion - FROM DirectoryAbstractService directoryAbstractService - -- from ITU-T Rec. X.520 | ISO/IEC 9594-6 - booleanMatch, commonName, generalizedTimeMatch, generalizedTimeOrderingMatch, - integerFirstComponentMatch, integerMatch, integerOrderingMatch, - objectIdentifierFirstComponentMatch, UnboundedDirectoryString - FROM SelectedAttributeTypes selectedAttributeTypes; - --- attribute data types -Attribute{ATTRIBUTE:SupportedAttributes} ::= SEQUENCE { - type ATTRIBUTE.&id({SupportedAttributes}), - values - SET SIZE (0..MAX) OF ATTRIBUTE.&Type({SupportedAttributes}{@type}), - valuesWithContext - SET SIZE (1..MAX) OF - SEQUENCE {value ATTRIBUTE.&Type({SupportedAttributes}{@type}), - contextList SET SIZE (1..MAX) OF Context} OPTIONAL -} - -AttributeType ::= ATTRIBUTE.&id - -AttributeValue ::= ATTRIBUTE.&Type - -Context ::= SEQUENCE { - contextType CONTEXT.&id({SupportedContexts}), - contextValues - SET SIZE (1..MAX) OF CONTEXT.&Type({SupportedContexts}{@contextType}), - fallback BOOLEAN DEFAULT FALSE -} - -AttributeValueAssertion ::= SEQUENCE { - type ATTRIBUTE.&id({SupportedAttributes}), - assertion - ATTRIBUTE.&equality-match.&AssertionType - ({SupportedAttributes}{@type}), - assertedContexts - CHOICE {allContexts [0] NULL, - selectedContexts [1] SET SIZE (1..MAX) OF ContextAssertion - } OPTIONAL -} - -ContextAssertion ::= SEQUENCE { - contextType CONTEXT.&id({SupportedContexts}), - contextValues - SET SIZE (1..MAX) OF - CONTEXT.&Assertion({SupportedContexts}{@contextType}) -} - -AttributeTypeAssertion ::= SEQUENCE { - type ATTRIBUTE.&id({SupportedAttributes}), - assertedContexts SEQUENCE SIZE (1..MAX) OF ContextAssertion OPTIONAL -} - --- Definition of the following information object set is deferred, perhaps to standardized --- profiles or to protocol implementation conformance statements. The set is required to --- specify a table constraint on the values component of Attribute, the value component --- of AttributeTypeAndValue, and the assertion component of AttributeValueAssertion. -SupportedAttributes ATTRIBUTE ::= - {objectClass | aliasedEntryName, ...} - --- Definition of the following information object set is deferred, perhaps to standardized --- profiles or to protocol implementation conformance statements. The set is required to --- specify a table constraint on the context specifications -SupportedContexts CONTEXT ::= - {...} - --- naming data types -Name ::= CHOICE { -- only one possibility for now --rdnSequence RDNSequence -} - -RDNSequence ::= SEQUENCE OF RelativeDistinguishedName - -DistinguishedName ::= RDNSequence - -RelativeDistinguishedName ::= - SET SIZE (1..MAX) OF AttributeTypeAndDistinguishedValue - -AttributeTypeAndDistinguishedValue ::= SEQUENCE { - type ATTRIBUTE.&id({SupportedAttributes}), - value ATTRIBUTE.&Type({SupportedAttributes}{@type}), - primaryDistinguished BOOLEAN DEFAULT TRUE, - valuesWithContext - SET SIZE (1..MAX) OF - SEQUENCE {distingAttrValue - [0] ATTRIBUTE.&Type({SupportedAttributes}{@type}) - OPTIONAL, - contextList SET SIZE (1..MAX) OF Context} OPTIONAL -} - --- subtree data types -SubtreeSpecification ::= SEQUENCE { - base [0] LocalName DEFAULT {}, - COMPONENTS OF ChopSpecification, - specificationFilter [4] Refinement OPTIONAL -} - --- empty sequence specifies whole administrative area -LocalName ::= RDNSequence - -ChopSpecification ::= SEQUENCE { - specificExclusions - [1] SET SIZE (1..MAX) OF - CHOICE {chopBefore [0] LocalName, - chopAfter [1] LocalName} OPTIONAL, - minimum [2] BaseDistance DEFAULT 0, - maximum [3] BaseDistance OPTIONAL -} - -BaseDistance ::= INTEGER(0..MAX) - -Refinement ::= CHOICE { - item [0] OBJECT-CLASS.&id, - and [1] SET SIZE (1..MAX) OF Refinement, - or [2] SET SIZE (1..MAX) OF Refinement, - not [3] Refinement -} - --- OBJECT-CLASS information object class specification -OBJECT-CLASS ::= CLASS { - &Superclasses OBJECT-CLASS OPTIONAL, - &kind ObjectClassKind DEFAULT structural, - &MandatoryAttributes ATTRIBUTE OPTIONAL, - &OptionalAttributes ATTRIBUTE OPTIONAL, - &id OBJECT IDENTIFIER UNIQUE -} -WITH SYNTAX { - [SUBCLASS OF &Superclasses] - [KIND &kind] - [MUST CONTAIN &MandatoryAttributes] - [MAY CONTAIN &OptionalAttributes] - ID &id -} - -ObjectClassKind ::= ENUMERATED {abstract(0), structural(1), auxiliary(2)} - --- object classes -top OBJECT-CLASS ::= { - KIND abstract - MUST CONTAIN {objectClass} - ID id-oc-top -} - -alias OBJECT-CLASS ::= { - SUBCLASS OF {top} - MUST CONTAIN {aliasedEntryName} - ID id-oc-alias -} - -parent OBJECT-CLASS ::= {KIND abstract - ID id-oc-parent -} - -child OBJECT-CLASS ::= {KIND auxiliary - ID id-oc-child -} - --- ATTRIBUTE information object class specification -ATTRIBUTE ::= CLASS { - &derivation ATTRIBUTE OPTIONAL, - &Type OPTIONAL, -- either &Type or &derivation required - &equality-match MATCHING-RULE OPTIONAL, - &ordering-match MATCHING-RULE OPTIONAL, - &substrings-match MATCHING-RULE OPTIONAL, - &single-valued BOOLEAN DEFAULT FALSE, - &collective BOOLEAN DEFAULT FALSE, - &dummy BOOLEAN DEFAULT FALSE, - -- operational extensions - &no-user-modification BOOLEAN DEFAULT FALSE, - &usage AttributeUsage DEFAULT userApplications, - &id OBJECT IDENTIFIER UNIQUE -} -WITH SYNTAX { - [SUBTYPE OF &derivation] - [WITH SYNTAX &Type] - [EQUALITY MATCHING RULE &equality-match] - [ORDERING MATCHING RULE &ordering-match] - [SUBSTRINGS MATCHING RULE &substrings-match] - [SINGLE VALUE &single-valued] - [COLLECTIVE &collective] - [DUMMY &dummy] - [NO USER MODIFICATION &no-user-modification] - [USAGE &usage] - ID &id -} - -AttributeUsage ::= ENUMERATED { - userApplications(0), directoryOperation(1), distributedOperation(2), - dSAOperation(3)} - --- attributes -objectClass ATTRIBUTE ::= { - WITH SYNTAX OBJECT IDENTIFIER - EQUALITY MATCHING RULE objectIdentifierMatch - ID id-at-objectClass -} - -aliasedEntryName ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - SINGLE VALUE TRUE - ID id-at-aliasedEntryName -} - --- MATCHING-RULE information object class specification -MATCHING-RULE ::= CLASS { - &ParentMatchingRules MATCHING-RULE OPTIONAL, - &AssertionType OPTIONAL, - &uniqueMatchIndicator ATTRIBUTE OPTIONAL, - &id OBJECT IDENTIFIER UNIQUE -} -WITH SYNTAX { - [PARENT &ParentMatchingRules] - [SYNTAX &AssertionType] - [UNIQUE-MATCH-INDICATOR &uniqueMatchIndicator] - ID &id -} - --- matching rules -objectIdentifierMatch MATCHING-RULE ::= { - SYNTAX OBJECT IDENTIFIER - ID id-mr-objectIdentifierMatch -} - -distinguishedNameMatch MATCHING-RULE ::= { - SYNTAX DistinguishedName - ID id-mr-distinguishedNameMatch -} - -MAPPING-BASED-MATCHING{SelectedBy, BOOLEAN:combinable, MappingResult, - OBJECT IDENTIFIER:matchingRule} ::= CLASS { - &selectBy SelectedBy OPTIONAL, - &ApplicableTo ATTRIBUTE, - &subtypesIncluded BOOLEAN DEFAULT TRUE, - &combinable BOOLEAN(combinable), - &mappingResults MappingResult OPTIONAL, - &userControl BOOLEAN DEFAULT FALSE, - &exclusive BOOLEAN DEFAULT TRUE, - &matching-rule MATCHING-RULE.&id(matchingRule), - &id OBJECT IDENTIFIER UNIQUE -} -WITH SYNTAX { - [SELECT BY &selectBy] - APPLICABLE TO &ApplicableTo - [SUBTYPES INCLUDED &subtypesIncluded] - COMBINABLE &combinable - [MAPPING RESULTS &mappingResults] - [USER CONTROL &userControl] - [EXCLUSIVE &exclusive] - MATCHING RULE &matching-rule - ID &id -} - --- NAME-FORM information object class specification -NAME-FORM ::= CLASS { - &namedObjectClass OBJECT-CLASS, - &MandatoryAttributes ATTRIBUTE, - &OptionalAttributes ATTRIBUTE OPTIONAL, - &id OBJECT IDENTIFIER UNIQUE -} -WITH SYNTAX { - NAMES &namedObjectClass - WITH ATTRIBUTES &MandatoryAttributes - [AND OPTIONALLY &OptionalAttributes] - ID &id -} - --- STRUCTURE-RULE class and DIT structure rule data types -DITStructureRule ::= SEQUENCE { - ruleIdentifier RuleIdentifier, - -- shall be unique within the scope of the subschema - nameForm NAME-FORM.&id, - superiorStructureRules SET SIZE (1..MAX) OF RuleIdentifier OPTIONAL -} - -RuleIdentifier ::= INTEGER - -STRUCTURE-RULE ::= CLASS { - &nameForm NAME-FORM, - &SuperiorStructureRules STRUCTURE-RULE OPTIONAL, - &id RuleIdentifier -} -WITH SYNTAX { - NAME FORM &nameForm - [SUPERIOR RULES &SuperiorStructureRules] - ID &id -} - --- DIT content rule data type and CONTENT-RULE class -DITContentRule ::= SEQUENCE { - structuralObjectClass OBJECT-CLASS.&id, - auxiliaries SET SIZE (1..MAX) OF OBJECT-CLASS.&id OPTIONAL, - mandatory [1] SET SIZE (1..MAX) OF ATTRIBUTE.&id OPTIONAL, - optional [2] SET SIZE (1..MAX) OF ATTRIBUTE.&id OPTIONAL, - precluded [3] SET SIZE (1..MAX) OF ATTRIBUTE.&id OPTIONAL -} - -CONTENT-RULE ::= CLASS { - &structuralClass OBJECT-CLASS.&id UNIQUE, - &Auxiliaries OBJECT-CLASS OPTIONAL, - &Mandatory ATTRIBUTE OPTIONAL, - &Optional ATTRIBUTE OPTIONAL, - &Precluded ATTRIBUTE OPTIONAL -} -WITH SYNTAX { - STRUCTURAL OBJECT-CLASS &structuralClass - [AUXILIARY OBJECT-CLASSES &Auxiliaries] - [MUST CONTAIN &Mandatory] - [MAY CONTAIN &Optional] - [MUST-NOT CONTAIN &Precluded] -} - -CONTEXT ::= CLASS { - &Type , - &DefaultValue OPTIONAL, - &Assertion OPTIONAL, - &absentMatch BOOLEAN DEFAULT TRUE, - &id OBJECT IDENTIFIER UNIQUE -} -WITH SYNTAX { - WITH SYNTAX &Type - [DEFAULT-VALUE &DefaultValue] - [ASSERTED AS &Assertion] - [ABSENT-MATCH &absentMatch] - ID &id -} - -DITContextUse ::= SEQUENCE { - attributeType ATTRIBUTE.&id, - mandatoryContexts [1] SET SIZE (1..MAX) OF CONTEXT.&id OPTIONAL, - optionalContexts [2] SET SIZE (1..MAX) OF CONTEXT.&id OPTIONAL -} - -DIT-CONTEXT-USE-RULE ::= CLASS { - &attributeType ATTRIBUTE.&id UNIQUE, - &Mandatory CONTEXT OPTIONAL, - &Optional CONTEXT OPTIONAL -} -WITH SYNTAX { - ATTRIBUTE TYPE &attributeType - [MANDATORY CONTEXTS &Mandatory] - [OPTIONAL CONTEXTS &Optional] -} - -FRIENDS ::= CLASS { - &anchor ATTRIBUTE.&id UNIQUE, - &Friends ATTRIBUTE -}WITH SYNTAX {ANCHOR &anchor - FRIENDS &Friends -} - --- system schema information objects --- object classes -subentry OBJECT-CLASS ::= { - SUBCLASS OF {top} - KIND structural - MUST CONTAIN {commonName | subtreeSpecification} - ID id-sc-subentry -} - -subentryNameForm NAME-FORM ::= { - NAMES subentry - WITH ATTRIBUTES {commonName} - ID id-nf-subentryNameForm -} - -subtreeSpecification ATTRIBUTE ::= { - WITH SYNTAX SubtreeSpecification - USAGE directoryOperation - ID id-oa-subtreeSpecification -} - -administrativeRole ATTRIBUTE ::= { - WITH SYNTAX OBJECT-CLASS.&id - EQUALITY MATCHING RULE objectIdentifierMatch - USAGE directoryOperation - ID id-oa-administrativeRole -} - -createTimestamp ATTRIBUTE ::= { - WITH SYNTAX GeneralizedTime - -- as per 46.3 b) or c) of ITU-T Rec. X.680 | ISO/IEC 8824-1 - EQUALITY MATCHING RULE generalizedTimeMatch - ORDERING MATCHING RULE generalizedTimeOrderingMatch - SINGLE VALUE TRUE - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-createTimestamp -} - -modifyTimestamp ATTRIBUTE ::= { - WITH SYNTAX GeneralizedTime - -- as per 46.3 b) or c) of ITU-T Rec. X.680 | ISO/IEC 8824-1 - EQUALITY MATCHING RULE generalizedTimeMatch - ORDERING MATCHING RULE generalizedTimeOrderingMatch - SINGLE VALUE TRUE - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-modifyTimestamp -} - -subschemaTimestamp ATTRIBUTE ::= { - WITH SYNTAX GeneralizedTime - -- as per 46.3 b) or c) of ITU-T Rec. X.680 | ISO/IEC 8824-1 - EQUALITY MATCHING RULE generalizedTimeMatch - ORDERING MATCHING RULE generalizedTimeOrderingMatch - SINGLE VALUE TRUE - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-subschemaTimestamp -} - -creatorsName ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - SINGLE VALUE TRUE - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-creatorsName -} - -modifiersName ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - SINGLE VALUE TRUE - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-modifiersName -} - -subschemaSubentryList ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - SINGLE VALUE TRUE - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-subschemaSubentryList -} - -accessControlSubentryList ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-accessControlSubentryList -} - -collectiveAttributeSubentryList ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-collectiveAttributeSubentryList -} - -contextDefaultSubentryList ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-contextDefaultSubentryList -} - -serviceAdminSubentryList ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-serviceAdminSubentryList -} - -hasSubordinates ATTRIBUTE ::= { - WITH SYNTAX BOOLEAN - EQUALITY MATCHING RULE booleanMatch - SINGLE VALUE TRUE - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-hasSubordinates -} - -accessControlSubentry OBJECT-CLASS ::= { - KIND auxiliary - ID id-sc-accessControlSubentry -} - -collectiveAttributeSubentry OBJECT-CLASS ::= { - KIND auxiliary - ID id-sc-collectiveAttributeSubentry -} - -collectiveExclusions ATTRIBUTE ::= { - WITH SYNTAX OBJECT IDENTIFIER - EQUALITY MATCHING RULE objectIdentifierMatch - USAGE directoryOperation - ID id-oa-collectiveExclusions -} - -contextAssertionSubentry OBJECT-CLASS ::= { - KIND auxiliary - MUST CONTAIN {contextAssertionDefaults} - ID id-sc-contextAssertionSubentry -} - -contextAssertionDefaults ATTRIBUTE ::= { - WITH SYNTAX TypeAndContextAssertion - EQUALITY MATCHING RULE objectIdentifierFirstComponentMatch - USAGE directoryOperation - ID id-oa-contextAssertionDefault -} - -serviceAdminSubentry OBJECT-CLASS ::= { - KIND auxiliary - MUST CONTAIN {searchRules} - ID id-sc-serviceAdminSubentry -} - -searchRules ATTRIBUTE ::= { - WITH SYNTAX SearchRuleDescription - EQUALITY MATCHING RULE integerFirstComponentMatch - USAGE directoryOperation - ID id-oa-searchRules -} - -SearchRuleDescription ::= SEQUENCE { - COMPONENTS OF SearchRule, - name [28] SET SIZE (1..MAX) OF UnboundedDirectoryString OPTIONAL, - description [29] UnboundedDirectoryString OPTIONAL -} - -hierarchyLevel ATTRIBUTE ::= { - WITH SYNTAX HierarchyLevel - EQUALITY MATCHING RULE integerMatch - ORDERING MATCHING RULE integerOrderingMatch - SINGLE VALUE TRUE - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-hierarchyLevel -} - -HierarchyLevel ::= INTEGER - -hierarchyBelow ATTRIBUTE ::= { - WITH SYNTAX HierarchyBelow - EQUALITY MATCHING RULE booleanMatch - SINGLE VALUE TRUE - NO USER MODIFICATION TRUE - USAGE directoryOperation - ID id-oa-hierarchyBelow -} - -HierarchyBelow ::= BOOLEAN - -hierarchyParent ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - SINGLE VALUE TRUE - USAGE directoryOperation - ID id-oa-hierarchyParent -} - -hierarchyTop ATTRIBUTE ::= { - WITH SYNTAX DistinguishedName - EQUALITY MATCHING RULE distinguishedNameMatch - SINGLE VALUE TRUE - USAGE directoryOperation - ID id-oa-hierarchyTop -} - --- object identifier assignments --- object classes -id-oc-top OBJECT IDENTIFIER ::= - {id-oc 0} - -id-oc-alias OBJECT IDENTIFIER ::= {id-oc 1} - -id-oc-parent OBJECT IDENTIFIER ::= {id-oc 28} - -id-oc-child OBJECT IDENTIFIER ::= {id-oc 29} - --- attributes -id-at-objectClass OBJECT IDENTIFIER ::= {id-at 0} - -id-at-aliasedEntryName OBJECT IDENTIFIER ::= {id-at 1} - --- matching rules -id-mr-objectIdentifierMatch OBJECT IDENTIFIER ::= {id-mr 0} - -id-mr-distinguishedNameMatch OBJECT IDENTIFIER ::= {id-mr 1} - --- operational attributes -id-oa-excludeAllCollectiveAttributes OBJECT IDENTIFIER ::= - {id-oa 0} - -id-oa-createTimestamp OBJECT IDENTIFIER ::= {id-oa 1} - -id-oa-modifyTimestamp OBJECT IDENTIFIER ::= {id-oa 2} - -id-oa-creatorsName OBJECT IDENTIFIER ::= {id-oa 3} - -id-oa-modifiersName OBJECT IDENTIFIER ::= {id-oa 4} - -id-oa-administrativeRole OBJECT IDENTIFIER ::= {id-oa 5} - -id-oa-subtreeSpecification OBJECT IDENTIFIER ::= {id-oa 6} - -id-oa-collectiveExclusions OBJECT IDENTIFIER ::= {id-oa 7} - -id-oa-subschemaTimestamp OBJECT IDENTIFIER ::= {id-oa 8} - -id-oa-hasSubordinates OBJECT IDENTIFIER ::= {id-oa 9} - -id-oa-subschemaSubentryList OBJECT IDENTIFIER ::= {id-oa 10} - -id-oa-accessControlSubentryList OBJECT IDENTIFIER ::= {id-oa 11} - -id-oa-collectiveAttributeSubentryList OBJECT IDENTIFIER ::= {id-oa 12} - -id-oa-contextDefaultSubentryList OBJECT IDENTIFIER ::= {id-oa 13} - -id-oa-contextAssertionDefault OBJECT IDENTIFIER ::= {id-oa 14} - -id-oa-serviceAdminSubentryList OBJECT IDENTIFIER ::= {id-oa 15} - -id-oa-searchRules OBJECT IDENTIFIER ::= {id-oa 16} - -id-oa-hierarchyLevel OBJECT IDENTIFIER ::= {id-oa 17} - -id-oa-hierarchyBelow OBJECT IDENTIFIER ::= {id-oa 18} - -id-oa-hierarchyParent OBJECT IDENTIFIER ::= {id-oa 19} - -id-oa-hierarchyTop OBJECT IDENTIFIER ::= {id-oa 20} - --- subentry classes -id-sc-subentry OBJECT IDENTIFIER ::= {id-sc 0} - -id-sc-accessControlSubentry OBJECT IDENTIFIER ::= {id-sc 1} - -id-sc-collectiveAttributeSubentry OBJECT IDENTIFIER ::= {id-sc 2} - -id-sc-contextAssertionSubentry OBJECT IDENTIFIER ::= {id-sc 3} - -id-sc-serviceAdminSubentry OBJECT IDENTIFIER ::= {id-sc 4} - --- Name forms -id-nf-subentryNameForm OBJECT IDENTIFIER ::= {id-nf 16} - --- administrative roles -id-ar-autonomousArea OBJECT IDENTIFIER ::= {id-ar 1} - -id-ar-accessControlSpecificArea OBJECT IDENTIFIER ::= {id-ar 2} - -id-ar-accessControlInnerArea OBJECT IDENTIFIER ::= {id-ar 3} - -id-ar-subschemaAdminSpecificArea OBJECT IDENTIFIER ::= {id-ar 4} - -id-ar-collectiveAttributeSpecificArea OBJECT IDENTIFIER ::= {id-ar 5} - -id-ar-collectiveAttributeInnerArea OBJECT IDENTIFIER ::= {id-ar 6} - -id-ar-contextDefaultSpecificArea OBJECT IDENTIFIER ::= {id-ar 7} - -id-ar-serviceSpecificArea OBJECT IDENTIFIER ::= {id-ar 8} - -END -- InformationFramework diff --git a/lib/public_key/asn1/Makefile b/lib/public_key/asn1/Makefile index 2ce1168349..943d97bdb8 100644 --- a/lib/public_key/asn1/Makefile +++ b/lib/public_key/asn1/Makefile @@ -40,7 +40,7 @@ RELSYSDIR = $(RELEASE_PATH)/lib/public_key-$(VSN) ASN_TOP = OTP-PUB-KEY PKCS-FRAME ASN_MODULES = PKIX1Explicit88 PKIX1Implicit88 PKIX1Algorithms88 \ - PKIXAttributeCertificate PKCS-1 PKCS-3 PKCS-8 InformationFramework PKCS5v2-0 OTP-PKIX + PKIXAttributeCertificate PKCS-1 PKCS-3 PKCS-8 PKCS5v2-0 OTP-PKIX ASN_ASNS = $(ASN_MODULES:%=%.asn1) ASN_ERLS = $(ASN_TOP:%=%.erl) ASN_HRLS = $(ASN_TOP:%=%.hrl) @@ -117,5 +117,4 @@ OTP-PUB-KEY.asn1db: PKIX1Algorithms88.asn1 \ $(EBIN)/PKCS-FRAME.beam: PKCS-FRAME.erl PKCS-FRAME.hrl PKCS-FRAME.erl PKCS-FRAME.hrl: PKCS-FRAME.asn1db PKCS-FRAME.asn1db: PKCS-8.asn1\ - InformationFramework.asn1\ PKCS5v2-0.asn1
\ No newline at end of file diff --git a/lib/public_key/asn1/PKCS-8.asn1 b/lib/public_key/asn1/PKCS-8.asn1 index 7413519b57..8412345b68 100644 --- a/lib/public_key/asn1/PKCS-8.asn1 +++ b/lib/public_key/asn1/PKCS-8.asn1 @@ -14,15 +14,15 @@ BEGIN -- All types and values defined in this module is exported for use in other -- ASN.1 modules. -IMPORTS +--IMPORTS -- informationFramework -- FROM UsefulDefinitions {joint-iso-itu-t(2) ds(5) module(1) -- usefulDefinitions(0) 3} -Attribute +--Attribute -- FROM InformationFramework informationFramework - FROM InformationFramework; +-- FROM InformationFramework; -- This import is really unnecessary since ALGORITHM-IDENTIFIER is defined as a -- TYPE-IDENTIFIER @@ -55,8 +55,8 @@ Version ::= INTEGER {v1(0)} (v1,...) PrivateKey ::= OCTET STRING --- Attributes ::= SET OF Attribute -Attributes ::= SET OF Attribute {{...}} +-- Attributes ::= SET OF PKAttribute +Attributes ::= SET OF PKAttribute {{...}} -- Encrypted private-key information syntax @@ -78,6 +78,66 @@ KeyEncryptionAlgorithms TYPE-IDENTIFIER ::= { ... -- For local profiles } +-- From InformationFramework +PKAttribute{ATTRIBUTE:SupportedAttributes} ::= SEQUENCE { + type ATTRIBUTE.&id({SupportedAttributes}), + values + SET SIZE (0..MAX) OF ATTRIBUTE.&Type({SupportedAttributes}{@type}), + valuesWithContext + SET SIZE (1..MAX) OF + SEQUENCE {value ATTRIBUTE.&Type({SupportedAttributes}{@type}), + contextList SET SIZE (1..MAX) OF Context} OPTIONAL +} + +Context ::= SEQUENCE { + contextType CONTEXT.&id({SupportedContexts}), + contextValues + SET SIZE (1..MAX) OF CONTEXT.&Type({SupportedContexts}{@contextType}), + fallback BOOLEAN DEFAULT FALSE +} +-- Definition of the following information object set is deferred, perhaps to standardized +-- profiles or to protocol implementation conformance statements. The set is required to +-- specify a table constraint on the context specifications +SupportedContexts CONTEXT ::= + {...} + + +CONTEXT ::= CLASS { + &Type , + &DefaultValue OPTIONAL, + &Assertion OPTIONAL, + &absentMatch BOOLEAN DEFAULT TRUE, + &id OBJECT IDENTIFIER UNIQUE +} + +-- ATTRIBUTE information object class specification +ATTRIBUTE ::= CLASS { + &derivation ATTRIBUTE OPTIONAL, + &Type OPTIONAL, -- either &Type or &derivation required + &equality-match MATCHING-RULE OPTIONAL, + &ordering-match MATCHING-RULE OPTIONAL, + &substrings-match MATCHING-RULE OPTIONAL, + &single-valued BOOLEAN DEFAULT FALSE, + &collective BOOLEAN DEFAULT FALSE, + &dummy BOOLEAN DEFAULT FALSE, + -- operational extensions + &no-user-modification BOOLEAN DEFAULT FALSE, + &usage AttributeUsage DEFAULT userApplications, + &id OBJECT IDENTIFIER UNIQUE +} + +-- MATCHING-RULE information object class specification +MATCHING-RULE ::= CLASS { + &ParentMatchingRules MATCHING-RULE OPTIONAL, + &AssertionType OPTIONAL, + &uniqueMatchIndicator ATTRIBUTE OPTIONAL, + &id OBJECT IDENTIFIER UNIQUE +} + +AttributeUsage ::= ENUMERATED { + userApplications(0), directoryOperation(1), distributedOperation(2), + dSAOperation(3)} + END diff --git a/lib/public_key/asn1/PKCS-FRAME.set.asn b/lib/public_key/asn1/PKCS-FRAME.set.asn index a0777ff260..69b6727bef 100644 --- a/lib/public_key/asn1/PKCS-FRAME.set.asn +++ b/lib/public_key/asn1/PKCS-FRAME.set.asn @@ -1,3 +1,2 @@ PKCS-8.asn1 -InformationFramework.asn1 PKCS5v2-0.asn1 diff --git a/lib/reltool/doc/src/reltool.xml b/lib/reltool/doc/src/reltool.xml index 31e15e34e7..ab1c8e3034 100644 --- a/lib/reltool/doc/src/reltool.xml +++ b/lib/reltool/doc/src/reltool.xml @@ -640,7 +640,7 @@ target_spec() = [target_spec()] </func> <func> - <name>get_target_spec(Server) -> {ok, targetSpec} | {error, Reason}</name> + <name>get_target_spec(Server) -> {ok, TargetSpec} | {error, Reason}</name> <fsummary>Return a specification of the target system</fsummary> <type> <v>Server = server()</v> diff --git a/lib/sasl/doc/src/systools.xml b/lib/sasl/doc/src/systools.xml index 1b90f0d4ee..32c2149a8d 100644 --- a/lib/sasl/doc/src/systools.xml +++ b/lib/sasl/doc/src/systools.xml @@ -198,7 +198,7 @@ the order in the <c>.rel</c> file is kept.</p> <p>If <c>sasl</c> is not included as an application in the <c>.rel</c> file, a warning is emitted because such a - release can not be used in an upgrade. To turn of this + release can not be used in an upgrade. To turn off this warning, add the option <c>no_warn_sasl</c>.</p> <p>All files are searched for in the current path. It is assumed that the <c>.app</c> and <c>.beam</c> files for an diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index a32e2c14c8..64a0d1a13f 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -34,23 +34,25 @@ <section> - <title>SNMP Development Toolkit 4.21.3</title> - <p>Version 4.21.3 supports code replacement in runtime from/to - version 4.21.2, 4.21.1, 4.21 and 4.20.1. </p> - + <title>SNMP Development Toolkit 4.21.4</title> + <p>Version 4.21.4 supports code replacement in runtime from/to + version 4.21.3, 4.21.2, 4.21.1, 4.21, 4.20.1, 4.20 and 4.19. </p> + <section> <title>Improvements and new features</title> -<!-- <p>-</p> ---> - + +<!-- <list type="bulleted"> <item> - <p>[compiler] Improved version info printout. </p> + <p>[compiler] Improved version info printout from the + <seealso marker="snmpc(command)#">MIB compiler frontend escript</seealso>. </p> <p>Own Id: OTP-9618</p> </item> </list> +--> + </section> <section> @@ -61,40 +63,31 @@ <list type="bulleted"> <item> - <p>[compiler] Fix the <c>--warnings/--W</c> option parsing in the - <seealso marker="snmpc(command)#option_warnings">snmpc</seealso> - wrapper (e)script. - The short warning option was incorrectly <c>--w</c>, instead - of as documented <c>--W</c>. This has now been corrected. </p> - <p>*** POTENTIAL INCOMPATIBILITY ***</p> - <p>Tuncer Ayaz</p> - <p>Own Id: OTP-9718</p> + <p>[agent] Removed use of old style tuple funs. </p> + <p>Own Id: OTP-9779</p> </item> </list> - </section> <section> <title>Incompatibilities</title> -<!-- - <p>-</p> ---> + <p>-</p> +<!-- <list type="bulleted"> <item> - <p>[compiler] The short warning option has been changed from - <c>--w</c> to <c>--W</c> to comply with the documentation. </p> - <p>Tuncer Ayaz</p> + <p>foo. </p> <p>Own Id: OTP-9718</p> - </item> - + </item> </list> +--> + </section> - </section> <!-- 4.21.3 --> + </section> <!-- 4.21.4 --> <section> diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index d84c9e9272..219ac62a73 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,11 +22,17 @@ %% ----- U p g r a d e ------------------------------------------------------- [ + {"4.21.3", + [ + {update, snmpa_local_db, soft, soft_purge, soft_purge, []} + ] + }, {"4.21.2", [ {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []} ] }, @@ -35,6 +41,7 @@ {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {update, snmp_note_store, soft, soft_purge, soft_purge, []} ] @@ -45,6 +52,7 @@ {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, {load_module, snmp_target_mib, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {update, snmp_note_store, soft, soft_purge, soft_purge, []} ] @@ -65,6 +73,7 @@ [snmp_conf, snmp_config]}, {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]}, {update, snmp_note_store, soft, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}, {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, {update, snmpm_server, soft, soft_purge, soft_purge, @@ -89,6 +98,7 @@ [snmp_conf, snmp_config]}, {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]}, {update, snmp_note_store, soft, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}, {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, {update, snmpm_server, soft, soft_purge, soft_purge, @@ -134,6 +144,7 @@ {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, {update, snmpm_server, soft, soft_purge, soft_purge, [snmpm_net_if, snmpm_mpd, snmpm_config]}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_net_if, soft, soft_purge, soft_purge, [snmp_conf, snmpa_mpd]}, {update, snmpa_agent, soft, soft_purge, soft_purge, @@ -145,11 +156,17 @@ %% ------D o w n g r a d e --------------------------------------------------- [ + {"4.21.3", + [ + {update, snmpa_local_db, soft, soft_purge, soft_purge, []} + ] + }, {"4.21.2", [ {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []} ] }, @@ -158,6 +175,7 @@ {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {update, snmp_note_store, soft, soft_purge, soft_purge, []} ] @@ -168,6 +186,7 @@ {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, {load_module, snmp_target_mib, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {update, snmp_note_store, soft, soft_purge, soft_purge, []} ] @@ -188,6 +207,7 @@ [snmp_conf, snmp_config]}, {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]}, {update, snmp_note_store, soft, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}, {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, {update, snmpm_server, soft, soft_purge, soft_purge, @@ -212,6 +232,7 @@ [snmp_conf, snmp_config]}, {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]}, {update, snmp_note_store, soft, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}, {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, {update, snmpm_server, soft, soft_purge, soft_purge, @@ -257,6 +278,7 @@ {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, {update, snmpm_server, soft, soft_purge, soft_purge, [snmpm_net_if, snmpm_mpd, snmpm_config]}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_net_if, soft, soft_purge, soft_purge, [snmp_conf, snmpa_mpd]}, {update, snmpa_agent, soft, soft_purge, soft_purge, diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 43f67a744e..ee2e633c69 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -18,6 +18,6 @@ # %CopyrightEnd% APPLICATION = snmp -SNMP_VSN = 4.21.3 +SNMP_VSN = 4.21.4 PRE_VSN = APP_VSN = "$(APPLICATION)-$(SNMP_VSN)$(PRE_VSN)" diff --git a/lib/ssl/src/ssl_cipher.erl b/lib/ssl/src/ssl_cipher.erl index 95a5efd6d0..015265441e 100644 --- a/lib/ssl/src/ssl_cipher.erl +++ b/lib/ssl/src/ssl_cipher.erl @@ -166,7 +166,7 @@ block_decipher(Fun, #cipher_state{key=Key, iv=IV} = CipherState0, false -> %% decryption failed or invalid padding, %% intentionally break Content to make - %% sure a packet with a an invalid padding + %% sure a packet with invalid padding %% but otherwise correct data will fail %% the MAC test later {<<16#F0, Content/binary>>, Mac, CipherState1} @@ -523,7 +523,7 @@ hash_size(sha) -> %% %% implementation note: %% We return the original (possibly invalid) PadLength in any case. -%% A invalid PadLength will be cought by is_correct_padding/2 +%% An invalid PadLength will be caught by is_correct_padding/2 %% generic_block_cipher_from_bin(T, HashSize) -> Sz1 = byte_size(T) - 1, diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl index e68a4c375d..45da9ac25b 100644 --- a/lib/ssl/test/ssl_basic_SUITE.erl +++ b/lib/ssl/test/ssl_basic_SUITE.erl @@ -3033,8 +3033,8 @@ invalid_signature_server(Config) when is_list(Config) -> {from, self()}, {options, [{verify, verify_peer} | ClientOpts]}]), - ssl_test_lib:check_result(Server, {error, "bad certificate"}, - Client, {error,"bad certificate"}). + tcp_delivery_workaround(Server, {error, "bad certificate"}, + Client, {error,"bad certificate"}). %%-------------------------------------------------------------------- diff --git a/lib/stdlib/doc/src/io_protocol.xml b/lib/stdlib/doc/src/io_protocol.xml index 3e8ab1affc..0ff3d5c1ee 100644 --- a/lib/stdlib/doc/src/io_protocol.xml +++ b/lib/stdlib/doc/src/io_protocol.xml @@ -50,10 +50,10 @@ current I/O-protocol.</p> and execution time efficiency has triggered extensions to the protocol over the years, making the protocol larger and somewhat less easy to implement than the original. It can certainly be argumented that the -current protocol is to complex, but this text describes how it looks +current protocol is too complex, but this text describes how it looks today, not how it should have looked.</p> -<p>The basic ideas from the original protocol still holds. The io_server +<p>The basic ideas from the original protocol still hold. The io_server and client communicate with one single, rather simplistic protocol and no server state is ever present in the client. Any io_server can be used together with any client code and client code need not be aware @@ -62,7 +62,7 @@ of the actual device the io_server communicates with.</p> <section> <title>Protocol basics</title> -<p>As described in Roberts paper, servers and clients communicate using +<p>As described in Robert's paper, servers and clients communicate using io_request/io_reply tuples as follows:</p> <p><em>{io_request, From, ReplyAs, Request}</em><br/> @@ -103,7 +103,7 @@ Reply part.</p> <em>{put_chars, Encoding, Module, Function, Args}</em> </p> <list type="bulleted"> -<item>Encoding is either 'latin1' or 'unicode', meaning that the +<item>Encoding is either 'unicode' or 'latin1', meaning that the characters are (in case of binaries) encoded as either UTF-8 or iso-latin-1 (pure bytes). A well behaved io_server should also return error if list elements contain integers > 255 when the @@ -116,13 +116,13 @@ Reply part.</p> produces. Note that byte-oriented data is simplest sent using latin1 Encoding</item> -<item>Characters are the data to be put on the device. If encoding is - latin1, this is an iolist(). If encoding is unicode, this is an +<item>Characters are the data to be put on the device. If Encoding is + latin1, this is an iolist(). If Encoding is unicode, this is an Erlang standard mixed unicode list (one integer in a list per character, characters in binaries represented as UTF-8).</item> <item>Module, Function, Args denotes a function which will be called to - produce the data (like io_lib:format), Args is a list of arguments + produce the data (like io_lib:format). Args is a list of arguments to the function. The function should produce data in the given Encoding. The io_server should call the function as apply(Mod, Func, Args) and will put the returned data on the device as if it was sent @@ -164,7 +164,7 @@ latin1, Module, Function, Args} respectively. </p> <list type="bulleted"> <item>Encoding denotes how data is to be sent back to the client and what data is sent to the function denoted by - Module/Function/Arity. If the function supplied returns data as a + Module/Function/ExtraArgs. If the function supplied returns data as a list, the data is converted to this encoding. If however the function supplied returns data in some other format, no conversion can be done and it's up to the client supplied function to return @@ -179,7 +179,7 @@ latin1, Module, Function, Args} respectively. </p> <item>Prompt is a list of characters (not mixed, no binaries) or an atom() to be output as a prompt for input on the device. The Prompt is often ignored by the io_server and a Prompt set to '' should always - be ignored (and result in nothing being written to the device). </item> + be ignored (and result in nothing being written to the device).</item> <item><p>Module, Function, ExtraArgs denotes a function and arguments to determine when enough data is written. The function should take two @@ -550,7 +550,7 @@ request({get_line, Encoding, _Prompt}, State) -> </code> <p>Here we have cheated a little by more or less only implementing -get_until and using internal helpers to implement get__chars and +get_until and using internal helpers to implement get_chars and get_line. In production code, this might be to inefficient, but that of course depends on the frequency of the different requests. Before we start actually implementing the functions put_chars/2 and @@ -618,7 +618,7 @@ encounter an error or the list is exhausted. The last return value is sent back to the client (it's first returned to the main loop and then sent back by the function io_reply).</p> -<p>The getopt and setopt requests is also simple to handle, we just +<p>The getopt and setopt requests are also simple to handle, we just change or read our state record:</p> <code> diff --git a/lib/stdlib/test/tar_SUITE.erl b/lib/stdlib/test/tar_SUITE.erl index 65ccdcb7a8..5bc34e35af 100644 --- a/lib/stdlib/test/tar_SUITE.erl +++ b/lib/stdlib/test/tar_SUITE.erl @@ -766,9 +766,9 @@ run_in_short_tempdir(Config, Fun) -> %% We need a base directory with a much shorter pathname than %% priv_dir. We KNOW that priv_dir is located four levels below %% the directory that common_test puts the ct_run.* directories - %% in. That fact is not documented, but an usually reliable source + %% in. That fact is not documented, but a usually reliable source %% assured me that the directory structure is unlikely to change - %% in future versions of common_test because of backward + %% in future versions of common_test because of backwards %% compatibility (tools developed by users of common_test depend %% on the current directory layout). Base = lists:foldl(fun(_, D) -> diff --git a/lib/test_server/doc/src/test_server.xml b/lib/test_server/doc/src/test_server.xml index 78bb922cc5..5bfa42c36f 100644 --- a/lib/test_server/doc/src/test_server.xml +++ b/lib/test_server/doc/src/test_server.xml @@ -203,7 +203,7 @@ <func> <name>format(Format) -> ok</name> <name>format(Format, Args)</name> - <name>format(Pri,Format)</name> + <name>format(Pri, Format)</name> <name>format(Pri, Format, Args)</name> <fsummary></fsummary> <type> diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl index 881a3c2997..576d7e261c 100644 --- a/lib/tools/test/cover_SUITE.erl +++ b/lib/tools/test/cover_SUITE.erl @@ -130,13 +130,20 @@ compile(Config) when is_list(Config) -> ?line {ok,_} = compile:file(x), ?line {ok,_} = compile:file("d/y",[debug_info,{outdir,"d"},report]), ?line Key = "A Krypto Key", - ?line {ok,_} = compile:file(crypt, [debug_info,{debug_info_key,Key},report]), + CryptoWorks = crypto_works(), + case CryptoWorks of + false -> + {ok,_} = compile:file(crypt, [debug_info,report]), + {ok,crypt} = cover:compile_beam("crypt.beam"); + true -> + {ok,_} = compile:file(crypt, [{debug_info_key,Key},report]), + {error,{encrypted_abstract_code,_}} = + cover:compile_beam("crypt.beam"), + ok = beam_lib:crypto_key_fun(simple_crypto_fun(Key)), + {ok,crypt} = cover:compile_beam("crypt.beam") + end, ?line {ok,v} = cover:compile_beam(v), ?line {ok,w} = cover:compile_beam("w.beam"), - ?line {error,{encrypted_abstract_code,_}} = - cover:compile_beam("crypt.beam"), - ?line ok = beam_lib:crypto_key_fun(simple_crypto_fun(Key)), - ?line {ok,crypt} = cover:compile_beam("crypt.beam"), ?line {error,{no_abstract_code,"./x.beam"}} = cover:compile_beam(x), ?line {error,{already_cover_compiled,no_beam_found,a}}=cover:compile_beam(a), ?line {error,non_existing} = cover:compile_beam(z), @@ -148,6 +155,15 @@ compile(Config) when is_list(Config) -> ?line Files = lsfiles(), ?line remove(files(Files, ".beam")). +crypto_works() -> + try crypto:start() of + {error,{already_started,crypto}} -> true; + ok -> true + catch + error:_ -> + false + end. + simple_crypto_fun(Key) -> fun(init) -> ok; ({debug_info, des3_cbc, crypt, _}) -> Key diff --git a/lib/tools/test/eprof_SUITE.erl b/lib/tools/test/eprof_SUITE.erl index ecdbc5ce57..3283fa571f 100644 --- a/lib/tools/test/eprof_SUITE.erl +++ b/lib/tools/test/eprof_SUITE.erl @@ -183,8 +183,14 @@ eed(Config) when is_list(Config) -> ?line ok = eprof:log("eprof_SUITE_logfile"), ?line stopped = eprof:stop(), ?line ?t:timetrap_cancel(TTrap), - S = lists:flatten(io_lib:format("~p times slower", [10*(T3-T2)/(T2-T1)])), - {comment,S}. + try + S = lists:flatten(io_lib:format("~p times slower", + [10*(T3-T2)/(T2-T1)])), + {comment,S} + catch + error:badarith -> + {comment,"No time elapsed. Bad clock? Fast computer?"} + end. ensure_eprof_stopped() -> Pid = whereis(eprof), diff --git a/lib/tools/test/lcnt_SUITE.erl b/lib/tools/test/lcnt_SUITE.erl index f2afa60e33..1bee6021ab 100644 --- a/lib/tools/test/lcnt_SUITE.erl +++ b/lib/tools/test/lcnt_SUITE.erl @@ -34,7 +34,7 @@ ]). %% Default timetrap timeout (set in init_per_testcase) --define(default_timeout, ?t:minutes(2)). +-define(default_timeout, ?t:minutes(4)). init_per_suite(Config) when is_list(Config) -> Config. @@ -49,6 +49,7 @@ init_per_testcase(_Case, Config) -> end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), + catch lcnt:stop(), ok. suite() -> [{ct_hooks,[ts_install_cth]}]. diff --git a/lib/typer/src/typer.erl b/lib/typer/src/typer.erl index fd39b55dd4..6392f5765f 100644 --- a/lib/typer/src/typer.erl +++ b/lib/typer/src/typer.erl @@ -682,10 +682,10 @@ analyze_result(show_succ, Args, Analysis) -> analyze_result(no_spec, Args, Analysis) -> {Args, Analysis#analysis{no_spec = true}}; analyze_result({pa, Dir}, Args, Analysis) -> - code:add_patha(Dir), + true = code:add_patha(Dir), {Args, Analysis}; analyze_result({pz, Dir}, Args, Analysis) -> - code:add_pathz(Dir), + true = code:add_pathz(Dir), {Args, Analysis}. %%-------------------------------------------------------------------- diff --git a/lib/wx/api_gen/wx_extra/wxEvtHandler.erl b/lib/wx/api_gen/wx_extra/wxEvtHandler.erl index c6810eb32c..080ebfa49f 100644 --- a/lib/wx/api_gen/wx_extra/wxEvtHandler.erl +++ b/lib/wx/api_gen/wx_extra/wxEvtHandler.erl @@ -76,7 +76,7 @@ parse_opts([{callback,Fun}|R], Opts) when is_function(Fun) -> %% Check Fun Arity? parse_opts(R, Opts#evh{cb=Fun}); parse_opts([callback|R], Opts) -> - parse_opts(R, Opts#evh{cb=1}); + parse_opts(R, Opts#evh{cb=self()}); parse_opts([{userData, UserData}|R],Opts) -> parse_opts(R, Opts#evh{userdata=UserData}); parse_opts([{skip, Skip}|R],Opts) when is_boolean(Skip) -> diff --git a/lib/wx/src/gen/wxEvtHandler.erl b/lib/wx/src/gen/wxEvtHandler.erl index f155351b66..820c2b7a58 100644 --- a/lib/wx/src/gen/wxEvtHandler.erl +++ b/lib/wx/src/gen/wxEvtHandler.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2011. 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 @@ -95,7 +95,7 @@ parse_opts([{callback,Fun}|R], Opts) when is_function(Fun) -> %% Check Fun Arity? parse_opts(R, Opts#evh{cb=Fun}); parse_opts([callback|R], Opts) -> - parse_opts(R, Opts#evh{cb=1}); + parse_opts(R, Opts#evh{cb=self()}); parse_opts([{userData, UserData}|R],Opts) -> parse_opts(R, Opts#evh{userdata=UserData}); parse_opts([{skip, Skip}|R],Opts) when is_boolean(Skip) -> diff --git a/lib/wx/src/wx_object.erl b/lib/wx/src/wx_object.erl index 82c4cfbad5..bc85cd93d4 100644 --- a/lib/wx/src/wx_object.erl +++ b/lib/wx/src/wx_object.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2011. 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 @@ -226,9 +226,11 @@ call(Name, Request, Timeout) when is_atom(Name) orelse is_pid(Name) -> %% Invokes handle_cast(Request, State) in the server cast(#wx_ref{state=Pid}, Request) when is_pid(Pid) -> - Pid ! {'$gen_cast',Request}; + Pid ! {'$gen_cast',Request}, + ok; cast(Name, Request) when is_atom(Name) orelse is_pid(Name) -> - Name ! {'$gen_cast',Request}. + Name ! {'$gen_cast',Request}, + ok. %% @spec (Ref::wxObject()) -> pid() %% @doc Get the pid of the object handle. @@ -258,9 +260,10 @@ init_it(Starter, self, Name, Mod, Args, Options) -> init_it(Starter, self(), Name, Mod, Args, Options); init_it(Starter, Parent, Name, Mod, Args, [WxEnv|Options]) -> case WxEnv of - undefined -> ok; + undefined -> ok; _ -> wx:set_env(WxEnv) end, + put('_wx_object_', {Mod,'_wx_init_'}), Debug = debug_options(Name, Options), case catch Mod:init(Args) of {#wx_ref{} = Ref, State} -> @@ -350,57 +353,16 @@ handle_msg({'$gen_call', From, Msg}, Parent, Name, State, Mod) -> {noreply, NState, Time1} -> loop(Parent, Name, NState, Mod, Time1, []); {stop, Reason, Reply, NState} -> - {'EXIT', R} = + {'EXIT', R} = (catch terminate(Reason, Name, Msg, Mod, NState, [])), reply(From, Reply), exit(R); Other -> handle_common_reply(Other, Name, Msg, Mod, State, []) end; - -handle_msg(Msg = {_,_,'_wx_invoke_cb_'}, Parent, Name, State, Mod) -> - Reply = dispatch_cb(Msg, Mod, State), - handle_no_reply(Reply, Parent, Name, Msg, Mod, State, []); handle_msg(Msg, Parent, Name, State, Mod) -> Reply = (catch dispatch(Msg, Mod, State)), handle_no_reply(Reply, Parent, Name, Msg, Mod, State, []). -%% @hidden -dispatch_cb({{Msg=#wx{}, Obj=#wx_ref{}}, _, '_wx_invoke_cb_'}, Mod, State) -> - Callback = fun() -> - wxe_util:cast(?WXE_CB_START, <<>>), - case Mod:handle_sync_event(Msg, Obj, State) of - ok -> <<>>; - noreply -> <<>>; - Other -> - Args = [Msg, Obj, State], - MFA = {Mod, handle_sync_event, Args}, - exit({bad_return, Other, MFA}) - end - end, - wxe_server:invoke_callback(Callback), - {noreply, State}; -dispatch_cb({Func, ArgList, '_wx_invoke_cb_'}, Mod, State) -> - try %% This don't work yet.... - [#wx_ref{type=ThisClass}] = ArgList, - case Mod:handle_overloaded(Func, ArgList, State) of - {reply, CBReply, NState} -> - ThisClass:send_return_value(Func, CBReply), - {noreply, NState}; - {reply, CBReply, NState, Time1} -> - ThisClass:send_return_value(Func, CBReply), - {noreply, NState, Time1}; - {noreply, NState} -> - ThisClass:send_return_value(Func, <<>>), - {noreply, NState}; - {noreply, NState, Time1} -> - ThisClass:send_return_value(Func, <<>>), - {noreply, NState, Time1}; - Other -> Other - end - catch _Err:Reason -> - %% Hopefully we can release the wx-thread with this - wxe_util:cast(?WXE_CB_RETURN, <<>>), - {'EXIT', {Reason, erlang:get_stacktrace()}} - end. + %% @hidden handle_msg({'$gen_call', From, Msg}, Parent, Name, State, Mod, Debug) -> case catch Mod:handle_call(Msg, From, State) of @@ -426,9 +388,6 @@ handle_msg({'$gen_call', From, Msg}, Parent, Name, State, Mod, Debug) -> Other -> handle_common_reply(Other, Name, Msg, Mod, State, Debug) end; -handle_msg(Msg = {_,_,'_wx_invoke_cb_'}, Parent, Name, State, Mod, Debug) -> - Reply = dispatch_cb(Msg, Mod, State), - handle_no_reply(Reply, Parent, Name, Msg, Mod, State, Debug); handle_msg(Msg, Parent, Name, State, Mod, Debug) -> Reply = (catch dispatch(Msg, Mod, State)), handle_no_reply(Reply, Parent, Name, Msg, Mod, State, Debug). diff --git a/lib/wx/src/wxe_server.erl b/lib/wx/src/wxe_server.erl index 69e2189fac..6e982c97f6 100644 --- a/lib/wx/src/wxe_server.erl +++ b/lib/wx/src/wxe_server.erl @@ -221,7 +221,7 @@ handle_connect(Object, EvData, From, State0 = #state{users=Users}) -> Evs = [#event{object=Object,callback=Callback, cb_handler=CBHandler}|Evs0], User = User0#user{events=Evs, evt_handler=Handler}, State1 = State0#state{users=gb_trees:update(From, User, Users)}, - if is_function(Callback) -> + if is_function(Callback) orelse is_pid(Callback) -> {FunId, State} = attach_fun(Callback,State1), Res = wxEvtHandler:connect_impl(CBHandler,Object, wxEvtHandler:replace_fun_with_id(EvData,FunId)), @@ -229,6 +229,7 @@ handle_connect(Object, EvData, From, State0 = #state{users=Users}) -> ok -> {reply,Res,State}; _Error -> {reply,Res,State0} end; + true -> Res = {call_impl, connect_cb, CBHandler}, {reply, Res, State1} @@ -239,6 +240,8 @@ invoke_cb({{Ev=#wx{}, Ref=#wx_ref{}}, FunId,_}, _S) -> case get(FunId) of Fun when is_function(Fun) -> invoke_callback(fun() -> Fun(Ev, Ref), <<>> end); + Pid when is_pid(Pid) -> %% wx_object sync event + invoke_callback(Pid, Ev, Ref); Err -> ?log("Internal Error ~p~n",[Err]) end; @@ -270,6 +273,44 @@ invoke_callback(Fun) -> spawn(CB), ok. +invoke_callback(Pid, Ev, Ref) -> + Env = get(?WXE_IDENTIFIER), + CB = fun() -> + wx:set_env(Env), + wxe_util:cast(?WXE_CB_START, <<>>), + try + case get_wx_object_state(Pid) of + ignore -> + %% Ignore early events + wxEvent:skip(Ref); + {Mod, State} -> + case Mod:handle_sync_event(Ev, Ref, State) of + ok -> ok; + noreply -> ok; + Return -> exit({bad_return, Return}) + end + end + catch _:Reason -> + wxEvent:skip(Ref), + ?log("Callback fun crashed with {'EXIT, ~p, ~p}~n", + [Reason, erlang:get_stacktrace()]) + end, + wxe_util:cast(?WXE_CB_RETURN, <<>>) + end, + spawn(CB), + ok. + +get_wx_object_state(Pid) -> + case process_info(Pid, dictionary) of + {dictionary, Dict} -> + case lists:keysearch('_wx_object_',1,Dict) of + {value, {'_wx_object_', {_Mod, '_wx_init_'}}} -> ignore; + {value, {'_wx_object_', Value}} -> Value; + _ -> ignore + end; + _ -> ignore + end. + new_evt_listener(State) -> #wx_env{port=Port} = wx:get_env(), _ = erlang:port_control(Port,98,<<>>), diff --git a/lib/wx/test/Makefile b/lib/wx/test/Makefile index cf51d7918f..333711789f 100644 --- a/lib/wx/test/Makefile +++ b/lib/wx/test/Makefile @@ -27,7 +27,7 @@ PWD = $(shell pwd) APPDIR = $(shell dirname $(PWD)) ERL_COMPILE_FLAGS = -pa $(APPDIR)/ebin -Mods = wxt wx_test_lib \ +Mods = wxt wx_test_lib wx_obj_test \ wx_app_SUITE \ wx_basic_SUITE \ wx_event_SUITE \ diff --git a/lib/wx/test/wx_basic_SUITE.erl b/lib/wx/test/wx_basic_SUITE.erl index 9ad34248a9..46c72bb453 100644 --- a/lib/wx/test/wx_basic_SUITE.erl +++ b/lib/wx/test/wx_basic_SUITE.erl @@ -48,7 +48,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [create_window, several_apps, wx_api, wx_misc, - data_types]. + data_types, wx_object]. groups() -> []. @@ -298,3 +298,77 @@ data_types(_Config) -> wxClientDC:destroy(CDC), %%wx_test_lib:wx_destroy(Frame,Config). wx:destroy(). + +wx_object(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo); +wx_object(Config) -> + wx:new(), + Frame = ?mt(wxFrame, wx_obj_test:start([])), + timer:sleep(500), + ?m(ok, check_events(flush())), + + Me = self(), + ?m({call, foobar, {Me, _}}, wx_object:call(Frame, foobar)), + ?m(ok, wx_object:cast(Frame, foobar2)), + ?m([{cast, foobar2}], flush()), + FramePid = wx_object:get_pid(Frame), + io:format("wx_object pid ~p~n",[FramePid]), + FramePid ! foo3, + ?m([{info, foo3}], flush()), + + ?m(ok, wx_object:cast(Frame, fun(_) -> hehe end)), + ?m([{cast, hehe}], flush()), + wxWindow:refresh(Frame), + ?m([{sync_event, #wx{event=#wxPaint{}}, _}], flush()), + ?m(ok, wx_object:cast(Frame, fun(_) -> timer:sleep(200), slept end)), + %% The sleep above should not hinder the Paint event below + %% Which it did in my buggy handling of the sync_callback + wxWindow:refresh(Frame), + ?m([{sync_event, #wx{event=#wxPaint{}}, _}], flush()), + ?m([{cast, slept}], flush()), + + Monitor = erlang:monitor(process, FramePid), + case proplists:get_value(user, Config, false) of + false -> + timer:sleep(100), + wxFrame:destroy(Frame); + true -> + timer:sleep(500), + ?m(ok, wxFrame:destroy(Frame)); + _ -> + ?m(ok, wxEvtHandler:connect(Frame, close_window, [{skip,true}])), + wx_test_lib:wait_for_close() + end, + ?m(ok, receive + {'DOWN', Monitor, _, _, _} -> + ?m([{terminate, wx_deleted}], flush()), + ok + after 1000 -> + Msgs = flush(), + io:format("Error ~p Alive ~p~n",[Msgs, is_process_alive(FramePid)]) + end), + catch wx:destroy(), + ok. + +check_events(Msgs) -> + check_events(Msgs, 0,0). + +check_events([{event, #wx{event=#wxSize{}}}|Rest], Async, Sync) -> + check_events(Rest, Async+1, Sync); +check_events([{sync_event, #wx{event=#wxPaint{}}, Obj}|Rest], Async, Sync) -> + ?mt(wxPaintEvent, Obj), + check_events(Rest, Async, Sync+1); +check_events([], Async, Sync) -> + case Async > 0 of %% Test sync explictly + true -> ok; + false -> {Async, Sync} + end. + +flush() -> + flush([], 500). + +flush(Acc, Wait) -> + receive + Msg -> flush([Msg|Acc], Wait div 10) + after Wait -> + lists:reverse(Acc) + end. diff --git a/lib/wx/test/wx_obj_test.erl b/lib/wx/test/wx_obj_test.erl new file mode 100644 index 0000000000..b4d7640c7e --- /dev/null +++ b/lib/wx/test/wx_obj_test.erl @@ -0,0 +1,86 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2011. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +-module(wx_obj_test). +-include_lib("wx/include/wx.hrl"). + +-export([start/1]). + +%% wx_object callbacks +-export([init/1, handle_info/2, terminate/2, code_change/3, handle_call/3, + handle_sync_event/3, handle_event/2, handle_cast/2]). + +-record(state, {frame, panel, opts}). + +start(Opts) -> + wx_object:start_link(?MODULE, [{parent, self()}, Opts], []). + +init(Opts) -> + put(parent_pid, proplists:get_value(parent, Opts)), + Frame = wxFrame:new(wx:null(), ?wxID_ANY, "Test wx_object", [{size, {500, 400}}]), + Sz = wxBoxSizer:new(?wxHORIZONTAL), + Panel = wxPanel:new(Frame), + wxSizer:add(Sz, Panel, [{flag, ?wxEXPAND}, {proportion, 1}]), + wxPanel:connect(Panel, size, [{skip, true}]), + wxPanel:connect(Panel, paint, [callback, {userData, proplists:get_value(parent, Opts)}]), + wxWindow:show(Frame), + {Frame, #state{frame=Frame, panel=Panel, opts=Opts}}. + +handle_sync_event(Event = #wx{obj=Panel}, WxEvent, #state{opts=Opts}) -> + DC=wxPaintDC:new(Panel), %% We must create & destroy paintDC, or call wxEvent:skip(WxEvent)) + wxPaintDC:destroy(DC), %% in sync_event. Otherwise wx on windows keeps sending the events. + Pid = proplists:get_value(parent, Opts), + true = is_pid(Pid), + Pid ! {sync_event, Event, WxEvent}, + ok. + +handle_event(Event, State = #state{opts=Opts}) -> + Pid = proplists:get_value(parent, Opts), + Pid ! {event, Event}, + {noreply, State}. + +handle_call(What, From, State) when is_function(What) -> + Result = What(State), + {reply, {call, Result, From}, State}; +handle_call(What, From, State) -> + {reply, {call, What, From}, State}. + +handle_cast(What, State = #state{opts=Opts}) when is_function(What) -> + Result = What(State), + Pid = proplists:get_value(parent, Opts), + Pid ! {cast, Result}, + {noreply, State}; + +handle_cast(What, State = #state{opts=Opts}) -> + Pid = proplists:get_value(parent, Opts), + Pid ! {cast, What}, + {noreply, State}. + +handle_info(What, State = #state{opts=Opts}) -> + Pid = proplists:get_value(parent, Opts), + Pid ! {info, What}, + {noreply, State}. + +terminate(What, #state{opts=Opts}) -> + Pid = proplists:get_value(parent, Opts), + Pid ! {terminate, What}, + ok. + +code_change(Ver1, Ver2, State = #state{opts=Opts}) -> + Pid = proplists:get_value(parent, Opts), + Pid ! {code_change, Ver1, Ver2}, + State. diff --git a/lib/wx/test/wx_test_lib.hrl b/lib/wx/test/wx_test_lib.hrl index 34e1e9c6b8..820e8f0050 100644 --- a/lib/wx/test/wx_test_lib.hrl +++ b/lib/wx/test/wx_test_lib.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-2011. 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 @@ -40,7 +40,6 @@ -define(m(ExpectedRes, Expr), fun() -> - {TeStFILe, TeSTLiNe} = {?FILE, ?LINE}, AcTuAlReS = (catch (Expr)), case AcTuAlReS of ExpectedRes -> @@ -48,8 +47,8 @@ AcTuAlReS; _ -> wx_test_lib:error("Not Matching Actual result was:~n ~p ~n Expected ~s~n", - [AcTuAlReS, ??ExpectedRes], - TeStFILe,TeSTLiNe), + [AcTuAlReS, ??ExpectedRes], + ?FILE,?LINE), AcTuAlReS end end()). diff --git a/lib/xmerl/include/xmerl_xsd.hrl b/lib/xmerl/include/xmerl_xsd.hrl index 6dad7d8ff0..644cc2e433 100644 --- a/lib/xmerl/include/xmerl_xsd.hrl +++ b/lib/xmerl/include/xmerl_xsd.hrl @@ -184,7 +184,7 @@ %% allowed for a schema. %% chain, represents a series of ordered objects, some of whom may be %% optional. -%% alterantive, a collection of objects of which only one is choosen. +%% alterantive, a collection of objects of which only one is chosen. -record(chain,{ content, occurance={1,1} |