lio 0.9.2.0 → 0.9.2.2
raw patch · 4 files changed
+26/−25 lines, 4 filesdep +binarydep −cerealdep −timePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: binary
Dependencies removed: cereal, time
API changes (from Hackage documentation)
- LIO.DCLabel.Serialize: instance Serialize Clause
- LIO.DCLabel.Serialize: instance Serialize Component
- LIO.DCLabel.Serialize: instance Serialize DCLabel
- LIO.DCLabel.Serialize: instance Serialize Principal
+ LIO.DCLabel.Serialize: instance Binary Clause
+ LIO.DCLabel.Serialize: instance Binary Component
+ LIO.DCLabel.Serialize: instance Binary DCLabel
+ LIO.DCLabel.Serialize: instance Binary Principal
- LIO.FS.TCB: type SLabel l = (Label l, Serialize l)
+ LIO.FS.TCB: type SLabel l = (Label l, Binary l)
- LIO.Handle: hGetContentsP :: (Priv l p, Serialize l, HandleOps Handle b IO) => p -> LabeledHandle l -> LIO l b
+ LIO.Handle: hGetContentsP :: (Priv l p, Binary l, HandleOps Handle b IO) => p -> LabeledHandle l -> LIO l b
- LIO.Handle: hGetLineP :: (Priv l p, Serialize l, HandleOps Handle b IO) => p -> LabeledHandle l -> LIO l b
+ LIO.Handle: hGetLineP :: (Priv l p, Binary l, HandleOps Handle b IO) => p -> LabeledHandle l -> LIO l b
- LIO.Handle: hGetNonBlockingP :: (Priv l p, Serialize l, HandleOps Handle b IO) => p -> LabeledHandle l -> Int -> LIO l b
+ LIO.Handle: hGetNonBlockingP :: (Priv l p, Binary l, HandleOps Handle b IO) => p -> LabeledHandle l -> Int -> LIO l b
- LIO.Handle: hGetP :: (Priv l p, Serialize l, HandleOps Handle b IO) => p -> LabeledHandle l -> Int -> LIO l b
+ LIO.Handle: hGetP :: (Priv l p, Binary l, HandleOps Handle b IO) => p -> LabeledHandle l -> Int -> LIO l b
- LIO.Handle: hPutP :: (Priv l p, Serialize l, HandleOps Handle b IO) => p -> LabeledHandle l -> b -> LIO l ()
+ LIO.Handle: hPutP :: (Priv l p, Binary l, HandleOps Handle b IO) => p -> LabeledHandle l -> b -> LIO l ()
- LIO.Handle: hPutStrLnP :: (Priv l p, Serialize l, HandleOps Handle b IO) => p -> LabeledHandle l -> b -> LIO l ()
+ LIO.Handle: hPutStrLnP :: (Priv l p, Binary l, HandleOps Handle b IO) => p -> LabeledHandle l -> b -> LIO l ()
- LIO.Handle: hPutStrP :: (Priv l p, Serialize l, HandleOps Handle b IO) => p -> LabeledHandle l -> b -> LIO l ()
+ LIO.Handle: hPutStrP :: (Priv l p, Binary l, HandleOps Handle b IO) => p -> LabeledHandle l -> b -> LIO l ()
- LIO.Handle: readFileP :: (HandleOps Handle b IO, Priv l p, Serialize l) => p -> FilePath -> LIO l b
+ LIO.Handle: readFileP :: (HandleOps Handle b IO, Priv l p, Binary l) => p -> FilePath -> LIO l b
- LIO.Handle: type SLabel l = (Label l, Serialize l)
+ LIO.Handle: type SLabel l = (Label l, Binary l)
- LIO.Handle: writeFileP :: (HandleOps Handle b IO, Priv l p, Serialize l) => p -> l -> FilePath -> b -> LIO l ()
+ LIO.Handle: writeFileP :: (HandleOps Handle b IO, Priv l p, Binary l) => p -> l -> FilePath -> b -> LIO l ()
Files
- LIO/DCLabel/Serialize.hs +10/−8
- LIO/FS/TCB.hs +4/−4
- LIO/Handle.hs +10/−10
- lio.cabal +2/−3
LIO/DCLabel/Serialize.hs view
@@ -1,23 +1,25 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE StandaloneDeriving, GeneralizedNewtypeDeriving #-}+{- | -{- | This module provides instances for binary serialization of-'DCLabel's. Specifically, we provide insgtances for @cereal@\'s-@Data.Serialize@. -}+This module provides instances for binary serialization of+'DCLabel's. Specifically, we provide insgtances for @binary@\'s+@Data.Binary@. +-} module LIO.DCLabel.Serialize () where import LIO.DCLabel.Core-import Data.Serialize+import Data.Binary import Control.Monad -deriving instance Serialize Principal-deriving instance Serialize Clause+deriving instance Binary Principal+deriving instance Binary Clause -- | Serialize components by converting them to maybe's-instance Serialize Component where+instance Binary Component where put c = put . dcToMaybe $! c where dcToMaybe DCFalse = Nothing dcToMaybe (DCFormula f) = Just f@@ -26,6 +28,6 @@ dcFromMaybe (Just f) = dcFormula f -- | Serialize labels by converting them to pairs of components.-instance Serialize DCLabel where+instance Binary DCLabel where put l = put (dcSecrecy l, dcIntegrity l) get = uncurry dcLabelNoReduce `liftM` get
LIO/FS/TCB.hs view
@@ -31,7 +31,7 @@ , lazyEncodeLabel, encodeLabel, decodeLabel ) where -import Data.Serialize+import Data.Binary import Data.Typeable import Data.IORef import qualified Data.ByteString as S@@ -63,7 +63,7 @@ type L8 = L8.ByteString -- | Constraintfor serializable labels-type SLabel l = (Label l, Serialize l)+type SLabel l = (Label l, Binary l) -- -- Exception thrown by the file store interface@@ -189,7 +189,7 @@ -- | Encode a label into an attribute value. lazyEncodeLabel :: SLabel l => l -> L8-lazyEncodeLabel = compress . encodeLazy+lazyEncodeLabel = compress . encode -- | Encode a label into an attribute value. encodeLabel :: SLabel l => l -> AttrValue@@ -197,7 +197,7 @@ -- | Descode label from an attribute value. decodeLabel :: SLabel l => AttrValue -> Either String l-decodeLabel = decodeLazy . decompress . lazyfy+decodeLabel = decode . decompress . lazyfy -- | Set the label of a given path. This function sets the 'labelAttr' -- attribute to the encoded label, and the hash to 'labelHashAttr'.
LIO/Handle.hs view
@@ -82,7 +82,7 @@ import Prelude hiding (readFile, writeFile) -import Data.Serialize+import Data.Binary import qualified Data.ByteString.Char8 as S8 import qualified Data.ByteString.Lazy.Char8 as L8 @@ -319,7 +319,7 @@ -- | Read @n@ bytes from the labeled handle, using privileges when -- performing label comparisons and tainting.-hGetP :: (Priv l p, Serialize l, HandleOps IO.Handle b IO)+hGetP :: (Priv l p, Binary l, HandleOps IO.Handle b IO) => p -- ^ Privileges -> LabeledHandle l -- ^ Labeled handle -> Int -- ^ Number of bytes to read@@ -332,7 +332,7 @@ -- available. Instead, it returns whatever data is available. -- Privileges are used in the label comparisons and when raising -- the current label.-hGetNonBlockingP :: (Priv l p, Serialize l, HandleOps IO.Handle b IO)+hGetNonBlockingP :: (Priv l p, Binary l, HandleOps IO.Handle b IO) => p -> LabeledHandle l -> Int -> LIO l b hGetNonBlockingP p lh n = do guardWriteP p (labelOf lh)@@ -341,14 +341,14 @@ -- | Read the entire labeled handle contents and close handle upon -- reading @EOF@. Privileges are used in the label comparisons -- and when raising the current label.-hGetContentsP :: (Priv l p, Serialize l, HandleOps IO.Handle b IO)+hGetContentsP :: (Priv l p, Binary l, HandleOps IO.Handle b IO) => p -> LabeledHandle l -> LIO l b hGetContentsP p lh = do guardWriteP p (labelOf lh) liftLIO . rethrowIoTCB $ hGetContents (unlabelTCB lh) -- | Read the a line from a labeled handle.-hGetLineP :: (Priv l p, Serialize l, HandleOps IO.Handle b IO)+hGetLineP :: (Priv l p, Binary l, HandleOps IO.Handle b IO) => p -> LabeledHandle l -> LIO l b hGetLineP p lh = do guardWriteP p (labelOf lh)@@ -357,21 +357,21 @@ -- | Output the given (Byte)String to the specified labeled handle. -- Privileges are used in the label comparisons and when raising -- the current label.-hPutP :: (Priv l p, Serialize l, HandleOps IO.Handle b IO)+hPutP :: (Priv l p, Binary l, HandleOps IO.Handle b IO) => p -> LabeledHandle l -> b -> LIO l () hPutP p lh s = do guardWriteP p (labelOf lh) liftLIO . rethrowIoTCB $ hPut (unlabelTCB lh) s -- | Synonym for 'hPutP'.-hPutStrP :: (Priv l p, Serialize l, HandleOps IO.Handle b IO)+hPutStrP :: (Priv l p, Binary l, HandleOps IO.Handle b IO) => p -> LabeledHandle l -> b -> LIO l () hPutStrP = hPutP -- | Output the given (Byte)String with an appended newline to the -- specified labeled handle. Privileges are used in the label -- comparisons and when raising the current label.-hPutStrLnP :: (Priv l p, Serialize l, HandleOps IO.Handle b IO)+hPutStrLnP :: (Priv l p, Binary l, HandleOps IO.Handle b IO) => p -> LabeledHandle l -> b -> LIO l () hPutStrLnP p lh s = do guardWriteP p (labelOf lh)@@ -387,7 +387,7 @@ readFile = readFileP NoPrivs -- | Same as 'readFile' but uses privilege in opening the file.-readFileP :: (HandleOps Handle b IO, Priv l p, Serialize l)+readFileP :: (HandleOps Handle b IO, Priv l p, Binary l) => p -> FilePath -> LIO l b readFileP p file = openFileP p Nothing file ReadMode >>= hGetContentsP p @@ -398,7 +398,7 @@ -- | Same as 'writeFile' but uses privilege when opening, writing and -- closing the file.-writeFileP :: (HandleOps Handle b IO, Priv l p, Serialize l)+writeFileP :: (HandleOps Handle b IO, Priv l p, Binary l) => p -> l -> FilePath -> b -> LIO l () writeFileP p l file contents = do bracket (openFileP p (Just l) file WriteMode) (hCloseP p)
lio.cabal view
@@ -1,5 +1,5 @@ Name: lio-Version: 0.9.2.0+Version: 0.9.2.2 Cabal-Version: >= 1.8 Build-type: Simple License: GPL@@ -73,16 +73,15 @@ Library Build-Depends: base >= 4.5 && < 5.0+ ,binary >= 0.5.0.0 ,transformers >= 0.2.2 ,containers >= 0.4.2 ,bytestring >= 0.9- ,cereal >= 0.3.5.1 ,filepath >= 1.3.0.0 ,directory >= 1.1.0.2 ,xattr >= 0.6.1 ,zlib >= 0.5.3.1 ,SHA >= 1.5.0.0- ,time >= 1.2.0.5 GHC-options: -Wall -fno-warn-orphans