Mercurial > dropbear
comparison cli-session.c @ 478:d4f32c3443ac dbclient-netcat-alike
propagate from branch 'au.asn.ucc.matt.dropbear' (head f21045c791002d81fc6b8dde6537ea481e513eb2)
to branch 'au.asn.ucc.matt.dropbear.dbclient-netcat-alike' (head d1f69334581dc4c35f9ca16aa5355074c9dd315d)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 14 Sep 2008 06:47:51 +0000 |
parents | 6b41e2cbf071 c216212001fc |
children | 12d845ab7b5f |
comparison
equal
deleted
inserted
replaced
296:6b41e2cbf071 | 478:d4f32c3443ac |
---|---|
210 cli_ses.state = SESSION_RUNNING; | 210 cli_ses.state = SESSION_RUNNING; |
211 return; | 211 return; |
212 */ | 212 */ |
213 | 213 |
214 case USERAUTH_SUCCESS_RCVD: | 214 case USERAUTH_SUCCESS_RCVD: |
215 | |
216 if (cli_opts.backgrounded) { | |
217 int devnull; | |
218 /* keeping stdin open steals input from the terminal and | |
219 is confusing, though stdout/stderr could be useful. */ | |
220 devnull = open(_PATH_DEVNULL, O_RDONLY); | |
221 if (devnull < 0) { | |
222 dropbear_exit("opening /dev/null: %d %s", | |
223 errno, strerror(errno)); | |
224 } | |
225 dup2(devnull, STDIN_FILENO); | |
226 if (daemon(0, 1) < 0) { | |
227 dropbear_exit("Backgrounding failed: %d %s", | |
228 errno, strerror(errno)); | |
229 } | |
230 } | |
231 | |
215 #ifdef ENABLE_CLI_LOCALTCPFWD | 232 #ifdef ENABLE_CLI_LOCALTCPFWD |
216 //setup_localtcp(); | 233 //setup_localtcp(); |
217 #endif | 234 #endif |
218 #ifdef ENABLE_CLI_REMOTETCPFWD | 235 #ifdef ENABLE_CLI_REMOTETCPFWD |
219 //setup_remotetcp(); | 236 //setup_remotetcp(); |
220 #endif | 237 #endif |
221 cli_send_chansess_request(); | 238 if (!cli_opts.no_cmd) { |
222 TRACE(("leave cli_sessionloop: cli_send_chansess_request")) | 239 cli_send_chansess_request(); |
240 } | |
241 TRACE(("leave cli_sessionloop: running")) | |
223 cli_ses.state = SESSION_RUNNING; | 242 cli_ses.state = SESSION_RUNNING; |
224 return; | 243 return; |
225 | 244 |
226 case SESSION_RUNNING: | 245 case SESSION_RUNNING: |
227 if (ses.chancount < 1) { | 246 if (ses.chancount < 1 && !cli_opts.no_cmd) { |
228 cli_finished(); | 247 cli_finished(); |
229 } | 248 } |
230 | 249 |
231 if (cli_ses.winchange) { | 250 if (cli_ses.winchange) { |
232 cli_chansess_winchange(); | 251 cli_chansess_winchange(); |