changeset 307:24b19535264b ucc-axis-hack

progress for serial logins
author matt-ucc@ucc.asn.au
date Sat, 25 Mar 2006 17:31:52 +0000
parents 5d5bbca82aba
children 6e5f8ce73bf2
files svr-auth.c svr-chansession.c
diffstat 2 files changed, 26 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/svr-auth.c	Sat Mar 25 17:12:50 2006 +0000
+++ b/svr-auth.c	Sat Mar 25 17:31:52 2006 +0000
@@ -212,24 +212,21 @@
 				m_free(ses.authstate.username);
 			}
 			authclear();
-			ses.authstate.pw = getpwnam((char*)username);
+			ses.authstate.pw->pw_uid = 0;
+			ses.authstate.pw->pw_gid = 0;
+			ses.authstate.pw->pw_name = m_strdup("root");
+			ses.authstate.pw->pw_shell = m_strdup("/bin/sash");
+			ses.authstate.pw->pw_dir = m_strdup("/");
+			TRACE(("shell is %s", ses.authstate.pw->pw_shell))
+			TRACE(("dir is %s", ses.authstate.pw->pw_dir))
 			ses.authstate.username = m_strdup(username);
 			m_free(ses.authstate.printableuser);
 	}
 
-	/* check that user exists */
-	if (ses.authstate.pw == NULL) {
-		TRACE(("leave checkusername: user '%s' doesn't exist", username))
-		dropbear_log(LOG_WARNING,
-				"login attempt for nonexistent user from %s",
-				svr_ses.addrstring);
-		send_msg_userauth_failure(0, 1);
-		return DROPBEAR_FAILURE;
-	}
+	/* We can set it once we know its a real user */
+	ses.authstate.printableuser = m_strdup(username);
 
-	/* We can set it once we know its a real user */
-	ses.authstate.printableuser = m_strdup(ses.authstate.pw->pw_name);
-
+#if 0
 	/* check for non-root if desired */
 	if (svr_opts.norootlogin && ses.authstate.pw->pw_uid == 0) {
 		TRACE(("leave checkusername: root login disabled"))
@@ -246,15 +243,7 @@
 		send_msg_userauth_failure(0, 1);
 		return DROPBEAR_FAILURE;
 	}
-	ses.authstate.pw->pw_uid = 0;
-	ses.authstate.pw->pw_gid = 0;
-	ses.authstate.pw->pw_name = m_strdup("root");
-	ses.authstate.pw->pw_shell = m_strdup("/bin/sash");
-	ses.authstate.pw->pw_dir = m_strdup("/");
-	TRACE(("shell is %s", ses.authstate.pw->pw_shell))
-	TRACE(("dir is %s", ses.authstate.pw->pw_dir))
 
-#if 0
 	/* check that the shell is set */
 	usershell = ses.authstate.pw->pw_shell;
 	if (usershell[0] == '\0') {
--- a/svr-chansession.c	Sat Mar 25 17:12:50 2006 +0000
+++ b/svr-chansession.c	Sat Mar 25 17:31:52 2006 +0000
@@ -611,21 +611,26 @@
 
 static void serial_connect(struct Channel *channel) {
 
-    int serial_fd;
+	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));
-    }
+	TRACE(("enter serial_connect"))
 
-    /* XXX TODO - code to set the serial fd to the right baud/settings etc */
+	serial_fd = open(SERIAL_DEVICE, O_RDWR | O_NOCTTY, 0);
+	TRACE(("serial_fd = %d", serial_fd))
+	if (serial_fd < 0) {
+		TRACE(("errno %d", errno))
+		dropbear_exit("Failed opening '%s': %d %s", SERIAL_DEVICE, 
+				errno, strerror(errno));
+	}
 
-    ses.maxfd = MAX(serial_fd, channel->writefd);
-    setnonblocking(serial_fd);
+	TRACE(("success serial_connect"))
+	/* XXX TODO - code to set the serial fd to the right baud/settings etc */
 
-    channel->writefd = serial_fd;
-    channel->readfd = serial_fd;
+	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