kentpeacock / rpms / openssh

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