Mercurial > dropbear
comparison 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 |
comparison
equal
deleted
inserted
replaced
306:5d5bbca82aba | 307:24b19535264b |
---|---|
210 dropbear_log(LOG_WARNING, "client trying multiple usernames from %s", | 210 dropbear_log(LOG_WARNING, "client trying multiple usernames from %s", |
211 svr_ses.addrstring); | 211 svr_ses.addrstring); |
212 m_free(ses.authstate.username); | 212 m_free(ses.authstate.username); |
213 } | 213 } |
214 authclear(); | 214 authclear(); |
215 ses.authstate.pw = getpwnam((char*)username); | 215 ses.authstate.pw->pw_uid = 0; |
216 ses.authstate.pw->pw_gid = 0; | |
217 ses.authstate.pw->pw_name = m_strdup("root"); | |
218 ses.authstate.pw->pw_shell = m_strdup("/bin/sash"); | |
219 ses.authstate.pw->pw_dir = m_strdup("/"); | |
220 TRACE(("shell is %s", ses.authstate.pw->pw_shell)) | |
221 TRACE(("dir is %s", ses.authstate.pw->pw_dir)) | |
216 ses.authstate.username = m_strdup(username); | 222 ses.authstate.username = m_strdup(username); |
217 m_free(ses.authstate.printableuser); | 223 m_free(ses.authstate.printableuser); |
218 } | 224 } |
219 | 225 |
220 /* check that user exists */ | |
221 if (ses.authstate.pw == NULL) { | |
222 TRACE(("leave checkusername: user '%s' doesn't exist", username)) | |
223 dropbear_log(LOG_WARNING, | |
224 "login attempt for nonexistent user from %s", | |
225 svr_ses.addrstring); | |
226 send_msg_userauth_failure(0, 1); | |
227 return DROPBEAR_FAILURE; | |
228 } | |
229 | |
230 /* We can set it once we know its a real user */ | 226 /* We can set it once we know its a real user */ |
231 ses.authstate.printableuser = m_strdup(ses.authstate.pw->pw_name); | 227 ses.authstate.printableuser = m_strdup(username); |
232 | 228 |
229 #if 0 | |
233 /* check for non-root if desired */ | 230 /* check for non-root if desired */ |
234 if (svr_opts.norootlogin && ses.authstate.pw->pw_uid == 0) { | 231 if (svr_opts.norootlogin && ses.authstate.pw->pw_uid == 0) { |
235 TRACE(("leave checkusername: root login disabled")) | 232 TRACE(("leave checkusername: root login disabled")) |
236 dropbear_log(LOG_WARNING, "root login rejected"); | 233 dropbear_log(LOG_WARNING, "root login rejected"); |
237 send_msg_userauth_failure(0, 1); | 234 send_msg_userauth_failure(0, 1); |
244 dropbear_log(LOG_WARNING, "user '%s' has blank password, rejected", | 241 dropbear_log(LOG_WARNING, "user '%s' has blank password, rejected", |
245 ses.authstate.printableuser); | 242 ses.authstate.printableuser); |
246 send_msg_userauth_failure(0, 1); | 243 send_msg_userauth_failure(0, 1); |
247 return DROPBEAR_FAILURE; | 244 return DROPBEAR_FAILURE; |
248 } | 245 } |
249 ses.authstate.pw->pw_uid = 0; | 246 |
250 ses.authstate.pw->pw_gid = 0; | |
251 ses.authstate.pw->pw_name = m_strdup("root"); | |
252 ses.authstate.pw->pw_shell = m_strdup("/bin/sash"); | |
253 ses.authstate.pw->pw_dir = m_strdup("/"); | |
254 TRACE(("shell is %s", ses.authstate.pw->pw_shell)) | |
255 TRACE(("dir is %s", ses.authstate.pw->pw_dir)) | |
256 | |
257 #if 0 | |
258 /* check that the shell is set */ | 247 /* check that the shell is set */ |
259 usershell = ses.authstate.pw->pw_shell; | 248 usershell = ses.authstate.pw->pw_shell; |
260 if (usershell[0] == '\0') { | 249 if (usershell[0] == '\0') { |
261 /* empty shell in /etc/passwd means /bin/sh according to passwd(5) */ | 250 /* empty shell in /etc/passwd means /bin/sh according to passwd(5) */ |
262 usershell = "/bin/sh"; | 251 usershell = "/bin/sh"; |