comparison cli-session.c @ 43:942b22d7dd1c

Banner printing
author Matt Johnston <matt@ucc.asn.au>
date Mon, 02 Aug 2004 04:25:05 +0000
parents 18eccbfb9641
children 9ee8996a375f
comparison
equal deleted inserted replaced
42:837f9172df09 43:942b22d7dd1c
34 {SSH_MSG_CHANNEL_CLOSE, recv_msg_channel_close}, 34 {SSH_MSG_CHANNEL_CLOSE, recv_msg_channel_close},
35 {SSH_MSG_CHANNEL_OPEN_CONFIRMATION, recv_msg_channel_open_confirmation}, 35 {SSH_MSG_CHANNEL_OPEN_CONFIRMATION, recv_msg_channel_open_confirmation},
36 {SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure}, 36 {SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure},
37 {SSH_MSG_USERAUTH_FAILURE, recv_msg_userauth_failure}, // client 37 {SSH_MSG_USERAUTH_FAILURE, recv_msg_userauth_failure}, // client
38 {SSH_MSG_USERAUTH_SUCCESS, recv_msg_userauth_success}, // client 38 {SSH_MSG_USERAUTH_SUCCESS, recv_msg_userauth_success}, // client
39 {SSH_MSG_USERAUTH_BANNER, recv_msg_userauth_banner}, // client
39 {0, 0} /* End */ 40 {0, 0} /* End */
40 }; 41 };
41 42
42 static const struct ChanType *cli_chantypes[] = { 43 static const struct ChanType *cli_chantypes[] = {
43 /* &chan_tcpdirect etc, though need to only allow if we've requested 44 /* &chan_tcpdirect etc, though need to only allow if we've requested
215 * already sent/received disconnect message(s) ??? */ 216 * already sent/received disconnect message(s) ??? */
216 close(ses.sock); 217 close(ses.sock);
217 ses.sock = -1; 218 ses.sock = -1;
218 dropbear_exit("remote closed the connection"); 219 dropbear_exit("remote closed the connection");
219 } 220 }
221
222 /* Operates in-place turning dirty (untrusted potentially containing control
223 * characters) text into clean text. */
224 void cleantext(unsigned char* dirtytext) {
225
226 unsigned int i, j;
227 unsigned char c, lastchar;
228
229 j = 0;
230 for (i = 0; dirtytext[i] != '\0'; i++) {
231
232 c = dirtytext[i];
233 /* We can ignore '\r's */
234 if ( (c >= ' ' && c <= '~') || c == '\n' || c == '\t') {
235 dirtytext[j] = c;
236 j++;
237 }
238 }
239 /* Null terminate */
240 dirtytext[j] = '\0';
241 }