Mercurial > crates > nonstick
annotate libpam-sys/src/lib.rs @ 116:a12706e42c9d default tip
Logging, macros, and building:
- Changes logging API to accept the `Location` of the log statement.
Fixes OpenPAM implementation.
- Stops publicly exporting doc macros.
- Uses dlopen to detect the PAM library rather than header jankery.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 29 Jun 2025 18:27:51 -0400 |
parents | 2346fd501b7a |
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 |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
9 mod constants; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
10 pub mod helpers; |
109 | 11 mod structs; |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
12 |
110
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
13 /// 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
|
14 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
15 /// 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
|
16 /// 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
|
17 /// 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
|
18 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
19 /// 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
|
20 /// (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
|
21 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
22 /// 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
|
23 /// |
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 /// 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
|
26 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
27 /// #[cfg_pam_impl("Sun")] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
28 /// 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
|
29 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
30 /// #[cfg_pam_impl(not("Sun"))] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
31 /// 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
|
32 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
33 /// #[cfg_pam_impl(any("LinuxPam", "MinimalOpenPam"))] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
34 /// fn do_something_else() { /* Linux-PAM or minimal OpenPAM */ } |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
35 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
36 /// #[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
|
37 /// 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
|
38 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
39 /// #[cfg_pam_impl(any())] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
40 /// 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
|
41 /// |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
42 /// #[cfg_pam_impl(not(any()))] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
43 /// 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
|
44 /// ``` |
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 /// [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
|
47 #[doc(inline)] |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
48 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
|
49 |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
50 // 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
|
51 // 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
|
52 __pam_impl_enum__!(#[non_exhaustive]); |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
53 |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
54 #[doc(inline)] |
109 | 55 pub use crate::{constants::*, structs::*}; |