Fix initremote with encryption=pubkey to work with S3, glacier, webdav, and external special remotes.
This commit is contained in:
parent
810b26e1d9
commit
3a3fda5bc0
4 changed files with 18 additions and 8 deletions
2
Creds.hs
2
Creds.hs
|
@ -51,7 +51,7 @@ setRemoteCredPair' c storage creds
|
||||||
return c
|
return c
|
||||||
|
|
||||||
storeconfig key (Just cipher) = do
|
storeconfig key (Just cipher) = do
|
||||||
s <- liftIO $ encrypt [] cipher
|
s <- liftIO $ encrypt (getGpgEncParams c) cipher
|
||||||
(feedBytes $ L.pack $ encodeCredPair creds)
|
(feedBytes $ L.pack $ encodeCredPair creds)
|
||||||
(readBytes $ return . L.unpack)
|
(readBytes $ return . L.unpack)
|
||||||
return $ M.insert key (toB64 s) c
|
return $ M.insert key (toB64 s) c
|
||||||
|
|
18
Crypto.hs
18
Crypto.hs
|
@ -196,14 +196,20 @@ prop_HmacSha1WithCipher_sane = known_good == macWithCipher' HmacSha1 "foo" "bar"
|
||||||
class LensGpgEncParams a where getGpgEncParams :: a -> [CommandParam]
|
class LensGpgEncParams a where getGpgEncParams :: a -> [CommandParam]
|
||||||
|
|
||||||
{- Extract the GnuPG options from a pair of a Remote Config and a Remote
|
{- 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,
|
- Git Config. -}
|
||||||
- look up the recipient keys and add them to the option list. -}
|
|
||||||
instance LensGpgEncParams (RemoteConfig, RemoteGitConfig) where
|
instance LensGpgEncParams (RemoteConfig, RemoteGitConfig) where
|
||||||
getGpgEncParams (c,gc) = map Param (remoteAnnexGnupgOptions gc) ++ recipients
|
getGpgEncParams (c,gc) = map Param (remoteAnnexGnupgOptions gc) ++ getGpgEncParams c
|
||||||
where
|
where
|
||||||
recipients = case M.lookup "encryption" c of
|
|
||||||
Just "pubkey" -> Gpg.pkEncTo $ maybe [] (split ",") $
|
{- Extract the GnuPG options from a Remote Config, ignoring any
|
||||||
M.lookup "cipherkeys" c
|
- 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. -}
|
{- Extract the GnuPG options from a Remote. -}
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -29,6 +29,8 @@ git-annex (5.20140128) UNRELEASED; urgency=medium
|
||||||
* Windows: Fix deletion of repositories by test suite and webapp.
|
* Windows: Fix deletion of repositories by test suite and webapp.
|
||||||
* Windows: Test suite 100% passes again.
|
* Windows: Test suite 100% passes again.
|
||||||
* Windows: Fix bug in symlink calculation code.
|
* 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
|
-- Joey Hess <joeyh@debian.org> Tue, 28 Jan 2014 13:57:19 -0400
|
||||||
|
|
||||||
|
|
|
@ -40,3 +40,5 @@ git-annex: initremote: 1 failed
|
||||||
|
|
||||||
# End of transcript or log.
|
# End of transcript or log.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue