- (djm) [contrib/ssh-copy-id] Fix bug that could cause "rm *" to be

executed if mktemp failed; bz#2105 ok dtucker@
This commit is contained in:
Damien Miller 2013-05-16 11:10:17 +10:00
parent c54e3e0741
commit 6aa3eacc5e
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,7 @@
20130516
- (djm) [contrib/ssh-copy-id] Fix bug that could cause "rm *" to be
executed if mktemp failed; bz#2105 ok dtucker@
20130510 20130510
- (dtucker) [configure.ac] Enable -Wsizeof-pointer-memaccess if the compiler - (dtucker) [configure.ac] Enable -Wsizeof-pointer-memaccess if the compiler
supports it. Mentioned by Colin Watson in bz#2100, ok djm. supports it. Mentioned by Colin Watson in bz#2100, ok djm.

View File

@ -165,6 +165,9 @@ done
eval set -- "$SAVEARGS" eval set -- "$SAVEARGS"
if [ $# == 0 ] ; then
usage
fi
if [ $# != 1 ] ; then if [ $# != 1 ] ; then
printf '%s: ERROR: Too many arguments. Expecting a target hostname, got: %s\n\n' "$0" "$SAVEARGS" >&2 printf '%s: ERROR: Too many arguments. Expecting a target hostname, got: %s\n\n' "$0" "$SAVEARGS" >&2
usage usage
@ -196,7 +199,11 @@ populate_new_ids() {
umask 0177 umask 0177
local L_TMP_ID_FILE=$(mktemp ~/.ssh/ssh-copy-id_id.XXXXXXXXXX) 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 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=$( NEW_IDS=$(
eval $GET_ID | { eval $GET_ID | {