From: Nicolas François Date: Sat, 20 Sep 2014 21:56:25 +0000 (+0200) Subject: Extend checks for moving home directory X-Git-Tag: 4.3.0~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8bf8af5aadbddb88483f5aef918d7d37167f5c0;p=shadow 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. --- diff --git a/tests/usertools/usermod/49_usermod_change_gid+move_homedir_other_device/data/home_ls-a b/tests/usertools/usermod/49_usermod_change_gid+move_homedir_other_device/data/home_ls-a index ddf97829..654c2bec 100644 --- a/tests/usertools/usermod/49_usermod_change_gid+move_homedir_other_device/data/home_ls-a +++ b/tests/usertools/usermod/49_usermod_change_gid+move_homedir_other_device/data/home_ls-a @@ -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/.' diff --git a/tests/usertools/usermod/49_usermod_change_gid+move_homedir_other_device/usermod.test b/tests/usertools/usermod/49_usermod_change_gid+move_homedir_other_device/usermod.test index 0d92e9e9..9a42e8de 100755 --- a/tests/usertools/usermod/49_usermod_change_gid+move_homedir_other_device/usermod.test +++ b/tests/usertools/usermod/49_usermod_change_gid+move_homedir_other_device/usermod.test @@ -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..."