From 6fd676c9823d127fc3eaa454d1327a6e23dad32b Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Sat, 14 Jul 2001 08:38:24 +0000 Subject: [PATCH] Use a better method to get user credentials to account for (legal) duplications of UID's in /etc/*passwd. --- lib/libpam/modules/pam_opie/pam_opie.8 | 3 ++- lib/libpam/modules/pam_opie/pam_opie.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libpam/modules/pam_opie/pam_opie.8 b/lib/libpam/modules/pam_opie/pam_opie.8 index 3895eb557a3..996d1d39f73 100644 --- a/lib/libpam/modules/pam_opie/pam_opie.8 +++ b/lib/libpam/modules/pam_opie/pam_opie.8 @@ -69,7 +69,7 @@ level. This option will require the user to authenticate themself as the user given by -.Xr getuid 2 , +.Xr getlogin 2 , not as the account they are attempting to access. This is primarily for services like .Xr su 1 , @@ -84,6 +84,7 @@ default OPIE password database. .El .Sh SEE ALSO .Xr passwd 1 , +.Xr getlogin 2 , .Xr opiechallenge 3 , .Xr syslog 3 , .Xr opie 4 , diff --git a/lib/libpam/modules/pam_opie/pam_opie.c b/lib/libpam/modules/pam_opie/pam_opie.c index 566a6949e0a..dc5c8144fe2 100644 --- a/lib/libpam/modules/pam_opie/pam_opie.c +++ b/lib/libpam/modules/pam_opie/pam_opie.c @@ -74,7 +74,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv) user = NULL; if (pam_test_option(&options, PAM_OPT_AUTH_AS_SELF, NULL)) { - pwd = getpwuid(getuid()); + pwd = getpwnam(getlogin()); user = pwd->pw_name; } else {