From owner-svn-src-user@FreeBSD.ORG Sun Nov 3 08:54:48 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0BD83DDC; Sun, 3 Nov 2013 08:54:48 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DE1BA2475; Sun, 3 Nov 2013 08:54:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA38slUQ088559; Sun, 3 Nov 2013 08:54:47 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA38sljq088558; Sun, 3 Nov 2013 08:54:47 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201311030854.rA38sljq088558@svn.freebsd.org> From: Colin Percival Date: Sun, 3 Nov 2013 08:54:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257565 - user/cperciva/panicmail X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2013 08:54:48 -0000 Author: cperciva Date: Sun Nov 3 08:54:47 2013 New Revision: 257565 URL: http://svnweb.freebsd.org/changeset/base/257565 Log: Add more quoting paranoia. Not likely anyone will be running with a TMPDIR which has spaces in it, but still... Submitted by: dt71 Modified: user/cperciva/panicmail/panicmail Modified: user/cperciva/panicmail/panicmail ============================================================================== --- user/cperciva/panicmail/panicmail Sun Nov 3 08:51:27 2013 (r257564) +++ user/cperciva/panicmail/panicmail Sun Nov 3 08:54:47 2013 (r257565) @@ -46,14 +46,14 @@ panicmail_gather() # And we want a backtrace (we should be able to pipe the commands # directly into kgdb, but that doesn't work with our /bin/sh): echo "Backtrace:" >> "${dumpdir}/panicmail.$1" - echo bt > ${tmpfile} - echo quit >> ${tmpfile} - kgdb -q `sysctl -n kern.bootfile` "${dumpdir}/vmcore.$1" \ - < ${tmpfile} >> "${dumpdir}/panicmail.$1" 2> /dev/null + echo bt > "${tmpfile}" + echo quit >> "${tmpfile}" + kgdb -q "`sysctl -n kern.bootfile`" "${dumpdir}/vmcore.$1" \ + < "${tmpfile}" >> "${dumpdir}/panicmail.$1" 2> /dev/null echo >> "${dumpdir}/panicmail.$1" # Remove the temporary file. - rm ${tmpfile} + rm "${tmpfile}" } # Encrypt the information in the panic report. @@ -62,15 +62,15 @@ panicmail_encrypt() local tmpfile=`mktemp` || exit 1 # Encrypt using pkesh. - /usr/local/bin/pkesh enc "$2" "${dumpdir}/panicmail.$1" ${tmpfile} || exit 1 + /usr/local/bin/pkesh enc "$2" "${dumpdir}/panicmail.$1" "${tmpfile}" || exit 1 # Add extra armour. echo "-----ENCRYPTED FREEBSD PANIC DATA STARTS HERE---------------------" > "${dumpdir}/panicmail.$1.enc" - lam -s '|' ${tmpfile} -s '|' >> "${dumpdir}/panicmail.$1.enc" + lam -s '|' "${tmpfile}" -s '|' >> "${dumpdir}/panicmail.$1.enc" echo "-----ENCRYPTED FREEBSD PANIC DATA ENDS HERE-----------------------" >> "${dumpdir}/panicmail.$1.enc" # Remove the temporary file. - rm ${tmpfile} + rm "${tmpfile}" } # Construct an email destined for root to review and forward. @@ -131,11 +131,11 @@ panicmail_run() # If we have info.last, use that to figure out the last dump number. if [ -e "${dumpdir}/info.last" ]; then - nr=`readlink ${dumpdir}/info.last` + nr=`readlink "${dumpdir}/info.last"` nr=${nr##*.} else # Otherwise, get the number from bounds. - nr=$((`cat ${dumpdir}/bounds` - 1)) + nr=$((`cat "${dumpdir}/bounds"` - 1)) fi # Make sure the dump actually exists. @@ -151,16 +151,16 @@ panicmail_run() fi # Gather information about this panic. - panicmail_gather ${nr} + panicmail_gather "${nr}" # Encrypt the panic information. - panicmail_encrypt ${nr} "${panicmail_key}" + panicmail_encrypt "${nr}" "${panicmail_key}" # Generate and send an email. if checkyesno panicmail_autosubmit; then - panicmail_auto ${nr} | sendmail -t + panicmail_auto "${nr}" | sendmail -t else - panicmail_root ${nr} | sendmail -t + panicmail_root "${nr}" | sendmail -t fi }