diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-01-27 16:34:44 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-01-27 16:36:55 +0000 |
commit | 18dba05104304778ed1939b23a1f6c078e683e51 (patch) | |
tree | af26f9ad0f07c673a352ccbea811a7f8c14f5fee /src | |
parent | 73be1a9adfc1fa04bd4ac0a64317ebea74534155 (diff) | |
download | pam_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')
-rw-r--r-- | src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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, } |