mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
Option -R did not only dump right-to-left, but also left-to-right traffic
This commit is contained in:
parent
a390dfc547
commit
1a1cbb1598
3 changed files with 56 additions and 3 deletions
5
CHANGES
5
CHANGES
|
@ -35,6 +35,11 @@ Corrections:
|
|||
Test: ABSTRACT_USER
|
||||
Thanks to Andreas Fink for reporting this issue.
|
||||
|
||||
Option -R did not only dump ("sniff") right-to-left, but also
|
||||
left-to-right traffic to the given file.
|
||||
Test: SNIFF_RIGHT_TO_LEFT
|
||||
Thanks to 1314 gsf for reporting this bug and sending a patch.
|
||||
|
||||
Testing:
|
||||
Prevent the TIMESTAMP tests from sporadically failing due do seconds
|
||||
overflow
|
||||
|
|
4
socat.c
4
socat.c
|
@ -208,7 +208,7 @@ int main(int argc, const char *argv[]) {
|
|||
O_LARGEFILE|
|
||||
#endif
|
||||
O_NONBLOCK, 0664)) < 0)
|
||||
Error2("option -r \"%s\": %s", a, strerror(errno));
|
||||
Error2("option -R \"%s\": %s", a, strerror(errno));
|
||||
break;
|
||||
case 'b': if (arg1[0][2]) {
|
||||
a = *arg1+2;
|
||||
|
@ -1303,7 +1303,7 @@ int xiotransfer(xiofile_t *inpipe, xiofile_t *outpipe,
|
|||
|
||||
if (!righttoleft && socat_opts.sniffleft >= 0) {
|
||||
Write(socat_opts.sniffleft, buff, bytes);
|
||||
} else if (socat_opts.sniffright >= 0) {
|
||||
} else if (righttoleft && socat_opts.sniffright >= 0) {
|
||||
Write(socat_opts.sniffright, buff, bytes);
|
||||
}
|
||||
|
||||
|
|
50
test.sh
50
test.sh
|
@ -15112,7 +15112,7 @@ kill -9 $pid 2>/dev/null;
|
|||
rc=$? # did process still exist?
|
||||
if [ $rc -ne 0 ]; then
|
||||
$PRINTF "$OK\n"
|
||||
if [" $VERBOSE" ]; then
|
||||
if [ "$VERBOSE" ]; then
|
||||
echo "$CMD &" >&2
|
||||
fi
|
||||
numOK=$((numOK+1))
|
||||
|
@ -15173,6 +15173,50 @@ PORT=$((PORT+1))
|
|||
N=$((N+1))
|
||||
|
||||
|
||||
# Test if option -R does not "sniff" left-to-right traffic
|
||||
NAME=SNIFF_RIGHT_TO_LEFT
|
||||
case "$TESTS" in
|
||||
*%$N%*|*%functions%*|*%bugs%*|*%$NAME%*)
|
||||
TEST="$NAME: test if option -R does not "sniff" left-to-right traffic"
|
||||
# Use option -R, check if left-to-right traffic is not in output file
|
||||
if ! eval $NUMCOND; then :; else
|
||||
tf="$td/test$N.stdout"
|
||||
te="$td/test$N.stderr"
|
||||
ts="$td/test$N.sniffed"
|
||||
tdiff="$td/test$N.diff"
|
||||
da="test$N $(date) $RANDOM"
|
||||
CMD="$TRACE $SOCAT $opts -R $ts - /dev/null"
|
||||
printf "test $F_n $TEST... " $N
|
||||
echo "$da" |$CMD >"${tf}" 2>"${te}"
|
||||
rc=$?
|
||||
if [ ! -f "$ts" ]; then
|
||||
$PRINTF "$CANT\n"
|
||||
if [ "$VERBOSE" ]; then
|
||||
echo "$CMD" >&2
|
||||
cat "${te}" >&2
|
||||
fi
|
||||
numCANT=$((numCANT+1))
|
||||
listCANT="$listCANT $N"
|
||||
elif [ ! -s "$ts" ]; then
|
||||
$PRINTF "$OK\n"
|
||||
if [ "$VERBOSE" ]; then
|
||||
echo "$CMD" >&2
|
||||
fi
|
||||
numOK=$((numOK+1))
|
||||
else
|
||||
$PRINTF "$FAILED\n"
|
||||
echo "$CMD &" >&2
|
||||
cat "${te}" >&2
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
fi
|
||||
fi # NUMCOND
|
||||
;;
|
||||
esac
|
||||
PORT=$((PORT+1))
|
||||
N=$((N+1))
|
||||
|
||||
|
||||
# end of common tests
|
||||
|
||||
##################################################################################
|
||||
|
@ -15296,11 +15340,15 @@ rc1=$?
|
|||
kill $pid0 2>/dev/null; wait
|
||||
if [ !!! ]; then
|
||||
$PRINTF "$OK\n"
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
if [" $VERBOSE" ]; then
|
||||
=======
|
||||
if [ "$VERBOSE" ]; then
|
||||
>>>>>>> 8e56329... ABSTEACT-LISTEN with option user calls fchown()
|
||||
=======
|
||||
if [ "$VERBOSE" ]; then
|
||||
>>>>>>> 4927d33... Option -R did not only dump right-to-left, but also left-to-right traffic
|
||||
echo "$CMD0 &" >&2
|
||||
echo "$CMD1" >&2
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue