1#! /bin/sh
2
3test -f check..sccs || exit 77
4
5. $srcdir/check_lib
6check_start 21 "put (WRQ) of a not checked out SCCS file which exists nevertheless"
7# this checks that utftpd does not check in or overwrite files which exist although
8# they are not checked out.
9
10# setup configuration file
11wd=`pwd`
12cat >$CHECKDIR/check.conf <<EOF
13127.0.0.1:write($CHECKDIR)
14default:sccs-get($SCCS_GET)sccs-delta($SCCS_DELTA)
15EOF
16./utftpd_make <$CHECKDIR/check.conf $CHECKDIR/check.cdb $CHECKDIR/check.tmp
17
18for i in `cat check..sccs_few_files` ; do
19	cd $CHECKDIR/s
20	cp $wd/$i ./$i
21	sccs_create $i
22	# create illegal file.
23	cp $wd/$i ./$i
24	echo "difference" >>$i
25	cd $wd
26	do_test FAIL   ./utftp --put 127.0.0.1:$CHECKPORT $CHECKDIR/s/$i    $i
27	# there now should the file in its original, illegal state.
28	if test "x$last_test_ok" = "x0" ; then
29		:
30	elif test -f $CHECKDIR/s/$i 2>/dev/null ; then
31		cp $wd/$i $CHECKDIR/s/$i.cmp
32		echo "difference" >>$CHECKDIR/s/$i.cmp
33		out=`cmp $CHECKDIR/s/$i $CHECKDIR/s/$i.cmp 2>&1`
34		if test $? = 0 ; then
35			:
36		else
37			fail_after "file has been changed: $out"
38		fi
39		cd $wd
40	else
41		fail_after  "file does not exist anymore"
42	fi
43done
44check_end
45