diff 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
line wrap: on
line diff
--- a/cli-session.c	Sun Aug 01 11:02:44 2004 +0000
+++ b/cli-session.c	Mon Aug 02 04:25:05 2004 +0000
@@ -36,6 +36,7 @@
 	{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 @@
 	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';
+}