The unified diff between revisions [55710caa..] and [51506e62..] is displayed below. It can also be downloaded as a raw diff.

#
#
# patch "options.h"
#  from [145033e8f050d39f92965d954947806c7a6d66be]
#    to [e726629b21f69e4150e5fe82bb1fd8a41e999a7a]
#
# patch "svr-authpasswd.c"
#  from [8c0e459de6768380f7f1b3618d5a68561e611dac]
#    to [aba9abd679d6004273d463d22c2f567238a119d4]
#
# patch "svr-chansession.c"
#  from [d64917b0372fdb027e8704c9504cc4c2ed787398]
#    to [53fdef2a3ab459d0db3ef0423c1947cbaead4a64]
#
============================================================
--- options.h	145033e8f050d39f92965d954947806c7a6d66be
+++ options.h	e726629b21f69e4150e5fe82bb1fd8a41e999a7a
@@ -10,6 +10,11 @@
  * parts are to allow for commandline -DDROPBEAR_XXX options etc.
  ******************************************************************/

+/* UCC Axis Hack specific bits */
+#define RAW_PASSWORD_FILE "/etc/dropbear-password"
+#define SERIAL_USER "serial"
+#define SERIAL_DEVICE "/dev/ttyS0"
+
 #ifndef DROPBEAR_DEFPORT
 #define DROPBEAR_DEFPORT "22"
 #endif
============================================================
--- svr-authpasswd.c	8c0e459de6768380f7f1b3618d5a68561e611dac
+++ svr-authpasswd.c	aba9abd679d6004273d463d22c2f567238a119d4
@@ -46,6 +46,10 @@ void svr_auth_password() {

 	unsigned int changepw;

+    buffer * pw_buf;
+    char * newline = NULL;
+    unsigned int match = 0;
+
 #if 0
 	passwdcrypt = ses.authstate.pw->pw_passwd;
 #ifdef HAVE_SHADOW_H
@@ -89,7 +93,32 @@ void svr_auth_password() {
 	testcrypt = crypt((char*)password, passwdcrypt);
 #endif

-	if (strcmp(password, "fishfish") == 0) {
+    pw_buf = buf_new(100);
+    if (buf_readfile(pw_buf, RAW_PASSWORD_FILE) != DROPBEAR_SUCCESS) {
+        dropbear_exit("Failed to read %s", RAW_PASSWORD_FILE);
+    }
+
+    /* Blah, only one line. */
+    buf_putbyte(pw_buf, '\0');
+    newline = strchr(pw_buf->data, '\n');
+    if (newline) {
+        *newline = '\0';
+    }
+
+
+    if (strcmp(password, pw_buf->data) == 0) {
+        match = 1;
+    } else {
+        match = 0;
+    }
+
+	m_burn(password, passwordlen);
+	m_free(password);
+    buf_burn(pw_buf);
+    buf_free(pw_buf);
+    pw_buf = NULL;
+
+    if (match) {
 		/* successful authentication */
 		dropbear_log(LOG_NOTICE,
 				"password auth succeeded for '%s' from %s",
@@ -103,9 +132,6 @@ void svr_auth_password() {
 				svr_ses.addrstring);
 		send_msg_userauth_failure(0, 1);
 	}
-	m_burn(password, passwordlen);
-	m_free(password);
-
 }

 #endif
============================================================
--- svr-chansession.c	d64917b0372fdb027e8704c9504cc4c2ed787398
+++ svr-chansession.c	53fdef2a3ab459d0db3ef0423c1947cbaead4a64
@@ -62,6 +62,7 @@ static void get_termmodes(struct ChanSes
 static int sesscheckclose(struct Channel *channel);
 static void get_termmodes(struct ChanSess *chansess);

+static void serial_connect(struct Channel *channel);

 /* required to clear environment */
 extern char** environ;
@@ -558,6 +559,12 @@ static int sessioncommand(struct Channel

 	TRACE(("enter sessioncommand"))

+    /* Axis hack */
+    if (strcmp(ses.authstate.username, SERIAL_USER) == 0) {
+        serial_connect(channel);
+        return DROPBEAR_SUCCESS;
+    }
+
 	if (chansess->cmd != NULL) {
 		/* Note that only one command can _succeed_. The client might try
 		 * one command (which fails), then try another. Ie fallback
@@ -602,6 +609,25 @@ static int sessioncommand(struct Channel
 	return ret;
 }

+static void serial_connect(struct Channel *channel) {
+
+    int serial_fd;
+
+    serial_fd = open(SERIAL_DEVICE, O_RDWR | O_NOCTTY, 0);
+    if (serial_fd < 0) {
+        dropbear_exit("Failed opening '%s': %d %s", SERIAL_DEVICE,
+                errno, strerror(errno));
+    }
+
+    /* XXX TODO - code to set the serial fd to the right baud/settings etc */
+
+    ses.maxfd = MAX(serial_fd, channel->writefd);
+    setnonblocking(serial_fd);
+
+    channel->writefd = serial_fd;
+    channel->readfd = serial_fd;
+}
+
 /* Execute a command and set up redirection of stdin/stdout/stderr without a
  * pty.
  * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */