Mercurial > crates > nonstick
annotate libpam-sys/libpam-sys-consts/src/lib.rs @ 155:ab8020566cd9
Only use real PAM constants for logging within `nonstick/libpam`.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Tue, 08 Jul 2025 00:49:38 -0400 |
parents | 4b3a5095f68c |
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 /// |
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
18 /// 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
|
19 /// 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
|
20 /// |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
21 /// 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
|
22 /// 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
|
23 /// |
155
ab8020566cd9
Only use real PAM constants for logging within `nonstick/libpam`.
Paul Fisher <paul@pfish.zone>
parents:
148
diff
changeset
|
24 /// ```ignore |
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
25 /// #[cfg(pam_impl = "OpenPam")] |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
26 /// 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
|
27 /// 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
|
28 /// // ... |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
29 /// libpam_sys::openpam_free_envlist() |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
30 /// } |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
31 /// |
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
32 /// // 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
|
33 /// #[cfg(not(pam_impl = "UnknownImpl"))] |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
34 /// fn do_something() { |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
35 /// // ... |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
36 /// } |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
37 /// ``` |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
38 /// |
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
39 /// 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
|
40 #[doc = concat!("`", env!("LIBPAMSYS_IMPL"), "`.")] |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
41 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
|
42 |
148
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
43 #[doc(inline)] |
4b3a5095f68c
Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents:
143
diff
changeset
|
44 pub use pam_impl::*; |