scp not tolerant of extraneous shell messages

Nicolas Williams Nicolas.Williams at ubsw.com
Wed Jul 3 06:28:44 EST 2002


On Tue, Jul 02, 2002 at 08:13:57PM +0000, Bryan Henderson wrote:
> I haven't used sftp, but I see the same thing Dan does in the code:
> when you use a subsystem such as sftp, there's no shell.  I note that it
> is possible to use sftp without a subsystem, though, by specifying the
> sftp server program on the sftp command, and in that case the server
> program runs under a shell just like scp.  

See session.c:session_subsystem_req(), which calls session.c:do_exec(),
which calls session.c:do_exec_no_pty() which calls session.c:do_child(),
which, at the very end does this if the session is non-interactive (or,
rather, if the variable "command" has a non-null value):

        argv[0] = (char *) cp;
        argv[1] = "-c";
        argv[2] = (char *) command;
        argv[3] = NULL;
        execve(shell, argv, env);
        perror(shell);
        exit(1);

So sub-system servers are executed via a shell - the user's shell.

Cheers,

Nico
-- 
-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.




More information about the openssh-unix-dev mailing list