Browse Source

Adapt to trixie openssl

master
Adrian Heine 3 days ago
parent
commit
97057db8d2
  1. 9
      src/command_runner.rs
  2. 7
      src/symbols/tls/csr.rs

9
src/command_runner.rs

@ -33,6 +33,15 @@ pub fn get_output(output: Output) -> Result<Vec<u8>, Box<dyn Error>> {
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)]
pub trait CommandRunner {
async fn run<'a>(&self, program: &str, args: &'a [&'a OsStr], input: &[u8]) -> IoResult<Output>;

7
src/symbols/tls/csr.rs

@ -1,4 +1,4 @@
use crate::command_runner::CommandRunner;
use crate::command_runner::{get_stderr_or_stdout, CommandRunner};
use crate::symbols::Symbol;
use async_trait::async_trait;
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);
}
let output = self
let result = self
.command_runner
.get_stderr(
.run_with_args(
"openssl",
args!["req", "-in", self.csr_path.as_ref(), "-noout", "-verify",],
)
.await?;
let output = get_stderr_or_stdout(result)?;
Ok(output == b"verify OK\n" || output == b"Certificate request self-signature verify OK\n")
}

Loading…
Cancel
Save