comparison svr-authpam.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 9c372a039532
children 0cfba3034be5
comparison
equal deleted inserted replaced
156:8c2b3506f112 158:364a75cfebab
192 192
193 if ((rc = pam_authenticate(pamHandlep, 0)) != PAM_SUCCESS) { 193 if ((rc = pam_authenticate(pamHandlep, 0)) != PAM_SUCCESS) {
194 dropbear_log(LOG_WARNING, "pam_authenticate() failed, rc=%d, %s\n", 194 dropbear_log(LOG_WARNING, "pam_authenticate() failed, rc=%d, %s\n",
195 rc, pam_strerror(pamHandlep, rc)); 195 rc, pam_strerror(pamHandlep, rc));
196 dropbear_log(LOG_WARNING, 196 dropbear_log(LOG_WARNING,
197 "bad PAM password attempt for '%s'", 197 "bad PAM password attempt for '%s' from %s",
198 ses.authstate.printableuser); 198 ses.authstate.printableuser,
199 svr_ses.addrstring);
199 send_msg_userauth_failure(0, 1); 200 send_msg_userauth_failure(0, 1);
200 goto cleanup; 201 goto cleanup;
201 } 202 }
202 203
203 if ((rc = pam_acct_mgmt(pamHandlep, 0)) != PAM_SUCCESS) { 204 if ((rc = pam_acct_mgmt(pamHandlep, 0)) != PAM_SUCCESS) {
204 dropbear_log(LOG_WARNING, "pam_acct_mgmt() failed, rc=%d, %s\n", 205 dropbear_log(LOG_WARNING, "pam_acct_mgmt() failed, rc=%d, %s\n",
205 rc, pam_strerror(pamHandlep, rc)); 206 rc, pam_strerror(pamHandlep, rc));
206 dropbear_log(LOG_WARNING, 207 dropbear_log(LOG_WARNING,
207 "bad PAM password attempt for '%s'", 208 "bad PAM password attempt for '%s' from %s",
208 ses.authstate.printableuser); 209 ses.authstate.printableuser,
210 svr_ses.addrstring);
209 send_msg_userauth_failure(0, 1); 211 send_msg_userauth_failure(0, 1);
210 goto cleanup; 212 goto cleanup;
211 } 213 }
212 214
213 /* successful authentication */ 215 /* successful authentication */
214 dropbear_log(LOG_NOTICE, "PAM password auth succeeded for '%s'", 216 dropbear_log(LOG_NOTICE, "PAM password auth succeeded for '%s' from %s",
215 ses.authstate.printableuser); 217 ses.authstate.printableuser,
218 svr_ses.addrstring);
216 send_msg_userauth_success(); 219 send_msg_userauth_success();
217 220
218 cleanup: 221 cleanup:
219 if (password != NULL) { 222 if (password != NULL) {
220 m_burn(password, passwordlen); 223 m_burn(password, passwordlen);