The rawer option no longer clears CREAD

This commit is contained in:
Gerhard Rieger 2022-08-13 17:41:12 +02:00
parent 0b1af3703d
commit cf81901fe5
3 changed files with 44 additions and 4 deletions

View file

@ -24,6 +24,9 @@ Corrections:
Thanks to Paul Wise for reporting and analyzing the case of accessing
a left over socket entry with GOPEN.
The rawer option failed because it tried to clear CREAD.
Test: RAWER
Porting:
OpenSSL, at least 1.1 on Ubuntu, crashed with SIGSEGV under certain
conditions: client connection to server with certificate with empty

43
test.sh
View file

@ -15274,7 +15274,6 @@ esac
PORT=$((PORT+1))
N=$((N+1))
# Socats access to different types of file system entries using various kinds
# of addresses fails in a couple of useless combinations. These failures have
# to print an error message and exit with return code 1.
@ -15296,6 +15295,7 @@ tf="$td/test$N.stdout"
te="$td/test$N.stderr"
tdiff="$td/test$N.diff"
da="test$N $(date) $RANDOM"
printf "test $F_n $TEST... " $N
# create an invalid or non-matching UNIX socket
case "$entry" in
@ -15457,6 +15457,43 @@ esac
PORT=$((PORT+1))
N=$((N+1))
# Test if the rawer option works. Up to Socat 1.7.4.3, it failed because it
# cleared the CREAD flag.
NAME=RAWER
case "$TESTS" in
*%$N%*|*%functions%*|*%bugs%*|*%pty%*|*%$NAME%*)
TEST="$NAME: Test if the rawer option fails"
# Invoke Socat with a terminal address with option rawer. When it has no error
# the test succeeded.
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"
CMD0="$SOCAT -lp outer /dev/null EXEC:\"$SOCAT\\ -lp\\ inner\\ -\\,rawer\\ PIPE\",pty"
printf "test $F_n $TEST... " $N
eval "$CMD0" >/dev/null 2>"${te}0"
rc0=$?
if [ $rc0 -eq 0 ]; then
$PRINTF "$OK\n"
if [ "$VERBOSE" ]; then
echo "$CMD0" >&2
fi
numOK=$((numOK+1))
else
$PRINTF "$FAILED\n"
echo "$CMD0" >&2
cat "${te}0" >&2
numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N"
fi
fi # NUMCOND
;;
esac
PORT=$((PORT+1))
N=$((N+1))
# end of common tests
##################################################################################
@ -15558,12 +15595,12 @@ exit
#==============================================================================
# test template
# give a description of what is tested (a bugfix, a new feature...)
# Give a description of what is tested (a bugfix, a new feature...)
NAME=SHORT_UNIQUE_TESTNAME
case "$TESTS" in
*%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%$NAME%*)
TEST="$NAME: give a one line description of test"
# describe how the test is performed, and what's the success criteria
# Describe how the test is performed, and what's the success criteria
if ! eval $NUMCOND; then :; else
tf="$td/test$N.stdout"
te="$td/test$N.stderr"

View file

@ -475,7 +475,7 @@ int xiotermios_spec(int fd, int optcode) {
_xiotermios_data.termarg.c_iflag = 0;
_xiotermios_data.termarg.c_oflag = 0;
_xiotermios_data.termarg.c_lflag = 0;
_xiotermios_data.termarg.c_cflag = (CS8);
_xiotermios_data.termarg.c_cflag = (CREAD|CS8);
_xiotermios_data.termarg.c_cc[VMIN] = 1;
_xiotermios_data.termarg.c_cc[VTIME] = 0;
break;