Windows: Avoid eating stdin when running ssh to add a authorized key, since this is used for password prompting.

This commit is contained in:
Joey Hess 2014-01-01 15:49:51 -04:00
parent 2c27b1397b
commit fab7adb161
2 changed files with 7 additions and 5 deletions

View file

@ -278,9 +278,9 @@ testServer sshinput@(SshInput { inputHostname = Just hn }) = do
{- Runs a ssh command; if it fails shows the user the transcript, {- Runs a ssh command; if it fails shows the user the transcript,
- and if it succeeds, runs an action. -} - and if it succeeds, runs an action. -}
sshSetup :: [String] -> String -> Handler Html -> Handler Html sshSetup :: [String] -> Maybe String -> Handler Html -> Handler Html
sshSetup opts input a = do sshSetup opts input a = do
(transcript, ok) <- liftIO $ sshTranscript opts (Just input) (transcript, ok) <- liftIO $ sshTranscript opts input
if ok if ok
then a then a
else showSshErr transcript else showSshErr transcript
@ -383,7 +383,7 @@ prepSsh' newgcrypt origsshdata sshdata keypair a = sshSetup
[ "-p", show (sshPort origsshdata) [ "-p", show (sshPort origsshdata)
, genSshHost (sshHostName origsshdata) (sshUserName origsshdata) , genSshHost (sshHostName origsshdata) (sshUserName origsshdata)
, remoteCommand , remoteCommand
] "" (a sshdata) ] Nothing (a sshdata)
where where
remotedir = T.unpack $ sshDirectory sshdata remotedir = T.unpack $ sshDirectory sshdata
remoteCommand = shellWrap $ intercalate "&&" $ catMaybes remoteCommand = shellWrap $ intercalate "&&" $ catMaybes
@ -450,7 +450,7 @@ getMakeRsyncNetGCryptR :: SshData -> RepoKey -> Handler Html
getMakeRsyncNetGCryptR sshdata NoRepoKey = whenGcryptInstalled $ getMakeRsyncNetGCryptR sshdata NoRepoKey = whenGcryptInstalled $
withNewSecretKey $ getMakeRsyncNetGCryptR sshdata . RepoKey withNewSecretKey $ getMakeRsyncNetGCryptR sshdata . RepoKey
getMakeRsyncNetGCryptR sshdata (RepoKey keyid) = whenGcryptInstalled $ getMakeRsyncNetGCryptR sshdata (RepoKey keyid) = whenGcryptInstalled $
sshSetup [sshhost, gitinit] [] $ makeGCryptRepo keyid sshdata sshSetup [sshhost, gitinit] Nothing $ makeGCryptRepo keyid sshdata
where where
sshhost = genSshHost (sshHostName sshdata) (sshUserName sshdata) sshhost = genSshHost (sshHostName sshdata) (sshUserName sshdata)
gitinit = "git init --bare " ++ T.unpack (sshDirectory sshdata) gitinit = "git init --bare " ++ T.unpack (sshDirectory sshdata)
@ -498,7 +498,7 @@ prepRsyncNet sshinput reponame a = do
, genSshHost (sshHostName sshdata) (sshUserName sshdata) , genSshHost (sshHostName sshdata) (sshUserName sshdata)
, remotecommand , remotecommand
] ]
sshSetup sshopts (sshPubKey keypair) $ a sshdata sshSetup sshopts (Just $ sshPubKey keypair) $ a sshdata
isRsyncNet :: Maybe Text -> Bool isRsyncNet :: Maybe Text -> Bool
isRsyncNet Nothing = False isRsyncNet Nothing = False

2
debian/changelog vendored
View file

@ -3,6 +3,8 @@ git-annex (5.20131231) UNRELEASED; urgency=medium
* external special remote protocol: Added GETUUID. * external special remote protocol: Added GETUUID.
* Windows: Fix bug in direct mode merge code that could cause files * Windows: Fix bug in direct mode merge code that could cause files
in subdirectories to go missing. in subdirectories to go missing.
* Windows: Avoid eating stdin when running ssh to add a authorized key,
since this is used for password prompting.
-- Joey Hess <joeyh@debian.org> Tue, 31 Dec 2013 13:41:18 -0400 -- Joey Hess <joeyh@debian.org> Tue, 31 Dec 2013 13:41:18 -0400