summaryrefslogtreecommitdiffhomepage
path: root/cli-session.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli-session.c')
-rw-r--r--cli-session.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/cli-session.c b/cli-session.c
index 6882d2e..e8c6ae6 100644
--- a/cli-session.c
+++ b/cli-session.c
@@ -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';
+}