comparison build.rs @ 90:f6186e41399b

Miscellaneous fixes and cleanup: - Rename `get_user` to `username` and `get_authtok` to `authtok`. - Use pam_strerror for error messages. - Add library linkage to build.rs (it was missing???).
author Paul Fisher <paul@pfish.zone>
date Sat, 14 Jun 2025 09:30:16 -0400
parents a638a45e5f1f
children 5ddbcada30f2
comparison
equal deleted inserted replaced
89:dd3e9c4bcde3 90:f6186e41399b
2 use std::env; 2 use std::env;
3 use std::path::PathBuf; 3 use std::path::PathBuf;
4 4
5 fn main() { 5 fn main() {
6 if cfg!(feature = "link") { 6 if cfg!(feature = "link") {
7 println!("cargo::rustc-link-lib=pam");
7 println!("cargo::rustc-check-cfg=cfg(pam_impl, values(\"linux-pam\",\"openpam\"))"); 8 println!("cargo::rustc-check-cfg=cfg(pam_impl, values(\"linux-pam\",\"openpam\"))");
8 let common_builder = bindgen::Builder::default() 9 let common_builder = bindgen::Builder::default()
9 .merge_extern_blocks(true) 10 .merge_extern_blocks(true)
10 .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) 11 .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
11 .blocklist_type("pam_handle") 12 .blocklist_type("pam_handle")
14 .allowlist_function("pam_start") 15 .allowlist_function("pam_start")
15 .allowlist_function("pam_[gs]et_item") 16 .allowlist_function("pam_[gs]et_item")
16 .allowlist_function("pam_get_user") 17 .allowlist_function("pam_get_user")
17 .allowlist_function("pam_get_authtok") 18 .allowlist_function("pam_get_authtok")
18 .allowlist_function("pam_end") 19 .allowlist_function("pam_end")
19 .dynamic_link_require_all(true) 20 .allowlist_function("pam_strerror")
20 .default_macro_constant_type(MacroTypeVariation::Unsigned); 21 .default_macro_constant_type(MacroTypeVariation::Unsigned);
21 22
22 let linux_builder = common_builder 23 let linux_builder = common_builder
23 .clone() 24 .clone()
24 // This function is not available in OpenPAM. 25 // This function is not available in OpenPAM.