0
0
Fork 0
mirror of https://git.verdigado.com/NB-Public/simple-wkd.git synced 2024-10-30 03:05:51 +01:00

Refactor validate_cert macro

This commit is contained in:
Delta1925 2023-04-18 19:42:26 +02:00
parent f431246321
commit 2ce66b9ba0
No known key found for this signature in database
GPG key ID: 1C21ACE44193CB25

View file

@ -1,6 +1,5 @@
use crate::errors::CompatErr; use crate::errors::CompatErr;
use crate::errors::SpecialErrors; use crate::errors::SpecialErrors;
use crate::settings::POLICY;
use crate::settings::ROOT_FOLDER; use crate::settings::ROOT_FOLDER;
use crate::settings::SETTINGS; use crate::settings::SETTINGS;
@ -24,13 +23,14 @@ use std::{
#[macro_export] #[macro_export]
macro_rules! validate_cert { macro_rules! validate_cert {
( $x:expr ) => { ( $x:expr ) => {
match $x.with_policy(POLICY, None) { match $x.with_policy($crate::settings::POLICY, None) {
Ok(validcert) => Ok(validcert), Ok(validcert) => Ok(validcert),
Err(_) => Err(SpecialErrors::InvalidCert), Err(_) => Err($crate::errors::SpecialErrors::InvalidCert),
} }
}; };
} }
pub fn pending_path() -> PathBuf { pub fn pending_path() -> PathBuf {
Path::new(&ROOT_FOLDER).join("pending") Path::new(&ROOT_FOLDER).join("pending")
} }