Set SSH_ORIGINAL_COMMAND for "dropbear -c" too, fix build without

DROPBEAR_SVR_PUBKEY_OPTIONS
This commit is contained in:
Matt Johnston 2020-03-14 23:28:18 +08:00
parent cc6fa57a41
commit e35d0784a8
2 changed files with 4 additions and 10 deletions

View File

@ -41,6 +41,9 @@ struct ChanSess {
char * cmd; /* command to exec */
pid_t pid; /* child process pid */
/* command that was sent by the client, if authorized_keys command= or
dropbear -c was used */
char *original_command;
/* pty details */
int master; /* the master terminal fd*/
@ -72,10 +75,6 @@ struct ChanSess {
char * agentfile;
char * agentdir;
#endif
#if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT
char *original_command;
#endif
};
struct ChildPid {

View File

@ -322,10 +322,7 @@ static void cleanupchansess(const struct Channel *channel) {
m_free(chansess->cmd);
m_free(chansess->term);
#if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT
m_free(chansess->original_command);
#endif
if (chansess->tty) {
/* write the utmp/wtmp login record */
@ -833,7 +830,7 @@ static int ptycommand(struct Channel *channel, struct ChanSess *chansess) {
(dup2(chansess->slave, STDOUT_FILENO) < 0)) {
TRACE(("leave ptycommand: error redirecting filedesc"))
return DROPBEAR_FAILURE;
}
}
close(chansess->slave);
@ -997,11 +994,9 @@ static void execchild(const void *user_data) {
addnewvar("SSH_CLIENT", chansess->client_string);
}
#if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT
if (chansess->original_command) {
addnewvar("SSH_ORIGINAL_COMMAND", chansess->original_command);
}
#endif
/* change directory */
if (chdir(ses.authstate.pw_dir) < 0) {