summaryrefslogtreecommitdiff
path: root/src/v1.erl
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2016-04-06 10:07:48 +0200
committerLinus Nordberg <linus@nordu.net>2016-04-06 10:07:48 +0200
commit28bc4ae4d9cf9f34f9dcd99da1c89bdb56a2bd38 (patch)
tree1466969b12989b1645f39aa7f742ff4f5880807d /src/v1.erl
parentba016c8b02006943198aa5bfb68cf13fccdc33ca (diff)
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.
Diffstat (limited to 'src/v1.erl')
-rw-r--r--src/v1.erl17
1 files changed, 9 insertions, 8 deletions
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.