SPF: verify IPv4 and IPv6 ranges in SPF mechanisms.
This commit is contained in:
parent
a6b658253d
commit
5b93c32669
@ -97,6 +97,7 @@ show_error_ip6 e = case e of
|
|||||||
Bulma.p "The IPv6 representation is erroneous. It should contain only up to 8 groups of hexadecimal characters."
|
Bulma.p "The IPv6 representation is erroneous. It should contain only up to 8 groups of hexadecimal characters."
|
||||||
IPAddress.IP6IrrelevantShortRepresentation ->
|
IPAddress.IP6IrrelevantShortRepresentation ->
|
||||||
Bulma.p "IPv6 address has been unnecessarily shortened (with two ':')."
|
Bulma.p "IPv6 address has been unnecessarily shortened (with two ':')."
|
||||||
|
IPAddress.IP6InvalidRange -> Bulma.p "IPv6 address or range isn't valid."
|
||||||
|
|
||||||
show_error_ip4 :: forall w i. IPAddress.IPv4Error -> HH.HTML w i
|
show_error_ip4 :: forall w i. IPAddress.IPv4Error -> HH.HTML w i
|
||||||
show_error_ip4 e = case e of
|
show_error_ip4 e = case e of
|
||||||
@ -104,6 +105,7 @@ show_error_ip4 e = case e of
|
|||||||
Bulma.p $ "IPv4 address contains a number too big (should be between 0 and 255). Current entered number: " <> show n
|
Bulma.p $ "IPv4 address contains a number too big (should be between 0 and 255). Current entered number: " <> show n
|
||||||
IPAddress.IP4IrrelevantShortRepresentation ->
|
IPAddress.IP4IrrelevantShortRepresentation ->
|
||||||
Bulma.p "IPv4 address has been unnecessarily shortened (with two '.')."
|
Bulma.p "IPv4 address has been unnecessarily shortened (with two '.')."
|
||||||
|
IPAddress.IP4InvalidRange -> Bulma.p "IPv4 address or range isn't valid."
|
||||||
|
|
||||||
show_error_txt :: forall w i. ValidationDNS.TXTError -> HH.HTML w i
|
show_error_txt :: forall w i. ValidationDNS.TXTError -> HH.HTML w i
|
||||||
show_error_txt e = case e of
|
show_error_txt e = case e of
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module App.Validation.DNS where
|
module App.Validation.DNS where
|
||||||
|
|
||||||
import Prelude (apply, between, bind, map, pure, ($), (-), (<), (<$>), (<>))
|
import Prelude (apply, between, bind, map, pure, ($), (-), (<), (<>))
|
||||||
|
|
||||||
import Control.Alt ((<|>))
|
import Control.Alt ((<|>))
|
||||||
import Data.Array as A
|
import Data.Array as A
|
||||||
@ -57,24 +57,15 @@ data Error
|
|||||||
type AVErrors = Array Error
|
type AVErrors = Array Error
|
||||||
|
|
||||||
-- | Current default values.
|
-- | Current default values.
|
||||||
min_ttl :: Int
|
min_ttl = 30 :: Int
|
||||||
min_ttl = 30
|
max_ttl = 86000 :: Int
|
||||||
max_ttl :: Int
|
max_txt = 500 :: Int
|
||||||
max_ttl = 86000
|
min_priority = 0 :: Int
|
||||||
max_txt :: Int
|
max_priority = 65535 :: Int
|
||||||
max_txt = 500
|
min_port = 0 :: Int
|
||||||
min_priority :: Int
|
max_port = 65535 :: Int
|
||||||
min_priority = 0
|
min_weight = 0 :: Int
|
||||||
max_priority :: Int
|
max_weight = 65535 :: Int
|
||||||
max_priority = 65535
|
|
||||||
min_port :: Int
|
|
||||||
min_port = 0
|
|
||||||
max_port :: Int
|
|
||||||
max_port = 65535
|
|
||||||
min_weight :: Int
|
|
||||||
min_weight = 0
|
|
||||||
max_weight :: Int
|
|
||||||
max_weight = 65535
|
|
||||||
|
|
||||||
-- Functions handling network-related structures (ResourceRecord).
|
-- Functions handling network-related structures (ResourceRecord).
|
||||||
|
|
||||||
@ -215,10 +206,10 @@ validate_SPF_mechanism m = case m.t of
|
|||||||
name <- parse (or_nothing DomainParser.sub_eof) m.v VESPFMechanismName
|
name <- parse (or_nothing DomainParser.sub_eof) m.v VESPFMechanismName
|
||||||
in first m name -- name is discarded
|
in first m name -- name is discarded
|
||||||
RR.IP4 -> ado
|
RR.IP4 -> ado
|
||||||
name <- parse IPAddress.ipv4 m.v VESPFMechanismIPv4
|
name <- parse (IPAddress.ipv4_range <|> IPAddress.ipv4) m.v VESPFMechanismIPv4
|
||||||
in first m name -- name is discarded
|
in first m name -- name is discarded
|
||||||
RR.IP6 -> ado
|
RR.IP6 -> ado
|
||||||
name <- parse IPAddress.ipv6 m.v VESPFMechanismIPv6
|
name <- parse (IPAddress.ipv6_range <|> IPAddress.ipv6) m.v VESPFMechanismIPv6
|
||||||
in first m name -- name is discarded
|
in first m name -- name is discarded
|
||||||
_ -> pure m
|
_ -> pure m
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user