|
|
118fca |
From 6bf9b454eb971083f0cce49faa2aa1cde329ff5d Mon Sep 17 00:00:00 2001
|
|
|
118fca |
From: ikerexxe <ipedrosa@redhat.com>
|
|
|
118fca |
Date: Wed, 26 Aug 2020 14:44:23 +0200
|
|
|
118fca |
Subject: [PATCH 1/3] pam_wheel: improve coding style
|
|
|
118fca |
|
|
|
118fca |
modules/pam_wheel/pam_wheel.c: improve indentation and explicitly state
|
|
|
118fca |
condition statements
|
|
|
118fca |
---
|
|
|
118fca |
modules/pam_wheel/pam_wheel.c | 36 ++++++++++++++++++-----------------
|
|
|
118fca |
1 file changed, 19 insertions(+), 17 deletions(-)
|
|
|
118fca |
|
|
|
118fca |
diff --git a/modules/pam_wheel/pam_wheel.c b/modules/pam_wheel/pam_wheel.c
|
|
|
118fca |
index a025ebaf..94cb7d89 100644
|
|
|
118fca |
--- a/modules/pam_wheel/pam_wheel.c
|
|
|
118fca |
+++ b/modules/pam_wheel/pam_wheel.c
|
|
|
118fca |
@@ -130,25 +130,27 @@ perform_check (pam_handle_t *pamh, int ctrl, const char *use_group)
|
|
|
118fca |
}
|
|
|
118fca |
|
|
|
118fca |
if (ctrl & PAM_USE_UID_ARG) {
|
|
|
118fca |
- tpwd = pam_modutil_getpwuid (pamh, getuid());
|
|
|
118fca |
- if (!tpwd) {
|
|
|
118fca |
- if (ctrl & PAM_DEBUG_ARG) {
|
|
|
118fca |
+ tpwd = pam_modutil_getpwuid (pamh, getuid());
|
|
|
118fca |
+ if (tpwd == NULL) {
|
|
|
118fca |
+ if (ctrl & PAM_DEBUG_ARG) {
|
|
|
118fca |
pam_syslog(pamh, LOG_NOTICE, "who is running me ?!");
|
|
|
118fca |
- }
|
|
|
118fca |
- return PAM_SERVICE_ERR;
|
|
|
118fca |
- }
|
|
|
118fca |
- fromsu = tpwd->pw_name;
|
|
|
118fca |
+ }
|
|
|
118fca |
+ return PAM_SERVICE_ERR;
|
|
|
118fca |
+ }
|
|
|
118fca |
+ fromsu = tpwd->pw_name;
|
|
|
118fca |
} else {
|
|
|
118fca |
- fromsu = pam_modutil_getlogin(pamh);
|
|
|
118fca |
- if (fromsu) {
|
|
|
118fca |
- tpwd = pam_modutil_getpwnam (pamh, fromsu);
|
|
|
118fca |
- }
|
|
|
118fca |
- if (!fromsu || !tpwd) {
|
|
|
118fca |
- if (ctrl & PAM_DEBUG_ARG) {
|
|
|
118fca |
- pam_syslog(pamh, LOG_NOTICE, "who is running me ?!");
|
|
|
118fca |
- }
|
|
|
118fca |
- return PAM_SERVICE_ERR;
|
|
|
118fca |
- }
|
|
|
118fca |
+ fromsu = pam_modutil_getlogin(pamh);
|
|
|
118fca |
+
|
|
|
118fca |
+ if (fromsu != NULL) {
|
|
|
118fca |
+ tpwd = pam_modutil_getpwnam (pamh, fromsu);
|
|
|
118fca |
+ }
|
|
|
118fca |
+
|
|
|
118fca |
+ if (fromsu == NULL || tpwd == NULL) {
|
|
|
118fca |
+ if (ctrl & PAM_DEBUG_ARG) {
|
|
|
118fca |
+ pam_syslog(pamh, LOG_NOTICE, "who is running me ?!");
|
|
|
118fca |
+ }
|
|
|
118fca |
+ return PAM_SERVICE_ERR;
|
|
|
118fca |
+ }
|
|
|
118fca |
}
|
|
|
118fca |
|
|
|
118fca |
/*
|
|
|
118fca |
--
|
|
|
118fca |
2.26.2
|
|
|
118fca |
|
|
|
118fca |
|
|
|
118fca |
From 9091ea1d81e85f49a221b0325d27b22ce69e444a Mon Sep 17 00:00:00 2001
|
|
|
118fca |
From: ikerexxe <ipedrosa@redhat.com>
|
|
|
118fca |
Date: Thu, 27 Aug 2020 09:16:15 +0200
|
|
|
118fca |
Subject: [PATCH 2/3] pam_wheel: if getlogin fails fallback to PAM_RUSER
|
|
|
118fca |
|
|
|
118fca |
modules/pam_wheel/pam_wheel.c: if getlogin fails to obtain the real user
|
|
|
118fca |
ID, then try with PAM_RUSER.
|
|
|
118fca |
|
|
|
118fca |
Resolves:
|
|
|
118fca |
https://bugzilla.redhat.com/show_bug.cgi?id=1866866
|
|
|
118fca |
---
|
|
|
118fca |
modules/pam_wheel/pam_wheel.c | 10 ++++++++++
|
|
|
118fca |
1 file changed, 10 insertions(+)
|
|
|
118fca |
|
|
|
118fca |
diff --git a/modules/pam_wheel/pam_wheel.c b/modules/pam_wheel/pam_wheel.c
|
|
|
118fca |
index 94cb7d89..7fa3cfa9 100644
|
|
|
118fca |
--- a/modules/pam_wheel/pam_wheel.c
|
|
|
118fca |
+++ b/modules/pam_wheel/pam_wheel.c
|
|
|
118fca |
@@ -141,6 +141,16 @@ perform_check (pam_handle_t *pamh, int ctrl, const char *use_group)
|
|
|
118fca |
} else {
|
|
|
118fca |
fromsu = pam_modutil_getlogin(pamh);
|
|
|
118fca |
|
|
|
118fca |
+ /* if getlogin fails try a fallback to PAM_RUSER */
|
|
|
118fca |
+ if (fromsu == NULL) {
|
|
|
118fca |
+ const char *rhostname;
|
|
|
118fca |
+
|
|
|
118fca |
+ retval = pam_get_item(pamh, PAM_RHOST, (const void **)&rhostname);
|
|
|
118fca |
+ if (retval != PAM_SUCCESS || rhostname == NULL) {
|
|
|
118fca |
+ retval = pam_get_item(pamh, PAM_RUSER, (const void **)&fromsu);
|
|
|
118fca |
+ }
|
|
|
118fca |
+ }
|
|
|
118fca |
+
|
|
|
118fca |
if (fromsu != NULL) {
|
|
|
118fca |
tpwd = pam_modutil_getpwnam (pamh, fromsu);
|
|
|
118fca |
}
|
|
|
118fca |
--
|
|
|
118fca |
2.26.2
|
|
|
118fca |
|
|
|
118fca |
|
|
|
118fca |
From a3a5cbf86083c43026b558e2023f597530626267 Mon Sep 17 00:00:00 2001
|
|
|
118fca |
From: ikerexxe <ipedrosa@redhat.com>
|
|
|
118fca |
Date: Wed, 9 Sep 2020 10:32:03 +0200
|
|
|
118fca |
Subject: [PATCH 3/3] pam_wheel: clarify use_uid option in man page
|
|
|
118fca |
|
|
|
118fca |
modules/pam_wheel/pam_wheel.8.xml: indicate that use_uid option uses the
|
|
|
118fca |
real uid of the calling process.
|
|
|
118fca |
---
|
|
|
118fca |
modules/pam_wheel/pam_wheel.8.xml | 6 +++---
|
|
|
118fca |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
118fca |
|
|
|
118fca |
diff --git a/modules/pam_wheel/pam_wheel.8.xml b/modules/pam_wheel/pam_wheel.8.xml
|
|
|
118fca |
index b32f5e2b..ee8c7d26 100644
|
|
|
118fca |
--- a/modules/pam_wheel/pam_wheel.8.xml
|
|
|
118fca |
+++ b/modules/pam_wheel/pam_wheel.8.xml
|
|
|
118fca |
@@ -122,9 +122,9 @@
|
|
|
118fca |
</term>
|
|
|
118fca |
<listitem>
|
|
|
118fca |
<para>
|
|
|
118fca |
- The check for wheel membership will be done against
|
|
|
118fca |
- the current uid instead of the original one (useful when
|
|
|
118fca |
- jumping with su from one account to another for example).
|
|
|
118fca |
+ The check will be done against the real uid of the calling process,
|
|
|
118fca |
+ instead of trying to obtain the user from the login session
|
|
|
118fca |
+ associated with the terminal in use.
|
|
|
118fca |
</para>
|
|
|
118fca |
</listitem>
|
|
|
118fca |
</varlistentry>
|
|
|
118fca |
--
|
|
|
118fca |
2.26.2
|
|
|
118fca |
|