tolerate invalid config
This commit is contained in:
parent
68cd2c581e
commit
ec8d3cdb23
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -395,7 +395,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pam_fido2"
|
name = "pam_fido2"
|
||||||
version = "0.2.5"
|
version = "0.2.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ctap_hmac 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ctap_hmac 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ctrlc 3.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ctrlc 3.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "pam_fido2"
|
name = "pam_fido2"
|
||||||
version = "0.2.5"
|
version = "0.2.7"
|
||||||
authors = ["shimun <shimun@shimun.net>"]
|
authors = ["shimun <shimun@shimun.net>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
14
default.nix
Normal file
14
default.nix
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> { }
|
||||||
|
, callPackage ? pkgs.callPackage
|
||||||
|
, name ? "pam_fido2"
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
crate2nix_tools = import "${builtins.fetchTarball { url = "https://github.com/kolloch/crate2nix/archive/0.8.0.tar.gz"; }}/tools.nix" { };
|
||||||
|
overrides = pkgs.defaultCrateOverrides // {
|
||||||
|
pam_fido2 = attrs: with pkgs; {
|
||||||
|
buildInputs = [ linux-pam ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
project = callPackage (crate2nix_tools.generatedCargoNix { name = name; src = "${./.}"; }) { defaultCrateOverrides = overrides; };
|
||||||
|
in
|
||||||
|
project.rootCrate.build
|
@ -90,13 +90,15 @@ impl Settings {
|
|||||||
let re = Regex::new(&pattern).expect(&["Invalid regex pattern:", &pattern].join(" "));
|
let re = Regex::new(&pattern).expect(&["Invalid regex pattern:", &pattern].join(" "));
|
||||||
if re.is_match(user) {
|
if re.is_match(user) {
|
||||||
let mut parts = cred.split(":");
|
let mut parts = cred.split(":");
|
||||||
//TODO: use expect
|
match (parts.by_ref().next(), parts.by_ref().next()) {
|
||||||
let id = parts.by_ref().next().unwrap();
|
(Some(id), Some(key)) => {
|
||||||
let key = parts.by_ref().next().unwrap();
|
creds.push(ctap::FidoCredential {
|
||||||
creds.push(ctap::FidoCredential {
|
id: hex::decode(id).unwrap(),
|
||||||
id: hex::decode(id).unwrap(),
|
public_key: hex::decode(key).ok(),
|
||||||
public_key: hex::decode(key).ok(),
|
});
|
||||||
});
|
}
|
||||||
|
_ => eprintln!("Failed to parse {}", cred),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
creds
|
creds
|
||||||
|
Loading…
x
Reference in New Issue
Block a user