Extend checks for moving home directory

Add hard link to files inside or outside the home directory)
Add files with user or group owner different from the user.
This commit is contained in:
Nicolas François 2014-09-20 23:56:25 +02:00
parent d8c8e8b4b6
commit a8bf8af5aa
2 changed files with 23 additions and 0 deletions

View File

@ -1,5 +1,10 @@
-rw-r--r-- 0:1001 `/home/foo2/uroot'
-rw-r--r-- 1000:0 `/home/foo2/groot'
-rw-r--r-- 1000:1001 `/home/foo2/.tata'
-rw-r--r-- 1000:1001 `/home/foo2/.tyty'
-rw-r--r-- 1000:1001 `/home/foo2/profile2'
-rw-r--r-- 1000:1001 `/home/foo2/toto'
-rw-r--r-- 1000:1001 `/home/foo2/tyty'
crw-r--r-- 1000:1001 `/home/foo2/null'
drwxr-xr-x 0:0 `/home/foo2/..'
drwxr-xr-x 1000:1001 `/home/foo2/.'

View File

@ -19,10 +19,17 @@ change_config
mkdir /home/foo
mkdir /home/foo/titi
echo toto > /home/foo/toto
echo tyty > /home/foo/tyty
ln /home/foo/toto /home/foo/.tata
ln /home/foo/tyty /home/foo/.tyty
ln -s /home/foo/toto /home/foo/tutu
mknod /home/foo/null c 1 3
ln /etc/profile /home/foo/profile2
echo root > /home/foo/uroot
echo root > /home/foo/groot
chown -R foo:foo /home/foo
chown root /home/foo/uroot
chgrp root /home/foo/groot
stat --printf "%A %u:%g %N\n" /home/foo/* /home/foo/.* 2>/dev/null | sort
mkdir /tmp/home
@ -54,6 +61,17 @@ echo -n "Check content of /tmp/test-newusers..."
stat --printf "%A %u:%g %N\n" /home/foo2/* /home/foo2/.* 2>/dev/null | sort > tmp/home_ls-a
diff -rauN data/home_ls-a tmp/home_ls-a
echo "OK"
echo -n "Check that hardlink to another homedir file remains a hardlink..."
dev_ino=$(stat --printf "%d-%i" /home/foo2/toto)
dev_ino2=$(stat --printf "%d-%i" /home/foo2/.tata)
test "$dev_ino" = "$dev_ino2"
echo "OK"
echo -n "Check hardlink to outside the homedir..."
dev_ino=$(stat --printf "%d-%i" /etc/profile)
dev_ino2=$(stat --printf "%d-%i" /home/foo2/profile2)
echo "$dev_ino" != "$dev_ino2"
#test "$dev_ino" = "$dev_ino2"
echo "NOT IMPLEMENTED"
rm -f tmp/home_ls-a
echo -n "Remove the new home directory..."