From f45325bd161e2c0bc97f3b69b6a2785448bdb2a9 Mon Sep 17 00:00:00 2001 From: JustPav Date: Sun, 9 Aug 2026 13:17:17 +0400 Subject: [PATCH 1/2] pam: explicitly link against libpam The PAM module didn't specify #[link(name = "pam")] on the extern "C" block, so the linker never emitted -lpam. PAM then failed to dlopen the module with undefined symbol errors for pam_get_item, pam_get_user, pam_set_data, pam_get_data --- pam/src/ffi.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pam/src/ffi.rs b/pam/src/ffi.rs index 5a798228d..9425dc6df 100644 --- a/pam/src/ffi.rs +++ b/pam/src/ffi.rs @@ -30,6 +30,7 @@ pub struct pam_handle_t { _private: [u8; 0], } +#[link(name = "pam")] unsafe extern "C" { /// Get the username pub fn pam_get_user( From 672b27dba3698bde0eed395c39b7d277024d3968 Mon Sep 17 00:00:00 2001 From: JustPav Date: Sat, 15 Aug 2026 20:16:28 +0400 Subject: [PATCH 2/2] fix: Correction in accordance with requirements --- .github/workflows/CI.yml | 7 ++++++- pam/build.rs | 11 +++++++++++ pam/src/ffi.rs | 1 - 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 pam/build.rs diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8f54349e7..165aae463 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -54,6 +54,11 @@ jobs: run: | cargo build --manifest-path ./server/Cargo.toml --no-default-features --features openssl_crypto + - name: Install PAM headers + run: | + sudo apt-get update + sudo apt-get install -y libpam0g-dev + - name: Build PAM run: | cargo build --manifest-path ./pam/Cargo.toml @@ -124,7 +129,7 @@ jobs: - uses: actions/checkout@v7 - uses: dtolnay/rust-toolchain@stable - name: Install dependencies - run: dnf install -y git meson gcc systemd + run: dnf install -y git meson gcc systemd pam-devel - name: Build (portal) working-directory: ./portal run: meson setup ./ _build --prefix /usr && ninja -C _build diff --git a/pam/build.rs b/pam/build.rs new file mode 100644 index 000000000..38fe76276 --- /dev/null +++ b/pam/build.rs @@ -0,0 +1,11 @@ +use std::env::var_os; + +fn main() { + if var_os("DOCS_RS").is_some() { + // libpam isn't available on docs.rs, and we don't need to link + // against it to build the documentation. + return; + } + + println!("cargo::rustc-link-lib=pam"); +} diff --git a/pam/src/ffi.rs b/pam/src/ffi.rs index 9425dc6df..5a798228d 100644 --- a/pam/src/ffi.rs +++ b/pam/src/ffi.rs @@ -30,7 +30,6 @@ pub struct pam_handle_t { _private: [u8; 0], } -#[link(name = "pam")] unsafe extern "C" { /// Get the username pub fn pam_get_user(