mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
Test if EXEC only passes stdio
This commit is contained in:
parent
0cf1275349
commit
5033ec1ffd
2 changed files with 40 additions and 1 deletions
2
CHANGES
2
CHANGES
|
@ -89,6 +89,8 @@ Testing:
|
|||
|
||||
test.sh: Check if ports are free before using them for tests
|
||||
|
||||
Test EXEC_FDS checks with Filan if EXEC address only passes stdio FDs.
|
||||
|
||||
####################### V 1.7.4.4:
|
||||
|
||||
Corrections:
|
||||
|
|
39
test.sh
39
test.sh
|
@ -574,7 +574,7 @@ init_openssl_s_server () {
|
|||
|
||||
[ -z "$TESTS" ] && TESTS="consistency functions filan"
|
||||
# use '%' as separation char
|
||||
TESTS="%$(echo "$TESTS" |tr ' ' '%')%"
|
||||
TESTS="%$(echo " $TESTS " |tr ' ' '%')%"
|
||||
|
||||
[ -z "$USER" ] && USER="$LOGNAME" # HP-UX
|
||||
if [ -z "$TMPDIR" ]; then
|
||||
|
@ -15924,6 +15924,43 @@ PORT=$((PORT+1))
|
|||
N=$((N+1))
|
||||
|
||||
|
||||
# Test if EXEC'd program inherits only the stdio file descriptors
|
||||
# thus there are no FD leaks from Socat to EXEC'd program
|
||||
NAME=EXEC_FDS
|
||||
case "$TESTS" in
|
||||
*%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%filan%*|*%$NAME%*)
|
||||
TEST="$NAME: Socat does not leak FDs to EXEC'd program"
|
||||
# Run Socat with EXEC address, execute Filan to display its file descriptors
|
||||
# Test succeeds when only FDs 0, 1, 2 are in use.
|
||||
if ! eval $NUMCOND; then :; else
|
||||
tf="$td/test$N.stdout"
|
||||
te="$td/test$N.stderr"
|
||||
tdiff="$td/test$N.diff"
|
||||
da="test$N $(date) $RANDOM"
|
||||
CMD="$TRACE $SOCAT $opts - EXEC:\"$FILAN -s\",stderr"
|
||||
printf "test $F_n $TEST... " $N
|
||||
eval "$CMD" >"${tf}" 2>"${te}"
|
||||
# "door" is a special FD type on Solaris/SunOS
|
||||
if [ "$(cat "${tf}" |grep -v ' door ' |wc -l)" -eq 3 ]; then
|
||||
$PRINTF "$OK\n"
|
||||
if [ "$VERBOSE" ]; then
|
||||
echo "$CMD" >&2
|
||||
fi
|
||||
numOK=$((numOK+1))
|
||||
else
|
||||
$PRINTF "$FAILED\n"
|
||||
echo "$CMD" >&2
|
||||
cat "${tf}" >&2
|
||||
cat "${te}" >&2
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
fi
|
||||
fi # NUMCOND
|
||||
;;
|
||||
esac
|
||||
PORT=$((PORT+1))
|
||||
N=$((N+1))
|
||||
|
||||
# end of common tests
|
||||
|
||||
##################################################################################
|
||||
|
|
Loading…
Reference in a new issue