From f64ffc8babb9143f48504743f42c816e6fc928dc Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Tue, 22 Nov 2016 15:35:16 +0100 Subject: Added back support for R16 --- src/catlfish_compat.erl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/catlfish_compat.erl b/src/catlfish_compat.erl index 183eb44..6dab325 100644 --- a/src/catlfish_compat.erl +++ b/src/catlfish_compat.erl @@ -10,6 +10,11 @@ poison_val(Value) -> poison_val(erlang:system_info(otp_release), Value). %% @doc Dig out alg, params and key from issuer. +unpack_issuer("R16" ++ _, Issuer) -> + #'SubjectPublicKeyInfo'{ + algorithm = #'AlgorithmIdentifier'{algorithm = Alg, parameters = Params}, + subjectPublicKey = {0, Key}} = Issuer, + {Alg, Params, Key}; unpack_issuer("17", Issuer) -> #'SubjectPublicKeyInfo'{ algorithm = #'AlgorithmIdentifier'{algorithm = Alg, parameters = Params}, @@ -22,6 +27,9 @@ unpack_issuer("18", Issuer) -> {Alg, Params, Key}. %% @doc Unpack a #'Certificate'.signature, return the signature. +unpack_signature("R16" ++ _, Signature) -> + {_, Sig} = Signature, + Sig; unpack_signature("17", Signature) -> {_, Sig} = Signature, Sig; @@ -29,6 +37,8 @@ unpack_signature("18", Signature) -> Signature. %% Use a list for R17 and a binary for newer versions. +poison_val("R16" ++ _, Val) -> + Val; poison_val("17", Val) -> Val; poison_val("18", Val) -> -- cgit v1.1 From 3e976860ddf968b06ee77b93680acae7fc24a566 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Tue, 22 Nov 2016 15:35:47 +0100 Subject: Log simple web request logging on level info --- src/catlfish_web.erl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/catlfish_web.erl b/src/catlfish_web.erl index f44745d..12441cf 100644 --- a/src/catlfish_web.erl +++ b/src/catlfish_web.erl @@ -43,14 +43,16 @@ loop(Req, Module) -> {403, [{"Content-Type", "text/plain"}], "Invalid credentials"}; success -> + lager:info("GET ~p", [Path]), lager:debug("GET ~p ~p", [Path, Query]), add_auth(Path, Module:request(get, App, Fun, Query)); noauth -> + lager:info("GET ~p", [Path]), lager:debug("GET ~p ~p", [Path, Query]), Module:request(get, App, Fun, Query) end, - lager:debug("GET finished: ~p us", + lager:info("GET finished: ~p us", [timer:now_diff(os:timestamp(), Starttime)]), case Result of none -> @@ -67,14 +69,16 @@ loop(Req, Module) -> {403, [{"Content-Type", "text/plain"}], "Invalid credentials"}; success -> + lager:info("POST ~p", [Path]), lager:debug("POST ~p ~p", [Path, Body]), add_auth(Path, Module:request(post, App, Fun, Body)); noauth -> + lager:info("POST ~p", [Path]), lager:debug("POST ~p ~p", [Path, Body]), Module:request(post, App, Fun, Body) end, - lager:debug("POST finished: ~p us", + lager:info("POST finished: ~p us", [timer:now_diff(os:timestamp(), Starttime)]), case Result of none -> -- cgit v1.1