adds more validation to input handling in dns apps

This commit is contained in:
Joe Bryan 2019-06-07 11:36:12 -07:00
parent 918470119c
commit 97113f7e99
3 changed files with 27 additions and 4 deletions

View File

@ -43,9 +43,11 @@
=* adr address.in-poke-data
=/ rac (clan:title who)
?. ?=(?(%king %duke) rac)
~| [%dns-collector-bind-invalid rac] !!
~& [%dns-collector-bind-invalid who]
(pure:m state)
?: (reserved:eyre if.adr)
~| [%reserved-address if.adr] !!
~& [%dns-collector-reserved-address who if.adr]
(pure:m state)
::
=/ req=(unit address:dns) (~(get by requested.state) who)
=/ dun=(unit binding:dns) (~(get by completed.state) who)
@ -60,6 +62,8 @@
(pure:m state)
::
%dns-complete
:: XX or confirm valid binding?
::
?. (team:title [our src]:bowl)
~| %complete-yoself !!
=* who ship.in-poke-data

View File

@ -59,6 +59,8 @@
|= [=host:eyre max=@ud]
=/ m (async:stdio ?)
^- form:m
:: XX also scry into eyre
:: q:.^(hart:eyre %e /(scot %p our)/host/real)
=/ =hiss:eyre
=/ url=purl:eyre
[[sec=| por=~ host] [ext=`~.udon path=/static] query=~]
@ -183,7 +185,13 @@
:: manual dns binding -- by explicit ipv4
::
%dns-address
;< requested=? bind:m (request-by-ip if.address.in-poke-data)
=* adr address.in-poke-data
=/ rac (clan:title our.bowl)
?. ?=(?(%king %duke) rac)
~| [%dns-collector-bind-invalid rac] !!
?: (reserved:eyre if.adr)
~| [%dns-collector-reserved-address if.adr] !!
;< requested=? bind:m (request-by-ip if.adr)
:: XX save failure?
=? requested.state requested
(some address.in-poke-data)

View File

@ -11,12 +11,23 @@
==
^- (sole-result [%dns-address address])
=* our p.bec
=/ rac (clan:title our)
?: ?=(%czar rac)
:: XX what process?
=/ msg "galaxy domain requests must be made out-of-band"
(print leaf+msg no-product)
?: ?=(?(%earl %pawn) rac)
=/ msg "DNS for moons and comets is not supported"
(print leaf+msg no-product)
:: invoke parser with arg if present
::
=- ?~ arg -
(fun.q.q addr.arg)
%+ prompt
[%& %dns-address "ipv4 address: "]
%+ parse
`$-(nail (like @if))`;~(pfix ;~(pose dot (easy ~)) lip:ag)
^- $-(nail (like @if))
;~(pfix ;~(pose dot (easy ~)) lip:ag)
|= addr=@if
?: (reserved:eyre addr)
=/ msg "unable to bind reserved ipv4 address {(scow %if addr)}"