Mercurial > crates > nonstick
comparison pam/src/conv.rs @ 44:50371046c61a default tip
Add support for pam_get_authtok and minor cleanups.
This change adds the pam_get_authtok function for PAM modules,
as well as performing a few cleanups:
- Pattern match in a few more places.
- Pull out string-copying into a function.
- Format and run clippy.
- Replace outdated PAM doc links with man7.org pages.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 08 Mar 2025 19:29:46 -0500 |
parents | ec70822cbdef |
children |
comparison
equal
deleted
inserted
replaced
43:60e74d6a2b88 | 44:50371046c61a |
---|---|
1 use libc::{c_char, c_int}; | 1 use libc::{c_char, c_int}; |
2 use std::ffi::{CStr, CString}; | 2 use std::ffi::{CStr, CString}; |
3 use std::ptr; | 3 use std::ptr; |
4 | 4 |
5 use constants::PamMessageStyle; | |
5 use constants::PamResultCode; | 6 use constants::PamResultCode; |
6 use constants::PamMessageStyle; | |
7 use items::Item; | 7 use items::Item; |
8 use module::PamResult; | 8 use module::PamResult; |
9 | 9 |
10 #[repr(C)] | 10 #[repr(C)] |
11 struct PamMessage { | 11 struct PamMessage { |
35 appdata_ptr: *const libc::c_void, | 35 appdata_ptr: *const libc::c_void, |
36 } | 36 } |
37 | 37 |
38 pub struct Conv<'a>(&'a Inner); | 38 pub struct Conv<'a>(&'a Inner); |
39 | 39 |
40 impl<'a> Conv<'a> { | 40 impl Conv<'_> { |
41 /// Sends a message to the pam client. | 41 /// Sends a message to the pam client. |
42 /// | 42 /// |
43 /// This will typically result in the user seeing a message or a prompt. | 43 /// This will typically result in the user seeing a message or a prompt. |
44 /// There are several message styles available: | 44 /// There are several message styles available: |
45 /// | 45 /// |
75 Err(ret) | 75 Err(ret) |
76 } | 76 } |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 impl<'a> Item for Conv<'a> { | 80 impl Item for Conv<'_> { |
81 type Raw = Inner; | 81 type Raw = Inner; |
82 | 82 |
83 fn type_id() -> crate::items::ItemType { | 83 fn type_id() -> crate::items::ItemType { |
84 crate::items::ItemType::Conv | 84 crate::items::ItemType::Conv |
85 } | 85 } |