Bug 100815

Summary: sftp ioslave doesn't work with new "slave connections" in openssh 3.9
Product: [Frameworks and Libraries] kio Reporter: Robin Green <greenrd>
Component: sftpAssignee: Dawit Alemayehu <adawit>
Status: RESOLVED FIXED    
Severity: normal CC: asn, darius, gokdenizk, rnjn.sinha
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Work around for OpenSSH bug with ControlMaster

Description Robin Green 2005-03-04 15:25:07 UTC
Version:            (using KDE KDE 3.3.1)
Installed from:    RedHat RPMs

In openssh 3.9 there is a new facility to share connections, which confuses the sftp ioslave.

To share a connection, and avoid authenticating to the server multiple times, you just put in your config file:

Host host
 ControlPath /some/path

Then you designate your first connection as a "master" by logging in with

ssh -M host

After that, all other connections will go transparently through the master connection, without needing to authenticate.

This confuses the sftp ioslave, which returns a connection failed error. I think it is because it is waiting for an "authentication success" message - which, of course, never comes, because no authentication is needed.

My suggestion to fix this problem would be to do the reverse - instead of waiting for authentication _success_ messages, just send data straight away, and look for authentication _failed_ error messages for error detection purposes.
Comment 1 Robin Green 2005-03-04 15:31:13 UTC
Workaround is just to use fish: instead of sftp:
Comment 2 Dawit Alemayehu 2005-08-05 10:27:26 UTC
This is actually an sftp bug. The -s option with ssh does not work with the slave connections in openssh 3.9. You can try this yourself by issuing 

ssh -s sftp

on the command line after you establish the master connection...
Comment 3 Dawit Alemayehu 2005-08-05 10:29:22 UTC
Meant to day "a ssh client bug" instead of "an sftp bug" in the previous message...
Comment 4 Robin Green 2005-08-05 14:05:14 UTC
I issued

ssh -s sftp myhost

at the command line after bringing up the master connection, and it just outputs nothing (presumably it is waiting for you to type something).

But I issued the same command

ssh -s sftp localhost

and the same thing happened.

So how do I verify for myself that the ssh -s option is not working with a master/slave setup?
Comment 5 Dawit Alemayehu 2005-08-06 00:53:34 UTC
On Friday 05 August 2005 08:05, Robin Green wrote:
> ssh -s sftp myhost
>
> at the command line after bringing up the master connection, and it just
> outputs nothing (presumably it is waiting for you to type something).
>
> But I issued the same command
>
> ssh -s sftp localhost
>
> and the same thing happened.
>
> So how do I verify for myself that the ssh -s option is not working with a
> master/slave setup?


Simple compare the debug output of the command below when there is a master 
connection setup and when there isn't one:

ssh -vvv localhost -s sftp
Comment 6 Robin Green 2005-08-06 02:11:47 UTC
OK - I think I see what you mean. There is no subsystem call. I'll file a bug with openssh, but I'm not sure if it is fixable without a protocol change.
Comment 7 Alexandre Nunes 2007-11-05 15:29:32 UTC
An ugly workaround would it be to pass -o ControlMaster=no in ssh invocation. This crap is still bugged even today (in march 2008 this bug will have a 3 year birthday).
Comment 8 Dawit Alemayehu 2009-03-08 08:10:18 UTC
*** Bug 152866 has been marked as a duplicate of this bug. ***
Comment 9 Dawit Alemayehu 2009-03-08 08:29:33 UTC
*** Bug 179686 has been marked as a duplicate of this bug. ***
Comment 10 Dawit Alemayehu 2009-04-21 22:40:16 UTC
*** Bug 188227 has been marked as a duplicate of this bug. ***
Comment 11 Daniel O'Connor 2009-07-01 09:56:39 UTC
Created attachment 34959 [details]
Work around for OpenSSH bug with ControlMaster
Comment 12 Daniel O'Connor 2009-07-01 09:58:33 UTC
The patch I posted works for me (the lines might not be 100% I made the diff a dumb way).

I did tried -o ControlMaster=no but it did not work, I am not sure why..

FWIW I think this is a general failing with ControlMaster - stuff like -L and -R do not work with it either.
Comment 13 Andreas Schneider 2009-09-08 11:11:58 UTC
kio_sftp has been rewritten using libssh. This bug couldn't happen anymore as libssh creates a new connection for every sftp session. This will be released with KDE 4.4.0.