mirror of
https://github.com/Devolutions/IronRDP.git
synced 2025-08-04 15:18:17 +00:00
fix: fix commit 9198284263
(#626)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Changelog: ignore
This commit is contained in:
parent
236a132120
commit
a0d32d7245
2 changed files with 17 additions and 8 deletions
|
@ -21,16 +21,21 @@ impl TlsIdentityCtx {
|
|||
///
|
||||
/// The file format can be either PEM (if the file extension ends with .pem) or DER.
|
||||
pub fn init_from_paths(cert_path: &Path, key_path: &Path) -> anyhow::Result<Self> {
|
||||
let certs: Vec<_> = if cert_path.extension().map_or(false, |ext| ext == "pem") {
|
||||
let certs = if cert_path.extension().map_or(false, |ext| ext == "pem") {
|
||||
CertificateDer::pem_file_iter(cert_path)
|
||||
.with_context(|| format!("reading server cert `{cert_path:?}`"))?
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.with_context(|| format!("collecting server cert `{cert_path:?}`"))?
|
||||
} else {
|
||||
certs(&mut BufReader::new(File::open(cert_path)?))
|
||||
}
|
||||
.collect::<Result<_, _>>()
|
||||
.context(format!("reading server cert `{cert_path:?}`"))?;
|
||||
certs(&mut BufReader::new(
|
||||
File::open(cert_path).with_context(|| format!("opening server cert `{cert_path:?}`"))?,
|
||||
))
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.with_context(|| format!("collecting server cert `{cert_path:?}`"))?
|
||||
};
|
||||
|
||||
let priv_key = if key_path.extension().map_or(false, |ext| ext == "pem") {
|
||||
PrivateKeyDer::from_pem_file(key_path).context("reading server key `{key_path:?}`")?
|
||||
PrivateKeyDer::from_pem_file(key_path).with_context(|| format!("reading server key `{key_path:?}`"))?
|
||||
} else {
|
||||
pkcs8_private_keys(&mut BufReader::new(File::open(key_path)?))
|
||||
.next()
|
||||
|
@ -42,7 +47,7 @@ impl TlsIdentityCtx {
|
|||
use x509_cert::der::Decode as _;
|
||||
|
||||
let cert = certs.first().ok_or_else(|| std::io::Error::other("invalid cert"))?;
|
||||
let cert = x509_cert::Certificate::from_der(&cert).map_err(std::io::Error::other)?;
|
||||
let cert = x509_cert::Certificate::from_der(cert).map_err(std::io::Error::other)?;
|
||||
cert.tbs_certificate
|
||||
.subject_public_key_info
|
||||
.subject_public_key
|
||||
|
|
|
@ -18,7 +18,11 @@ pub fn lints(sh: &Shell) -> anyhow::Result<()> {
|
|||
let _s = Section::new("LINTS");
|
||||
|
||||
// TODO: when 1.74 is released use `--keep-going`: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#keep-going
|
||||
cmd!(sh, "{CARGO} clippy --workspace --all-targets --locked -- -D warnings").run()?;
|
||||
cmd!(
|
||||
sh,
|
||||
"{CARGO} clippy --workspace --all-targets --features helper --locked -- -D warnings"
|
||||
)
|
||||
.run()?;
|
||||
|
||||
println!("All good!");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue