vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jakub Jelen dc5e31
From 66f16e5425eb881570e82bfef7baeac2e7accc0a Mon Sep 17 00:00:00 2001
Jakub Jelen dc5e31
From: Oleg <Fallmay@users.noreply.github.com>
Jakub Jelen dc5e31
Date: Thu, 1 Oct 2020 12:09:08 +0300
Jakub Jelen dc5e31
Subject: [PATCH] Fix `EOF: command not found` error in ssh-copy-id
Jakub Jelen dc5e31
Jakub Jelen dc5e31
---
Jakub Jelen dc5e31
 contrib/ssh-copy-id | 3 ++-
Jakub Jelen dc5e31
 1 file changed, 2 insertions(+), 1 deletion(-)
Jakub Jelen dc5e31
Jakub Jelen dc5e31
diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id
Jakub Jelen dc5e31
index 392f64f94..a76907717 100644
Jakub Jelen dc5e31
--- a/contrib/ssh-copy-id
Jakub Jelen dc5e31
+++ b/contrib/ssh-copy-id
Jakub Jelen dc5e31
@@ -247,7 +247,7 @@ installkeys_sh() {
Jakub Jelen dc5e31
   #    the -z `tail ...` checks for a trailing newline. The echo adds one if was missing
Jakub Jelen dc5e31
   #    the cat adds the keys we're getting via STDIN
Jakub Jelen dc5e31
   #    and if available restorecon is used to restore the SELinux context
Jakub Jelen dc5e31
-  INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF)
Jakub Jelen dc5e31
+  INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF
Jakub Jelen dc5e31
 	cd;
Jakub Jelen dc5e31
 	umask 077;
Jakub Jelen dc5e31
 	mkdir -p $(dirname "${AUTH_KEY_FILE}") &&
Jakub Jelen dc5e31
@@ -258,6 +258,7 @@ installkeys_sh() {
Jakub Jelen dc5e31
 	  restorecon -F .ssh ${AUTH_KEY_FILE};
Jakub Jelen dc5e31
 	fi
Jakub Jelen dc5e31
 EOF
Jakub Jelen dc5e31
+  )
Jakub Jelen dc5e31
 
Jakub Jelen dc5e31
   # to defend against quirky remote shells: use 'exec sh -c' to get POSIX;
Jakub Jelen dc5e31
   printf "exec sh -c '%s'" "${INSTALLKEYS_SH}"
Jakub Jelen dc5e31
Jakub Jelen 62e762
From de59a431cdec833e3ec15691dd950402b4c052cf Mon Sep 17 00:00:00 2001
Jakub Jelen 62e762
From: Philip Hands <phil@hands.com>
Jakub Jelen 62e762
Date: Sat, 3 Oct 2020 00:20:07 +0200
Jakub Jelen 62e762
Subject: [PATCH] un-nest $() to make ksh cheerful
Jakub Jelen 62e762
Jakub Jelen 62e762
---
Jakub Jelen 62e762
 ssh-copy-id | 3 ++-
Jakub Jelen 62e762
 1 file changed, 2 insertions(+), 1 deletion(-)
Jakub Jelen 62e762
Jakub Jelen 62e762
From 02ac2c3c3db5478a440dfb1b90d15f686f2cbfc6 Mon Sep 17 00:00:00 2001
Jakub Jelen 62e762
From: Philip Hands <phil@hands.com>
Jakub Jelen 62e762
Date: Fri, 2 Oct 2020 21:30:10 +0200
Jakub Jelen 62e762
Subject: [PATCH] ksh doesn't grok 'local'
Jakub Jelen 62e762
Jakub Jelen 62e762
and AFAICT it's not actually doing anything useful in the code, so let's
Jakub Jelen 62e762
see how things go without it.
Jakub Jelen 62e762
---
Jakub Jelen 62e762
 ssh-copy-id | 11 +++++------
Jakub Jelen 62e762
 1 file changed, 5 insertions(+), 6 deletions(-)
Jakub Jelen 62e762
Jakub Jelen 62e762
diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id
Jakub Jelen 62e762
index a769077..11c9463 100755
Jakub Jelen 62e762
--- a/contrib/ssh-copy-id
Jakub Jelen 62e762
+++ b/contrib/ssh-copy-id
Jakub Jelen 62e762
@@ -76,7 +76,7 @@ quote() {
Jakub Jelen 62e762
 }
Jakub Jelen 62e762
 
Jakub Jelen 62e762
 use_id_file() {
Jakub Jelen 62e762
-  local L_ID_FILE="$1"
Jakub Jelen 62e762
+  L_ID_FILE="$1"
Jakub Jelen 62e762
 
Jakub Jelen 62e762
   if [ -z "$L_ID_FILE" ] ; then
Jakub Jelen 62e762
     printf '%s: ERROR: no ID file found\n' "$0"
Jakub Jelen 62e762
@@ -94,7 +94,7 @@ use_id_file() {
Jakub Jelen 62e762
   # check that the files are readable
Jakub Jelen 62e762
   for f in "$PUB_ID_FILE" ${PRIV_ID_FILE:+"$PRIV_ID_FILE"} ; do
Jakub Jelen 62e762
     ErrMSG=$( { : < "$f" ; } 2>&1 ) || {
Jakub Jelen 62e762
-      local L_PRIVMSG=""
Jakub Jelen 62e762
+      L_PRIVMSG=""
Jakub Jelen 62e762
       [ "$f" = "$PRIV_ID_FILE" ] && L_PRIVMSG="	(to install the contents of '$PUB_ID_FILE' anyway, look at the -f option)"
Jakub Jelen 62e762
       printf "\\n%s: ERROR: failed to open ID file '%s': %s\\n" "$0" "$f" "$(printf '%s\n%s\n' "$ErrMSG" "$L_PRIVMSG" | sed -e 's/.*: *//')"
Jakub Jelen 62e762
       exit 1
Jakub Jelen 62e762
@@ -169,7 +169,7 @@ fi
Jakub Jelen 62e762
 # populate_new_ids() uses several global variables ($USER_HOST, $SSH_OPTS ...)
Jakub Jelen 62e762
 # and has the side effect of setting $NEW_IDS
Jakub Jelen 62e762
 populate_new_ids() {
Jakub Jelen 62e762
-  local L_SUCCESS="$1"
Jakub Jelen 62e762
+  L_SUCCESS="$1"
Jakub Jelen 62e762
 
Jakub Jelen 62e762
   # shellcheck disable=SC2086
Jakub Jelen 62e762
   if [ "$FORCED" ] ; then
Jakub Jelen 62e762
@@ -181,13 +181,12 @@ populate_new_ids() {
Jakub Jelen 62e762
   eval set -- "$SSH_OPTS"
Jakub Jelen 62e762
 
Jakub Jelen 62e762
   umask 0177
Jakub Jelen 62e762
-  local L_TMP_ID_FILE
Jakub Jelen 62e762
   L_TMP_ID_FILE=$(mktemp ~/.ssh/ssh-copy-id_id.XXXXXXXXXX)
Jakub Jelen 62e762
   if test $? -ne 0 || test "x$L_TMP_ID_FILE" = "x" ; then
Jakub Jelen 62e762
     printf '%s: ERROR: mktemp failed\n' "$0" >&2
Jakub Jelen 62e762
     exit 1
Jakub Jelen 62e762
   fi
Jakub Jelen 62e762
-  local L_CLEANUP="rm -f \"$L_TMP_ID_FILE\" \"${L_TMP_ID_FILE}.stderr\""
Jakub Jelen 62e762
+  L_CLEANUP="rm -f \"$L_TMP_ID_FILE\" \"${L_TMP_ID_FILE}.stderr\""
Jakub Jelen 62e762
   # shellcheck disable=SC2064
Jakub Jelen 62e762
   trap "$L_CLEANUP" EXIT TERM INT QUIT
Jakub Jelen 62e762
   printf '%s: INFO: attempting to log in with the new key(s), to filter out any that are already installed\n' "$0" >&2
Jakub Jelen 62e762
@@ -237,7 +236,7 @@ populate_new_ids() {
Jakub Jelen 62e762
 #    produce a one-liner to add the keys to remote authorized_keys file
Jakub Jelen 62e762
 #    optionally takes an alternative path for authorized_keys
Jakub Jelen 62e762
 installkeys_sh() {
Jakub Jelen 62e762
-  local AUTH_KEY_FILE=${1:-.ssh/authorized_keys}
Jakub Jelen 62e762
+  AUTH_KEY_FILE=${1:-.ssh/authorized_keys}
Jakub Jelen 62e762
 
Jakub Jelen 62e762
   # In setting INSTALLKEYS_SH:
Jakub Jelen 62e762
   #    the tr puts it all on one line (to placate tcsh)
Jakub Jelen 62e762
-- 
Jakub Jelen 62e762
Jakub Jelen 62e762
diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id
Jakub Jelen 62e762
index 11c9463..ee3f637 100755
Jakub Jelen 62e762
--- a/contrib/ssh-copy-id
Jakub Jelen 62e762
+++ b/contrib/ssh-copy-id
Jakub Jelen 62e762
@@ -237,6 +237,7 @@ populate_new_ids() {
Jakub Jelen 62e762
 #    optionally takes an alternative path for authorized_keys
Jakub Jelen 62e762
 installkeys_sh() {
Jakub Jelen 62e762
   AUTH_KEY_FILE=${1:-.ssh/authorized_keys}
Jakub Jelen 62e762
+  AUTH_KEY_DIR=$(dirname "${AUTH_KEY_FILE}")
Jakub Jelen 62e762
 
Jakub Jelen 62e762
   # In setting INSTALLKEYS_SH:
Jakub Jelen 62e762
   #    the tr puts it all on one line (to placate tcsh)
Jakub Jelen 62e762
@@ -249,7 +250,7 @@ installkeys_sh() {
Jakub Jelen 62e762
   INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF
Jakub Jelen 62e762
 	cd;
Jakub Jelen 62e762
 	umask 077;
Jakub Jelen 62e762
-	mkdir -p $(dirname "${AUTH_KEY_FILE}") &&
Jakub Jelen 62e762
+	mkdir -p "${AUTH_KEY_DIR}" &&
Jakub Jelen 62e762
 	  { [ -z \`tail -1c ${AUTH_KEY_FILE} 2>/dev/null\` ] || echo >> ${AUTH_KEY_FILE} || exit 1; } &&
Jakub Jelen 62e762
 	  cat >> ${AUTH_KEY_FILE} ||
Jakub Jelen 62e762
 	  exit 1;
Jakub Jelen 62e762
--