From 8c54af14f257f07d346c29d4a828ff9f8910f213 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sun, 24 Aug 2008 18:55:04 +0000 Subject: [PATCH] * don't use temp files while migrating aliases; we trade security here for performance; this fixes our portion of debian Bug #496359 --- citadel/migrate_aliases.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/citadel/migrate_aliases.sh b/citadel/migrate_aliases.sh index a0caa615b..bc5c31ef3 100755 --- a/citadel/migrate_aliases.sh +++ b/citadel/migrate_aliases.sh @@ -6,18 +6,24 @@ fi CITALIAS=$1 if test -f /etc/aliases; then - cat /etc/aliases | \ +# don't work with temp fils, so they can't get hijacked. +# sorry users with megabytes of aliases. + NLINES=`cat /etc/aliases | \ sed -e "s; *;;g" \ -e "s;\t*;;g" | \ grep -v ^root: | \ grep -v ^# | \ sed -e "s;:root;,room_aide;" \ - -e "s;:;,;" >/tmp/aliases - - NLINES=`cat /tmp/aliases|wc -l` + -e "s;:;,;" |wc -l` for ((i=1; i <= $NLINES; i++)); do - ALIAS=`head -n $i /tmp/aliases |tail -n 1` + ALIAS=` cat /etc/aliases | \ + sed -e "s; *;;g" \ + -e "s;\t*;;g" | \ + grep -v ^root: | \ + grep -v ^# | \ + sed -e "s;:root;,room_aide;" \ + -e "s;:;,;" |head -n $i |tail -n 1` ORG=`echo $ALIAS|sed "s;,.*;;"` if grep "$ORG" "$CITALIAS"; then echo "Ignoring Alias $ORG as its already there" -- 2.39.2