From 57a747d0819d587d8f7fb301c3c6c589c80c556f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 8 Feb 2012 11:41:15 -0400 Subject: [PATCH] S3: Fix irrefutable pattern failure when accessing encrypted S3 credentials. --- Remote/S3.hs | 9 ++++++--- debian/changelog | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Remote/S3.hs b/Remote/S3.hs index 2ef96dbdaf..c9527ba67a 100644 --- a/Remote/S3.hs +++ b/Remote/S3.hs @@ -289,12 +289,15 @@ s3GetCreds c = maybe fromconfig (return . Just) =<< liftIO getenv liftIO $ decrypt s3creds cipher _ -> return Nothing decrypt s3creds cipher = do - [ak, sk, _rest] <- lines <$> + creds <- lines <$> withDecryptedContent cipher (return $ L.pack $ fromB64 s3creds) (return . L.unpack) - setenv (ak, sk) - return $ Just (ak, sk) + case creds of + [ak, sk] -> do + setenv (ak, sk) + return $ Just (ak, sk) + _ -> do error "bad s3creds" {- Stores S3 creds encrypted in the remote's config if possible. -} s3SetCreds :: RemoteConfig -> Annex RemoteConfig diff --git a/debian/changelog b/debian/changelog index 7165092a65..ad7121da24 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ git-annex (3.20120124) UNRELEASED; urgency=low a remote's location log. * Modifications to support ghc 7.4's handling of filenames. This version can only be built with ghc 7.4 or newer. + * S3: Fix irrefutable pattern failure when accessing encrypted S3 + credentials. -- Joey Hess Tue, 24 Jan 2012 16:21:55 -0400