The unified diff between revisions [51506e62..] and [950c261f..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "svr-auth.c"
# from [1928202b36a75393ddd5aec3b73fbcd9f49257c0]
# to [9e1a4679db96d4782d821ed17a5ab4240f0cc364]
#
# patch "svr-chansession.c"
# from [53fdef2a3ab459d0db3ef0423c1947cbaead4a64]
# to [5d5ab8c49d0c673e5f2cffa59bddaf926cd514e7]
#
============================================================
--- svr-auth.c 1928202b36a75393ddd5aec3b73fbcd9f49257c0
+++ svr-auth.c 9e1a4679db96d4782d821ed17a5ab4240f0cc364
@@ -212,24 +212,21 @@ static int checkusername(unsigned char *
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(ses.authstate.pw->pw_name);
+ ses.authstate.printableuser = m_strdup(username);
+#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 @@ static int checkusername(unsigned char *
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') {
============================================================
--- svr-chansession.c 53fdef2a3ab459d0db3ef0423c1947cbaead4a64
+++ svr-chansession.c 5d5ab8c49d0c673e5f2cffa59bddaf926cd514e7
@@ -611,21 +611,26 @@ static void serial_connect(struct Channe
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