[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#741344: ssh-copy-id: Could not resolve hostname :: Name or service not known



Package: openssh-client
Version: 1:6.5p1-4

Hello,

ssh-copy-id incorrectly parses the host name, removing everything
after and including the last colon. I'm not sure why is it done at
all, but this prevents me from copying an id to the localhost (don't
ask why I need that).

Here's a patch which removes the last colon and everything after it
only if it's not preceded by one more colon (::), so user@:: would
still work.

-- 
Cheers,
  Andrew
--- /usr/bin/ssh-copy-id	2013-06-05 14:48:45.000000000 +0200
+++ /usr/bin/ssh-copy-id	2014-03-11 13:42:18.694699984 +0100
@@ -174,7 +174,7 @@
 fi
 
 # drop trailing colon
-USER_HOST=$(printf "%s\n" "$1" | sed 's/:$//')
+USER_HOST=$(printf "%s\n" "$1" | sed 's/\([^:]\):$/\1/')
 # tack the hostname onto SSH_OPTS
 SSH_OPTS="${SSH_OPTS:+$SSH_OPTS }'$(quote "$USER_HOST")'"
 # and populate "$@" for later use (only way to get proper quoting of options)


Reply to: