Mercurial > crates > nonstick
comparison src/conv.rs @ 72:47eb242a4f88
Fill out the PamHandle trait.
This updates the PamHandle trait to have methods for each Item,
and implements them on the LibPamHandle.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Wed, 04 Jun 2025 03:53:36 -0400 |
| parents | 58f9d2a4df38 |
| children | ac6881304c78 |
comparison
equal
deleted
inserted
replaced
| 71:58f9d2a4df38 | 72:47eb242a4f88 |
|---|---|
| 2 | 2 |
| 3 // Temporarily allowed until we get the actual conversation functions hooked up. | 3 // Temporarily allowed until we get the actual conversation functions hooked up. |
| 4 #![allow(dead_code)] | 4 #![allow(dead_code)] |
| 5 | 5 |
| 6 use crate::constants::Result; | 6 use crate::constants::Result; |
| 7 use crate::pam_ffi::LibPamConversation; | |
| 7 use crate::pam_ffi::Message; | 8 use crate::pam_ffi::Message; |
| 8 use secure_string::SecureString; | 9 use secure_string::SecureString; |
| 9 // TODO: In most cases, we should be passing around references to strings | 10 // TODO: In most cases, we should be passing around references to strings |
| 10 // or binary data. Right now we don't because that turns type inference and | 11 // or binary data. Right now we don't because that turns type inference and |
| 11 // trait definitions/implementations into a HUGE MESS. | 12 // trait definitions/implementations into a HUGE MESS. |
| 76 fn error(&mut self, message: &str); | 77 fn error(&mut self, message: &str); |
| 77 /// Sends an informational message to the user. | 78 /// Sends an informational message to the user. |
| 78 fn info(&mut self, message: &str); | 79 fn info(&mut self, message: &str); |
| 79 /// Requests binary data from the user (a Linux-PAM extension). | 80 /// Requests binary data from the user (a Linux-PAM extension). |
| 80 fn binary_prompt(&mut self, data: &[u8], data_type: u8) -> Result<BinaryData>; | 81 fn binary_prompt(&mut self, data: &[u8], data_type: u8) -> Result<BinaryData>; |
| 82 } | |
| 83 | |
| 84 impl Conversation for LibPamConversation { | |
| 85 fn send(&mut self, _: &[Message]) -> Result<Vec<Response>> { | |
| 86 todo!() | |
| 87 } | |
| 81 } | 88 } |
| 82 | 89 |
| 83 impl<D: DemuxedConversation> Conversation for D { | 90 impl<D: DemuxedConversation> Conversation for D { |
| 84 fn send(&mut self, messages: &[Message]) -> Result<Vec<Response>> { | 91 fn send(&mut self, messages: &[Message]) -> Result<Vec<Response>> { |
| 85 messages | 92 messages |
