mirror of
https://github.com/clearml/dropbear
synced 2025-06-26 18:17:32 +00:00
Banner printing
--HG-- extra : convert_revision : a38558944355bb9b4c8e9e22147c1f2d8d327775
This commit is contained in:
@@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user