1wilkens / pam-sys Goto Github PK
View Code? Open in Web Editor NEWRust FFI bindings to the Linux Pluggable Authentication Modules (PAM)
Home Page: https://docs.rs/pam-sys/
License: Apache License 2.0
Rust FFI bindings to the Linux Pluggable Authentication Modules (PAM)
Home Page: https://docs.rs/pam-sys/
License: Apache License 2.0
Build log can be seen here: https://docs.rs/crate/pam-sys/1.0.0-alpha1/builds/198171
OS: Ubuntu
Version: 20.04.4
Compiling pam-sys v1.0.0-alpha4 (https://github.com/1wilkens/pam-sys.git?branch=master#d292fb94)
error: failed to run custom build command for `pam-sys v1.0.0-alpha4 (https://github.com/1wilkens/pam-sys.git?branch=master#d292fb94)`
Caused by:
process didn't exit successfully: `/home/janabhumi/repos/warlock/target/debug/build/pam-sys-659db3b7e443d33b/build-script-build` (exit status: 101)
--- stdout
cargo:rustc-link-lib=pam
cargo:rustc-link-lib=pam_misc
cargo:rerun-if-changed=wrapper.h
--- stderr
wrapper.h:1:10: fatal error: 'security/pam_appl.h' file not found
wrapper.h:1:10: fatal error: 'security/pam_appl.h' file not found, err: true
thread 'main' panicked at 'Unable to generate bindings: ()', /home/janabhumi/.cargo/git/checkouts/pam-sys-1899b10cd9237027/d292fb9/build.rs:69:10
cargo --version
cargo 1.78.0 (54d8815d0 2024-03-26)
error: failed to run custom build command for `pam-sys v1.0.0-alpha5`
Caused by:
process didn't exit successfully: `/app/target/debug/build/pam-sys-b0342a7291a9caed/build-script-build` (exit status: 101)
--- stdout
cargo:rustc-link-lib=pam
cargo:rustc-link-lib=pam_misc
cargo:rerun-if-changed=wrapper.h
--- stderr
thread 'main' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clang-sys-1.7.0/src/lib.rs:1860:1:
a `libclang` shared library is not loaded on this thread
stack backtrace:
0: 0x5fd2c4ab56a2 - std::backtrace_rs::backtrace::libunwind::trace::he4ee80166a02c846
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
1: 0x5fd2c4ab56a2 - std::backtrace_rs::backtrace::trace_unsynchronized::h476faccf57e88641
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x5fd2c4ab56a2 - std::sys_common::backtrace::_print_fmt::h430c922a77e7a59c
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:68:5
3: 0x5fd2c4ab56a2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hffecb437d922f988
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:44:22
4: 0x5fd2c4ade14c - core::fmt::rt::Argument::fmt::hf3df69369399bfa9
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/rt.rs:142:9
5: 0x5fd2c4ade14c - core::fmt::write::hd9a8d7d029f9ea1a
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/mod.rs:1153:17
6: 0x5fd2c4ab2d0f - std::io::Write::write_fmt::h0e1226b2b8d973fe
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:1843:15
7: 0x5fd2c4ab5474 - std::sys_common::backtrace::_print::hd2df4a083f6e69b8
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:47:5
8: 0x5fd2c4ab5474 - std::sys_common::backtrace::print::he907f6ad7eee41cb
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:34:9
9: 0x5fd2c4ab6a8b - std::panicking::default_hook::{{closure}}::h3926193b61c9ca9b
10: 0x5fd2c4ab67e3 - std::panicking::default_hook::h25ba2457dea68e65
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:292:9
11: 0x5fd2c4ab6f2d - std::panicking::rust_panic_with_hook::h0ad14d90dcf5224f
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:779:13
12: 0x5fd2c4ab6e02 - std::panicking::begin_panic_handler::{{closure}}::h4a1838a06f542647
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:657:13
13: 0x5fd2c4ab5b76 - std::sys_common::backtrace::__rust_end_short_backtrace::h77cc4dc3567ca904
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:171:18
14: 0x5fd2c4ab6b34 - rust_begin_unwind
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
15: 0x5fd2c43ce2f5 - core::panicking::panic_fmt::h940d4fd01a4b4fd1
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
16: 0x5fd2c4adc921 - core::panicking::panic_display::h277de99b44f66bbb
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:197:5
17: 0x5fd2c43ce2bb - core::panicking::panic_str::h6e5626df23cd5848
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:172:5
18: 0x5fd2c43ce2bb - core::option::expect_failed::h9d76e63e47b0f089
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/option.rs:1995:5
19: 0x5fd2c48e6fe2 - core::option::Option<T>::expect::hdbfc92d91f647cf5
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/option.rs:896:21
20: 0x5fd2c48c8924 - clang_sys::clang_createIndex::h64a508ff1feb426d
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clang-sys-1.7.0/src/link.rs:177:25
21: 0x5fd2c44c70fd - bindgen::clang::Index::new::hbacd5ba925a5b785
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.69.4/clang.rs:1780:20
22: 0x5fd2c4567c95 - bindgen::ir::context::BindgenContext::new::h6a4fd09192a29480
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.69.4/ir/context.rs:541:21
23: 0x5fd2c445854a - bindgen::Bindings::generate::h5bc3aa94245a0042
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.69.4/lib.rs:896:27
24: 0x5fd2c44562b7 - bindgen::Builder::generate::h04c16c191f11bc60
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.69.4/lib.rs:349:9
25: 0x5fd2c43d237b - build_script_build::main::h510fb405cdc8811d
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pam-sys-1.0.0-alpha5/build.rs:66:20
26: 0x5fd2c43cf98b - core::ops::function::FnOnce::call_once::ha8b3949a493e800b
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:250:5
27: 0x5fd2c43ceb5e - std::sys_common::backtrace::__rust_begin_short_backtrace::h06170cb89002f0da
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:155:18
28: 0x5fd2c43cf521 - std::rt::lang_start::{{closure}}::h59113a629f058471
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/rt.rs:166:18
29: 0x5fd2c4aaeb83 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h52f5991f9ab8b369
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:284:13
30: 0x5fd2c4aaeb83 - std::panicking::try::do_call::h0ac4bee9a397a1bf
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:552:40
31: 0x5fd2c4aaeb83 - std::panicking::try::hc005decaf198d0ed
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:516:19
32: 0x5fd2c4aaeb83 - std::panic::catch_unwind::hb0f967d870b2a382
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panic.rs:146:14
33: 0x5fd2c4aaeb83 - std::rt::lang_start_internal::{{closure}}::hd140b84b0efe534b
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/rt.rs:148:48
34: 0x5fd2c4aaeb83 - std::panicking::try::do_call::h1ddfaf1d0d576c38
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:552:40
35: 0x5fd2c4aaeb83 - std::panicking::try::hdd4bdf855547659f
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:516:19
36: 0x5fd2c4aaeb83 - std::panic::catch_unwind::h276ba91c7706110c
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panic.rs:146:14
37: 0x5fd2c4aaeb83 - std::rt::lang_start_internal::h103c42a9c4e95084
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/rt.rs:148:20
38: 0x5fd2c43cf4fa - std::rt::lang_start::hb3caf5884d69df09
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/rt.rs:165:17
39: 0x5fd2c43d25fe - main
40: 0x7e6e7881a083 - __libc_start_main
at /build/glibc-e2p3jK/glibc-2.31/csu/../csu/libc-start.c:308:16
41: 0x5fd2c43cea8e - _start
42: 0x0 - <unknown>
warning: build failed, waiting for other jobs to finish...
Running clippy
against master
produces a couple of lint failures:
warning: Comparing with null is better expressed by the .is_null() method
--> src/wrapped.rs:121:12
|
121 | if env != ptr::null(){
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(clippy::cmp_null)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cmp_null
error: this public function dereferences a raw pointer but is not marked `unsafe`
--> src/wrapped.rs:206:17
|
206 | prompt
| ^^^^^^
|
= note: `#[deny(clippy::not_unsafe_ptr_arg_deref)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
The second could theoretically lead to undefined behavior if the user passes an expired pointer. Either marking the function as unsafe
or changing the type of the prompt
argument to Option<&CStr>
should fix the issue.
Currently the published package contains files irrelevant for the crate such as .travis.yml
and .gitignore
. We should fix that by adding the following line to Cargo.toml
.
include: [ "src/lib.rs", "LICENSE-*", "README.md", "CHANGELOG.md", "wrapper.h", "build.rs", ]
Hey,
Do you know or have any ETA when you release 1.0.0 stable?
Hello, i am trying to use pam-auth, that depends on pam-sys, under FreeBSD.
Building will fail with the following error :
-freebsd/lib/libcompiler_builtins-ac67d1cbae2d63b8.rlib" "-Wl,-Bdynamic" "-l" "ssh2" "-l" "z" "-l" "pam" "-l" "pam_misc" "-l" "ssl" "-l" "crypto" "-l" "sqlite3" "-l" "util" "-l" "execinfo" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util"
= note: /usr/bin/ld: cannot find -lpam_misc
cc: error: linker command failed with exit code 1 (use -v to see invocation)
I saw that the last commit excludes linking over pam_misc under macos.
The same must applies for at least FreeBSD.
I dont want to spread false informations, but as far as i know, linking over pam_misc is only done under linux (correct me if i am wrong).
PS: I see that latest version on github is 0.5.2 while crates.io reference 0.5.3, why ?
OpenPAM does not match Linux PAM 100% and thus is not compatible with this library in its current state.
To correctly support openPAM, we should get a comprehensive list of operating systems that use it, match that with the ones Rust builds for and properly handle API differences in a uniform way.
Noticed this function but don't see the FFI binding in the docs.
Functions like pam_prompt
and pam_syslog
are blocklisted in build.rs
.
Is there any particular reason for that? I think when writing a pam module the function pam_prompt
is the intended way to communicate with the user like when calling pam_error
in C, which is currently not available with the pam-sys
and therefore also with pam
crates.
I saw that the initial blocking of those functions were comitted in this commit, which indicates that there is an issue with openPAM/freeBSD. Maybe it is sufficient to exclude those functions for this platform?
Furthermore, pam_error
does not get exported, probably due to this rust-bindgen issue.
My current workaround is to implement functions like pam_error
in the pam
crate. An alternative would be to re-implement those functions as a macro in this crate, but I personally like the first method more as it is more explicit and the current structure of the pam
crate does require a wrapping function anyways.
I do have patches ready for exporting pam_prompt
and pam_syslog
as well as using pam_prompt
in your pam
crate. If there is no particular reason why the functions pam_prompt
and pam_syslog
were excluded in the first place, I would submit these patches as PRs.
Hey,
The bindings don't build on OS X Sierra because it attempts linking against pam_misc
, which apparently does not exist.
See the below trace:
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-m64" "-L" "/usr/local/Cellar/rust/1.16.0/lib/rustlib/x86_64-apple-darwin/lib" "/Users/rmuller/Dropbox/Private/Development/test/target/debug/deps/test.0.o" "-o" "/Users/rmuller/Dropbox/Private/Development/test/target/debug/deps/libtest.dylib" "/Users/rmuller/Dropbox/Private/Development/test/target/debug/deps/test.metadata.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/rmuller/Dropbox/Private/Development/test/target/debug/deps" "-L" "/usr/local/Cellar/rust/1.16.0/lib/rustlib/x86_64-apple-darwin/lib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/libpam_sys-ab9e9d3b8ab186e5.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/liblibc-5dc7b85e748840b4.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/libstd-a71699d9a2708b89.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/librand-670a947df89a2ccc.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/libcollections-5b3898f8c5f0e814.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/libstd_unicode-a3427337083eea0c.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/libpanic_unwind-938ad17540379fcc.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/libunwind-cb9ccdab2eb2dc79.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/liballoc-a6daae03bd7bd954.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/liballoc_system-997c707c901d0bda.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/liblibc-4e8e9be8cd6f1b87.rlib" "-Wl,-force_load,/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/libcore-f29b4bdb6959fcf5.rlib" "/var/folders/61/gpv4h95539n7fwl076y822bhr5yvck/T/rustc.OiuyAIbfTR4x/libcompiler_builtins-87bae4784d673068.rlib" "-l" "pam" "-l" "pam_misc" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-dynamiclib" "-Wl,-dylib"
= note: ld: library not found for -lpam_misc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there a way this binding can be made optional?
Description
I use pam-sys crate for my project. I'm trying resolve every dependencies issues for my project. So to do that I spawned a new archlinux:latest
and installed :
pacman -S git sudo pam pkgconf openssl curl cargo-make gcc llvm clang libcap libcap-ng libelf libxml2 linux-headers linux-api-headers make
error[E0412]: cannot find type `__builtin_va_list` in this scope
--> target/release/build/pam-sys-92ed0c7825a00e53/out/bindings.rs:277:27
|
277 | pub type __gnuc_va_list = __builtin_va_list;
| ^^^^^^^^^^^^^^^^^ not found in this scope
For more information about this error, try `rustc --explain E0412`.
error: could not compile `pam-sys` (lib) due to previous error
I'm stuck, this should be working...
Here is the bindings.rs file :
/* automatically generated by rust-bindgen 0.59.2 */
use libc::{uid_t, gid_t, group, passwd, spwd};
pub const PAM_SUCCESS: i32 = 0;
pub const PAM_OPEN_ERR: i32 = 1;
pub const PAM_SYMBOL_ERR: i32 = 2;
pub const PAM_SERVICE_ERR: i32 = 3;
pub const PAM_SYSTEM_ERR: i32 = 4;
pub const PAM_BUF_ERR: i32 = 5;
pub const PAM_PERM_DENIED: i32 = 6;
pub const PAM_AUTH_ERR: i32 = 7;
pub const PAM_CRED_INSUFFICIENT: i32 = 8;
pub const PAM_AUTHINFO_UNAVAIL: i32 = 9;
pub const PAM_USER_UNKNOWN: i32 = 10;
pub const PAM_MAXTRIES: i32 = 11;
pub const PAM_NEW_AUTHTOK_REQD: i32 = 12;
pub const PAM_ACCT_EXPIRED: i32 = 13;
pub const PAM_SESSION_ERR: i32 = 14;
pub const PAM_CRED_UNAVAIL: i32 = 15;
pub const PAM_CRED_EXPIRED: i32 = 16;
pub const PAM_CRED_ERR: i32 = 17;
pub const PAM_NO_MODULE_DATA: i32 = 18;
pub const PAM_CONV_ERR: i32 = 19;
pub const PAM_AUTHTOK_ERR: i32 = 20;
pub const PAM_AUTHTOK_RECOVERY_ERR: i32 = 21;
pub const PAM_AUTHTOK_LOCK_BUSY: i32 = 22;
pub const PAM_AUTHTOK_DISABLE_AGING: i32 = 23;
pub const PAM_TRY_AGAIN: i32 = 24;
pub const PAM_IGNORE: i32 = 25;
pub const PAM_ABORT: i32 = 26;
pub const PAM_AUTHTOK_EXPIRED: i32 = 27;
pub const PAM_MODULE_UNKNOWN: i32 = 28;
pub const PAM_BAD_ITEM: i32 = 29;
pub const PAM_CONV_AGAIN: i32 = 30;
pub const PAM_INCOMPLETE: i32 = 31;
pub const PAM_SILENT: i32 = 32768;
pub const PAM_DISALLOW_NULL_AUTHTOK: i32 = 1;
pub const PAM_ESTABLISH_CRED: i32 = 2;
pub const PAM_DELETE_CRED: i32 = 4;
pub const PAM_REINITIALIZE_CRED: i32 = 8;
pub const PAM_REFRESH_CRED: i32 = 16;
pub const PAM_CHANGE_EXPIRED_AUTHTOK: i32 = 32;
pub const PAM_SERVICE: i32 = 1;
pub const PAM_USER: i32 = 2;
pub const PAM_TTY: i32 = 3;
pub const PAM_RHOST: i32 = 4;
pub const PAM_CONV: i32 = 5;
pub const PAM_AUTHTOK: i32 = 6;
pub const PAM_OLDAUTHTOK: i32 = 7;
pub const PAM_RUSER: i32 = 8;
pub const PAM_USER_PROMPT: i32 = 9;
pub const PAM_FAIL_DELAY: i32 = 10;
pub const PAM_XDISPLAY: i32 = 11;
pub const PAM_XAUTHDATA: i32 = 12;
pub const PAM_AUTHTOK_TYPE: i32 = 13;
pub const PAM_DATA_SILENT: i32 = 1073741824;
pub const PAM_PROMPT_ECHO_OFF: i32 = 1;
pub const PAM_PROMPT_ECHO_ON: i32 = 2;
pub const PAM_ERROR_MSG: i32 = 3;
pub const PAM_TEXT_INFO: i32 = 4;
pub const PAM_RADIO_TYPE: i32 = 5;
pub const PAM_BINARY_PROMPT: i32 = 7;
pub const PAM_MAX_NUM_MSG: i32 = 32;
pub const PAM_MAX_MSG_SIZE: i32 = 512;
pub const PAM_MAX_RESP_SIZE: i32 = 512;
pub const PAM_AUTHTOK_RECOVER_ERR: i32 = 21;
pub const PAM_BP_MAX_LENGTH: i32 = 131072;
pub const PAM_BPC_FALSE: i32 = 0;
pub const PAM_BPC_TRUE: i32 = 1;
pub const PAM_BPC_OK: i32 = 1;
pub const PAM_BPC_SELECT: i32 = 2;
pub const PAM_BPC_DONE: i32 = 3;
pub const PAM_BPC_FAIL: i32 = 4;
pub const PAM_BPC_GETENV: i32 = 65;
pub const PAM_BPC_PUTENV: i32 = 66;
pub const PAM_BPC_TEXT: i32 = 67;
pub const PAM_BPC_ERROR: i32 = 68;
pub const PAM_BPC_PROMPT: i32 = 69;
pub const PAM_BPC_PASS: i32 = 70;
pub const PAM_PRELIM_CHECK: i32 = 16384;
pub const PAM_UPDATE_AUTHTOK: i32 = 8192;
pub const PAM_DATA_REPLACE: i32 = 536870912;
pub const PAM_MODUTIL_NGROUPS: i32 = 64;
pub type pam_handle_t = u8;
extern "C" {
pub fn pam_set_item(
pamh: *mut pam_handle_t,
item_type: libc::c_int,
item: *const libc::c_void,
) -> libc::c_int;
}
extern "C" {
pub fn pam_get_item(
pamh: *const pam_handle_t,
item_type: libc::c_int,
item: *mut *const libc::c_void,
) -> libc::c_int;
}
extern "C" {
pub fn pam_strerror(pamh: *mut pam_handle_t, errnum: libc::c_int) -> *const libc::c_char;
}
extern "C" {
pub fn pam_putenv(pamh: *mut pam_handle_t, name_value: *const libc::c_char) -> libc::c_int;
}
extern "C" {
pub fn pam_getenv(pamh: *mut pam_handle_t, name: *const libc::c_char) -> *const libc::c_char;
}
extern "C" {
pub fn pam_getenvlist(pamh: *mut pam_handle_t) -> *mut *mut libc::c_char;
}
extern "C" {
pub fn pam_fail_delay(pamh: *mut pam_handle_t, musec_delay: libc::c_uint) -> libc::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct pam_message {
pub msg_style: libc::c_int,
pub msg: *const libc::c_char,
}
#[test]
fn bindgen_test_layout_pam_message() {
assert_eq!(
::std::mem::size_of::<pam_message>(),
16usize,
concat!("Size of: ", stringify!(pam_message))
);
assert_eq!(
::std::mem::align_of::<pam_message>(),
8usize,
concat!("Alignment of ", stringify!(pam_message))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_message>())).msg_style as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(pam_message),
"::",
stringify!(msg_style)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_message>())).msg as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(pam_message),
"::",
stringify!(msg)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct pam_response {
pub resp: *mut libc::c_char,
pub resp_retcode: libc::c_int,
}
#[test]
fn bindgen_test_layout_pam_response() {
assert_eq!(
::std::mem::size_of::<pam_response>(),
16usize,
concat!("Size of: ", stringify!(pam_response))
);
assert_eq!(
::std::mem::align_of::<pam_response>(),
8usize,
concat!("Alignment of ", stringify!(pam_response))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_response>())).resp as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(pam_response),
"::",
stringify!(resp)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_response>())).resp_retcode as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(pam_response),
"::",
stringify!(resp_retcode)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct pam_conv {
pub conv: ::std::option::Option<
unsafe extern "C" fn(
num_msg: libc::c_int,
msg: *mut *const pam_message,
resp: *mut *mut pam_response,
appdata_ptr: *mut libc::c_void,
) -> libc::c_int,
>,
pub appdata_ptr: *mut libc::c_void,
}
#[test]
fn bindgen_test_layout_pam_conv() {
assert_eq!(
::std::mem::size_of::<pam_conv>(),
16usize,
concat!("Size of: ", stringify!(pam_conv))
);
assert_eq!(
::std::mem::align_of::<pam_conv>(),
8usize,
concat!("Alignment of ", stringify!(pam_conv))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_conv>())).conv as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(pam_conv),
"::",
stringify!(conv)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_conv>())).appdata_ptr as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(pam_conv),
"::",
stringify!(appdata_ptr)
)
);
}
extern "C" {
pub fn pam_start(
service_name: *const libc::c_char,
user: *const libc::c_char,
pam_conversation: *const pam_conv,
pamh: *mut *mut pam_handle_t,
) -> libc::c_int;
}
extern "C" {
pub fn pam_start_confdir(
service_name: *const libc::c_char,
user: *const libc::c_char,
pam_conversation: *const pam_conv,
confdir: *const libc::c_char,
pamh: *mut *mut pam_handle_t,
) -> libc::c_int;
}
extern "C" {
pub fn pam_end(pamh: *mut pam_handle_t, pam_status: libc::c_int) -> libc::c_int;
}
extern "C" {
pub fn pam_authenticate(pamh: *mut pam_handle_t, flags: libc::c_int) -> libc::c_int;
}
extern "C" {
pub fn pam_setcred(pamh: *mut pam_handle_t, flags: libc::c_int) -> libc::c_int;
}
extern "C" {
pub fn pam_acct_mgmt(pamh: *mut pam_handle_t, flags: libc::c_int) -> libc::c_int;
}
extern "C" {
pub fn pam_open_session(pamh: *mut pam_handle_t, flags: libc::c_int) -> libc::c_int;
}
extern "C" {
pub fn pam_close_session(pamh: *mut pam_handle_t, flags: libc::c_int) -> libc::c_int;
}
extern "C" {
pub fn pam_chauthtok(pamh: *mut pam_handle_t, flags: libc::c_int) -> libc::c_int;
}
pub type __gnuc_va_list = __builtin_va_list;
extern "C" {
pub fn pam_get_authtok(
pamh: *mut pam_handle_t,
item: libc::c_int,
authtok: *mut *const libc::c_char,
prompt: *const libc::c_char,
) -> libc::c_int;
}
extern "C" {
pub fn pam_get_authtok_noverify(
pamh: *mut pam_handle_t,
authtok: *mut *const libc::c_char,
prompt: *const libc::c_char,
) -> libc::c_int;
}
extern "C" {
pub fn pam_get_authtok_verify(
pamh: *mut pam_handle_t,
authtok: *mut *const libc::c_char,
prompt: *const libc::c_char,
) -> libc::c_int;
}
extern "C" {
pub fn pam_misc_paste_env(
pamh: *mut pam_handle_t,
user_env: *const *const libc::c_char,
) -> libc::c_int;
}
extern "C" {
pub fn pam_misc_drop_env(env: *mut *mut libc::c_char) -> *mut *mut libc::c_char;
}
extern "C" {
pub fn pam_misc_setenv(
pamh: *mut pam_handle_t,
name: *const libc::c_char,
value: *const libc::c_char,
readonly: libc::c_int,
) -> libc::c_int;
}
extern "C" {
pub fn pam_set_data(
pamh: *mut pam_handle_t,
module_data_name: *const libc::c_char,
data: *mut libc::c_void,
cleanup: ::std::option::Option<
unsafe extern "C" fn(
pamh: *mut pam_handle_t,
data: *mut libc::c_void,
error_status: libc::c_int,
),
>,
) -> libc::c_int;
}
extern "C" {
pub fn pam_get_data(
pamh: *const pam_handle_t,
module_data_name: *const libc::c_char,
data: *mut *const libc::c_void,
) -> libc::c_int;
}
extern "C" {
pub fn pam_get_user(
pamh: *mut pam_handle_t,
user: *mut *const libc::c_char,
prompt: *const libc::c_char,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_check_user_in_passwd(
pamh: *mut pam_handle_t,
user_name: *const libc::c_char,
file_name: *const libc::c_char,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_getpwnam(pamh: *mut pam_handle_t, user: *const libc::c_char) -> *mut passwd;
}
extern "C" {
pub fn pam_modutil_getpwuid(pamh: *mut pam_handle_t, uid: uid_t) -> *mut passwd;
}
extern "C" {
pub fn pam_modutil_getgrnam(pamh: *mut pam_handle_t, group: *const libc::c_char) -> *mut group;
}
extern "C" {
pub fn pam_modutil_getgrgid(pamh: *mut pam_handle_t, gid: gid_t) -> *mut group;
}
extern "C" {
pub fn pam_modutil_getspnam(pamh: *mut pam_handle_t, user: *const libc::c_char) -> *mut spwd;
}
extern "C" {
pub fn pam_modutil_user_in_group_nam_nam(
pamh: *mut pam_handle_t,
user: *const libc::c_char,
group: *const libc::c_char,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_user_in_group_nam_gid(
pamh: *mut pam_handle_t,
user: *const libc::c_char,
group: gid_t,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_user_in_group_uid_nam(
pamh: *mut pam_handle_t,
user: uid_t,
group: *const libc::c_char,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_user_in_group_uid_gid(
pamh: *mut pam_handle_t,
user: uid_t,
group: gid_t,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_getlogin(pamh: *mut pam_handle_t) -> *const libc::c_char;
}
extern "C" {
pub fn pam_modutil_read(
fd: libc::c_int,
buffer: *mut libc::c_char,
count: libc::c_int,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_write(
fd: libc::c_int,
buffer: *const libc::c_char,
count: libc::c_int,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_audit_write(
pamh: *mut pam_handle_t,
type_: libc::c_int,
message: *const libc::c_char,
retval: libc::c_int,
) -> libc::c_int;
}
#[repr(C)]
pub struct pam_modutil_privs {
pub grplist: *mut gid_t,
pub number_of_groups: libc::c_int,
pub allocated: libc::c_int,
pub old_gid: gid_t,
pub old_uid: uid_t,
pub is_dropped: libc::c_int,
}
#[test]
fn bindgen_test_layout_pam_modutil_privs() {
assert_eq!(
::std::mem::size_of::<pam_modutil_privs>(),
32usize,
concat!("Size of: ", stringify!(pam_modutil_privs))
);
assert_eq!(
::std::mem::align_of::<pam_modutil_privs>(),
8usize,
concat!("Alignment of ", stringify!(pam_modutil_privs))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_modutil_privs>())).grplist as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(pam_modutil_privs),
"::",
stringify!(grplist)
)
);
assert_eq!(
unsafe {
&(*(::std::ptr::null::<pam_modutil_privs>())).number_of_groups as *const _ as usize
},
8usize,
concat!(
"Offset of field: ",
stringify!(pam_modutil_privs),
"::",
stringify!(number_of_groups)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_modutil_privs>())).allocated as *const _ as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(pam_modutil_privs),
"::",
stringify!(allocated)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_modutil_privs>())).old_gid as *const _ as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(pam_modutil_privs),
"::",
stringify!(old_gid)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_modutil_privs>())).old_uid as *const _ as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(pam_modutil_privs),
"::",
stringify!(old_uid)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<pam_modutil_privs>())).is_dropped as *const _ as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(pam_modutil_privs),
"::",
stringify!(is_dropped)
)
);
}
extern "C" {
pub fn pam_modutil_drop_priv(
pamh: *mut pam_handle_t,
p: *mut pam_modutil_privs,
pw: *const passwd,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_regain_priv(
pamh: *mut pam_handle_t,
p: *mut pam_modutil_privs,
) -> libc::c_int;
}
pub const pam_modutil_redirect_fd_PAM_MODUTIL_IGNORE_FD: pam_modutil_redirect_fd = 0;
pub const pam_modutil_redirect_fd_PAM_MODUTIL_PIPE_FD: pam_modutil_redirect_fd = 1;
pub const pam_modutil_redirect_fd_PAM_MODUTIL_NULL_FD: pam_modutil_redirect_fd = 2;
pub type pam_modutil_redirect_fd = libc::c_uint;
extern "C" {
pub fn pam_modutil_sanitize_helper_fds(
pamh: *mut pam_handle_t,
redirect_stdin: pam_modutil_redirect_fd,
redirect_stdout: pam_modutil_redirect_fd,
redirect_stderr: pam_modutil_redirect_fd,
) -> libc::c_int;
}
extern "C" {
pub fn pam_modutil_search_key(
pamh: *mut pam_handle_t,
file_name: *const libc::c_char,
key: *const libc::c_char,
) -> *mut libc::c_char;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.