Skip to content

Commit 4860c10

Browse files
committed
[accli] B: Fix SCP-Logic In Apps
1 parent da3a798 commit 4860c10

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

accli/src/tasks/applications.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use clap::ValueEnum;
77
use log::error;
88
use std::{
99
fmt::{Display, Formatter, Result as FmtResult},
10+
fs,
1011
path::{Path, PathBuf},
1112
str::FromStr,
1213
};
@@ -163,7 +164,17 @@ impl Applications {
163164
if let Some(host_cert_dir) = as_cert_dir {
164165
let guest_cert_dir =
165166
host_cert_dir_to_target_path(&host_cert_dir, &ApplicationBackend::Cvm)?;
166-
scp_files.push((host_cert_dir, guest_cert_dir.clone()));
167+
for entry in fs::read_dir(&host_cert_dir)? {
168+
let entry = entry?;
169+
let file_type = entry.file_type()?;
170+
if !file_type.is_file() {
171+
anyhow::bail!(
172+
"certificate directory may only contain files (found: {})",
173+
entry.path().display()
174+
);
175+
}
176+
scp_files.push((entry.path(), guest_cert_dir.join(entry.file_name())));
177+
}
167178

168179
cmd.push("--as-cert-dir".to_string());
169180
cmd.push(guest_cert_dir.display().to_string());

0 commit comments

Comments
 (0)