Use upstream pam_client on non-macos platforms

This commit is contained in:
Michael Pfaff 2023-06-09 09:31:17 -04:00
parent 7901a2a0b0
commit ba5fa16cc1
Signed by: michael
GPG Key ID: CF402C4A012AA9D4
3 changed files with 28 additions and 3 deletions

17
Cargo.lock generated
View File

@ -517,6 +517,20 @@ dependencies = [
"serde",
]
[[package]]
name = "pam-client"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51bd776116a7ada5ebbe31f54cdc5b1030ed7265686cf7c8a21c057a2f8dab9a"
dependencies = [
"bitflags",
"enum-repr",
"libc",
"pam-sys",
"rustversion",
"serde",
]
[[package]]
name = "pam-sys"
version = "1.0.0-alpha4"
@ -677,7 +691,8 @@ dependencies = [
"flume",
"libc",
"nix",
"pam-client",
"pam-client 0.5.0",
"pam-client 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot",
"pin-project-lite",
"quinn",

View File

@ -13,7 +13,6 @@ fast-hex = { git = "https://git.pfaff.dev/michael/fast-hex.git", version = "0.1.
flume = "0.10.14"
libc = "0.2.145"
nix = "0.26.2"
pam-client = { version = "0.5.0", path = "../../../../../Users/michael/b/rust-pam-client", default-features = false, features = ["serde"] }
parking_lot = "0.12.1"
pin-project-lite = "0.2.9"
quinn = "0.10.1"
@ -29,3 +28,9 @@ tokio = { version = "1.28.2", default-features = false, features = ["rt-multi-th
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
triggered = "0.1.2"
[target.'cfg(not(target_os = "macos"))'.dependencies]
pam-client = { version = "0.5.0", default-features = false, features = ["serde"] }
[target.'cfg(target_os = "macos")'.dependencies]
pam-client-macos = { package = "pam-client", version = "0.5.0", path = "../../../../../Users/michael/b/rust-pam-client", default-features = false, features = ["serde"] }

View File

@ -12,6 +12,9 @@ mod pty;
mod terminfo;
mod user_info;
#[cfg(target_os = "macos")]
use pam_client_macos as pam_client;
use std::ffi::{CStr, CString};
use std::fmt;
use std::future::Future;
@ -119,7 +122,7 @@ struct ClientConfig {
async fn run_server() -> Result<()> {
let cfg = {
let opt_listen = std::env::var("BIND_ADDR")
.unwrap_or_else(|_| "127.0.0.1:8022".to_owned())
.expect("BIND_ADDR not specified")
.parse()?;
&*Box::leak(ServerConfig { listen: opt_listen }.into())
@ -786,6 +789,8 @@ async fn greet_conn(cfg: &'static ServerConfig, conn: quinn::Connecting) -> Resu
}
mod auth {
use super::pam_client;
use std::ffi::CString;
#[derive(Debug, Serialize, Deserialize)]