From 28bc4ae4d9cf9f34f9dcd99da1c89bdb56a2bd38 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Wed, 6 Apr 2016 10:07:48 +0200 Subject: Add unit test for validation, from dnssecport:handle_call(). - The port now returns the RRset (DS, chain, trust root and all RRSIG's). This in preparatino for when this data will be normalised. - dnssecport decodes and encodes DNS data. - v1 stores the DS RR in the leaf and the rest, including the DS RRSIG, in the chain. --- src/v1.erl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/v1.erl') diff --git a/src/v1.erl b/src/v1.erl index 86cd799..bab77aa 100644 --- a/src/v1.erl +++ b/src/v1.erl @@ -156,8 +156,8 @@ add_ds(Input) -> case decode_chain(List) of {invalid, ErrText} -> err400(io:format("add-ds-rr: ~p", [ErrText]), List); - [DSRR, DSRRSIG | SupportRRs] -> - add_ds_helper(DSRR, DSRRSIG, SupportRRs); + Data when is_list(Data) -> + add_ds_helper(Data); _ -> err400("add-ds-rr: missing one or more entries", List) end; @@ -173,10 +173,11 @@ decode_chain(List) -> L end. -add_ds_helper(DSRR, DSRRSIG, Support) -> - case dnssecport:dnssec_validate([DSRR, DSRRSIG], Support) of - ok -> - success(catlfish:add_chain(DSRR, [DSRRSIG | Support], normal)); - _ -> - err400("add-ds-rr: invalid DS record", [DSRR, DSRRSIG | Support]) +add_ds_helper(Data) -> + case dnssecport:dnssec_validate(Data) of + {ok, [DS | Chain]} -> + success(catlfish:add_chain(DS, Chain, normal)); + {error, ErrorCode} -> + err400(io:format("add-ds-rr: invalid DS record: ~p", [ErrorCode]), + Data) end. -- cgit v1.1