Mercurial > crates > nonstick
comparison src/libpam/handle.rs @ 118:39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Also formats and assorted other cleanup.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 29 Jun 2025 20:13:03 -0400 |
parents | a12706e42c9d |
children |
comparison
equal
deleted
inserted
replaced
117:20f7712a6857 | 118:39760dfc9b3b |
---|---|
6 use crate::libpam::environ::{LibPamEnviron, LibPamEnvironMut}; | 6 use crate::libpam::environ::{LibPamEnviron, LibPamEnvironMut}; |
7 pub use crate::libpam::pam_ffi::LibPamHandle; | 7 pub use crate::libpam::pam_ffi::LibPamHandle; |
8 use crate::libpam::{memory, pam_ffi}; | 8 use crate::libpam::{memory, pam_ffi}; |
9 use crate::logging::{Level, Location}; | 9 use crate::logging::{Level, Location}; |
10 use crate::{ | 10 use crate::{ |
11 Conversation, EnvironMap, Flags, PamHandleApplication, PamHandleModule, guide, linklist, | 11 guide, linklist, stdlinks, Conversation, EnvironMap, Flags, PamHandleApplication, |
12 stdlinks, | 12 PamHandleModule, |
13 }; | 13 }; |
14 use num_enum::{IntoPrimitive, TryFromPrimitive}; | 14 use num_enum::{IntoPrimitive, TryFromPrimitive}; |
15 use std::cell::Cell; | 15 use std::cell::Cell; |
16 use std::ffi::{c_char, c_int, CString}; | 16 use std::ffi::{c_char, c_int, CString}; |
17 use std::ops::{Deref, DerefMut}; | 17 use std::ops::{Deref, DerefMut}; |
206 #[cfg(pam_impl = "openpam")] | 206 #[cfg(pam_impl = "openpam")] |
207 { | 207 { |
208 let func = CString::new(loc.function).unwrap_or(CString::default()); | 208 let func = CString::new(loc.function).unwrap_or(CString::default()); |
209 // SAFETY: We're calling this function with a known value. | 209 // SAFETY: We're calling this function with a known value. |
210 unsafe { | 210 unsafe { |
211 pam_ffi::_openpam_log(level as c_int, func.as_ptr(), "%s\0".as_ptr().cast(), entry.as_ptr()) | 211 pam_ffi::_openpam_log( |
212 level as c_int, | |
213 func.as_ptr(), | |
214 "%s\0".as_ptr().cast(), | |
215 entry.as_ptr(), | |
216 ) | |
212 } | 217 } |
213 } | 218 } |
214 } | 219 } |
215 | 220 |
216 fn username(&mut self, prompt: Option<&str>) -> Result<String> { | 221 fn username(&mut self, prompt: Option<&str>) -> Result<String> { |