Mercurial > dropbear
comparison svr-auth.c @ 158:364a75cfebab
Log the IP along with auth success/fail attempts
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 23 Dec 2004 17:00:15 +0000 |
parents | 9337c9f9a607 |
children | 0cfba3034be5 |
comparison
equal
deleted
inserted
replaced
156:8c2b3506f112 | 158:364a75cfebab |
---|---|
203 /* new user or username has changed */ | 203 /* new user or username has changed */ |
204 if (ses.authstate.username == NULL || | 204 if (ses.authstate.username == NULL || |
205 strcmp(username, ses.authstate.username) != 0) { | 205 strcmp(username, ses.authstate.username) != 0) { |
206 /* the username needs resetting */ | 206 /* the username needs resetting */ |
207 if (ses.authstate.username != NULL) { | 207 if (ses.authstate.username != NULL) { |
208 dropbear_log(LOG_WARNING, "client trying multiple usernames"); | 208 dropbear_log(LOG_WARNING, "client trying multiple usernames from %s", |
209 svr_ses.addrstring); | |
209 m_free(ses.authstate.username); | 210 m_free(ses.authstate.username); |
210 } | 211 } |
211 authclear(); | 212 authclear(); |
212 ses.authstate.pw = getpwnam((char*)username); | 213 ses.authstate.pw = getpwnam((char*)username); |
213 ses.authstate.username = m_strdup(username); | 214 ses.authstate.username = m_strdup(username); |
216 | 217 |
217 /* check that user exists */ | 218 /* check that user exists */ |
218 if (ses.authstate.pw == NULL) { | 219 if (ses.authstate.pw == NULL) { |
219 TRACE(("leave checkusername: user '%s' doesn't exist", username)); | 220 TRACE(("leave checkusername: user '%s' doesn't exist", username)); |
220 dropbear_log(LOG_WARNING, | 221 dropbear_log(LOG_WARNING, |
221 "login attempt for nonexistent user"); | 222 "login attempt for nonexistent user from %s", |
223 svr_ses.addrstring); | |
222 send_msg_userauth_failure(0, 1); | 224 send_msg_userauth_failure(0, 1); |
223 return DROPBEAR_FAILURE; | 225 return DROPBEAR_FAILURE; |
224 } | 226 } |
225 | 227 |
226 /* We can set it once we know its a real user */ | 228 /* We can set it once we know its a real user */ |
334 if (ses.authstate.printableuser == NULL) { | 336 if (ses.authstate.printableuser == NULL) { |
335 userstr = "is invalid"; | 337 userstr = "is invalid"; |
336 } else { | 338 } else { |
337 userstr = ses.authstate.printableuser; | 339 userstr = ses.authstate.printableuser; |
338 } | 340 } |
339 dropbear_exit("Max auth tries reached - user %s", userstr); | 341 dropbear_exit("Max auth tries reached - user '%s' from %s", |
342 userstr, svr_ses.addrstring); | |
340 } | 343 } |
341 | 344 |
342 TRACE(("leave send_msg_userauth_failure")); | 345 TRACE(("leave send_msg_userauth_failure")); |
343 } | 346 } |
344 | 347 |