rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone

Blame SOURCES/openssh-6.4p1-legacy-ssh-copy-id.patch

770374
diff -up openssh-6.4p1/contrib/ssh-copy-id.1.legacy-ssh-copy-id openssh-6.4p1/contrib/ssh-copy-id.1
770374
--- openssh-6.4p1/contrib/ssh-copy-id.1.legacy-ssh-copy-id	2013-03-22 00:17:37.000000000 +0100
770374
+++ openssh-6.4p1/contrib/ssh-copy-id.1	2014-01-28 17:12:49.197542425 +0100
770374
@@ -180,6 +180,19 @@ should prove enlightening (N.B. the mode
770374
 .Fl W
770374
 option, rather than
770374
 .Xr nc 1 ) .
770374
+.Sh ENVIRONMENT
770374
+.Bl -tag -width Ds
770374
+.Pp
770374
+.It Pa SSH_COPY_ID_LEGACY
770374
+If the 
770374
+.Cm SSH_COPY_ID_LEGACY
770374
+environment variable is set, the
770374
+.Nm
770374
+is run in a legacy mode. In this mode, the 
770374
+.Nm
770374
+doesn't check an existence of a private key and doesn't do remote checks
770374
+of the remote server versions or if public keys are already installed.
770374
+.El
770374
 .Sh "SEE ALSO"
770374
 .Xr ssh 1 ,
770374
 .Xr ssh-agent 1 ,
770374
diff -up openssh-6.4p1/contrib/ssh-copy-id.legacy-ssh-copy-id openssh-6.4p1/contrib/ssh-copy-id
770374
--- openssh-6.4p1/contrib/ssh-copy-id.legacy-ssh-copy-id	2013-06-05 14:48:45.000000000 +0200
770374
+++ openssh-6.4p1/contrib/ssh-copy-id	2014-01-28 17:11:51.538833032 +0100
770374
@@ -77,7 +77,7 @@ use_id_file() {
770374
     PUB_ID_FILE="$L_ID_FILE.pub"
770374
   fi
770374
 
770374
-  PRIV_ID_FILE=$(dirname "$PUB_ID_FILE")/$(basename "$PUB_ID_FILE" .pub)
770374
+  [ "x$SSH_COPY_ID_LEGACY" != "x" ] || PRIV_ID_FILE=$(dirname "$PUB_ID_FILE")/$(basename "$PUB_ID_FILE" .pub)
770374
 
770374
   # check that the files are readable
770374
   for f in $PUB_ID_FILE $PRIV_ID_FILE ; do
770374
@@ -243,7 +243,7 @@ populate_new_ids() {
770374
   printf '%s: INFO: %d key(s) remain to be installed -- if you are prompted now it is to install the new keys\n' "$0" "$(printf '%s\n' "$NEW_IDS" | wc -l)" >&2
770374
 }
770374
 
770374
-REMOTE_VERSION=$(ssh -v -o PreferredAuthentications=',' "$@" 2>&1 |
770374
+[ "x$SSH_COPY_ID_LEGACY" != "x" ] || REMOTE_VERSION=$(ssh -v -o PreferredAuthentications=',' "$@" 2>&1 |
770374
                  sed -ne 's/.*remote software version //p')
770374
 
770374
 case "$REMOTE_VERSION" in
770374
@@ -268,7 +268,11 @@ case "$REMOTE_VERSION" in
770374
     ;;
770374
   *)
770374
     # Assuming that the remote host treats ~/.ssh/authorized_keys as one might expect
770374
-    populate_new_ids 0
770374
+    if [ "x$SSH_COPY_ID_LEGACY" != "x" ]; then
770374
+      NEW_IDS=`eval "$GET_ID"`
770374
+    else
770374
+      populate_new_ids 0
770374
+    fi
770374
     [ "$DRY_RUN" ] || printf '%s\n' "$NEW_IDS" | ssh "$@" "
770374
 		umask 077 ;
770374
 		mkdir -p .ssh && cat >> .ssh/authorized_keys || exit 1 ;