vishalmishra434 / rpms / openssh

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