diff svr-auth.c @ 299:740e782679be ucc-axis-hack

Various changes to compile+kind of run on UCC's axis board. Note that fprintf(stdin -> printf( accounts for many of the changes
author Matt Johnston <matt@ucc.asn.au>
date Sat, 25 Mar 2006 12:57:09 +0000
parents 0cfba3034be5
children 973fccb59ea4
line wrap: on
line diff
--- a/svr-auth.c	Fri Dec 09 06:10:27 2005 +0000
+++ b/svr-auth.c	Sat Mar 25 12:57:09 2006 +0000
@@ -112,6 +112,8 @@
 	servicename = buf_getstring(ses.payload, &servicelen);
 	methodname = buf_getstring(ses.payload, &methodlen);
 
+	TRACE(("user '%s' %d service '%s' %d method '%s' %d", username, userlen, servicename, servicelen, methodname, methodlen))
+
 	/* only handle 'ssh-connection' currently */
 	if (servicelen != SSH_SERVICE_CONNECTION_LEN
 			&& (strncmp(servicename, SSH_SERVICE_CONNECTION,
@@ -244,9 +246,15 @@
 		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') {
@@ -272,6 +280,7 @@
 				ses.authstate.printableuser);
 	send_msg_userauth_failure(0, 1);
 	return DROPBEAR_FAILURE;
+#endif
 	
 goodshell:
 	endusershell();
@@ -315,15 +324,19 @@
 	buf_setpos(typebuf, 0);
 	buf_putstring(ses.writepayload, buf_getptr(typebuf, typebuf->len),
 			typebuf->len);
+
+	TRACE(("auth fail: methods %d, '%s'", ses.authstate.authtypes,
+				buf_getptr(typebuf, typebuf->len)));
+
 	buf_free(typebuf);
 
 	buf_putbyte(ses.writepayload, partial ? 1 : 0);
 	encrypt_packet();
 
-	TRACE(("auth fail: methods %d, '%s'", ses.authstate.authtypes,
-				buf_getptr(typebuf, typebuf->len)));
+	TRACE(("after encrypt, failcount %d", ses.authstate.failcount))
 
 	if (incrfail) {
+		TRACE(("incrfail"))
 		usleep(300000); /* XXX improve this */
 		ses.authstate.failcount++;
 	}