changeset 1664:871484eac157

merge
author Matt Johnston <matt@ucc.asn.au>
date Sat, 14 Mar 2020 23:33:30 +0800
parents c795520269f9 (current diff) 8a7d26e86a56 (diff)
children 7c17995bcdfb
files
diffstat 3 files changed, 5 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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 {
--- 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 == '\\');
--- 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) {