diff options
author | Jeremy Allison <jra@samba.org> | 2010-03-09 16:36:48 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-03-09 16:36:48 -0800 |
commit | 3855c948c029490c616f4b4aa81b47e6df8c12a0 (patch) | |
tree | d8de146356be8e8c645e9da2351dcd141afa15c9 /source3/script/tests/selftest.sh | |
parent | ae79d8ce02921e9a5c82433527909c7f707051e3 (diff) | |
download | samba-3855c948c029490c616f4b4aa81b47e6df8c12a0.tar.gz samba-3855c948c029490c616f4b4aa81b47e6df8c12a0.tar.bz2 samba-3855c948c029490c616f4b4aa81b47e6df8c12a0.zip |
Add tests which, when run as root, will ensure we can't write
into a read-only directory, or read a owner-read-only file.
Jeremy.
Diffstat (limited to 'source3/script/tests/selftest.sh')
-rwxr-xr-x | source3/script/tests/selftest.sh | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index 9994e47035..e49bca863b 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -36,9 +36,22 @@ if [ $CUSTOM_CONF_ARG ]; then fi ## -## create the test directory +## create the test directory layout ## PREFIX=`echo $DIRECTORY | sed s+//+/+` +printf "%s" "CREATE TEST ENVIRONMENT IN '$PREFIX'"... +/bin/rm -rf $PREFIX +if [ -e "$PREFIX" ]; then + echo "***" + echo "*** Failed to delete test environment $PREFIX" + echo "*** Was a previous run done as root ?" + echo "***" + exit 1 +fi + +## +## create the test directory +## mkdir -p $PREFIX || exit $? OLD_PWD=`pwd` cd $PREFIX || exit $? @@ -145,11 +158,6 @@ if test "x`smbd -b | grep NSS_WRAPPER`" = "x"; then fi -## -## create the test directory layout -## -printf "%s" "CREATE TEST ENVIRONMENT IN '$PREFIX'"... -/bin/rm -rf $PREFIX/* mkdir -p $PRIVATEDIR $NCALRPCDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR mkdir -p $SOCKET_WRAPPER_DIR mkdir -p $WINBINDD_SOCKET_DIR @@ -173,6 +181,16 @@ fi chmod 777 $SHRDIR ## +## Create a read-only directory. +## +RO_SHRDIR=`echo $SHRDIR | sed -e 's:/[^/]*$::'` +RO_SHRDIR=$RO_SHRDIR/root-tmp +mkdir -p $RO_SHRDIR +chmod 755 $RO_SHRDIR +touch $RO_SHRDIR/unreadable_file +chmod 600 $RO_SHRDIR/unreadable_file + +## ## Create the common config include file with the basic settings ## @@ -269,6 +287,9 @@ cat >$SERVERCONFFILE<<EOF [tmp] path = $SHRDIR +[ro-tmp] + path = $RO_SHRDIR + guest ok = yes [hideunread] copy = tmp hide unreadable = yes |