diff --git a/Creds.hs b/Creds.hs index 73d631ff7d..7273ed966b 100644 --- a/Creds.hs +++ b/Creds.hs @@ -23,7 +23,7 @@ import Annex.Perms import Utility.FileMode import Crypto import Types.Remote (RemoteConfig, RemoteConfigKey) -import Remote.Helper.Encryptable (remoteCipher, remoteCipher', embedCreds) +import Remote.Helper.Encryptable (remoteCipher, embedCreds) import Utility.Env (getEnv) import qualified Data.ByteString.Lazy.Char8 as L @@ -85,19 +85,15 @@ getRemoteCredPair c storage = maybe fromcache (return . Just) =<< fromenv fromcache = maybe fromconfig (return . Just) =<< readCacheCredPair storage fromconfig = case credPairRemoteKey storage of Just key -> do - mcipher <- remoteCipher' c - case (mcipher, M.lookup key c) of - (_, Nothing) -> return Nothing - (Just (_cipher, SharedCipher {}), Just bcreds) -> - -- When using a shared cipher, the - -- creds are not stored encrypted. - fromcreds $ fromB64 bcreds - (Just (cipher, _), Just enccreds) -> do + mcipher <- remoteCipher c + case (M.lookup key c, mcipher) of + (Nothing, _) -> return Nothing + (Just enccreds, Just cipher) -> do creds <- liftIO $ decrypt cipher (feedBytes $ L.pack $ fromB64 enccreds) (readBytes $ return . L.unpack) fromcreds creds - (Nothing, Just bcreds) -> + (Just bcreds, Nothing) -> fromcreds $ fromB64 bcreds Nothing -> return Nothing fromcreds creds = case decodeCredPair creds of diff --git a/Remote/Helper/Encryptable.hs b/Remote/Helper/Encryptable.hs index 69216a793d..dd032ce337 100644 --- a/Remote/Helper/Encryptable.hs +++ b/Remote/Helper/Encryptable.hs @@ -71,21 +71,18 @@ encryptionSetup c = maybe genCipher updateCipher $ extractCipher c {- Gets encryption Cipher. The decrypted Ciphers are cached in the Annex - state. -} remoteCipher :: RemoteConfig -> Annex (Maybe Cipher) -remoteCipher = fmap fst <$$> remoteCipher' - -remoteCipher' :: RemoteConfig -> Annex (Maybe (Cipher, StorableCipher)) -remoteCipher' c = go $ extractCipher c +remoteCipher c = go $ extractCipher c where go Nothing = return Nothing go (Just encipher) = do cache <- Annex.getState Annex.ciphers case M.lookup encipher cache of - Just cipher -> return $ Just (cipher, encipher) + Just cipher -> return $ Just cipher Nothing -> do showNote "gpg" cipher <- liftIO $ decryptCipher encipher Annex.changeState (\s -> s { Annex.ciphers = M.insert encipher cipher cache }) - return $ Just (cipher, encipher) + return $ Just cipher {- Checks if the remote's config allows storing creds in the remote's config. - diff --git a/debian/changelog b/debian/changelog index d0bff041d3..91b2c8986d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ git-annex (5.20140916) UNRELEASED; urgency=medium (Bug introduced in version 5.20140817.) * add: In direct mode, adding an annex symlink will check it into git, as was already done in indirect mode. + * Fix reversion in handling creds with encryption=shared embedcreds=yes + introduced in 5.20140817. -- Joey Hess Mon, 15 Sep 2014 14:39:17 -0400 diff --git a/doc/bugs/box.com.mdwn b/doc/bugs/box.com.mdwn index 7f3bcf58fa..6f431b2750 100644 --- a/doc/bugs/box.com.mdwn +++ b/doc/bugs/box.com.mdwn @@ -31,3 +31,5 @@ Mac OS X 10.9.4 # End of transcript or log. """]] + +> [[fixed|done]] --[[Joey]]