# HG changeset patch # User Matt Johnston # Date 1584200010 -28800 # Node ID 871484eac157718776698e836f6687ba6883de6b # Parent c795520269f975c2fa62faf78c247c9314a4c35d# Parent 8a7d26e86a5601742b99c837c14ddac448cfb631 merge diff -r c795520269f9 -r 871484eac157 chansession.h --- a/chansession.h Sat Mar 14 14:37:35 2020 +0000 +++ b/chansession.h Sat Mar 14 23:33:30 2020 +0800 @@ -41,6 +41,9 @@ 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 @@ char * agentfile; char * agentdir; #endif - -#if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT - char *original_command; -#endif }; struct ChildPid { diff -r c795520269f9 -r 871484eac157 svr-authpubkeyoptions.c --- a/svr-authpubkeyoptions.c Sat Mar 14 14:37:35 2020 +0000 +++ b/svr-authpubkeyoptions.c Sat Mar 14 23:33:30 2020 +0800 @@ -92,6 +92,7 @@ * by any 'command' public key option. */ void svr_pubkey_set_forced_command(struct ChanSess *chansess) { if (ses.authstate.pubkey_options && ses.authstate.pubkey_options->forced_command) { + TRACE(("Forced command '%s'", ses.authstate.pubkey_options->forced_command)) if (chansess->cmd) { /* original_command takes ownership */ chansess->original_command = chansess->cmd; @@ -182,8 +183,6 @@ memcpy(ses.authstate.pubkey_options->forced_command, command_start, command_len-1); ses.authstate.pubkey_options->forced_command[command_len-1] = '\0'; - dropbear_log(LOG_WARNING, "Forced command '%s'", - ses.authstate.pubkey_options->forced_command); goto next_option; } escaped = (!escaped && c == '\\'); diff -r c795520269f9 -r 871484eac157 svr-chansession.c --- a/svr-chansession.c Sat Mar 14 14:37:35 2020 +0000 +++ b/svr-chansession.c Sat Mar 14 23:33:30 2020 +0800 @@ -322,10 +322,7 @@ 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 @@ (dup2(chansess->slave, STDOUT_FILENO) < 0)) { TRACE(("leave ptycommand: error redirecting filedesc")) return DROPBEAR_FAILURE; - } + } close(chansess->slave); @@ -997,11 +994,9 @@ 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) {