代码拉取完成,页面将自动刷新
From 66106ea2c9c20c1c5c05f919b363ae6ca3e7d5ca Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Tue, 9 Jan 2024 08:00:00 +0000
Subject: [PATCH] pam_localuser: 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_localuser/pam_localuser.c (pam_sm_authenticate): Rename
to pam_localuser, add static qualifier, remove "flags" argument.
Update all callers. Add a new pam_sm_authenticate as a thin wrapper
around pam_localuser.
---
modules/pam_localuser/pam_localuser.c | 32 ++++++++++++++++++---------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/modules/pam_localuser/pam_localuser.c b/modules/pam_localuser/pam_localuser.c
index a9f2233c03..e47bb00f3a 100644
--- a/modules/pam_localuser/pam_localuser.c
+++ b/modules/pam_localuser/pam_localuser.c
@@ -49,9 +49,8 @@
#include <security/pam_ext.h>
#include "pam_inline.h"
-int
-pam_sm_authenticate(pam_handle_t *pamh, int flags UNUSED,
- int argc, const char **argv)
+static int
+pam_localuser(pam_handle_t *pamh, int argc, const char **argv)
{
int i;
int rc;
@@ -102,25 +101,36 @@ pam_sm_setcred(pam_handle_t *pamh UNUSED, int flags UNUSED,
}
int
-pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc, const char **argv)
+pam_sm_authenticate(pam_handle_t *pamh, int flags UNUSED,
+ int argc, const char **argv)
+{
+ return pam_localuser(pamh, argc, argv);
+}
+
+int
+pam_sm_acct_mgmt(pam_handle_t *pamh, int flags UNUSED,
+ int argc, const char **argv)
{
- return pam_sm_authenticate(pamh, flags, argc, argv);
+ return pam_localuser(pamh, argc, argv);
}
int
-pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv)
+pam_sm_open_session(pam_handle_t *pamh, int flags UNUSED,
+ int argc, const char **argv)
{
- return pam_sm_authenticate(pamh, flags, argc, argv);
+ return pam_localuser(pamh, argc, argv);
}
int
-pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv)
+pam_sm_close_session(pam_handle_t *pamh, int flags UNUSED,
+ int argc, const char **argv)
{
- return pam_sm_authenticate(pamh, flags, argc, argv);
+ return pam_localuser(pamh, argc, argv);
}
int
-pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv)
+pam_sm_chauthtok(pam_handle_t *pamh, int flags UNUSED,
+ int argc, const char **argv)
{
- return pam_sm_authenticate(pamh, flags, argc, argv);
+ return pam_localuser(pamh, argc, argv);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。