aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh/sftp
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-07-26 23:00:01 +0700
committerShulhan <ms@kilabit.info>2023-07-26 23:02:20 +0700
commita144541051452c8c910ca0c8bbd7919e2d597249 (patch)
treefbe6c811b8740023c0471c39962ec70f93a355e6 /lib/ssh/sftp
parent89428e739893e22526dadf4216526c597f9b0e8f (diff)
downloadpakakeh.go-a144541051452c8c910ca0c8bbd7919e2d597249.tar.xz
lib/ssh: refactoring NewClientFromConfig, renamed to NewClientInteractive
Previously, the NewClientInteractive blindly use the signers from Section.Signers. If one of the IdentityFile valid, it will add all the keys in IdentityFile to SSH agent. In this changes we try each IdentityFile independently. If the key is valid, client connected to remote machine, then only that key will be added to SSH agent. While at it we also rename the method to NewClientInteractive to indicate that the function will prompt for passphrase if one of the IdentityFile is encrypted.
Diffstat (limited to 'lib/ssh/sftp')
-rw-r--r--lib/ssh/sftp/sftp_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ssh/sftp/sftp_test.go b/lib/ssh/sftp/sftp_test.go
index 1a40d56d..38523b59 100644
--- a/lib/ssh/sftp/sftp_test.go
+++ b/lib/ssh/sftp/sftp_test.go
@@ -44,7 +44,7 @@ func TestMain(m *testing.M) {
},
}
- sshClient, err := ssh.NewClientFromConfig(cfg)
+ sshClient, err := ssh.NewClientInteractive(cfg)
if err != nil {
log.Fatal(err)
}