Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
This commit fixes
- Clippy complaints on the latest Rust version 1.79.0
- Certificate load issues when FTPS are enabled
- Compilation error in a test of unftp-sbe-gcs
  • Loading branch information
hannesdejager committed Jun 19, 2024
1 parent b49b233 commit 20a1226
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion crates/unftp-sbe-gcs/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ async fn run_test(test: impl Future<Output = ()>) {
}))
.logger(Some(Logger::root(drain, o!())))
.build()
.await
.unwrap()
.listen(ADDR),
);
Expand Down
2 changes: 1 addition & 1 deletion src/server/controlchan/codecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Encoder<Reply> for FtpCodec {
}
Reply::MultiLine { code, mut lines } => {
// Get the last line since it needs to be preceded by the response code.
let last_line = if let Some(x) = lines.pop() { x } else { String::from("") };
let last_line = lines.pop().unwrap_or_default();

// Lines starting with a digit should be indented
for it in lines.iter_mut() {
Expand Down
13 changes: 9 additions & 4 deletions src/server/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@ pub fn new_config<P: AsRef<Path>>(
let certs: Vec<CertificateDer> = load_certs(certs_file)?;
let privkey: PrivateKeyDer = load_private_key(key_file)?;

let builder: ClientCertVerifierBuilder = WebPkiClientVerifier::builder(Arc::new(root_cert_store(trust_store)?));

let client_auther = match client_auth {
FtpsClientAuth::Off => Ok(WebPkiClientVerifier::no_client_auth()),
FtpsClientAuth::Request => builder.allow_unauthenticated().build(),
FtpsClientAuth::Require => builder.build(),
FtpsClientAuth::Request => {
let builder: ClientCertVerifierBuilder = WebPkiClientVerifier::builder(Arc::new(root_cert_store(trust_store)?));
builder.allow_unauthenticated().build()
}
FtpsClientAuth::Require => {
let builder: ClientCertVerifierBuilder = WebPkiClientVerifier::builder(Arc::new(root_cert_store(trust_store)?));
builder.build()
}
}
.map_err(ConfigError::ClientVerifier)?;

Expand Down Expand Up @@ -134,6 +138,7 @@ fn load_certs<P: AsRef<Path>>(filename: P) -> Result<Vec<CertificateDer<'static>
let cert = cert.map_err(ConfigError::Load)?;
res.push(cert);
}

Ok(res)
}

Expand Down

0 comments on commit 20a1226

Please sign in to comment.