summaryrefslogtreecommitdiff
path: root/Creds.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-09-18 15:18:52 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-09-18 15:21:47 -0400
commitaf53f3d29bad3c41ac2c520dfca39885005dac48 (patch)
tree2a3544de0e7ed25566841282abda0cdd777beef3 /Creds.hs
parent79e6403390a52bfef1e8cc2fa971986888053e3a (diff)
Revert "S3, Glacier, WebDAV: Fix bug that prevented accessing the creds when the repository was configured with encryption=shared embedcreds=yes."
This reverts commit cc54ff9e49260cd94f938e69e926a273e231ef4e. I can find no basis for that commit and think that I made it in error. setRemoteCredPair always encrypts using the cipher from remoteCipher, even when the cipher is shared.
Diffstat (limited to 'Creds.hs')
-rw-r--r--Creds.hs16
1 files changed, 6 insertions, 10 deletions
diff --git a/Creds.hs b/Creds.hs
index 73d631ff7..7273ed966 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