aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorOlivier Houchard <cognet@FreeBSD.org>2006-03-28 15:30:42 +0000
committerOlivier Houchard <cognet@FreeBSD.org>2006-03-28 15:30:42 +0000
commit8f9370b050153d6d91ae22eaab4b567fa0bb29fd (patch)
treeeb3c6616fe1ff5021c7ea358b8afbe9603d995c3 /usr.bin
parent11d15d51b36ee68af93322e61615887c85858fce (diff)
downloadsrc-8f9370b050153d6d91ae22eaab4b567fa0bb29fd.tar.gz
src-8f9370b050153d6d91ae22eaab4b567fa0bb29fd.zip
Don't call audit_logout() if pwd is NULL, as audit_logout() attempts to
dereference it. This will happen if we ^D at the Login: prompt without having provided a valid login before. Set pwd to NULL on bad login attempts to prevent audit_logout() from being called for a user which didn't actually log on. Reported by: Jerome Magnin jethro at docisland dot org
Notes
Notes: svn path=/head/; revision=157215
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/login/login.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index f23467de807a..b7aa278cdabf 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -343,6 +343,8 @@ main(int argc, char *argv[])
(void)printf("Login incorrect\n");
failures++;
+ pwd = NULL;
+
/*
* Allow up to 'retry' (10) attempts, but start
* backing off after 'backoff' (3) attempts.
@@ -951,7 +953,8 @@ bail(int sec, int eval)
{
pam_cleanup();
- audit_logout();
+ if (pwd != NULL)
+ audit_logout();
(void)sleep(sec);
exit(eval);
}