diff options
author | Linus Nordberg <linus@nordu.net> | 2016-04-06 10:07:48 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-04-07 16:06:12 +0200 |
commit | 03874b8eca8f065f6a1b133f06f19c0ff1d1494e (patch) | |
tree | 49ba20ad12e907270468353bc868742001086098 /src/v1.erl | |
parent | b8d1f0175850fbbbb8e8f6e2cdab5438ab8a54b6 (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.erl | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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. |