From 383345c47cb12d5b33ccccdf9200b8b29ce56c77 Mon Sep 17 00:00:00 2001 From: "rk@emlix.com" Date: Fri, 8 May 2009 11:09:02 +0200 Subject: [PATCH] adding support for ports in scp transport Signed-off-by: rk@emlix.com --- generic/transport.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/generic/transport.lua b/generic/transport.lua index 037d396..6c40ece 100644 --- a/generic/transport.lua +++ b/generic/transport.lua @@ -159,15 +159,25 @@ function fetch_file(surl, location, destdir, destname) end elseif u.transport == "scp" or u.transport == "ssh" then - local user + local user,port if u.user then user = string.format("%s@", u.user) else user = "" end + if u.port then + if u.transport == "scp" then + port = "-P " .. u.port + else + port = "-p " .. u.port + end + else + port = "" + end + local args = string.format( - "'%s%s:/%s/%s' '%s/%s'", - user, u.servername, u.path, location, + " %s '%s%s:/%s/%s' '%s/%s'", + port,user, u.servername, u.path, location, destdir, tmpfile) rc, re = e2lib.scp(args) if not rc then -- 2.39.5