mirror of
https://github.com/moparisthebest/socat
synced 2024-12-22 06:58:47 -05:00
issue error when PTY called with parameters
This commit is contained in:
parent
aae035c5b9
commit
b8d16ecd51
3
CHANGES
3
CHANGES
@ -23,6 +23,9 @@ corrections:
|
||||
socat option -x did not print packet direction, timestamp etc; thanks
|
||||
to Anthony Sharobaiko for sending a patch
|
||||
|
||||
address PTY does not take any parameters but did not report an error
|
||||
when some were given
|
||||
|
||||
####################### V 1.7.1.3:
|
||||
|
||||
security:
|
||||
|
32
test.sh
32
test.sh
@ -1,6 +1,6 @@
|
||||
#! /bin/bash
|
||||
# source: test.sh
|
||||
# Copyright Gerhard Rieger 2001-2010
|
||||
# Copyright Gerhard Rieger 2001-2011
|
||||
# Published under the GNU General Public License V.2, see file COPYING
|
||||
|
||||
# perform lots of tests on socat
|
||||
@ -10409,6 +10409,36 @@ esac
|
||||
N=$((N+1))
|
||||
|
||||
|
||||
# PTY address allowed to sepcify address parameters but ignored them
|
||||
NAME=PTY_VOIDARG
|
||||
case "$TESTS" in
|
||||
*%functions%*|*%bugs%*|*%pty%*|*%$NAME%*)
|
||||
TEST="$NAME: check if address params of PTY produce error"
|
||||
# invoke socat with address PTY and some param; expect an error
|
||||
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 $opts /dev/null PTY:/tmp/xyz"
|
||||
printf "test $F_n $TEST... " $N
|
||||
$CMD0 >/dev/null 2>"${te}0"
|
||||
rc0=$?
|
||||
if [ $rc0 -ne 0 ]; then
|
||||
$PRINTF "$OK\n"
|
||||
numOK=$((numOK+1))
|
||||
else
|
||||
$PRINTF "$FAILED\n"
|
||||
echo "$CMD0"
|
||||
cat "${te}0"
|
||||
numFAIL=$((numFAIL+1))
|
||||
fi
|
||||
fi # NUMCOND
|
||||
;;
|
||||
esac
|
||||
N=$((N+1))
|
||||
|
||||
|
||||
###############################################################################
|
||||
# here come tests that might affect your systems integrity. Put normal tests
|
||||
# before this paragraph.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* source: xio-pty.c */
|
||||
/* Copyright Gerhard Rieger 2002-2009 */
|
||||
/* Copyright Gerhard Rieger 2002-2011 */
|
||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||
|
||||
/* this file contains the source for creating pty addresses */
|
||||
@ -47,6 +47,10 @@ static int xioopen_pty(int argc, const char *argv[], struct opt *opts, int xiofl
|
||||
compatibility we choose "no" as default */
|
||||
struct timespec pollintv = { PTY_INTERVALL };
|
||||
|
||||
if (argc != 1) {
|
||||
Error2("%s: wrong number of parameters (%d instead of 0)", argv[0], argc-1);
|
||||
}
|
||||
|
||||
xfd->stream.howtoend = END_CLOSE;
|
||||
|
||||
if (applyopts_single(&xfd->stream, opts, PH_INIT) < 0) return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user