diff options
author | ikerexxe <ipedrosa@redhat.com> | 2020-08-27 09:16:15 +0200 |
---|---|---|
committer | Tomáš Mráz <tmraz@redhat.com> | 2020-09-10 09:06:31 +0200 |
commit | 9091ea1d81e85f49a221b0325d27b22ce69e444a (patch) | |
tree | a86bfe0ac58f06f01db7860260c337efc7526255 | |
parent | 6bf9b454eb971083f0cce49faa2aa1cde329ff5d (diff) | |
download | pam-9091ea1d81e85f49a221b0325d27b22ce69e444a.tar.gz pam-9091ea1d81e85f49a221b0325d27b22ce69e444a.tar.bz2 pam-9091ea1d81e85f49a221b0325d27b22ce69e444a.zip |
pam_wheel: if getlogin fails fallback to PAM_RUSER
modules/pam_wheel/pam_wheel.c: if getlogin fails to obtain the real user
ID, then try with PAM_RUSER.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1866866
-rw-r--r-- | modules/pam_wheel/pam_wheel.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/pam_wheel/pam_wheel.c b/modules/pam_wheel/pam_wheel.c index 94cb7d89..7fa3cfa9 100644 --- a/modules/pam_wheel/pam_wheel.c +++ b/modules/pam_wheel/pam_wheel.c @@ -141,6 +141,16 @@ perform_check (pam_handle_t *pamh, int ctrl, const char *use_group) } else { fromsu = pam_modutil_getlogin(pamh); + /* if getlogin fails try a fallback to PAM_RUSER */ + if (fromsu == NULL) { + const char *rhostname; + + retval = pam_get_item(pamh, PAM_RHOST, (const void **)&rhostname); + if (retval != PAM_SUCCESS || rhostname == NULL) { + retval = pam_get_item(pamh, PAM_RUSER, (const void **)&fromsu); + } + } + if (fromsu != NULL) { tpwd = pam_modutil_getpwnam (pamh, fromsu); } |