diff src/handle.rs @ 166:2f5913131295

Separate flag/action flags into flags and action. This also individualizes the type of flag for each PAM function, so that you can only call a function with the right flags and values.
author Paul Fisher <paul@pfish.zone>
date Tue, 15 Jul 2025 00:32:24 -0400
parents 634cd5f2ac8b
children 77470e45e397
line wrap: on
line diff
--- a/src/handle.rs	Mon Jul 14 18:56:55 2025 -0400
+++ b/src/handle.rs	Tue Jul 15 00:32:24 2025 -0400
@@ -1,7 +1,7 @@
 //! The wrapper types and traits for handles into the PAM library.
 
 use crate::_doc::{guide, linklist, man7, manbsd, stdlinks};
-use crate::constants::{Flags, Result};
+use crate::constants::{AuthnFlags, AuthtokFlags, Result};
 use crate::conv::Conversation;
 use crate::environ::{EnvironMap, EnvironMapMut};
 use crate::items::{getter, Items, ItemsMut};
@@ -119,7 +119,7 @@
     ///
     #[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_authenticate")]
     #[doc = stdlinks!(3 pam_authenticate)]
-    fn authenticate(&mut self, flags: Flags) -> Result<()>;
+    fn authenticate(&mut self, flags: AuthnFlags) -> Result<()>;
 
     /// Verifies the validity of the user's account (and other stuff).
     ///
@@ -132,7 +132,7 @@
     ///
     #[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_acct_mgmt")]
     #[doc = stdlinks!(3 pam_acct_mgmt)]
-    fn account_management(&mut self, flags: Flags) -> Result<()>;
+    fn account_management(&mut self, flags: AuthnFlags) -> Result<()>;
 
     /// Changes the authentication token.
     ///
@@ -141,7 +141,7 @@
     ///
     #[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_chauthtok")]
     #[doc = stdlinks!(3 pam_chauthtok)]
-    fn change_authtok(&mut self, flags: Flags) -> Result<()>;
+    fn change_authtok(&mut self, flags: AuthtokFlags) -> Result<()>;
 }
 
 /// Functionality of a PAM handle that can be expected by a PAM module.