diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-01-27 16:02:08 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-01-27 16:02:08 +0000 |
commit | 8226faf4e070c9eacb9c619d8a5346cc4dc1a6ee (patch) | |
tree | 585f84b60072d18904b20e4bfaa2dbfd797f3316 | |
parent | 10e79d4bc7a85ff28ffbcfb1584c80bd5b796eae (diff) | |
download | pam_usercg_rust-8226faf4e070c9eacb9c619d8a5346cc4dc1a6ee.tar.gz pam_usercg_rust-8226faf4e070c9eacb9c619d8a5346cc4dc1a6ee.tar.xz pam_usercg_rust-8226faf4e070c9eacb9c619d8a5346cc4dc1a6ee.zip |
Use match for open_session error handling
-rw-r--r-- | src/lib.rs | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -53,10 +53,9 @@ impl PamHooks for PAMUserCG { _args: Vec<&CStr>, _flags: PamFlag, ) -> PamResultCode { - if open_session(h).is_ok() { - PamResultCode::PAM_SUCCESS - } else { - PamResultCode::PAM_SESSION_ERR + match open_session(h) { + Ok(()) => PamResultCode::PAM_SUCCESS, + Err(SessionError) => PamResultCode::PAM_SESSION_ERR, } } } |