Mercurial > crates > nonstick
comparison libpam-sys/src/lib.rs @ 174:9e4ce1631bd3
Dramatically expand documentation.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Tue, 29 Jul 2025 18:58:27 -0400 |
parents | a75a66cb4181 |
children | 0730f5f2ee2a |
comparison
equal
deleted
inserted
replaced
173:46e8ce5cd5d1 | 174:9e4ce1631bd3 |
---|---|
6 //! - The [`pam_impl`] submodule (and the associated [`pam_impl_name!`] macro), | 6 //! - The [`pam_impl`] submodule (and the associated [`pam_impl_name!`] macro), |
7 //! which can be used to detect the current PAM implementation. | 7 //! which can be used to detect the current PAM implementation. |
8 //! - The [`aliases`] submodule, which contains convenient aliases | 8 //! - The [`aliases`] submodule, which contains convenient aliases |
9 //! for callback types used in libpam, so you don't have to type | 9 //! for callback types used in libpam, so you don't have to type |
10 //! `unsafe extern "C" fn(this is so long)` all the time. | 10 //! `unsafe extern "C" fn(this is so long)` all the time. |
11 //! | |
12 #![doc = concat!("This documentation was built for the **", pam_impl_name!(), "** implementation.")] | 11 #![doc = concat!("This documentation was built for the **", pam_impl_name!(), "** implementation.")] |
13 //! | 12 //! |
14 //! You can override this **at build time** by setting the `LIBPAMSYS_IMPL` | 13 //! You can override this **at build time** by setting the `LIBPAMSYS_IMPL` |
15 //! environment variable to one of the values of the [`pam_impl::PamImpl`] enum. | 14 //! environment variable to one of the values of the [`pam_impl::PamImpl`] enum. |
16 //! For more information about configuration, see the documentation of | 15 //! For more information about configuration, see the documentation of |
409 /// # use std::ptr; | 408 /// # use std::ptr; |
410 /// use libpam_sys::*; | 409 /// use libpam_sys::*; |
411 /// # let service = CString::new("whatever").unwrap(); | 410 /// # let service = CString::new("whatever").unwrap(); |
412 /// # let user = CString::new("whatever").unwrap(); | 411 /// # let user = CString::new("whatever").unwrap(); |
413 /// let mut handle: *mut pam_handle = ptr::null_mut(); | 412 /// let mut handle: *mut pam_handle = ptr::null_mut(); |
414 /// let mut conv = pam_conv{ | 413 /// let mut conv = pam_conv { |
415 /// conv: openpam_ttyconv, | 414 /// conv: openpam_ttyconv, |
416 /// appdata_ptr: ptr::null_mut(), | 415 /// appdata_ptr: ptr::null_mut(), |
417 /// }; | 416 /// }; |
418 /// let result = unsafe { pam_start( | 417 /// let result = unsafe { pam_start(service.as_ptr(), user.as_ptr(), &mut conv, &mut handle) }; |
419 /// service.as_ptr(), user.as_ptr(), &mut conv, &mut handle | |
420 /// ) }; | |
421 /// ``` | 418 /// ``` |
422 pub fn openpam_ttyconv( | 419 pub fn openpam_ttyconv( |
423 n: c_int, | 420 n: c_int, |
424 _msg: *const *const pam_message, | 421 _msg: *const *const pam_message, |
425 _resp: *mut *mut pam_response, | 422 _resp: *mut *mut pam_response, |
435 /// # use std::ptr; | 432 /// # use std::ptr; |
436 /// use libpam_sys::*; | 433 /// use libpam_sys::*; |
437 /// # let service = CString::new("whatever").unwrap(); | 434 /// # let service = CString::new("whatever").unwrap(); |
438 /// # let user = CString::new("whatever").unwrap(); | 435 /// # let user = CString::new("whatever").unwrap(); |
439 /// let mut handle: *mut pam_handle = ptr::null_mut(); | 436 /// let mut handle: *mut pam_handle = ptr::null_mut(); |
440 /// let mut conv = pam_conv{ | 437 /// let mut conv = pam_conv { |
441 /// conv: openpam_nullconv, | 438 /// conv: openpam_nullconv, |
442 /// appdata_ptr: ptr::null_mut(), | 439 /// appdata_ptr: ptr::null_mut(), |
443 /// }; | 440 /// }; |
444 /// let result = unsafe { pam_start( | 441 /// let result = unsafe { pam_start(service.as_ptr(), user.as_ptr(), &mut conv, &mut handle) }; |
445 /// service.as_ptr(), user.as_ptr(), &mut conv, &mut handle | |
446 /// ) }; | |
447 /// ``` | 442 /// ``` |
448 pub fn openpam_nullconv( | 443 pub fn openpam_nullconv( |
449 n: c_int, | 444 n: c_int, |
450 _msg: *const *const pam_message, | 445 _msg: *const *const pam_message, |
451 _resp: *mut *mut pam_response, | 446 _resp: *mut *mut pam_response, |