From d5b38fc2736ae75c872a6eb51d80cc90e97d1fc4 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Tue, 16 Jul 2019 21:14:32 -0400 Subject: KeyExact --- lib/KeyRing/BuildKeyDB.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/KeyRing/BuildKeyDB.hs') diff --git a/lib/KeyRing/BuildKeyDB.hs b/lib/KeyRing/BuildKeyDB.hs index 510c820..ef4edba 100644 --- a/lib/KeyRing/BuildKeyDB.hs +++ b/lib/KeyRing/BuildKeyDB.hs @@ -416,9 +416,9 @@ parseSpec wkgrip spec = case prespec of AnyMatch -> (KeyGrip "", Nothing) EmptyMatch -> error "Bad key spec." - WorkingKeyMatch -> (KeyGrip $ show wkgrip, Nothing) - SubstringMatch (Just KeyTypeField) tag -> (KeyGrip $ show wkgrip, Just tag) - SubstringMatch Nothing str -> (KeyGrip $ show wkgrip, Just str) + WorkingKeyMatch -> (KeyExact wkgrip, Nothing) + SubstringMatch (Just KeyTypeField) tag -> (KeyExact wkgrip, Just tag) + SubstringMatch Nothing str -> (KeyExact wkgrip, Just str) SubstringMatch (Just UserIDField) ustr -> (KeyUidMatch ustr, Nothing) FingerprintMatch fp -> (KeyGrip fp, Nothing) else @@ -780,6 +780,11 @@ is40digitHex xs = ys == xs && length ys==40 ishex c = False matchSpec :: KeySpec -> KeyData -> Bool +matchSpec (KeyExact Nothing) _ = False +matchSpec (KeyExact (Just grip)) (KeyData p _ _ _) + | matchpr grip (packet p) = True + | otherwise = False + matchSpec (KeyGrip grip) (KeyData p _ _ _) | matchpr' grip (packet p) = True | otherwise = False -- cgit v1.2.3