Mercurial > crates > nonstick
annotate libpam-sys/src/lib.rs @ 128:ad77f2af5ff4 default tip
Fix `rustc-check-cfg` in `libpam-sys/build.rs`.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Mon, 30 Jun 2025 23:00:53 -0400 |
parents | c77846f3a979 |
children |
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 |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
9 /// 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
|
10 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
11 /// 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
|
12 /// 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
|
13 /// 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
|
14 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
15 /// 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
|
16 /// (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
|
17 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
18 /// 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
|
19 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
20 /// ``` |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
21 /// 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
|
22 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
23 /// #[cfg_pam_impl("Sun")] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
24 /// 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
|
25 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
26 /// #[cfg_pam_impl(not("Sun"))] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
27 /// 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
|
28 /// |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
29 /// #[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
|
30 /// 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
|
31 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
32 /// #[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
|
33 /// 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
|
34 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
35 /// #[cfg_pam_impl(any())] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
36 /// 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
|
37 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
38 /// #[cfg_pam_impl(not(any()))] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
39 /// 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
|
40 /// ``` |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
41 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
42 /// [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
|
43 #[doc(inline)] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
44 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
|
45 |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
46 mod constants; |
127 | 47 mod ffi; |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
48 pub mod helpers; |
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
49 |
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
50 #[doc(inline)] |
127 | 51 pub use crate::{constants::*, ffi::*}; |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
52 |
110
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
53 // 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
|
54 // 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
|
55 __pam_impl_enum__!(#[non_exhaustive]); |