Mercurial > crates > nonstick
diff src/handle.rs @ 95:51c9d7e8261a
Return owned strings rather than borrowed strings.
It's going to be irritating to have to work with strings borrowed from the
PAM handle rather than just using your own. They're cheap enough to copy.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Mon, 23 Jun 2025 14:03:44 -0400 |
parents | db167f96ba46 |
children | efe2f5f8b5b2 |
line wrap: on
line diff
--- a/src/handle.rs Mon Jun 23 13:04:27 2025 -0400 +++ b/src/handle.rs Mon Jun 23 14:03:44 2025 -0400 @@ -24,7 +24,7 @@ /// [man]: https://www.man7.org/linux/man-pages/man3/pam_get_item.3.html /// [adg]: https://www.chiark.greenend.org.uk/doc/libpam-doc/html/adg-interface-by-app-expected.html#adg-pam_get_item /// [mwg]: https://www.chiark.greenend.org.uk/doc/libpam-doc/html/mwg-expected-by-module-item.html#mwg-pam_get_item - fn $getter(&self) -> Result<Option<&str>>; + fn $getter(&self) -> Result<Option<String>>; }; ($(#[$md:meta])* set = $setter:ident, item = $item:literal $(, see = $see:path)?) => { $(#[$md])* @@ -111,7 +111,7 @@ /// /// [man]: https://www.man7.org/linux/man-pages/man3/pam_get_user.3.html /// [mwg]: https://www.chiark.greenend.org.uk/doc/libpam-doc/html/mwg-expected-by-module-item.html#mwg-pam_get_user - fn username(&mut self, prompt: Option<&str>) -> Result<&str>; + fn username(&mut self, prompt: Option<&str>) -> Result<String>; trait_item!( /// The identity of the user for whom service is being requested. @@ -282,7 +282,7 @@ /// /// [man]: https://www.man7.org/linux/man-pages/man3/pam_get_authtok.3.html /// [mwg]: https://www.chiark.greenend.org.uk/doc/libpam-doc/html/mwg-expected-by-module-item.html#mwg-pam_get_item - fn authtok(&mut self, prompt: Option<&str>) -> Result<&str>; + fn authtok(&mut self, prompt: Option<&str>) -> Result<String>; trait_item!( /// Gets the user's authentication token (e.g., password).