summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2023-01-27 16:34:44 +0000
committerTomasz Kramkowski <tomasz@kramkow.ski>2023-01-27 16:36:55 +0000
commit18dba05104304778ed1939b23a1f6c078e683e51 (patch)
treeaf26f9ad0f07c673a352ccbea811a7f8c14f5fee /src/lib.rs
parent73be1a9adfc1fa04bd4ac0a64317ebea74534155 (diff)
downloadpam_usercg_rust-18dba05104304778ed1939b23a1f6c078e683e51.tar.gz
pam_usercg_rust-18dba05104304778ed1939b23a1f6c078e683e51.tar.xz
pam_usercg_rust-18dba05104304778ed1939b23a1f6c078e683e51.zip
pass CG_MOUNT to open_session
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 2a1f0ea..7190e51 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -50,11 +50,11 @@ fn safe_to_string<T: MaxDisplayLength>(v: T) -> Result<String, SessionError> {
Ok(buf)
}
-fn open_session(h: &mut PamHandle) -> Result<(), SessionError> {
+fn open_session(h: &mut PamHandle, mountpoint: &str) -> Result<(), SessionError> {
let user = h.get_user(None).or(Err(SessionError))?;
let user = users::get_user_by_name(&user).ok_or(SessionError)?;
let uid = safe_to_string(user.uid())?;
- let d = Dir::open_ambient_dir(CG_MOUNT, cap_std::ambient_authority())?;
+ let d = Dir::open_ambient_dir(mountpoint, cap_std::ambient_authority())?;
let d = create_and_open_dir(&d, "user")?;
let d = create_and_open_dir(&d, &uid)?;
let d = create_and_open_dir(&d, "leaf")?;
@@ -72,7 +72,7 @@ impl PamHooks for PAMUserCG {
_args: Vec<&CStr>,
_flags: PamFlag,
) -> PamResultCode {
- match open_session(h) {
+ match open_session(h, CG_MOUNT) {
Ok(()) => PamResultCode::PAM_SUCCESS,
Err(SessionError) => PamResultCode::PAM_SESSION_ERR,
}