summaryrefslogtreecommitdiff
path: root/contrib/ssh-copy-id
diff options
context:
space:
mode:
authordjm <djm>2013-05-16 01:10:17 +0000
committerdjm <djm>2013-05-16 01:10:17 +0000
commitdc00f0620f8919df5af3aba0305cfdefa6cffaeb (patch)
treec9cf37a5c13f881d1b796b6813809d174bab1e1c /contrib/ssh-copy-id
parentf0cc80f3d10fa0a7a3ab419d6544892b23b4f5f4 (diff)
downloadopenssh-dc00f0620f8919df5af3aba0305cfdefa6cffaeb.tar.gz
- (djm) [contrib/ssh-copy-id] Fix bug that could cause "rm *" to be
executed if mktemp failed; bz#2105 ok dtucker@
Diffstat (limited to 'contrib/ssh-copy-id')
-rw-r--r--contrib/ssh-copy-id9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id
index af18a192..9f2817b6 100644
--- a/contrib/ssh-copy-id
+++ b/contrib/ssh-copy-id
@@ -165,6 +165,9 @@ done
eval set -- "$SAVEARGS"
+if [ $# == 0 ] ; then
+ usage
+fi
if [ $# != 1 ] ; then
printf '%s: ERROR: Too many arguments. Expecting a target hostname, got: %s\n\n' "$0" "$SAVEARGS" >&2
usage
@@ -196,7 +199,11 @@ populate_new_ids() {
umask 0177
local L_TMP_ID_FILE=$(mktemp ~/.ssh/ssh-copy-id_id.XXXXXXXXXX)
- trap "rm -f $L_TMP_ID_FILE*" EXIT TERM INT QUIT
+ if test $? -ne 0 || test "x$L_TMP_ID_FILE" = "x" ; then
+ echo "mktemp failed" 1>&2
+ exit 1
+ fi
+ trap "rm -f $L_TMP_ID_FILE ${L_TMP_ID_FILE}.pub" EXIT TERM INT QUIT
printf '%s: INFO: attempting to log in with the new key(s), to filter out any that are already installed\n' "$0" >&2
NEW_IDS=$(
eval $GET_ID | {