bmh10 / rpms / openssh

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