diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-14 13:30:50 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-14 13:31:00 -0400 |
commit | b6e61f8daed1a6c5bb6cecd545c71b04aaf86af9 (patch) | |
tree | 97a24833c457256732fd7e7c554d4ff92c39544e /Utility/Gpg.hs | |
parent | 889a2990734a818dff7133dcf936affdbc9c7558 (diff) |
Improve gpg secret key list parser to deal with changes in gpg 2.1.15. Fixes key name display in webapp.
gpg 2.1.15 (or so) seems to have added some new fields to the --with-colons
--list-secret-keys output. These include "fpr" and "grp", and come before
the "uid" line. So, the parser was giving up before it saw the name. Fix by
continuing to look for the uid line until the next "sec" line.
This commit was sponsored by Ole-Morten,Duesund on Patreon.
Diffstat (limited to 'Utility/Gpg.hs')
-rw-r--r-- | Utility/Gpg.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs index 1ac03ef54..af740c3e0 100644 --- a/Utility/Gpg.hs +++ b/Utility/Gpg.hs @@ -178,8 +178,10 @@ secretKeys cmd = catchDefaultIO M.empty makemap parse = extract [] Nothing . map (split ":") extract c (Just keyid) (("uid":_:_:_:_:_:_:_:_:userid:_):rest) = extract ((keyid, decode_c userid):c) Nothing rest - extract c (Just keyid) rest = + extract c (Just keyid) rest@(("sec":_):_) = extract ((keyid, ""):c) Nothing rest + extract c (Just keyid) (_:rest) = + extract c (Just keyid) rest extract c _ [] = c extract c _ (("sec":_:_:_:keyid:_):rest) = extract c (Just keyid) rest |