jonathancammack / rpms / openssh

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