aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_unix/pam_unix_acct.c
diff options
context:
space:
mode:
authorSam Hartman <hartmans@debian.org>2024-12-02 09:55:34 -0700
committerSam Hartman <hartmans@debian.org>2024-12-02 09:55:34 -0700
commit4f3cfaf827bfa42a239c255092a128a3a02198bf (patch)
treeeac7f023f043739b79b2a51bd68c3006acb12964 /modules/pam_unix/pam_unix_acct.c
parent6408d4b1baff9a7e58fd66e1d1c0871be0823777 (diff)
parent7c9fb6472dcfae34ddbf4fbc9ecfafae2cf173c3 (diff)
downloadpam-4f3cfaf827bfa42a239c255092a128a3a02198bf.tar.gz
pam-4f3cfaf827bfa42a239c255092a128a3a02198bf.tar.bz2
pam-4f3cfaf827bfa42a239c255092a128a3a02198bf.zip
Update upstream source from tag 'upstream/1.7.0'
Update to upstream version '1.7.0' with Debian dir 0b3cd490884352e14273caeca2f05c6a525499fa
Diffstat (limited to 'modules/pam_unix/pam_unix_acct.c')
-rw-r--r--modules/pam_unix/pam_unix_acct.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/pam_unix/pam_unix_acct.c b/modules/pam_unix/pam_unix_acct.c
index 8f5ed3e0..befd3c99 100644
--- a/modules/pam_unix/pam_unix_acct.c
+++ b/modules/pam_unix/pam_unix_acct.c
@@ -57,6 +57,7 @@
#include <security/pam_ext.h>
#include <security/pam_modutil.h>
+#include "pam_i18n.h"
#include "pam_cc_compat.h"
#include "support.h"
#include "passverify.h"
@@ -110,14 +111,15 @@ int _unix_run_verify_binary(pam_handle_t *pamh, unsigned long long ctrl,
_exit(PAM_AUTHINFO_UNAVAIL);
}
- if (geteuid() == 0) {
- /* must set the real uid to 0 so the helper will not error
- out if pam is called from setuid binary (su, sudo...) */
- if (setuid(0) == -1) {
- pam_syslog(pamh, LOG_ERR, "setuid failed: %m");
- printf("-1\n");
- fflush(stdout);
- _exit(PAM_AUTHINFO_UNAVAIL);
+ /* must set the real uid to 0 so the helper will not error
+ out if pam is called from setuid binary (su, sudo...) */
+ if (setuid(0) == -1) {
+ uid_t euid = geteuid();
+ pam_syslog(pamh, euid == 0 ? LOG_ERR : LOG_DEBUG, "setuid failed: %m");
+ if (euid == 0) {
+ printf("-1\n");
+ fflush(stdout);
+ _exit(PAM_AUTHINFO_UNAVAIL);
}
}