aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_lastlog
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2024-01-09 08:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2024-01-13 08:00:00 +0000
commit8295f092f6138ced15decc05e094667b0a8488e3 (patch)
treea3b4260bfe8ea6f5a02296b7aee860a1dd649b7f /modules/pam_lastlog
parent49b0b16a3d9781c6d7294b3d04a4d6d57b388c1b (diff)
downloadpam-8295f092f6138ced15decc05e094667b0a8488e3.tar.gz
pam-8295f092f6138ced15decc05e094667b0a8488e3.tar.bz2
pam-8295f092f6138ced15decc05e094667b0a8488e3.zip
pam_lastlog: do not call pam_sm_authenticate
Calling an exported function from the module is unsafe as there is no guarantee that the function that will be actually called is the one that is provided by the module. * modules/pam_lastlog/pam_lastlog.c (pam_sm_authenticate): Rename to pam_auth, add static qualifier, remove "flags" argument. Update all callers. Add a new pam_sm_authenticate as a thin wrapper around pam_auth.
Diffstat (limited to 'modules/pam_lastlog')
-rw-r--r--modules/pam_lastlog/pam_lastlog.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/pam_lastlog/pam_lastlog.c b/modules/pam_lastlog/pam_lastlog.c
index f255b9dd..02828033 100644
--- a/modules/pam_lastlog/pam_lastlog.c
+++ b/modules/pam_lastlog/pam_lastlog.c
@@ -665,9 +665,8 @@ cleanup:
}
/* --- authentication (locking out inactive users) functions --- */
-int
-pam_sm_authenticate(pam_handle_t *pamh, int flags,
- int argc, const char **argv)
+static int
+pam_auth(pam_handle_t *pamh, int flags, int argc, const char **argv)
{
int retval, ctrl;
const char *user = NULL;
@@ -742,10 +741,17 @@ pam_sm_setcred(pam_handle_t *pamh UNUSED, int flags UNUSED,
}
int
+pam_sm_authenticate(pam_handle_t *pamh, int flags,
+ int argc, const char **argv)
+{
+ return pam_auth(pamh, flags, argc, argv);
+}
+
+int
pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
int argc, const char **argv)
{
- return pam_sm_authenticate(pamh, flags, argc, argv);
+ return pam_auth(pamh, flags, argc, argv);
}
/* --- session management functions --- */