summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-06 18:25:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-06 18:25:31 -0400
commit1f76551dce12e7209422ee65980315bb60eb771a (patch)
tree3e5a64062498594b00fb68711edbc49f1acd47b2
parenta1e76e7fdcfcd17a690bd49e4a29f88ca83e82b1 (diff)
Fix initremote with encryption=pubkey to work with S3, glacier, webdav, and external special remotes.
-rw-r--r--Creds.hs2
-rw-r--r--Crypto.hs20
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/GPG_issues_with_pubkey___40__Again__63____41__.mdwn2
4 files changed, 18 insertions, 8 deletions
diff --git a/Creds.hs b/Creds.hs
index 7c300dd07..3bd87a522 100644
--- a/Creds.hs
+++ b/Creds.hs
@@ -51,7 +51,7 @@ setRemoteCredPair' c storage creds
return c
storeconfig key (Just cipher) = do
- s <- liftIO $ encrypt [] cipher
+ s <- liftIO $ encrypt (getGpgEncParams c) cipher
(feedBytes $ L.pack $ encodeCredPair creds)
(readBytes $ return . L.unpack)
return $ M.insert key (toB64 s) c
diff --git a/Crypto.hs b/Crypto.hs
index 371bbcaf1..f3a9e3957 100644
--- a/Crypto.hs
+++ b/Crypto.hs
@@ -196,15 +196,21 @@ prop_HmacSha1WithCipher_sane = known_good == macWithCipher' HmacSha1 "foo" "bar"
class LensGpgEncParams a where getGpgEncParams :: a -> [CommandParam]
{- Extract the GnuPG options from a pair of a Remote Config and a Remote
- - Git Config. If the remote is configured to use public-key encryption,
- - look up the recipient keys and add them to the option list. -}
+ - Git Config. -}
instance LensGpgEncParams (RemoteConfig, RemoteGitConfig) where
- getGpgEncParams (c,gc) = map Param (remoteAnnexGnupgOptions gc) ++ recipients
+ getGpgEncParams (c,gc) = map Param (remoteAnnexGnupgOptions gc) ++ getGpgEncParams c
where
- recipients = case M.lookup "encryption" c of
- Just "pubkey" -> Gpg.pkEncTo $ maybe [] (split ",") $
- M.lookup "cipherkeys" c
- _ -> []
+
+{- Extract the GnuPG options from a Remote Config, ignoring any
+ - git config settings. (Which is ok if the remote is just being set up
+ - and so doesn't have any.)
+ -
+ - If the remote is configured to use public-key encryption,
+ - look up the recipient keys and add them to the option list.-}
+instance LensGpgEncParams RemoteConfig where
+ getGpgEncParams c = case M.lookup "encryption" c of
+ Just "pubkey" -> Gpg.pkEncTo $ maybe [] (split ",") $ M.lookup "cipherkeys" c
+ _ -> []
{- Extract the GnuPG options from a Remote. -}
instance LensGpgEncParams (RemoteA a) where
diff --git a/debian/changelog b/debian/changelog
index 3c5d46de4..845507b24 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -29,6 +29,8 @@ git-annex (5.20140128) UNRELEASED; urgency=medium
* Windows: Fix deletion of repositories by test suite and webapp.
* Windows: Test suite 100% passes again.
* Windows: Fix bug in symlink calculation code.
+ * Fix initremote with encryption=pubkey to work with S3, glacier, webdav,
+ and external special remotes.
-- Joey Hess <joeyh@debian.org> Tue, 28 Jan 2014 13:57:19 -0400
diff --git a/doc/bugs/GPG_issues_with_pubkey___40__Again__63____41__.mdwn b/doc/bugs/GPG_issues_with_pubkey___40__Again__63____41__.mdwn
index c273c7e46..bf7f4f391 100644
--- a/doc/bugs/GPG_issues_with_pubkey___40__Again__63____41__.mdwn
+++ b/doc/bugs/GPG_issues_with_pubkey___40__Again__63____41__.mdwn
@@ -40,3 +40,5 @@ git-annex: initremote: 1 failed
# End of transcript or log.
"""]]
+
+> [[fixed|done]] --[[Joey]]