Mercurial > crates > nonstick
diff src/libpam/environ.rs @ 144:56b559b7ecea
Big rename: separate concepts of Transaction from Handle.
- An application that uses PAM creates a Transaction.
- The Transaction has a Handle.
Currently, a module still get something called a "handle",
but that's probably going to change soon.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 06 Jul 2025 11:59:26 -0400 |
parents | ebb71a412b58 |
children |
line wrap: on
line diff
--- a/src/libpam/environ.rs Sat Jul 05 22:12:46 2025 -0400 +++ b/src/libpam/environ.rs Sun Jul 06 11:59:26 2025 -0400 @@ -1,13 +1,13 @@ use crate::environ::{EnvironMap, EnvironMapMut}; use crate::libpam::memory::{CHeapBox, CHeapString}; -use crate::libpam::{memory, RawPamHandle}; +use crate::libpam::{memory, LibPamHandle}; use std::ffi::{c_char, CStr, CString, OsStr, OsString}; use std::marker::PhantomData; use std::os::unix::ffi::{OsStrExt, OsStringExt}; use std::ptr; use std::ptr::NonNull; -impl RawPamHandle { +impl LibPamHandle { fn environ_get(&self, key: &OsStr) -> Option<OsString> { let key = CString::new(key.as_bytes()).ok()?; // SAFETY: We are a valid handle and are calling with a good key. @@ -55,22 +55,22 @@ /// A view to the environment stored in a PAM handle. pub struct LibPamEnviron<'a> { - source: &'a RawPamHandle, + source: &'a LibPamHandle, } /// A mutable view to the environment stored in a PAM handle. pub struct LibPamEnvironMut<'a> { - source: &'a mut RawPamHandle, + source: &'a mut LibPamHandle, } impl<'a> LibPamEnviron<'a> { - pub fn new(source: &'a RawPamHandle) -> Self { + pub fn new(source: &'a LibPamHandle) -> Self { Self { source } } } impl<'a> LibPamEnvironMut<'a> { - pub fn new(source: &'a mut RawPamHandle) -> Self { + pub fn new(source: &'a mut LibPamHandle) -> Self { Self { source } } } @@ -113,7 +113,7 @@ start: NonNull<Option<EnvVar>>, /// The environment variable we're about to iterate into. current: NonNull<Option<EnvVar>>, - _owner: PhantomData<&'a RawPamHandle>, + _owner: PhantomData<&'a LibPamHandle>, } impl EnvList<'_> {