Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package socat for openSUSE:Factory checked in at 2022-01-25 17:35:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/socat (Old) and /work/SRC/openSUSE:Factory/.socat.new.1938 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "socat" Tue Jan 25 17:35:45 2022 rev:44 rq:948225 version:1.7.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/socat/socat.changes 2021-11-08 17:24:12.764694425 +0100 +++ /work/SRC/openSUSE:Factory/.socat.new.1938/socat.changes 2022-01-25 17:36:35.118121447 +0100 @@ -1,0 +2,8 @@ +Sat Jan 22 20:54:21 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 1.7.4.3: + * fixes the TCP_INFO issue that broke building on non-Linux platforms. + * building on AIX works again. + * A few more corrections and improvements have been added + +------------------------------------------------------------------- Old: ---- socat-1.7.4.2.tar.gz New: ---- socat-1.7.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ socat.spec ++++++ --- /var/tmp/diff_new_pack.oxFs0I/_old 2022-01-25 17:36:35.690117507 +0100 +++ /var/tmp/diff_new_pack.oxFs0I/_new 2022-01-25 17:36:35.694117479 +0100 @@ -1,7 +1,7 @@ # # spec file for package socat # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # Copyright (c) 2010 Pascal Bleser <pascal.ble...@opensuse.org> # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: socat -Version: 1.7.4.2 +Version: 1.7.4.3 Release: 0 Summary: Multipurpose relay for bidirectional data transfer License: MIT AND SUSE-GPL-2.0-with-openssl-exception ++++++ socat-1.7.4.2.tar.gz -> socat-1.7.4.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/CHANGES new/socat-1.7.4.3/CHANGES --- old/socat-1.7.4.2/CHANGES 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/CHANGES 2022-01-08 21:59:57.000000000 +0100 @@ -1,4 +1,57 @@ ??? +####################### V 1.7.4.3: + +Corrections: + Socat crashed with SIGSEGV when peer presented a certificate without + (or empty?) subject. + Thanks to Martin Dorey for reporting this issue and sending a patch. + + Socat 1.7.4.2 did not compile on OmniOS (and probably other OpenSolaris + distributions) + Thanks to Andy Fiddaman for sending a patch. + + Socat since 1.7.4.0 did not compile on Solaris and its derivatives + because the getprotobynumber_r() function prototype differ from the + Linux version. + configure now checks for the variant. + Thanks to Robert Zybeck for reporting this issue. + + The variable for the no-sni option was not initialized and could thus + break OpenSSL certificate verification. E.g., test OPENSSL_SNI on some + platform succeeded with -g but failed with -O compiler option. + Thanks to valgrind for quickly finding the cause. + +Porting: + Again porting Socat to AIX (7.1) - Fixed configure and compile issues: + Adapted include requirements for IPv6 + Guarded MSG_DONTWAIT + + Continued porting Socat to AIX-7.1 - Fixed some runtime errors: + UNIX domain sockets of type SEQPACKET are not available. + Connecting to UNIX datagram socket fails with EPROTONOSUPPORT (vs. + EPROTOTYPE on most other OSes). + Streams: Must not push ldterm when it is already active (hangs). + +Building: + Socats build date and time may now be set externally with environment + variable SOURCE_DATE_EPOCH. + Thanks to Viktor Kleinik for sending a patch. + + Building Socat in a sub directory failed. + Now the following works even for the docu parts: + mkdir -p myos; cd myos; ../configure && make; cd .. + Thanks to Jon Ringle for sending a patch. + +Testing: + test.sh: many corrections for AIX's older shell utilities, e.g.sleep(1) + does not allow fractions of seconds, grep does not understand '\<'; + OpenIndiana/SunOS netstat format; + many more functional and cosmetic code corrections. + +Documentation: + The socktype option was documented unspecifically as type option. + Thanks to Jonas Metzger for the hint. + ####################### V 1.7.4.2: Corrections: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/Makefile.in new/socat-1.7.4.3/Makefile.in --- old/socat-1.7.4.2/Makefile.in 2021-01-03 19:23:22.000000000 +0100 +++ new/socat-1.7.4.3/Makefile.in 2022-01-08 21:59:57.000000000 +0100 @@ -100,10 +100,11 @@ rm -f doc/socat.1 doc/socat.html doc/socat.1: doc/socat.yo - yodl2man -o $@ $+ + mkdir -p $(@D); yodl2man -o $@ $+ doc/socat.html: doc/socat.yo - cd doc; yodl2html -o socat.html socat.yo; cd .. +# care for refs in html + mkdir -p $(@D); cd $(@D); yodl2html -o socat.html ../$+; cd .. progs: $(PROGS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/README new/socat-1.7.4.3/README --- old/socat-1.7.4.2/README 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/README 2022-01-08 21:59:57.000000000 +0100 @@ -75,7 +75,7 @@ Get the tarball and extract it: tar xzf socat.tar.gz - cd socat-1.7.4.2 + cd socat-1.7.4.3 ./configure make su diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/VERSION new/socat-1.7.4.3/VERSION --- old/socat-1.7.4.2/VERSION 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/VERSION 2022-01-08 21:59:57.000000000 +0100 @@ -1 +1 @@ -"1.7.4.2" +"1.7.4.3" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/configure new/socat-1.7.4.3/configure --- old/socat-1.7.4.2/configure 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/configure 2022-01-08 21:59:57.000000000 +0100 @@ -4340,6 +4340,76 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sc_cv_have_prototype_hstrerror" >&5 $as_echo "$sc_cv_have_prototype_hstrerror" >&6; } +# getprotobynumber_r() is not standardized +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getprotobynumber_r() variant" >&5 +$as_echo_n "checking for getprotobynumber_r() variant... " >&6; } +if ${sc_cv_getprotobynumber_r+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stddef.h> +#include <netdb.h> +int +main () +{ +getprotobynumber_r(1,NULL,NULL,1024,NULL); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + sc_cv_getprotobynumber_r=1; tmp_bynum_variant=Linux +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stddef.h> + #include <netdb.h> +int +main () +{ +getprotobynumber_r(1,NULL,NULL,1024); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + sc_cv_getprotobynumber_r=2; tmp_bynum_variant=Solaris +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stddef.h> + #include <netdb.h> +int +main () +{ +getprotobynumber_r(1,NULL,NULL); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + sc_cv_getprotobynumber_r=3; tmp_bynum_variant=AIX +else + sc_cv_getprotobynumber_r= + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +if test "$sc_cv_getprotobynumber_r"; then + cat >>confdefs.h <<_ACEOF +#define HAVE_GETPROTOBYNUMBER_R $sc_cv_getprotobynumber_r +_ACEOF + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sc_cv_getprotobynumber_r /* $tmp_bynum_variant */" >&5 +$as_echo "$sc_cv_getprotobynumber_r /* $tmp_bynum_variant */" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include help" >&5 $as_echo_n "checking whether to include help... " >&6; } @@ -4567,6 +4637,9 @@ #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif + #ifdef HAVE_NETINET_IP_H + # include <netinet/ip.h> + #endif " if test "x$ac_cv_header_netinet_ip6_h" = xyes; then : cat >>confdefs.h <<_ACEOF @@ -6144,13 +6217,12 @@ fi done -for ac_func in getprotobynumber getprotobynumber_r +for ac_func in getprotobynumber do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + ac_fn_c_check_func "$LINENO" "getprotobynumber" "ac_cv_func_getprotobynumber" +if test "x$ac_cv_func_getprotobynumber" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_GETPROTOBYNUMBER 1 _ACEOF fi @@ -21298,7 +21370,14 @@ $as_echo "$sc_cv_var_environ" >&6; } # allow BUILD_DATE to be externally set for build reproducibility -if test "$BUILD_DATE"; then +if test "$SOURCE_DATE_EPOCH"; then + DATE_FMT="%d %b %Y %H:%M:%S" + BUILD_DATE=$(LC_ALL=C date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT") + cat >>confdefs.h <<_ACEOF +#define BUILD_DATE "$BUILD_DATE" +_ACEOF + +elif test "$BUILD_DATE"; then cat >>confdefs.h <<_ACEOF #define BUILD_DATE "$BUILD_DATE" _ACEOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/configure.ac new/socat-1.7.4.3/configure.ac --- old/socat-1.7.4.2/configure.ac 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/configure.ac 2022-01-08 21:59:57.000000000 +0100 @@ -134,6 +134,26 @@ fi AC_MSG_RESULT($sc_cv_have_prototype_hstrerror) +# getprotobynumber_r() is not standardized +AC_MSG_CHECKING(for getprotobynumber_r() variant) +AC_CACHE_VAL(sc_cv_getprotobynumber_r, +[AC_TRY_COMPILE([#include <stddef.h> +#include <netdb.h>],[getprotobynumber_r(1,NULL,NULL,1024,NULL);], +[sc_cv_getprotobynumber_r=1; tmp_bynum_variant=Linux], + [AC_TRY_COMPILE([#include <stddef.h> + #include <netdb.h>],[getprotobynumber_r(1,NULL,NULL,1024);], + [sc_cv_getprotobynumber_r=2; tmp_bynum_variant=Solaris], + [AC_TRY_COMPILE([#include <stddef.h> + #include <netdb.h>],[getprotobynumber_r(1,NULL,NULL);], + [sc_cv_getprotobynumber_r=3; tmp_bynum_variant=AIX], + + [sc_cv_getprotobynumber_r=] +)])])]) +if test "$sc_cv_getprotobynumber_r"; then + AC_DEFINE_UNQUOTED(HAVE_GETPROTOBYNUMBER_R, $sc_cv_getprotobynumber_r) +fi +AC_MSG_RESULT($sc_cv_getprotobynumber_r /* $tmp_bynum_variant */) + AC_MSG_CHECKING(whether to include help) AC_ARG_ENABLE(help, [ --disable-help disable help], @@ -242,6 +262,9 @@ [AC_INCLUDES_DEFAULT #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> + #endif + #ifdef HAVE_NETINET_IP_H + # include <netinet/ip.h> #endif]) AC_CHECK_HEADERS(netinet6/in6.h) # found on OpenBSD and Lion, used for IPV6_* @@ -811,7 +834,7 @@ AC_FUNC_STRFTIME AC_CHECK_FUNCS(putenv select pselect poll socket strtod strtol) AC_CHECK_FUNCS(strtoul uname getpgid getsid gethostbyname getaddrinfo) -AC_CHECK_FUNCS(getprotobynumber getprotobynumber_r) +AC_CHECK_FUNCS(getprotobynumber) AC_CHECK_FUNCS(setgroups inet_aton) AC_CHECK_FUNCS(grantpt unlockpt) @@ -2100,7 +2123,11 @@ AC_MSG_RESULT($sc_cv_var_environ) # allow BUILD_DATE to be externally set for build reproducibility -if test "$BUILD_DATE"; then +if test "$SOURCE_DATE_EPOCH"; then + DATE_FMT="%d %b %Y %H:%M:%S" + BUILD_DATE=$(LC_ALL=C date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT") + AC_DEFINE_UNQUOTED(BUILD_DATE, ["$BUILD_DATE"]) +elif test "$BUILD_DATE"; then AC_DEFINE_UNQUOTED(BUILD_DATE, ["$BUILD_DATE"]) else AC_DEFINE(BUILD_DATE, [__DATE__" "__TIME__]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/doc/socat.1 new/socat-1.7.4.3/doc/socat.1 --- old/socat-1.7.4.2/doc/socat.1 2021-10-31 19:08:33.000000000 +0100 +++ new/socat-1.7.4.3/doc/socat.1 2022-01-08 22:10:29.000000000 +0100 @@ -2279,15 +2279,15 @@ calls\&. This option affects address resolution and the required syntax of bind and range options\&. -.IP "\fB\f(CWtype=<type>\fP\fP" +.IP "\fB\f(CWsocktype=<type>\fP\fP" Sets the type of the socket, specified as second argument to the \f(CWsocket()\fP or \f(CWsocketpair()\fP calls, to <type> [int]\&. Address resolution is not affected by this option\&. -Under Linux, 1 means stream oriented socket, 2 means datagram socket, and 3 -means raw socket\&. +Under Linux, 1 means stream oriented socket, 2 means datagram socket, 3 +means raw socket, and 5 seqpacket (stream keeping packet boundaries)\&. .IP "\fB\f(CWprotocol\fP\fP" Sets the protocol of the socket, specified as third argument to the \f(CWsocket()\fP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/doc/socat.html new/socat-1.7.4.3/doc/socat.html --- old/socat-1.7.4.2/doc/socat.html 2021-10-31 19:08:34.000000000 +0100 +++ new/socat-1.7.4.3/doc/socat.html 2022-01-08 22:10:29.000000000 +0100 @@ -2129,7 +2129,7 @@ calls. This option affects address resolution and the required syntax of bind and range options. -<a name="OPTION_SO_TYPE"></a><p><dt><strong><strong><code>type=<type></code></strong></strong><dd> +<a name="OPTION_SO_TYPE"></a><p><dt><strong><strong><code>socktype=<type></code></strong></strong><dd> Sets the type of the socket, specified as second argument to the <code>socket()</code> @@ -2137,8 +2137,8 @@ <code>socketpair()</code> calls, to <type> [<a href="socat.html#TYPE_INT">int</a>]. Address resolution is not affected by this option. - Under Linux, 1 means stream oriented socket, 2 means datagram socket, and 3 - means raw socket. + Under Linux, 1 means stream oriented socket, 2 means datagram socket, 3 + means raw socket, and 5 seqpacket (stream keeping packet boundaries). <a name="OPTION_SO_PROTOCOL"></a><p><dt><strong><strong><code>protocol</code></strong></strong><dd> Sets the protocol of the socket, specified as third argument to the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/doc/socat.yo new/socat-1.7.4.3/doc/socat.yo --- old/socat-1.7.4.2/doc/socat.yo 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/doc/socat.yo 2022-01-08 21:59:57.000000000 +0100 @@ -1982,12 +1982,12 @@ used as first argument to the code(socket()) or code(socketpair()) calls. This option affects address resolution and the required syntax of bind and range options. -label(OPTION_SO_TYPE)dit(bf(tt(type=<type>))) +label(OPTION_SO_TYPE)dit(bf(tt(socktype=<type>))) Sets the type of the socket, specified as second argument to the code(socket()) or code(socketpair()) calls, to <type> [link(int)(TYPE_INT)]. Address resolution is not affected by this option. - Under Linux, 1 means stream oriented socket, 2 means datagram socket, and 3 - means raw socket. + Under Linux, 1 means stream oriented socket, 2 means datagram socket, 3 + means raw socket, and 5 seqpacket (stream keeping packet boundaries). label(OPTION_SO_PROTOCOL)dit(bf(tt(protocol))) Sets the protocol of the socket, specified as third argument to the code(socket()) or code(socketpair()) calls, to <protocol> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/error.c new/socat-1.7.4.3/error.c --- old/socat-1.7.4.2/error.c 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/error.c 2022-01-08 21:59:57.000000000 +0100 @@ -120,6 +120,10 @@ } diag_sock_send = handlersocks[1]; diag_sock_recv = handlersocks[0]; +#if !defined(MSG_DONTWAIT) + fcntl(diag_sock_send, F_SETFL, O_NONBLOCK); + fcntl(diag_sock_recv, F_SETFL, O_NONBLOCK); +#endif return 0; } @@ -278,7 +282,11 @@ diag_dgram.exitcode = diagopts.exitstatus; vsnprintf_r(diag_dgram.text, sizeof(diag_dgram.text), format, ap); if (diag_in_handler && !diag_immediate_msg) { - send(diag_sock_send, &diag_dgram, sizeof(diag_dgram)-TEXTLEN + strlen(diag_dgram.text)+1, MSG_DONTWAIT + send(diag_sock_send, &diag_dgram, sizeof(diag_dgram)-TEXTLEN + strlen(diag_dgram.text)+1, + 0 /* for canonical reasons */ +#ifdef MSG_DONTWAIT + |MSG_DONTWAIT +#endif #ifdef MSG_NOSIGNAL |MSG_NOSIGNAL #endif @@ -380,7 +388,12 @@ void diag_flush(void) { struct diag_dgram recv_dgram; char exitmsg[20]; - while (recv(diag_sock_recv, &recv_dgram, sizeof(recv_dgram)-1, MSG_DONTWAIT) > 0) { + while (recv(diag_sock_recv, &recv_dgram, sizeof(recv_dgram)-1, + 0 /* for canonical reasons */ +#ifdef MSG_DONTWAIT + |MSG_DONTWAIT +#endif + ) > 0) { recv_dgram.text[TEXTLEN-1] = '\0'; switch (recv_dgram.op) { case DIAG_OP_EXIT: @@ -443,7 +456,11 @@ if (diag_in_handler && !diag_immediate_exit) { diag_dgram.op = DIAG_OP_EXIT; diag_dgram.exitcode = status; - send(diag_sock_send, &diag_dgram, sizeof(diag_dgram)-TEXTLEN, MSG_DONTWAIT + send(diag_sock_send, &diag_dgram, sizeof(diag_dgram)-TEXTLEN, + 0 /* for canonical reasons */ +#ifdef MSG_DONTWAIT + |MSG_DONTWAIT +#endif #ifdef MSG_NOSIGNAL |MSG_NOSIGNAL #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/fdname.c new/socat-1.7.4.3/fdname.c --- old/socat-1.7.4.2/fdname.c 2021-01-03 19:23:22.000000000 +0100 +++ new/socat-1.7.4.3/fdname.c 2022-01-08 21:59:57.000000000 +0100 @@ -212,7 +212,7 @@ struct protoent protoent, *protoentp; #endif #define PROTONAMEMAX 1024 - char protoname[PROTONAMEMAX]; + char protoname[PROTONAMEMAX] = ""; #if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) int proto; #endif @@ -253,16 +253,25 @@ #endif #if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) -#if HAVE_GETPROTOBYNUMBER_R +#if HAVE_GETPROTOBYNUMBER_R==1 /* Linux */ rc = getprotobynumber_r(proto, &protoent, protoname, sizeof(protoname), &protoentp); if (protoentp == NULL) { Warn2("sockname(): getprotobynumber_r(proto=%d, ...): %s", proto, strerror(rc)); } strncpy(protoname, protoentp->p_name, sizeof(protoname)); -#elif HAVE_GETPROTOBYNUMBER +#elif HAVE_GETPROTOBYNUMBER_R==2 /* Solaris */ protoentp = getprotobynumber(proto); strncpy(protoname, protoentp->p_name, sizeof(protoname)); +#elif HAVE_GETPROTOBYNUMBER_R==3 /* AIX */ + { + struct protoent_data proto_data; + rc = getprotobynumber_r(proto, &protoent, &proto_data); + if (rc == 0) { + strncpy(protoname, protoent.p_name, sizeof(protoname)); + endprotoent_r(&proto_data); + } + } #else switch (proto) { case IPPROTO_TCP: strcpy(protoname, "tcp"); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/filan.c new/socat-1.7.4.3/filan.c --- old/socat-1.7.4.2/filan.c 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/filan.c 2022-01-08 21:59:57.000000000 +0100 @@ -897,12 +897,14 @@ ++optname; } +#ifdef TCP_INFO tcpan2(fd, outfile); +#endif return 0; } #endif /* WITH_TCP */ -#if WITH_TCP +#if WITH_TCP && defined(TCP_INFO) int tcpan2(int fd, FILE *outfile) { struct tcp_info tcpinfo; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/socat.c new/socat-1.7.4.3/socat.c --- old/socat-1.7.4.2/socat.c 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/socat.c 2022-01-08 21:59:57.000000000 +0100 @@ -1222,7 +1222,7 @@ #if HAVE_STRFTIME bytes = strftime(timestamp, 20, "%Y/%m/%d %H:%M:%S", localtime(&nowt)); #if HAVE_CLOCK_GETTIME - bytes += sprintf(timestamp+19, "."F_tv_usec" ", now.tv_nsec/1000); + bytes += sprintf(timestamp+19, "."F_tv_nsec" ", now.tv_nsec/1000); #elif HAVE_PROTOTYPE_LIB_gettimeofday bytes += sprintf(timestamp+19, "."F_tv_usec" ", now.tv_usec); #else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/socat.spec new/socat-1.7.4.3/socat.spec --- old/socat-1.7.4.2/socat.spec 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/socat.spec 2022-01-08 21:59:57.000000000 +0100 @@ -1,6 +1,6 @@ %define majorver 1.7 -%define minorver 4.2 +%define minorver 4.3 Summary: socat - multipurpose relay Name: socat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/test.sh new/socat-1.7.4.3/test.sh --- old/socat-1.7.4.2/test.sh 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/test.sh 2022-01-08 21:59:57.000000000 +0100 @@ -64,8 +64,8 @@ if ! [ -x "$SOCAT" ] && ! type $SOCAT >/dev/null 2>&1; then echo "$SOCAT does not exist" >&2; exit 1; fi -if [ -z "$PROCAN" ]; then if test -x ./procan; then PROCAN="./procan"; elif ! type procan >/dev/null 2>&1; then PROCAN=${SOCAT%/*}/procan; fi; fi -if [ -z "$FILAN" ]; then if test -x ./filan; then FILAN="./filan"; elif ! type filan >/dev/null 2>&1; then FILAN=${SOCAT%/*}/filan; fi; fi +if [ -z "$PROCAN" ]; then if test -x ./procan; then PROCAN="./procan"; elif type procan >/dev/null 2>&1; then PROCAN=procan; elif test -x ${SOCAT%/*}/procan; then PROCAN=${SOCAT%/*}/procan; else PROCAN=false; fi; fi +if [ -z "$FILAN" ]; then if test -x ./filan; then FILAN="./filan"; elif ! type filan >/dev/null 2>&1; then FILAN=filan; elif test -x ${SOCAT%/*}/filan; then FILAN=${SOCAT%/*}/filan; else FILAN=false; fi; fi opts="$opt_t $OPTS" export SOCAT_OPTS="$opts" #debug="1" @@ -255,12 +255,17 @@ ;; esac +# some OSes need special options case "$UNAME" in #HP-UX) # # on HP-UX, the default options (below) hang some tests (former 14, 15) # PTYOPTS= # PTYOPTS2= # ;; +SunOS) + PTYOPTS="echo=0,opost=0,perm=600" + PTYOPTS2="cfmakeraw" + ;; *) PTYOPTS="echo=0,opost=0" #PTYOPTS2="raw,echo=0" @@ -324,9 +329,9 @@ # need user (owner) of filesystem entry case "$UNAME" in - Linux) fileuser() { stat -L --print "%U\n" "$tsock" 2>/dev/null; } ;; - FreeBSD) fileuser() { ls -l test.sh |awk '{print($3);}'; } ;; - *) fileuser() { ls -l test.sh |awk '{print($3);}'; } ;; + Linux) fileuser() { stat -L --print "%U\n" "$1" 2>/dev/null; } ;; + FreeBSD) fileuser() { ls -l "$1" |awk '{print($3);}'; } ;; + *) fileuser() { ls -l "$1" |awk '{print($3);}'; } ;; esac if2addr4() { @@ -417,7 +422,7 @@ SECONDIP6ADDR="[$SECONDIP6ADDR]" fi -TRUE=$(type true) +TRUE=$(which true) #E=-e # Linux if [ $(echo "x\c") = "x" ]; then E="" elif [ $(echo -e "x\c") = "x" ]; then E="-e" @@ -1998,7 +2003,7 @@ [ -n "$HAVENOT_IP6" ] && return $HAVENOT_IP6 local l case "$UNAME" in - AIX) l=$($IFCONFIG lo0 |grep 'inet6 ::1/0') ;; + AIX) l=$($IFCONFIG lo0 |grep 'inet6 ::1[/%]') ;; HP-UX) l=$($IFCONFIG lo0 |grep ' inet6 ') ;; Linux) if [ "$IP" ]; then l=$($IP address |egrep 'inet6 ::1/128') @@ -2029,42 +2034,42 @@ # check if TCP on IPv4 is available on host runstcp4 () { runsip4 >/dev/null || { echo TCP4; return 1; } - $SOCAT -h |grep '\<tcp4-' >/dev/null || return 1 + $SOCAT -h |grep ' tcp4-' >/dev/null || return 1 return 0; } # check if TCP on IPv6 is available on host runstcp6 () { runsip6 >/dev/null || { echo TCP6; return 1; } - $SOCAT -h |grep '\<tcp6-' >/dev/null || return 1 + $SOCAT -h |grep ' tcp6-' >/dev/null || return 1 return 0; } # check if UDP on IPv4 is available on host runsudp4 () { runsip4 >/dev/null || { echo UDP4; return 1; } - $SOCAT -h |grep '\<udp4-' >/dev/null || return 1 + $SOCAT -h |grep ' udp4-' >/dev/null || return 1 return 0; } # check if UDP on IPv6 is available on host runsudp6 () { runsip6 >/dev/null || { echo UDP6; return 1; } - $SOCAT -h |grep '\<udp6-' >/dev/null || return 1 + $SOCAT -h |grep ' udp6-' >/dev/null || return 1 return 0; } # check if SCTP on IPv4 is available on host runssctp4 () { runsip4 >/dev/null || { echo SCTP4; return 1; } - $SOCAT -h |grep '\<sctp4-' >/dev/null || return 1 + $SOCAT -h |grep ' sctp4-' >/dev/null || return 1 return 0; } # check if SCTP on IPv6 is available on host runssctp6 () { runsip6 >/dev/null || { echo SCTP6; return 1; } - $SOCAT -h |grep '\<sctp6-' >/dev/null || return 1 + $SOCAT -h |grep ' sctp6-' >/dev/null || return 1 return 0; } @@ -2211,7 +2216,7 @@ *) l=$(netstat -an |grep '^tcp4.* .*[0-9*]\.'$port' .* \*\.\* .* LISTEN') ;; esac ;; AIX) l=$(netstat -an |grep '^tcp[^6] 0 0 .*[*0-9]\.'$port' .* LISTEN$') ;; - SunOS) l=$(netstat -an -f inet -P tcp |grep '.*[1-9*]\.'$port' .*\* 0 .* LISTEN') ;; + SunOS) l=$(netstat -an -f inet -P tcp |grep '.*[1-9*]\.'$port' .*\* .* 0 .* LISTEN') ;; HP-UX) l=$(netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' .* LISTEN$') ;; OSF1) l=$(/usr/sbin/netstat -an |grep '^tcp 0 0 .*[0-9*]\.'$port' [ ]*\*\.\* [ ]*LISTEN') ;; CYGWIN*) l=$(netstat -an -p TCP |grep '^ TCP [0-9.]*:'$port' .* LISTENING') ;; @@ -4041,6 +4046,7 @@ if ! eval $NUMCOND; then :; else tf="$td/test$N.stdout" te="$td/test$N.stderr" +# remark: diagnostics to null, no good style CMD="$TRACE $SOCAT $opts -lf /dev/null EXEC:$TRUE /dev/null,ignoreeof" printf "test $F_n $TEST... " $N $CMD >"$tf" 2>"$te" @@ -4075,7 +4081,7 @@ te="$td/test$N.stderr" tdiff="$td/test$N.diff" da="test$N $(date) $RANDOM" -CMD1="$TRACE $SOCAT $opts pty,link=$tt pipe" +CMD1="$TRACE $SOCAT $opts PTY,$PTYOPTS,link=$tt PIPE" CMD2="$TRACE $SOCAT $opts - $tt,$PTYOPTS2" printf "test $F_n $TEST... " $N $CMD1 2>"${te}1" & @@ -4083,9 +4089,9 @@ waitfile "$tt" # this hangs on HP-UX, so we use a timeout (echo "$da"; sleep 1) |$CMD2 >$tf 2>"${te}2" & -rc2=$! +pid2=$! #sleep 5 && kill $rc2 2>/dev/null & -wait $rc2 +wait $pid2 if ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: $TRACE $SOCAT:\n" echo "$CMD1 &" @@ -4311,7 +4317,7 @@ waittcp4port $PORT #echo "$da" |$CMD >$tf 2>"${te}2" #note: with about OpenSSL 1.1 s_server lost the half close feature, thus: -(echo "$da"; sleep 0.1) |$CMD >$tf 2>"${te}2" +(echo "$da"; psleep 0.1) |$CMD >$tf 2>"${te}2" if ! echo "$da" |diff - "$tf" >"$tdiff"; then $PRINTF "$FAILED: $TRACE $SOCAT:\n" echo "$CMD2 &" @@ -5341,7 +5347,8 @@ numCANT=$((numCANT+1)) listCANT="$listCANT $N" else -testecho "$N" "$TEST" "exec:cat,pty,raw!!-" "" "$opts" +# T value needed (only) by AIX +testecho "$N" "$TEST" "exec:cat,pty,raw!!-" "" "$opts" 0.1 fi ;; # NUMCOND, feats esac N=$((N+1)) @@ -5381,7 +5388,8 @@ # during development of this test, the following command line succeeded: # (sleep 1; $ECHO "user\n\c"; sleep 1; $ECHO "password\c"; sleep 1; $ECHO "\n\c"; sleep 1; $ECHO "test 1\n\c"; sleep 1; $ECHO "\003\c"; sleep 1; $ECHO "test 2\n\c"; sleep 1; $ECHO "exit\n\c"; sleep 1) |$TRACE $SOCAT -d -d -d -d -lf/tmp/$USER/debug1 -v -x - exec:'./readline.sh ./readline-test.sh',pty,ctty,setsid,raw,echo=0,isig # -PATH=${SOCAT%socat}:$PATH eval "$CMD 2>$te &" +# the following cat, in case of socat failure, reads the pipe to prevent below writer from hanging +PATH=${SOCAT%socat}:$PATH eval "$CMD 2>$te || cat $tpi >/dev/null &" pid=$! # background process id usleep $MICROS @@ -7079,6 +7087,7 @@ waitfile "$ts1" echo "$da1" |eval "$CLI" >"${tf}1" 2>"${te}1" rc=$? +kill $pids 2>/dev/null wait if [ $rc -ne 0 ]; then kill "$pids" 2>/dev/null @@ -7115,8 +7124,8 @@ TEST="$NAME: simple echo via exec of cat with pipes,stderr" # this test is known to fail when logging is enabled with OPTS/opts env var. SAVE_opts="$opts" -opts="$(echo "$opts" |sed 's/-d//g')" -testecho "$N" "$TEST" "" "exec:$CAT,pipes,stderr" "$opts" +opts="$(echo "$opts" |sed 's/-dd*//g')" +testecho "$N" "$TEST" "" "EXEC:$CAT,pipes,stderr" "$opts" opts="$SAVE_opts" esac N=$((N+1)) @@ -8649,10 +8658,17 @@ else tf="$td/test$N.stout" te="$td/test$N.stderr" -CMD="$TRACE $SOCAT $opts /dev/null pty,end-close" +CMD="$TRACE $SOCAT $opts -d -d /dev/null pty,end-close" printf "test $F_n $TEST... " $N -$CMD 2>"${te}" -rc=$? +# AIX reports the pty writeable for select() only when its slave side has been +# opened, therefore we run this process in background and check its NOTICE +# output for the PTY name +{ $CMD 2>"${te}"; echo $? >"$td/test$N.rc0"; } & +waitfile "${te}" +psleep 0.1 +PTY=$(grep "N PTY is " $te |sed 's/.*N PTY is //') +[ -e "$PTY" ] && cat $PTY >/dev/null +rc=$(cat "$td/test$N.rc0") if [ "$rc" = 0 ]; then $PRINTF "$OK\n" numOK=$((numOK+1)) @@ -8691,9 +8707,9 @@ $CMD0 >/dev/null 2>"${te}0" & pid0=$! waitudp4port $PORT 1 -{ echo "$da"; sleep 0.1; } |$CMD1 >"${tf}1" 2>"${te}1" +{ echo "$da"; psleep 0.1; } |$CMD1 >"${tf}1" 2>"${te}1" rc1=$? -{ echo "xyz"; sleep 0.1; } |$CMD1 >"${tf}2" 2>"${te}2" +{ echo "xyz"; psleep 0.1; } |$CMD1 >"${tf}2" 2>"${te}2" rc2=$? kill $pid0 2>/dev/null; wait if [ $rc1 != 0 -o $rc2 != 0 ]; then @@ -9723,7 +9739,7 @@ # process under some circumstances. NAME=EXECPTYKILL case "$TESTS" in -*%$N%*|*%functions%*|*%bugs%*|*%exec%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%exec%*|*%pty%*|*%$NAME%*) TEST="$NAME: exec:...,pty explicitely kills sub process" # we want to check if the exec'd sub process is killed in time # for this we have a shell script that generates a file after two seconds; @@ -9847,7 +9863,12 @@ TEST="$NAME: more than FOPEN_MAX FDs in use" # this test opens a number of FDs before socat is invoked. socat will have to # allocate higher FD numbers and thus hang if it cannot handle them. -if ! eval $NUMCOND; then :; else +if ! eval $NUMCOND; then :; +elif [ "$UNAME" != Linux ]; then + $PRINTF "test $F_n $TEST... ${YELLOW}only on Linux${NORMAL}\n" $N + numCANT=$((numCANT+1)) + listCANT="$listCANT $N" +else REDIR= #set -vx FOPEN_MAX=$($PROCAN -c 2>/dev/null |grep '^#define[ ][ ]*FOPEN_MAX' |awk '{print($3);}') @@ -10617,7 +10638,8 @@ tsa="$tra" esac #CMD0="$TRACE $SOCAT $opts -u $KEYW-RECVFROM:$tra,reuseaddr,$SCM_RECV SYSTEM:\"export -p\"" -CMD0="$TRACE $SOCAT $opts -u -lpsocat $KEYW-RECVFROM:$tra,reuseaddr,$SCM_RECV SYSTEM:\"echo \\\$SOCAT_$SCM_ENVNAME\"" +# without that ultra escaped quote the test failed for IPv6 when there was file ./1 +CMD0="$TRACE $SOCAT $opts -u -lpsocat $KEYW-RECVFROM:$tra,reuseaddr,$SCM_RECV SYSTEM:\"echo \\\\\\\"\\\$SOCAT_$SCM_ENVNAME\\\\\\\"\"" CMD1="$TRACE $SOCAT $opts -u - $KEYW-SENDTO:$tsa,$SCM_ENABLE" printf "test $F_n $TEST... " $N # is this option supported? @@ -10641,6 +10663,7 @@ # do not show more messages than requested if [ "$SCM_VALUE" = "timestamp" ]; then SCM_VALUE="$(date '+%a %b %e %H:%M:.. %Y'), ...... usecs" + #echo "\"$SCM_VALUE\"" >&2 # debugging fi if [ "$rc1" -ne 0 ]; then $PRINTF "$NO_RESULT: $SOCAT:\n" @@ -10652,9 +10675,9 @@ listCANT="$listCANT $N" #elif ! egrep "^export SOCAT_$SCM_ENVNAME=[\"']?$SCM_VALUE[\"']?\$" ${tf} >/dev/null; then #elif ! eval echo "$TRACE $SOCAT_\$SCM_VALUE" |diff - "${tf}" >/dev/null; then -elif ! expr "$(cat "$tf")" : "$(eval echo "\$SCM_VALUE")\$" >/dev/null; then +elif ! expr "$(cat "$tf")" : "$SCM_VALUE\$" >/dev/null; then $PRINTF "$FAILED\n" - echo "logged value \"$(cat "$tf")\" instead of \"$(eval echo "\$SCM_VALUE")\"" + echo "logged value \"$(cat "$tf")\" instead of $SCM_VALUE" echo "$CMD0 &" echo "$CMD1" cat "${te}0" @@ -11517,7 +11540,8 @@ if type openssl >/dev/null 2>&1; then - OPENSSL_METHOD=$(openssl s_client -help 2>&1 |egrep -o -e '-tls1(_[012])?' |sort |tail -n 1) + OPENSSL_METHOD=$(openssl s_client -help 2>&1 |egrep -e '-tls1_[012]' |sed -e 's/.*\(-tls1_[012]\).*/\1/' |sort |tail -n 1) + #OPENSSL_METHOD=$(openssl s_client -help 2>&1 |egrep -o -e '-tls1(_[012])?' |sort |tail -n 1) [ -z "$OPENSSL_METHOD" ] && OPENSSL_METHOD="-tls1" # just so fi @@ -12140,7 +12164,7 @@ # problem reported by Johan Thillemann NAME=READLINE_OVFL case "$TESTS" in -*%$N%*|*%functions%*|*%bugs%*|*%security%*|*%readline%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%security%*|*%readline%*|*%pty%*|*%$NAME%*) TEST="$NAME: test for buffer overflow in readline prompt handling" # address 1 is the readline where write data was handled erroneous # address 2 provides data to trigger the buffer overflow @@ -12199,8 +12223,12 @@ da="test$N $(date) $RANDOM" RLIMIT_NOFILE="$(ulimit -n)" if ! [[ "$RLIMIT_NOFILE" =~ ^[0-9][0-9]*$ ]]; then - $PRINTF "${YELLOW}cannot determine ulimit -n" + $PRINTF "${YELLOW}cannot determine ulimit -n${NORMAL}" else +if [ $RLIMIT_NOFILE -gt 1024 ]; then + ulimit -n 1024 # 65536 takes too long + RLIMIT_NOFILE="$(ulimit -n)" +fi CMD0="$TRACE $SOCAT $opts TCP-LISTEN:$PORT,$REUSEADDR,range=$LOCALHOST:255.255.255.255 PIPE" CMD1="$TRACE $SOCAT $opts -t 0 /dev/null TCP:$SECONDADDR:$PORT,bind=$SECONDADDR" CMD2="$TRACE $SOCAT $opts - TCP:$LOCALHOST:$PORT,bind=$LOCALHOST" @@ -12572,7 +12600,7 @@ if [ "$addropts" = "." ]; then addropts=; fi NAME=${ADDR_}_UMASK case "$TESTS" in -*%$N%*|*%functions%*|*%bugs%*|*%proto%*|*%socket%*|*%$proto%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%proto%*|*%socket%*|*%$proto%*|*%umask%*|*%$NAME%*) TEST="$NAME: $ADDR applies option umask" # start a socat process with passive/listening file system entry. Check the # permissions of the FS entry, then terminate the process. @@ -12634,18 +12662,17 @@ # tests: option perm with "passive" NAMED group addresses -while read addr fileopt addropts proto diropt; do +while read addr fileopt addropts feat waitfor diropt; do if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi # test if passive (listening...) filesystem based addresses implement option perm ADDR=$(toupper $addr) ADDR_=${ADDR/-/_} -PROTO=$(toupper $proto) if [ "$diropt" = "." ]; then diropt=; fi if [ "$fileopt" = "." ]; then fileopt=; fi if [ "$addropts" = "." ]; then addropts=; fi NAME=${ADDR_}_PERM case "$TESTS" in -*%$N%*|*%functions%*|*%bugs%*|*%proto%*|*%socket%*|*%$proto%*|*%ignoreeof%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%$feat%*|*%ignoreeof%*|*%perm%*|*%$NAME%*) TEST="$NAME: $ADDR applies option perm" # start a socat process with passive/listening file system entry. Check the # permissions of the FS entry, then terminate the process. @@ -12663,7 +12690,7 @@ printf "test $F_n $TEST... " $N $CMD0 >/dev/null 2>"$te0" & pid0=$! -wait${proto} $tsock 1 2>"$tlog" +wait${waitfor} $tsock 1 2>"$tlog" ERRNOENT=; if ! [ -e "$tsock" ]; then ERRNOENT=1; fi perms=$(fileperms "$tsock") kill $pid0 2>>"$tlog" @@ -12693,31 +12720,30 @@ N=$((N+1)) # done <<<" -# address fileopt addropts waitfor direction -create . . file -U -open . creat file . -gopen . creat file . -unix-listen . . unixport . -unix-recvfrom . . unixport . -unix-recv . . unixport -u -pipe . . file -u -pty link . file . +# address fileopt addropts feat waitfor direction +create . . file file -U +open . creat file file . +gopen . creat file file . +unix-listen . . unix unixport . +unix-recvfrom . . unix unixport . +unix-recv . . unix unixport -u +pipe . . pipe file -u +pty link . pty file . " # tests: option user with "passive" NAMED group addresses -while read addr fileopt addropts proto diropt; do +while read addr fileopt addropts feat waitfor diropt; do if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi # test if passive (listening...) filesystem based addresses implement option user ADDR=$(toupper $addr) ADDR_=${ADDR/-/_} -PROTO=$(toupper $proto) if [ "$diropt" = "." ]; then diropt=; fi if [ "$fileopt" = "." ]; then fileopt=; fi if [ "$addropts" = "." ]; then addropts=; fi NAME=${ADDR_}_USER case "$TESTS" in -*%$N%*|*%functions%*|*%bugs%*|*%proto%*|*%socket%*|*%$proto%*|*%root%*|*%ignoreeof%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%socket%*|*%$feat%*|*%root%*|*%ignoreeof%*|*%$NAME%*) TEST="$NAME: $ADDR applies option user" # start a socat process with passive/listening file system entry with user option. # Check the owner of the FS entry, then terminate the process. @@ -12740,7 +12766,7 @@ printf "test $F_n $TEST... " $N $CMD0 >/dev/null 2>"$te0" & pid0=$! -wait${proto} $tsock 1 2>"$tlog" +wait${waitfor} $tsock 1 2>"$tlog" ERRNOENT=; if ! [ -e "$tsock" ]; then ERRNOENT=1; fi user=$(fileuser "$tsock") kill $pid0 2>>"$tlog" @@ -12770,34 +12796,33 @@ N=$((N+1)) # done <<<" -# address fileopt addropts waitfor direction -create . . file -U -open . creat file . -gopen . creat file . -unix-listen . . unixport . -unix-recvfrom . . unixport . -unix-recv . . unixport -u -pipe . . file -u -pty link . file . +# address fileopt addropts feat waitfor direction +create . . file file -U +open . creat file file . +gopen . creat file file . +unix-listen . . unix unixport . +unix-recvfrom . . unix unixport . +unix-recv . . unix unixport -u +pipe . . pipe file -u +pty link . pty file . " # tests: is "passive" filesystem entry removed at the end? (without fork) -while read addr fileopt addropts proto diropt crit ADDR2; do +while read addr fileopt addropts feat waitfor diropt crit ADDR2; do if [ -z "$addr" ] || [[ "$addr" == \#* ]]; then continue; fi # some passive (listening...) filesystem based addresses did not remove the file # system entry at the end ADDR=$(toupper $addr) ADDR_=${ADDR/-/_} -PROTO=$(toupper $proto) if [ "$diropt" = "." ]; then diropt=; fi if [ "$fileopt" = "." ]; then fileopt=; fi if [ "$addropts" = "." ]; then addropts=; fi # $ADDR removes the file system entry when the process is terminated NAME=${ADDR_}_REMOVE case "$TESTS" in -*%$N%*|*%functions%*|*%bugs%*|*%unix%*|*%socket%*|*%$NAME%*) -TEST="$NAME: $ADDR removes socket entry when terminated during accept" +*%$N%*|*%functions%*|*%bugs%*|*%feat%*|*%socket%*|*%$NAME%*) +TEST="$NAME: $ADDR removes socket entry when terminated while waiting for connection" # start a socat process with listening unix domain socket etc. Terminate the # process and check if the file system socket entry still exists. # Test succeeds when entry does not exist. @@ -12813,7 +12838,7 @@ printf "test $F_n $TEST... " $N $CMD0 >/dev/null 2>"$te0" & pid0=$! -wait${proto} "$crit" $tsock 1 2>"$tlog" +wait${waitfor} "$crit" $tsock 1 2>"$tlog" kill $pid0 2>>"$tlog" rc1=$? wait >>"$tlog" @@ -12842,12 +12867,12 @@ N=$((N+1)) # done <<<" -# address fileopt addropts waitfor direction crit ADDR2 -unix-listen . . unixport . -e FILE:/dev/null -unix-recvfrom . . unixport . -e FILE:/dev/null -unix-recv . . unixport -u -e FILE:/dev/null -pipe . . file -u -e FILE:/dev/null -pty link . file . -L PIPE +# address fileopt addropts feat waitfor direction crit ADDR2 +unix-listen . . unix unixport . -e FILE:/dev/null +unix-recvfrom . . unix unixport . -e FILE:/dev/null +unix-recv . . unix unixport -u -e FILE:/dev/null +pipe . . pipe file -u -e FILE:/dev/null +pty link . pty file . -L PIPE " @@ -13074,11 +13099,13 @@ rc1=$? kill $pid0 2>/dev/null; wait fi -if [ $w0 -eq 0 ] && echo "$da" |diff - "${tf}1"; then +echo "$da" |diff - "${tf}1" >"$tdiff" 2>/dev/null +if [ $w0 -eq 0 ] && [ -f "${tf}1" ] && ! [ -s "$tdiff" ]; then $PRINTF "${YELLOW}WARN${NORMAL} (obsolete method succeeds)\n" numOK=$((numOK+1)) else $PRINTF "$OK (obsolete method fails)\n" + cat "$tdiff" numOK=$((numOK+1)) fi if [ "$VERBOSE" ]; then @@ -13140,7 +13167,7 @@ echo "$da" |$CMD1 >"${tf}1" 2>"${te}1" rc1=$? kill $pid0 2>/dev/null; wait -if echo "$da" |diff - "${tf}1"; then +if echo "$da" |diff - "${tf}1" >"$tdiff"; then $PRINTF "$OK\n" numOK=$((numOK+1)) if [ "$VERBOSE" ]; then @@ -13150,9 +13177,10 @@ else $PRINTF "$FAILED\n" echo "$CMD0 &" - echo "$CMD1" cat "${te}0" + echo "$CMD1" cat "${te}1" + cat "$tdiff" numFAIL=$((numFAIL+1)) listFAIL="$listFAIL $N" #esac @@ -13676,7 +13704,7 @@ # termios options of the first address were applied to the second address. NAME=TERMIOS_PH_ALL case "$TESTS" in -*%$N%*|*%functions%*|*%bugs%*|*%termios%*|*%$NAME%*) +*%$N%*|*%functions%*|*%bugs%*|*%pty%*|*%termios%*|*%$NAME%*) TEST="$NAME: are termios options applied to the correct address" # add a termios option to the first address, a tty, and have a second address # with pipe. If no error occurs the termios option was not applied to the pipe, @@ -13925,7 +13953,8 @@ echo "$da" |$CMD >"$to" 2>"$te" rc=$? if [ $rc -ne 0 ] && grep -q "Invalid argument" "$te" && [ $UNAME = Linux ]; then - case $(stat -f $tf |grep -o "Type: [^[:space:]]*" |cut -c 7-) in + case $(stat -f $tf |grep "Type: [^[:space:]]*" |sed -e 's/.*\(Type: [^[:space:]]*\).*/\1/' |cut -c 7-) in + #case $(stat -f $tf |grep -o "Type: [^[:space:]]*" |cut -c 7-) in ext2/ext3|xfs|reiserfs) $PRINTF "${FAILED}\n" echo "$CMD" >&2 @@ -14078,7 +14107,7 @@ da="test$N $(date) $RANDOM" init_openssl_s_server CMD1="$TRACE openssl s_server $OPENSSL_S_SERVER_4 $OPENSSL_S_SERVER_DTLS -accept $PORT -quiet $OPENSSL_S_SERVER_NO_IGN_EOF -cert testsrv.pem" -CMD="$TRACE $SOCAT $opts -T 1 - OPENSSL-DTLS-CLIENT:$LOCALHOST:$PORT,pf=ip4,verify=0,$SOCAT_EGD" +CMD="$TRACE $SOCAT $opts -T 3 - OPENSSL-DTLS-CLIENT:$LOCALHOST:$PORT,pf=ip4,verify=0,$SOCAT_EGD" printf "test $F_n $TEST... " $N ( sleep 2; echo "$da"; sleep 1 ) |$CMD1 2>"${te}1" & pid1=$! # background process id @@ -14146,7 +14175,7 @@ $CMD1 >/dev/null 2>"${te}1" & pid1=$! waitudp4port $PORT 1 -( echo "$da"; sleep 0.1 ) |$CMD 2>"$te" |grep "$da" >"$tf" +( echo "$da"; psleep 0.1 ) |$CMD 2>"$te" |grep "$da" >"$tf" rc=$? kill $pid1 2>/dev/null; wait if echo "$da" |diff - $tf >"$tdiff"; then @@ -14544,7 +14573,7 @@ waitudp4port $PORT 1 echo "$da" |$CMD1 >"${tf}1" 2>"${te}1" rc1=$? -sleep 0.1 +psleep 0.1 kill $pid0 2>/dev/null; wait if [ -f ${tf}0 ] && echo "$da" |diff - ${tf}0 >$tdiff; then $PRINTF "$OK\n" @@ -14868,7 +14897,7 @@ CMD0="$TRACE $SOCAT $opts -u OPENSSL-DTLS-LISTEN:$PORT,cert=testsrv.pem,verify=0 CREAT:$to" CMD1="$TRACE $SOCAT $opts -u OPEN:$ti OPENSSL-DTLS-CONNECT:$LOCALHOST:$PORT,cafile=testsrv.crt" printf "test $F_n $TEST... " $N -i=0; while [ $i -lt 100000 ]; do printf "%9u %9u %9u %9u %9u %9u %9u %9u %9u %9u\n" $i $i $i $i $i $i $i $i $i $i; let i+=100; done >$ti +i=0; while [ $i -lt $((2*8192)) ]; do printf "%9u %9u %9u %9u %9u %9u %9u %9u %9u %9u\n" $i $i $i $i $i $i $i $i $i $i; let i+=100; done >$ti $CMD0 >/dev/null 2>"${te}0" & pid0=$! waitudp4port $PORT 1 @@ -14942,7 +14971,7 @@ CMD0="$TRACE $SOCAT $opts -U OPENSSL-DTLS-LISTEN:$PORT,cert=testsrv.pem,verify=0 OPEN:$ti" CMD1="$TRACE $SOCAT $opts -u OPENSSL-DTLS-CONNECT:$LOCALHOST:$PORT,cafile=testsrv.crt CREAT:$to" printf "test $F_n $TEST... " $N -i=0; while [ $i -lt 100000 ]; do printf "%9u %9u %9u %9u %9u %9u %9u %9u %9u %9u\n" $i $i $i $i $i $i $i $i $i $i; let i+=100; done >$ti +i=0; while [ $i -lt $((2*8192)) ]; do printf "%9u %9u %9u %9u %9u %9u %9u %9u %9u %9u\n" $i $i $i $i $i $i $i $i $i $i; let i+=100; done >$ti $CMD0 >/dev/null 2>"${te}0" & pid0=$! waitudp4port $PORT 1 @@ -15016,7 +15045,7 @@ waittcp4port $PORT 1 $CMD1 >"${tf}1" 2>"${te}1" rc1=$? -sleep 0.5 +psleep 0.5 kill $pid0 2>/dev/null; wait if [ $rc1 -ne 0 ]; then $PRINTF "$CANT\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/xio-gopen.c new/socat-1.7.4.3/xio-gopen.c --- old/socat-1.7.4.2/xio-gopen.c 2017-01-06 22:51:24.000000000 +0100 +++ new/socat-1.7.4.3/xio-gopen.c 2022-01-08 21:59:57.000000000 +0100 @@ -89,7 +89,7 @@ if ((result = _xioopen_open(filename, openflags, opts)) < 0) return result; #ifdef I_PUSH - if (S_ISCHR(st_mode)) { + if (S_ISCHR(st_mode) && Ioctl(result, I_FIND, "ldterm\0") == 0) { Ioctl(result, I_PUSH, "ptem\0\0\0"); /* pad string length ... */ Ioctl(result, I_PUSH, "ldterm\0"); /* ... to requirements of ... */ Ioctl(result, I_PUSH, "ttcompat"); /* ... AdressSanitizer */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/xio-openssl.c new/socat-1.7.4.3/xio-openssl.c --- old/socat-1.7.4.2/xio-openssl.c 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/xio-openssl.c 2022-01-08 21:59:57.000000000 +0100 @@ -226,7 +226,7 @@ bool opt_ver = true; /* verify peer certificate */ char *opt_cert = NULL; /* file name of client certificate */ const char *opt_commonname = NULL; /* for checking peer certificate */ - bool opt_no_sni; + bool opt_no_sni = false; const char *opt_snihost = NULL; /* for SNI host */ int result; @@ -1539,7 +1539,7 @@ } memcpy(str, buf, len); str[len] = '\0'; - Info2("SSL peer cert %s: \"%s\"", field, buf); + Info2("SSL peer cert %s: \"%s\"", field, str); xiosetenv2("OPENSSL_X509", field, str, 1, NULL); free(str); BIO_free(bio); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/xio-socket.c new/socat-1.7.4.3/xio-socket.c --- old/socat-1.7.4.2/xio-socket.c 2021-10-31 19:06:09.000000000 +0100 +++ new/socat-1.7.4.3/xio-socket.c 2022-01-08 21:59:57.000000000 +0100 @@ -2219,8 +2219,10 @@ retropt_int(opts, OPT_SO_PROTOTYPE, &proto); result = Socket(pf, socktype, proto); if (result < 0) { + int _errno = errno; Msg4(msglevel, "socket(%d, %d, %d): %s", pf, socktype, proto, strerror(errno)); + errno = _errno; return -1; } return result; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/xio-unix.c new/socat-1.7.4.3/xio-unix.c --- old/socat-1.7.4.2/xio-unix.c 2021-01-03 19:23:22.000000000 +0100 +++ new/socat-1.7.4.3/xio-unix.c 2022-01-08 21:59:57.000000000 +0100 @@ -576,11 +576,11 @@ /* xfd->dtype = DATA_STREAM; // is default */ /* this function handles AF_UNIX with EPROTOTYPE specially for us */ if ((result = - xioopen_connect(xfd, - needbind?&us:NULL, uslen, - &them.soa, themlen, - opts, pf, socktype?socktype:SOCK_STREAM, protocol, - false)) == 0) + _xioopen_connect(xfd, + needbind?&us:NULL, uslen, + &them.soa, themlen, + opts, pf, socktype?socktype:SOCK_STREAM, protocol, + false, E_INFO)) == 0) break; if (errno != EPROTOTYPE || socktype != 0) break; @@ -590,13 +590,13 @@ socktype = SOCK_SEQPACKET; if ((result = - xioopen_connect(xfd, - needbind?&us:NULL, uslen, - (struct sockaddr *)&them, themlen, - opts, pf, SOCK_SEQPACKET, protocol, - false)) == 0) + _xioopen_connect(xfd, + needbind?&us:NULL, uslen, + (struct sockaddr *)&them, themlen, + opts, pf, SOCK_SEQPACKET, protocol, + false, E_INFO)) == 0) break; - if (errno != EPROTOTYPE) + if (errno != EPROTOTYPE && errno != EPROTONOSUPPORT/*AIX*/) break; if (needbind) Unlink(us.un.sun_path); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/socat-1.7.4.2/xioconfig.h new/socat-1.7.4.3/xioconfig.h --- old/socat-1.7.4.2/xioconfig.h 2017-01-06 21:58:40.000000000 +0100 +++ new/socat-1.7.4.3/xioconfig.h 2022-01-08 21:59:57.000000000 +0100 @@ -39,11 +39,13 @@ # define WITH_IP4 1 #endif +#if 0 #if WITH_IP6 # if !defined(HAVE_NETINET_IP6_H) # undef WITH_IP6 # endif #endif +#endif #if !WITH_IP4 && !WITH_IP6 # if WITH_TCP || WITH_UDP || WITH_RAWIP