Adapt to trixie openssl
This commit is contained in:
parent
136c348f01
commit
97057db8d2
2 changed files with 13 additions and 3 deletions
|
|
@ -33,6 +33,15 @@ pub fn get_output(output: Output) -> Result<Vec<u8>, Box<dyn Error>> {
|
||||||
Ok(check_success(output)?.stdout)
|
Ok(check_success(output)?.stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_stderr_or_stdout(output: Output) -> Result<Vec<u8>, Box<dyn Error>> {
|
||||||
|
let output = check_success(output)?;
|
||||||
|
Ok(if output.stderr.is_empty() {
|
||||||
|
output.stdout
|
||||||
|
} else {
|
||||||
|
output.stderr
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
#[async_trait(?Send)]
|
#[async_trait(?Send)]
|
||||||
pub trait CommandRunner {
|
pub trait CommandRunner {
|
||||||
async fn run<'a>(&self, program: &str, args: &'a [&'a OsStr], input: &[u8]) -> IoResult<Output>;
|
async fn run<'a>(&self, program: &str, args: &'a [&'a OsStr], input: &[u8]) -> IoResult<Output>;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::command_runner::CommandRunner;
|
use crate::command_runner::{get_stderr_or_stdout, CommandRunner};
|
||||||
use crate::symbols::Symbol;
|
use crate::symbols::Symbol;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
|
|
@ -32,13 +32,14 @@ impl<C: CommandRunner, D: Borrow<str>, K: AsRef<Path>, P: AsRef<Path>> Symbol fo
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
let output = self
|
let result = self
|
||||||
.command_runner
|
.command_runner
|
||||||
.get_stderr(
|
.run_with_args(
|
||||||
"openssl",
|
"openssl",
|
||||||
args!["req", "-in", self.csr_path.as_ref(), "-noout", "-verify",],
|
args!["req", "-in", self.csr_path.as_ref(), "-noout", "-verify",],
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
let output = get_stderr_or_stdout(result)?;
|
||||||
Ok(output == b"verify OK\n" || output == b"Certificate request self-signature verify OK\n")
|
Ok(output == b"verify OK\n" || output == b"Certificate request self-signature verify OK\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue