bmh10 / rpms / openssh

Forked from rpms/openssh 10 days ago
Clone
943807
diff --git a/scp.c b/scp.c
943807
index 60682c68..9344806e 100644
943807
--- a/scp.c
943807
+++ b/scp.c
943807
@@ -714,7 +714,9 @@ toremote(int argc, char **argv)
943807
 			addargs(&alist, "%s", host);
943807
 			addargs(&alist, "%s", cmd);
943807
 			addargs(&alist, "%s", src);
943807
-			addargs(&alist, "%s%s%s:%s",
943807
+			addargs(&alist,
943807
+			    /* IPv6 address needs to be enclosed with sqare brackets */
943807
+			    strchr(host, ':') != NULL ? "%s%s[%s]:%s" : "%s%s%s:%s",
943807
 			    tuser ? tuser : "", tuser ? "@" : "",
943807
 			    thost, targ);
943807
 			if (do_local_cmd(&alist) != 0)
943807