File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use clap::ValueEnum;
77use log:: error;
88use 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 ( ) ) ;
You can’t perform that action at this time.
0 commit comments