comparison 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
comparison
equal deleted inserted replaced
656:67fbba2c2a85 657:16af1decaf4c
216 /* set up a session channel */ 216 /* set up a session channel */
217 static int newchansess(struct Channel *channel) { 217 static int newchansess(struct Channel *channel) {
218 218
219 struct ChanSess *chansess; 219 struct ChanSess *chansess;
220 220
221 TRACE(("new chansess %p", channel))
222
221 dropbear_assert(channel->typedata == NULL); 223 dropbear_assert(channel->typedata == NULL);
222 224
223 chansess = (struct ChanSess*)m_malloc(sizeof(struct ChanSess)); 225 chansess = (struct ChanSess*)m_malloc(sizeof(struct ChanSess));
224 chansess->cmd = NULL; 226 chansess->cmd = NULL;
225 chansess->connection_string = NULL; 227 chansess->connection_string = NULL;
277 279
278 send_exitsignalstatus(channel); 280 send_exitsignalstatus(channel);
279 281
280 m_free(chansess->cmd); 282 m_free(chansess->cmd);
281 m_free(chansess->term); 283 m_free(chansess->term);
284
285 #ifdef ENABLE_SVR_PUBKEY_OPTIONS
286 m_free(chansess->original_command);
287 #endif
282 288
283 if (chansess->tty) { 289 if (chansess->tty) {
284 /* write the utmp/wtmp login record */ 290 /* write the utmp/wtmp login record */
285 li = chansess_login_alloc(chansess); 291 li = chansess_login_alloc(chansess);
286 login_logout(li); 292 login_logout(li);
923 if (chansess->connection_string) { 929 if (chansess->connection_string) {
924 addnewvar("SSH_CONNECTION", chansess->connection_string); 930 addnewvar("SSH_CONNECTION", chansess->connection_string);
925 } 931 }
926 932
927 #ifdef ENABLE_SVR_PUBKEY_OPTIONS 933 #ifdef ENABLE_SVR_PUBKEY_OPTIONS
928 if (ses.authstate.pubkey_options && 934 if (chansess->original_command) {
929 ses.authstate.pubkey_options->original_command) { 935 addnewvar("SSH_ORIGINAL_COMMAND", chansess->original_command);
930 addnewvar("SSH_ORIGINAL_COMMAND",
931 ses.authstate.pubkey_options->original_command);
932 } 936 }
933 #endif 937 #endif
934 938
935 /* change directory */ 939 /* change directory */
936 if (chdir(ses.authstate.pw_dir) < 0) { 940 if (chdir(ses.authstate.pw_dir) < 0) {