=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/session.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- src/usr.bin/ssh/session.c 2000/09/04 19:03:40 1.33 +++ src/usr.bin/ssh/session.c 2000/09/04 19:06:03 1.34 @@ -8,7 +8,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: session.c,v 1.33 2000/09/04 19:03:40 markus Exp $"); +RCSID("$OpenBSD: session.c,v 1.34 2000/09/04 19:06:03 markus Exp $"); #include "xmalloc.h" #include "ssh.h" @@ -84,6 +84,9 @@ /* Local Xauthority file. */ static char *xauthfile; +/* original command from peer. */ +char *original_command = NULL; + /* data */ #define MAX_SESSIONS 10 Session sessions[MAX_SESSIONS]; @@ -346,6 +349,7 @@ packet_integrity_check(plen, 0, type); } if (forced_command != NULL) { + original_command = command; command = forced_command; debug("Forced command '%.500s'", forced_command); } @@ -888,6 +892,9 @@ child_set_env(&env, &envsize, "TERM", term); if (display) child_set_env(&env, &envsize, "DISPLAY", display); + if (original_command) + child_set_env(&env, &envsize, "SSH_ORIGINAL_COMMAND", + original_command); #ifdef KRB4 { @@ -1365,7 +1372,7 @@ char *command = packet_get_string(&len); packet_done(); if (forced_command) { - xfree(command); + original_command = command; command = forced_command; debug("Forced command '%.500s'", forced_command); }