aboutsummaryrefslogtreecommitdiff
path: root/rsh/main.go
diff options
context:
space:
mode:
authorLena <lena@omega>2026-08-23 00:00:00 +0000
committerLena <lena@omega>2026-08-23 00:00:00 +0000
commit8a3746d71661df97615d004c353a183408c3e910 (patch)
treeaa9b6223d9fe0c1df249bf05f8edba87275f11cc /rsh/main.go
parent6578dc47a7d1f7946528e9540d9cfa2e9a5d88d2 (diff)
downloadrsend-8a3746d71661df97615d004c353a183408c3e910.tar.gz
rsh: pass the resolved port to dial
Both callers already read and used RSH_PORT before dialling. Reading it a third time inside dial hid the data flow and duplicated the error path.
Diffstat (limited to 'rsh/main.go')
-rw-r--r--rsh/main.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/rsh/main.go b/rsh/main.go
index 9906966..d75a9c7 100644
--- a/rsh/main.go
+++ b/rsh/main.go
@@ -138,7 +138,7 @@ func transport(args []string, in io.Reader, out, errw io.Writer) error {
// an unknown or changed key still fails loud, just after the dial.
algos = scanAlgos
}
- client, err := dial(user, host, cb, algos)
+ client, err := dial(user, host, port, cb, algos)
if err != nil {
return err
}
@@ -189,7 +189,7 @@ func scan(target string, out io.Writer) error {
hostKey = key
return nil
}
- client, err := dial(user, host, capture, algos)
+ client, err := dial(user, host, port, capture, algos)
if err != nil {
return err
}
@@ -314,15 +314,11 @@ func loadSigner() (ssh.Signer, error) {
// dial opens an SSH connection authenticated with the configured key, verifying
// the host key with hostKey and offering only the host-key algorithms in algos.
-func dial(user, host string, hostKey ssh.HostKeyCallback, algos []string) (*ssh.Client, error) {
+func dial(user, host string, port int, hostKey ssh.HostKeyCallback, algos []string) (*ssh.Client, error) {
signer, err := loadSigner()
if err != nil {
return nil, err
}
- port, err := sshPort()
- if err != nil {
- return nil, err
- }
timeout, err := dialTimeout()
if err != nil {
return nil, err