libcgroup/pam-cgroup-cgflags-no-usecache.patch
wanfeng b02dc82596 modify the mode of read rules for pam_cgroup
(cherry picked from commit dea78b406677ed9f21196e084facdc755092a027)
2023-11-07 14:45:41 +08:00

27 lines
959 B
Diff

diff --git a/include/libcgroup/tasks.h b/include/libcgroup/tasks.h
index aad438a..22f17d8 100644
--- a/include/libcgroup/tasks.h
+++ b/include/libcgroup/tasks.h
@@ -20,6 +20,8 @@ enum cgflags {
CGFLAG_USECACHE = 0x01,
/** Use cached templates, do not read templates from disk. */
CGFLAG_USE_TEMPLATE_CACHE = 0x02,
+ /** read rules from disk. */
+ CGFLAG_NOUSECACHE = 0x04,
};
/** Flags for cgroup_register_unchanged_process(). */
diff --git a/src/pam/pam_cgroup.c b/src/pam/pam_cgroup.c
index 1d78b81..fb427b4 100644
--- a/src/pam/pam_cgroup.c
+++ b/src/pam/pam_cgroup.c
@@ -138,7 +138,7 @@ PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags,
* under what egid service will be provided?
*/
ret = cgroup_change_cgroup_uid_gid_flags(pwd->pw_uid,
- pwd->pw_gid, pid, CGFLAG_USECACHE);
+ pwd->pw_gid, pid, CGFLAG_NOUSECACHE);
if (ret) {
if (ctrl & PAM_DEBUG_ARG)
pam_syslog(pamh, LOG_ERR, "Change of cgroup for process"