Banner printing

--HG--
extra : convert_revision : a38558944355bb9b4c8e9e22147c1f2d8d327775
This commit is contained in:
Matt Johnston
2004-08-02 04:25:05 +00:00
parent 0a60e4536d
commit 9c91ea1caf
5 changed files with 67 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ static const packettype cli_packettypes[] = {
{SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure},
{SSH_MSG_USERAUTH_FAILURE, recv_msg_userauth_failure}, // client
{SSH_MSG_USERAUTH_SUCCESS, recv_msg_userauth_success}, // client
{SSH_MSG_USERAUTH_BANNER, recv_msg_userauth_banner}, // client
{0, 0} /* End */
};
@@ -217,3 +218,24 @@ static void cli_remoteclosed() {
ses.sock = -1;
dropbear_exit("remote closed the connection");
}
/* Operates in-place turning dirty (untrusted potentially containing control
* characters) text into clean text. */
void cleantext(unsigned char* dirtytext) {
unsigned int i, j;
unsigned char c, lastchar;
j = 0;
for (i = 0; dirtytext[i] != '\0'; i++) {
c = dirtytext[i];
/* We can ignore '\r's */
if ( (c >= ' ' && c <= '~') || c == '\n' || c == '\t') {
dirtytext[j] = c;
j++;
}
}
/* Null terminate */
dirtytext[j] = '\0';
}