Mercurial > crates > nonstick
annotate libpam-sys/libpam-sys-consts/src/lib.rs @ 170:f052e2417195
Completely avoid using libpam_sys if we're not actually linking.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Wed, 16 Jul 2025 18:45:20 -0400 |
| parents | e9354e655f38 |
| children |
| rev | line source |
|---|---|
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
1 pub mod constants; |
|
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
2 |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
3 /// Information about the PAM implementation you're using right now. |
|
119
476a22db8639
Add PtrPtrVec to make it easy to pass pointer-to-pointers to PAM.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
4 /// |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
5 /// This module contains constants and values that can be used at build-script, |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
6 /// compile, and run time to determine what PAM implementation you're using. |
|
119
476a22db8639
Add PtrPtrVec to make it easy to pass pointer-to-pointers to PAM.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
7 /// |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
8 /// ## Always available |
|
119
476a22db8639
Add PtrPtrVec to make it easy to pass pointer-to-pointers to PAM.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
9 /// |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
10 /// [`PamImpl::CURRENT`] will tell you what version of PAM you're using. |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
11 /// It can be imported in any Rust code, from build scripts to runtime. |
|
119
476a22db8639
Add PtrPtrVec to make it easy to pass pointer-to-pointers to PAM.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
12 /// |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
13 /// ## Compile time |
|
119
476a22db8639
Add PtrPtrVec to make it easy to pass pointer-to-pointers to PAM.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
14 /// |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
15 /// Use [`enable_pam_impl_cfg`] in your `build.rs` to generate custom `#[cfg]`s |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
16 /// for conditional compilation based on PAM implementation. |
|
119
476a22db8639
Add PtrPtrVec to make it easy to pass pointer-to-pointers to PAM.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
17 /// |
| 161 | 18 /// ``` |
| 19 /// // Your package's build.rs: | |
| 20 /// | |
| 21 /// use libpam_sys_consts::pam_impl; | |
| 22 /// // also available at libpam_sys::pam_impl | |
| 23 /// | |
| 24 /// fn main() { | |
| 25 /// pam_impl::enable_pam_impl_cfg(); | |
| 26 /// // whatever else you do in your build script. | |
| 27 /// } | |
| 28 /// ``` | |
| 29 /// | |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
30 /// This will set the current `pam_impl` as well as registering all known |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
31 /// PAM implementations with `rustc-check-cfg` to get cfg-checking. |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
32 /// |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
33 /// The names that appear in the `cfg` variables are the same as the values |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
34 /// in the [`PamImpl`] enum. |
|
119
476a22db8639
Add PtrPtrVec to make it easy to pass pointer-to-pointers to PAM.
Paul Fisher <paul@pfish.zone>
parents:
118
diff
changeset
|
35 /// |
|
155
ab8020566cd9
Only use real PAM constants for logging within `nonstick/libpam`.
Paul Fisher <paul@pfish.zone>
parents:
148
diff
changeset
|
36 /// ```ignore |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
37 /// #[cfg(pam_impl = "OpenPam")] |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
38 /// fn openpam_specific_func(handle: *const libpam_sys::pam_handle) { |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
39 /// let environ = libpam_sys::pam_getenvlist(handle); |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
40 /// // ... |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
41 /// libpam_sys::openpam_free_envlist() |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
42 /// } |
|
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
43 /// |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
44 /// // This will give you a warning since "UnknownImpl" is not in the cfg. |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
45 /// #[cfg(not(pam_impl = "UnknownImpl"))] |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
46 /// fn do_something() { |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
47 /// // ... |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
48 /// } |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
49 /// ``` |
|
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
50 /// |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
51 /// The [`pam_impl_name!`] macro will expand to this same value, currently |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
52 #[doc = concat!("`", env!("LIBPAMSYS_IMPL"), "`.")] |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
53 pub mod pam_impl; |
|
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
54 |
|
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
55 #[doc(inline)] |
|
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
56 pub use pam_impl::*; |
