Skip to content

Commit

Permalink
Merge pull request #8318 from habitat-sh/dependabot/cargo/pem-1.0.0
Browse files Browse the repository at this point in the history
Bump pem from 0.8.3 to 1.0.0
  • Loading branch information
mwrock committed Oct 14, 2021
2 parents eb6c0bf + d0b9847 commit ddab950
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
17 changes: 14 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions components/core/src/error.rs
Expand Up @@ -2,6 +2,7 @@ use crate::{package::{self,
Identifiable},
tls::{ctl_gateway::Error as CtlGatewayTls,
rustls_wrapper::Error as RustlsReaderError}};
use pem;
use std::{env,
error,
ffi,
Expand Down Expand Up @@ -127,6 +128,8 @@ pub enum Error {
PackageUnpackFailed(String),
/// When an error occurs parsing an integer.
ParseIntError(num::ParseIntError),
/// When an error occurs in parsing a pem
ParsePemError(pem::PemError),
/// When parsing a string as an OS signal fails
ParseSignalError(String),
/// Occurs upon errors related to file or directory permissions.
Expand Down Expand Up @@ -331,6 +334,7 @@ impl fmt::Display for Error {
}
Error::PackageUnpackFailed(ref e) => format!("Package could not be unpacked. {}", e),
Error::ParseIntError(ref e) => format!("{}", e),
Error::ParsePemError(ref e) => format!("{}", e),
Error::ParseSignalError(ref s) => format!("Failed to parse '{}' as a signal", s),
Error::PlanMalformed => "Failed to read or parse contents of Plan file".to_string(),
Error::PermissionFailed(ref e) => e.to_string(),
Expand Down Expand Up @@ -406,6 +410,10 @@ impl From<num::ParseIntError> for Error {
fn from(err: num::ParseIntError) -> Self { Error::ParseIntError(err) }
}

impl From<pem::PemError> for Error {
fn from(err: pem::PemError) -> Self { Error::ParsePemError(err) }
}

impl From<regex::Error> for Error {
fn from(err: regex::Error) -> Self { Error::RegexParse(err) }
}
Expand Down
6 changes: 3 additions & 3 deletions components/core/src/tls/native_tls_wrapper/readers.rs
Expand Up @@ -125,9 +125,9 @@ fn certs_from_pem_file(buf: &[u8]) -> Result<Vec<Certificate>> {
// `pem::parse_many` does not return an error. It simply parses what it can and ignores the
// rest.
Certificate::from_pem(buf)?;
pem::parse_many(buf).iter()
.map(|cert| Ok(Certificate::from_der(&cert.contents)?))
.collect()
pem::parse_many(buf)?.iter()
.map(|cert| Ok(Certificate::from_der(&cert.contents)?))
.collect()
}

fn certs_from_file(file_path: &Path) -> Result<Vec<Certificate>> {
Expand Down

0 comments on commit ddab950

Please sign in to comment.