rutwa189 / rpms / openssh

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