Mercurial > crates > nonstick
comparison src/libpam/answer.rs @ 100:3f11b8d30f63
Implement environment variable management.
This actually wires up the environment variable handling to libpam,
so that applications and modules can manage the environment through
the authentication process.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Tue, 24 Jun 2025 17:08:01 -0400 |
| parents | b87100c5eed4 |
| children | 94b51fa4f797 |
comparison
equal
deleted
inserted
replaced
| 99:8840fa6534f6 | 100:3f11b8d30f63 |
|---|---|
| 7 use crate::{ErrorCode, Result}; | 7 use crate::{ErrorCode, Result}; |
| 8 use std::ffi::CStr; | 8 use std::ffi::CStr; |
| 9 use std::ops::{Deref, DerefMut}; | 9 use std::ops::{Deref, DerefMut}; |
| 10 use std::ptr::NonNull; | 10 use std::ptr::NonNull; |
| 11 use std::{iter, mem, ptr, slice}; | 11 use std::{iter, mem, ptr, slice}; |
| 12 use std::mem::ManuallyDrop; | |
| 12 | 13 |
| 13 /// The corridor via which the answer to Messages navigate through PAM. | 14 /// The corridor via which the answer to Messages navigate through PAM. |
| 14 #[derive(Debug)] | 15 #[derive(Debug)] |
| 15 pub struct Answers { | 16 pub struct Answers { |
| 16 /// The actual list of answers. This can't be a [`CHeapBox`] because | 17 /// The actual list of answers. This can't be a [`CHeapBox`] because |
| 46 /// Converts this into a `*Answer` for passing to PAM. | 47 /// Converts this into a `*Answer` for passing to PAM. |
| 47 /// | 48 /// |
| 48 /// This object is consumed and the `Answer` pointer now owns its data. | 49 /// This object is consumed and the `Answer` pointer now owns its data. |
| 49 /// It can be recreated with [`Self::from_c_heap`]. | 50 /// It can be recreated with [`Self::from_c_heap`]. |
| 50 pub fn into_ptr(self) -> NonNull<Answer> { | 51 pub fn into_ptr(self) -> NonNull<Answer> { |
| 51 let ret = self.base; | 52 ManuallyDrop::new(self).base |
| 52 mem::forget(self); | |
| 53 ret | |
| 54 } | 53 } |
| 55 | 54 |
| 56 /// Takes ownership of a list of answers allocated on the C heap. | 55 /// Takes ownership of a list of answers allocated on the C heap. |
| 57 /// | 56 /// |
| 58 /// # Safety | 57 /// # Safety |
