diff svr-chansession.c @ 657:16af1decaf4c

- Merge
author Matt Johnston <matt@ucc.asn.au>
date Tue, 21 Feb 2012 23:00:30 +0800
parents 67fbba2c2a85 818108bf7749
children d4d0279710b9
line wrap: on
line diff
--- a/svr-chansession.c	Tue Feb 21 22:57:19 2012 +0800
+++ b/svr-chansession.c	Tue Feb 21 23:00:30 2012 +0800
@@ -218,6 +218,8 @@
 
 	struct ChanSess *chansess;
 
+	TRACE(("new chansess %p", channel))
+
 	dropbear_assert(channel->typedata == NULL);
 
 	chansess = (struct ChanSess*)m_malloc(sizeof(struct ChanSess));
@@ -280,6 +282,10 @@
 	m_free(chansess->cmd);
 	m_free(chansess->term);
 
+#ifdef ENABLE_SVR_PUBKEY_OPTIONS
+	m_free(chansess->original_command);
+#endif
+
 	if (chansess->tty) {
 		/* write the utmp/wtmp login record */
 		li = chansess_login_alloc(chansess);
@@ -925,10 +931,8 @@
 	}
 	
 #ifdef ENABLE_SVR_PUBKEY_OPTIONS
-	if (ses.authstate.pubkey_options &&
-			ses.authstate.pubkey_options->original_command) {
-		addnewvar("SSH_ORIGINAL_COMMAND", 
-			ses.authstate.pubkey_options->original_command);
+	if (chansess->original_command) {
+		addnewvar("SSH_ORIGINAL_COMMAND", chansess->original_command);
 	}
 #endif