bmh10 / rpms / openssh

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