comparison src/constants.rs @ 139:33b9622ed6d2

Remove redundant memory management in nonstick::libpam; fix UB. - Uses the libpam-sys-helpers BinaryPayload / OwnedBinaryPayload structs to handle memory management and parsing for Linux-PAM binary messages. - Gets rid of the (technically) undefined behavior in PtrPtrVec due to pointer provenance. - Don't check for malloc failing. It won't, even if it does. - Formatting/cleanups/etc.
author Paul Fisher <paul@pfish.zone>
date Thu, 03 Jul 2025 23:57:49 -0400
parents 999bf07efbcb
children 1bc52025156b
comparison
equal deleted inserted replaced
138:999bf07efbcb 139:33b9622ed6d2
226 226
227 #[test] 227 #[test]
228 fn test_enums() { 228 fn test_enums() {
229 assert_eq!(Ok(()), ErrorCode::result_from(0)); 229 assert_eq!(Ok(()), ErrorCode::result_from(0));
230 assert_eq!( 230 assert_eq!(
231 pam_constants::PAM_SESSION_ERR as i32, 231 pam_constants::PAM_SESSION_ERR,
232 ErrorCode::result_to_c::<()>(Err(ErrorCode::SessionError)) 232 ErrorCode::result_to_c::<()>(Err(ErrorCode::SessionError))
233 ); 233 );
234 assert_eq!( 234 assert_eq!(
235 Err(ErrorCode::Abort), 235 Err(ErrorCode::Abort),
236 ErrorCode::result_from(pam_constants::PAM_ABORT as i32) 236 ErrorCode::result_from(pam_constants::PAM_ABORT)
237 ); 237 );
238 assert_eq!(Err(ErrorCode::SystemError), ErrorCode::result_from(423)); 238 assert_eq!(Err(ErrorCode::SystemError), ErrorCode::result_from(423));
239 } 239 }
240 } 240 }