From 18dba05104304778ed1939b23a1f6c078e683e51 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Fri, 27 Jan 2023 16:34:44 +0000 Subject: pass CG_MOUNT to open_session --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib.rs') 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(v: T) -> Result { 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, } -- cgit v1.2.3-54-g00ecf