annotate libpam-sys/src/lib.rs @ 118:39760dfc9b3b

Detect PAM library based only on system lib; rename minimal lib to XSso. Also formats and assorted other cleanup.
author Paul Fisher <paul@pfish.zone>
date Sun, 29 Jun 2025 20:13:03 -0400
parents 2346fd501b7a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
106
49d9e2b5c189 An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff changeset
1 #![doc = include_str!("../README.md")]
49d9e2b5c189 An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff changeset
2 //!
108
e97534be35e3 Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents: 106
diff changeset
3 //! ## PAM implementation
106
49d9e2b5c189 An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff changeset
4 //!
110
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
5 #![doc = concat!("This documentation was built for the **", __pam_impl_name__!(), "** implementation.")]
108
e97534be35e3 Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents: 106
diff changeset
6
110
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
7 use libpam_sys_impls::{__pam_impl_enum__, __pam_impl_name__};
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
8
106
49d9e2b5c189 An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff changeset
9 mod constants;
118
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 110
diff changeset
10 mod functions;
106
49d9e2b5c189 An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff changeset
11 pub mod helpers;
109
bb465393621f Minor cleanup and reorg.
Paul Fisher <paul@pfish.zone>
parents: 108
diff changeset
12 mod structs;
106
49d9e2b5c189 An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff changeset
13
110
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
14 /// A `cfg`-like attribute macro for code specific to one PAM implementation.
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
15 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
16 /// Different versions of PAM export different functions and have some
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
17 /// meaningful internal implementation differences, like the way `pam_conv`
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
18 /// is handled (see [the Linux-PAM man page for details][man7]).
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
19 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
20 /// This macro will let you figure out which PAM you're compiling
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
21 /// (and eventually running) against so you can make those critical changes.
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
22 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
23 /// The implementation names are the same as those in the [`PamImpl`] enum.
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
24 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
25 /// ```
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
26 /// use libpam_sys::cfg_pam_impl;
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
27 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
28 /// #[cfg_pam_impl("Sun")]
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
29 /// fn do_something() { /* Illumos/Solaris-only code */ }
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
30 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
31 /// #[cfg_pam_impl(not("Sun"))]
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
32 /// fn do_something() { /* non-Illumos code */ }
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
33 ///
118
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 110
diff changeset
34 /// #[cfg_pam_impl(any("LinuxPam", "XSso"))]
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 110
diff changeset
35 /// fn do_something_else() { /* Linux-PAM or X/SSO-spec PAM */ }
110
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
36 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
37 /// #[cfg_pam_impl(not(any("Sun", "OpenPam")))]
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
38 /// fn do_a_third_thing() { /* Neither Sun nor OpenPAM */ }
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
39 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
40 /// #[cfg_pam_impl(any())]
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
41 /// fn this_will_never_build() { /* why would you do this? */ }
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
42 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
43 /// #[cfg_pam_impl(not(any()))]
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
44 /// fn this_will_always_build() { /* I, sure, whatever, you do you. */ }
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
45 /// ```
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
46 ///
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
47 /// [man7]: https://man7.org/linux/man-pages/man3/pam_conv.3.html
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
48 #[doc(inline)]
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
49 pub use libpam_sys_impls::cfg_pam_impl;
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
50
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
51 // Looking for the actual code defining this enum?
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
52 // It's in the build.rs file for libpam_sys_impls.
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
53 __pam_impl_enum__!(#[non_exhaustive]);
2346fd501b7a Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents: 109
diff changeset
54
106
49d9e2b5c189 An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff changeset
55 #[doc(inline)]
109
bb465393621f Minor cleanup and reorg.
Paul Fisher <paul@pfish.zone>
parents: 108
diff changeset
56 pub use crate::{constants::*, structs::*};