summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-07-28 08:36:10 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-07-28 08:36:10 -0700
commit58021c21c28fdb4949d44aa92e68874155842ccc (patch)
tree9078ef70633f4ab83999ebce53fe2c642e5ea4cd
parenta3f1f5f5b8b3a070de6d9510f588b39f5ebcc0fc (diff)
Do a better job of getting user name for failed login log when using PAM
Check to see if username is filled in before calling FailedError, and fill it in if it's not. Call FailedError before calling pam_end, so we don't reference a username that may have been freed already. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--greeter/greet.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/greeter/greet.c b/greeter/greet.c
index a34ebf7..a4e799c 100644
--- a/greeter/greet.c
+++ b/greeter/greet.c
@@ -591,9 +591,18 @@ greet_user_rtn GreetUser(
SetValue (login, 1, NULL);
break;
} else {
+ /* Try to fill in username for failed login error log */
+ if (greet->name == NULL) {
+ if (username == NULL) {
+ RUN_AND_CHECK_PAM_ERROR(pam_get_item,
+ (*pamhp, PAM_USER,
+ (void *) &username));
+ }
+ greet->name = username;
+ }
+ FailedLogin (d, greet);
RUN_AND_CHECK_PAM_ERROR(pam_end,
(*pamhp, pam_error));
- FailedLogin (d, greet);
}
#else /* not PAM */
/*