comparison cli-session.c @ 219:654bc8327787

merge of 9522146cb07d4576f161fc4567c2c2fbd6f61fbb and b11630c15bc4d0649dba51c3572cac6f44e0ab0e
author Matt Johnston <matt@ucc.asn.au>
date Fri, 08 Jul 2005 13:28:03 +0000
parents aad4b3f58556
children ca7e76d981d9 efbaf6b03837
comparison
equal deleted inserted replaced
218:3ee0c2f85e1e 219:654bc8327787
111 cli_ses.kex_state = KEX_NOTHING; 111 cli_ses.kex_state = KEX_NOTHING;
112 112
113 cli_ses.tty_raw_mode = 0; 113 cli_ses.tty_raw_mode = 0;
114 cli_ses.winchange = 0; 114 cli_ses.winchange = 0;
115 115
116 /* We store stdin's flags, so we can set them back on exit (otherwise 116 /* We store std{in,out,err}'s flags, so we can set them back on exit
117 * busybox's ash isn't happy */ 117 * (otherwise busybox's ash isn't happy */
118 cli_ses.stdincopy = dup(STDIN_FILENO); 118 cli_ses.stdincopy = dup(STDIN_FILENO);
119 cli_ses.stdinflags = fcntl(STDIN_FILENO, F_GETFL, 0); 119 cli_ses.stdinflags = fcntl(STDIN_FILENO, F_GETFL, 0);
120 cli_ses.stdoutcopy = dup(STDOUT_FILENO);
121 cli_ses.stdoutflags = fcntl(STDOUT_FILENO, F_GETFL, 0);
122 cli_ses.stderrcopy = dup(STDERR_FILENO);
123 cli_ses.stderrflags = fcntl(STDERR_FILENO, F_GETFL, 0);
120 124
121 cli_ses.retval = EXIT_SUCCESS; /* Assume it's clean if we don't get a 125 cli_ses.retval = EXIT_SUCCESS; /* Assume it's clean if we don't get a
122 specific exit status */ 126 specific exit status */
123 127
124 /* Auth */ 128 /* Auth */
125 cli_ses.lastpubkey = NULL; 129 cli_ses.lastprivkey = NULL;
126 cli_ses.lastauthtype = 0; 130 cli_ses.lastauthtype = 0;
127 131
128 /* For printing "remote host closed" for the user */ 132 /* For printing "remote host closed" for the user */
129 ses.remoteclosed = cli_remoteclosed; 133 ses.remoteclosed = cli_remoteclosed;
130 ses.buf_match_algo = cli_buf_match_algo; 134 ses.buf_match_algo = cli_buf_match_algo;
248 252
249 if (!sessinitdone) { 253 if (!sessinitdone) {
250 return; 254 return;
251 } 255 }
252 256
253 /* Set stdin back to non-blocking - busybox ash dies nastily 257 /* Set std{in,out,err} back to non-blocking - busybox ash dies nastily if
254 * if we don't revert the flags */ 258 * we don't revert the flags */
255 fcntl(cli_ses.stdincopy, F_SETFL, cli_ses.stdinflags); 259 fcntl(cli_ses.stdincopy, F_SETFL, cli_ses.stdinflags);
260 fcntl(cli_ses.stdoutcopy, F_SETFL, cli_ses.stdoutflags);
261 fcntl(cli_ses.stderrcopy, F_SETFL, cli_ses.stderrflags);
256 262
257 cli_tty_cleanup(); 263 cli_tty_cleanup();
258 264
259 } 265 }
260 266