sftp client

Roumen Petrov roumen.petrov at skalasoft.com
Thu Feb 8 21:40:18 EST 2001


1.)
test.c:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <stdlib.h>

#define MAX_ARR	5
char *argv[MAX_ARR];
char *env[MAX_ARR];

main ()
{
      char **p;

      argv[0] = "bash";
      argv[1] = "-c";
      argv[2] = "ls ~/.bashrc";
      argv[3] = 0;

      env[0] = "SSH_CLIENT=";
      env[1] = 0;

      for ( p = env; *p; p++ )	printf ( "env:%s\n", *p );
      printf ( "-----------------------------\n" );
      execve("/bin/bash", argv, env);

    return 1;
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

2.)
Ben what is result result from this program, if $HOME/.bashrc has line 
with echo ?
Example for ~/.bashrc:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo "Executing $HOME/.bashrc ..."
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

3.)
My result is:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
env:SSH2_CLIENT=
-----------------------------
Executing /.bashrc ...
/root/.bashrc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

4.)
And result from 'sftp localhost' is:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Connecting to localhost...
......
Received message too long 1165518179
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

5.)
info: 1165518179 = 0x45786563 = "Exec" !!!!


Damien Miller wrote:

 > On Wed, 7 Feb 2001, Roumen Petrov wrote:
 >
 >
 >> Q: Has bash '--norc' option for other/all platforms ?
 >> If this is true attached file is my patch.
 >>
 >> Strange is that only first four bytes form $HOME/.bashrc are send to
 >> client !?!?
 >
 >
 > No - we need to source the shell rc files so we pick up the user's
 > default umask, etc.
 >
 > Please review you shell rc file - no-one else has reported problems
 > using bash as a shell and I have tested it pretty thoroughly. The only
 > time we have found problems is when people have shell init scripts
 > which generate output for non-interactive sessions.
 >
 > -d







More information about the openssh-unix-dev mailing list