From 9129fcd868bcad31fbf1a00681dc18bb638c6554 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 18 Dec 2009 16:27:05 +0000 Subject: [PATCH] Fix bug#1146 --- tools/ChangeLog | 4 ++++ tools/applygnupgdefaults | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/ChangeLog b/tools/ChangeLog index 681f977e5..23c5d5e51 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,7 @@ +2009-12-18 Werner Koch + + * applygnupgdefaults (errorfile): Use mktemp. Fixes bug#1146. + 2009-12-07 Werner Koch * no-libgcrypt.c (gcry_strdup): Actually copy the string. diff --git a/tools/applygnupgdefaults b/tools/applygnupgdefaults index 882189c0c..b4cff6390 100755 --- a/tools/applygnupgdefaults +++ b/tools/applygnupgdefaults @@ -1,5 +1,5 @@ #!/bin/sh -# Apply defaults from/etc/gnupg/gpg.conf to all users -*- sh -*- +# Apply defaults from /etc/gnupg/gpg.conf to all users -*- sh -*- # # Copyright 2007 Free Software Foundation, Inc. # @@ -16,7 +16,7 @@ errorfile= error () { echo "$PGM: $*" >&2 - echo "$PGM: $*" >>$errorfile + [ -n "$errorfile" ] && echo "$PGM: $*" >>$errorfile } info () { @@ -34,9 +34,8 @@ cleanup () [ -n "$errorfile" -a -f "$errorfile" ] && rm "$errorfile" } trap cleanup EXIT SIGINT SIGHUP SIGPIPE -errorfile="/tmp/$PGM.$$.log" -: >$errorfile - +errorfile=$(mktemp "/tmp/$PGM.log.XXXXXX") +[ -n "$errorfile" -a -f "$errorfile" ] || exit 2 # Check whether we can use getent if getent --help /dev/null 2>&1 ; then @@ -62,7 +61,7 @@ fi ${cat_passwd} \ | while IFS=: read -r user dmy_a uid dmy_c dmy_d home shell dmy_rest; do - # Process only entires with a valid login shell + # Process only entries with a valid login shell grep /dev/null >/dev/null || continue # and with an existant gnupg home directory [ -d "$home/.gnupg" ] || continue