Remove pretend password support for SFTP

This commit is contained in:
Olivier 'reivilibre' 2023-10-03 21:36:57 +01:00
parent ecda1e5359
commit 1c2d7957ee
2 changed files with 6 additions and 22 deletions

View File

@ -1025,16 +1025,8 @@ async fn set_up_connection(
let remote_path = line.trim().to_owned(); let remote_path = line.trim().to_owned();
line.clear(); line.clear();
println!(
"Enter password, or blank if not required (due to use of key authentication):"
);
stdin_br.read_line(&mut line).await?;
let password = line.trim().to_owned();
line.clear();
Ok(PileConnectionScheme::Sftp { Ok(PileConnectionScheme::Sftp {
user_at_host, user_at_host,
password,
directory: remote_path, directory: remote_path,
}) })
} }

View File

@ -5,7 +5,7 @@ use yama_wormfile::boxed::BoxedWormFileProvider;
use yama_wormfile_fs::LocalWormFilesystem; use yama_wormfile_fs::LocalWormFilesystem;
use yama_wormfile_sftp::SftpWormFilesystem; use yama_wormfile_sftp::SftpWormFilesystem;
#[derive(Clone, Serialize, Deserialize, Hash)] #[derive(Clone, Serialize, Deserialize, Debug, Hash)]
#[serde(tag = "scheme")] #[serde(tag = "scheme")]
pub enum PileConnectionScheme { pub enum PileConnectionScheme {
#[serde(rename = "local")] #[serde(rename = "local")]
@ -13,8 +13,6 @@ pub enum PileConnectionScheme {
#[serde(rename = "sftp")] #[serde(rename = "sftp")]
Sftp { Sftp {
user_at_host: String, user_at_host: String,
// TODO Should probably not serialise the password
password: String,
directory: String, directory: String,
}, },
#[serde(rename = "s3")] #[serde(rename = "s3")]
@ -40,18 +38,12 @@ impl PileConnectionScheme {
} }
PileConnectionScheme::Sftp { PileConnectionScheme::Sftp {
user_at_host, user_at_host,
password,
directory, directory,
} => { } => Ok(BoxedWormFileProvider::new(
if !password.is_empty() { SftpWormFilesystem::new(user_at_host, directory)
bail!("SFTP passwords not supported at the moment."); .await
} .context("Failed SFTP connection")?,
Ok(BoxedWormFileProvider::new( )),
SftpWormFilesystem::new(user_at_host, directory)
.await
.context("Failed SFTP connection")?,
))
}
PileConnectionScheme::S3 { .. } => { PileConnectionScheme::S3 { .. } => {
//S3WormFilesystem::new() //S3WormFilesystem::new()
todo!() todo!()