data NmcRRTlsa = NmcRRTlsa
{ tlsMatchType :: Int -- 0:exact 1:sha256 2:sha512
, tlsMatchValue :: String
- , tlsIncSubdoms :: Int -- 1:enforce on subdoms 0:no
+ , tlsIncSubdoms :: Bool -- enforce on subdoms?
} deriving (Show, Eq)
instance FromJSON NmcRRTlsa where
if length a == 3 then NmcRRTlsa
<$> parseJSON (a ! 0)
<*> parseJSON (a ! 1)
- <*> parseJSON (a ! 2)
+ <*> case (a ! 2) of
+ Number 0 -> return False
+ Number 1 -> return True
+ _ -> empty
else empty
parseJSON _ = empty
-- | transfer some elements of `base` into `sub`, notably TLSA
propagate :: NmcDom -> NmcDom -> NmcDom
-propagate base sub = sub -- FIXME implement it
+propagate base sub = sub `merge` (pickglobals base)
+ where -- FIXME must do this on the map elements, not on the top level
+ pickglobals dom = def { domTlsa = fmap pickforcedtls (domTlsa dom) }
+ pickforcedtls = filter (\x -> tlsIncSubdoms x)
-- | Presence of some elements require removal of some others
normalizeDom :: NmcDom -> NmcDom