Mercurial > dropbear
comparison svr-chansession.c @ 1662:8a7d26e86a56
Set SSH_ORIGINAL_COMMAND for "dropbear -c" too, fix build without
DROPBEAR_SVR_PUBKEY_OPTIONS
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 14 Mar 2020 23:28:18 +0800 |
parents | 592a18dac250 |
children | 4f13df974cf4 |
comparison
equal
deleted
inserted
replaced
1661:6a6a0bac52f4 | 1662:8a7d26e86a56 |
---|---|
320 return; | 320 return; |
321 } | 321 } |
322 | 322 |
323 m_free(chansess->cmd); | 323 m_free(chansess->cmd); |
324 m_free(chansess->term); | 324 m_free(chansess->term); |
325 | |
326 #if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT | |
327 m_free(chansess->original_command); | 325 m_free(chansess->original_command); |
328 #endif | |
329 | 326 |
330 if (chansess->tty) { | 327 if (chansess->tty) { |
331 /* write the utmp/wtmp login record */ | 328 /* write the utmp/wtmp login record */ |
332 li = chansess_login_alloc(chansess); | 329 li = chansess_login_alloc(chansess); |
333 login_logout(li); | 330 login_logout(li); |
831 if ((dup2(chansess->slave, STDIN_FILENO) < 0) || | 828 if ((dup2(chansess->slave, STDIN_FILENO) < 0) || |
832 (dup2(chansess->slave, STDERR_FILENO) < 0) || | 829 (dup2(chansess->slave, STDERR_FILENO) < 0) || |
833 (dup2(chansess->slave, STDOUT_FILENO) < 0)) { | 830 (dup2(chansess->slave, STDOUT_FILENO) < 0)) { |
834 TRACE(("leave ptycommand: error redirecting filedesc")) | 831 TRACE(("leave ptycommand: error redirecting filedesc")) |
835 return DROPBEAR_FAILURE; | 832 return DROPBEAR_FAILURE; |
836 } | 833 } |
837 | 834 |
838 close(chansess->slave); | 835 close(chansess->slave); |
839 | 836 |
840 /* write the utmp/wtmp login record - must be after changing the | 837 /* write the utmp/wtmp login record - must be after changing the |
841 * terminal used for stdout with the dup2 above */ | 838 * terminal used for stdout with the dup2 above */ |
995 | 992 |
996 if (chansess->client_string) { | 993 if (chansess->client_string) { |
997 addnewvar("SSH_CLIENT", chansess->client_string); | 994 addnewvar("SSH_CLIENT", chansess->client_string); |
998 } | 995 } |
999 | 996 |
1000 #if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT | |
1001 if (chansess->original_command) { | 997 if (chansess->original_command) { |
1002 addnewvar("SSH_ORIGINAL_COMMAND", chansess->original_command); | 998 addnewvar("SSH_ORIGINAL_COMMAND", chansess->original_command); |
1003 } | 999 } |
1004 #endif | |
1005 | 1000 |
1006 /* change directory */ | 1001 /* change directory */ |
1007 if (chdir(ses.authstate.pw_dir) < 0) { | 1002 if (chdir(ses.authstate.pw_dir) < 0) { |
1008 dropbear_exit("Error changing directory"); | 1003 dropbear_exit("Error changing directory"); |
1009 } | 1004 } |