#!/bin/sh

. ./test-functions

echo -n "/proc set as user and wget test:	"
( # Sub-shell so as not to taint the test process.
	read -r subshellpid _ < /proc/self/stat
	val=$(cat /proc/$subshellpid/attr/current)
        if [ x$val != x0 ]; then
                failmsg subshell already tainted
                exit
        fi

	echo 1 > /proc/$subshellpid/attr/current
	if [ $? != 0 ]; then
		failmsg unable to set taint through /proc
		exit
	fi

	val=$(cat /proc/$subshellpid/attr/current)
	if [ x$val != x1 ]; then
		failmsg unable to set taint through /proc; set to $val
		exit
	fi

	_wget=$(copy wget)
	echo https://$SF_HOSTNAME/ | test_evil_bit $_wget --no-check-certificate -i - --quiet -O /dev/null
	rm -f $_wget
)
