diff svr-auth.c @ 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 973fccb59ea4
children 474c1a700b67
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') {