3 # Test that we don't follow .augsave symlinks
5 ROOT=$abs_top_builddir/build/test-put-symlink-augsave
6 LENSES=$abs_top_srcdir/lenses
9 HOSTS_AUGSAVE=${HOSTS}.augsave
11 ATTACK_FILE=$ROOT/other/attack
14 mkdir -p $(dirname $HOSTS)
15 mkdir -p $(dirname $ATTACK_FILE)
20 HOSTS_SUM=$(sum $HOSTS | cut -d ' ' -f 1)
23 (cd $(dirname $HOSTS) && ln -s ../other/attack $(basename $HOSTS).augsave)
25 # Now ask for the original to be saved in .augsave
26 augtool --nostdinc -I $LENSES -r $ROOT --backup > /dev/null <<EOF
27 set /files/etc/hosts/1/alias myhost
31 if [ ! -f $HOSTS -o -h $HOSTS ] ; then
32 echo "/etc/hosts is no longer a regular file"
35 if [ -h $HOSTS_AUGSAVE ] ; then
36 echo "/etc/hosts.augsave is still a symlink, should be unlinked"
40 if [ ! "x${HOSTS_SUM}" = "x$(sum $HOSTS_AUGSAVE | cut -d ' ' -f 1)" ]; then
41 echo "/etc/hosts.augsave has changed from the original /etc/hosts"
44 if ! grep myhost $HOSTS >/dev/null; then
45 echo "/etc/hosts does not contain the modification"
49 if [ -s $ATTACK_FILE ]; then
50 echo "/other/attack now contains data, should be blank"