Compare commits
No commits in common. "c8" and "c9-beta" have entirely different histories.
43
SOURCES/socat-1.7.3.3-warn.patch
Normal file
43
SOURCES/socat-1.7.3.3-warn.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
diff -Naur socat-1.7.3.3-orig/sysutils.c socat-1.7.3.3/sysutils.c
|
||||||
|
--- socat-1.7.3.3-orig/sysutils.c 2017-01-08 05:38:53.000000000 -0500
|
||||||
|
+++ socat-1.7.3.3/sysutils.c 2019-06-24 17:02:56.693056583 -0400
|
||||||
|
@@ -614,7 +614,7 @@
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- strncpy(ifr.ifr_name, ifname, IFNAMSIZ); /* ok */
|
||||||
|
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1); /* ok */
|
||||||
|
if (Ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
|
Info3("ioctl(%d, SIOCGIFINDEX, {\"%s\"}): %s",
|
||||||
|
s, ifr.ifr_name, strerror(errno));
|
||||||
|
diff -Naur socat-1.7.3.3-orig/xio-socket.c socat-1.7.3.3/xio-socket.c
|
||||||
|
--- socat-1.7.3.3-orig/xio-socket.c 2017-01-08 04:56:00.000000000 -0500
|
||||||
|
+++ socat-1.7.3.3/xio-socket.c 2019-06-24 17:04:48.684491835 -0400
|
||||||
|
@@ -1710,7 +1710,6 @@
|
||||||
|
int xiocheckpeer(xiosingle_t *xfd,
|
||||||
|
union sockaddr_union *pa, union sockaddr_union *la) {
|
||||||
|
char infobuff[256];
|
||||||
|
- int result;
|
||||||
|
|
||||||
|
#if WITH_IP4
|
||||||
|
if (xfd->para.socket.dorange) {
|
||||||
|
@@ -1778,6 +1777,7 @@
|
||||||
|
#endif /* WITH_TCP || WITH_UDP */
|
||||||
|
|
||||||
|
#if (WITH_TCP || WITH_UDP) && WITH_LIBWRAP
|
||||||
|
+ int result;
|
||||||
|
result = xio_tcpwrap_check(xfd, la, pa);
|
||||||
|
if (result < 0) {
|
||||||
|
char infobuff[256];
|
||||||
|
diff -Naur socat-1.7.3.3-orig/xio-tun.c socat-1.7.3.3/xio-tun.c
|
||||||
|
--- socat-1.7.3.3-orig/xio-tun.c 2017-01-06 15:58:40.000000000 -0500
|
||||||
|
+++ socat-1.7.3.3/xio-tun.c 2019-06-24 17:03:55.276797729 -0400
|
||||||
|
@@ -106,7 +106,7 @@
|
||||||
|
memset(&ifr, 0,sizeof(ifr));
|
||||||
|
|
||||||
|
if (retropt_string(opts, OPT_TUN_NAME, &tunname) == 0) {
|
||||||
|
- strncpy(ifr.ifr_name, tunname, IFNAMSIZ); /* ok */
|
||||||
|
+ strncpy(ifr.ifr_name, tunname, IFNAMSIZ - 1); /* ok */
|
||||||
|
free(tunname);
|
||||||
|
} else {
|
||||||
|
ifr.ifr_name[0] = '\0';
|
||||||
161
SOURCES/socat-1.7.4.1-handle-EINTR-on-recvmsg.patch
Normal file
161
SOURCES/socat-1.7.4.1-handle-EINTR-on-recvmsg.patch
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
diff --git a/CHANGES b/CHANGES
|
||||||
|
index 794b7a7..b2046e1 100644
|
||||||
|
--- a/CHANGES
|
||||||
|
+++ b/CHANGES
|
||||||
|
@@ -91,6 +91,11 @@ Corrections:
|
||||||
|
|
||||||
|
Fixed some more non functional minor issues.
|
||||||
|
|
||||||
|
+ UDP-RECVFROM with fork sometimes terminated when multiple packets
|
||||||
|
+ arrived. This issue was introduced with a bug fix in version 1.7.4.0.
|
||||||
|
+ Reason was not handling EAGAIN on recvmsg().
|
||||||
|
+ Thanks to Jamie McQuillan for reporting this issue.
|
||||||
|
+
|
||||||
|
Porting:
|
||||||
|
In gcc version 10 the default changed from -fcommon to -fno-common.
|
||||||
|
Consequently, linking filan and procan failed with error
|
||||||
|
diff --git a/xio-socket.c b/xio-socket.c
|
||||||
|
index d6b935c..4254394 100644
|
||||||
|
--- a/xio-socket.c
|
||||||
|
+++ b/xio-socket.c
|
||||||
|
@@ -1214,6 +1214,7 @@ void xiosigaction_hasread(int signum
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pid == xio_waitingfor) {
|
||||||
|
+ xio_waitingfor = 0; /* so this child will not set hashappened again */
|
||||||
|
xio_hashappened = true;
|
||||||
|
xio_childstatus = WEXITSTATUS(status);
|
||||||
|
Debug("xiosigaction_hasread() ->");
|
||||||
|
@@ -1253,6 +1254,7 @@ void xiosigaction_hasread(int signum
|
||||||
|
PH_INIT, PH_PREBIND, PH_BIND, PH_PASTBIND, PH_EARLY, PH_PREOPEN, PH_FD,
|
||||||
|
PH_CONNECTED, PH_LATE, PH_LATE2
|
||||||
|
OPT_FORK, OPT_SO_TYPE, OPT_SO_PROTOTYPE, cloexec, OPT_RANGE, tcpwrap
|
||||||
|
+ EINTR is not handled specially.
|
||||||
|
*/
|
||||||
|
int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
|
||||||
|
struct sockaddr *us, socklen_t uslen,
|
||||||
|
@@ -1382,6 +1384,7 @@ int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
|
||||||
|
socklen_t palen = sizeof(_peername); /* peer address size */
|
||||||
|
char ctrlbuff[1024]; /* ancillary messages */
|
||||||
|
struct msghdr msgh = {0};
|
||||||
|
+ int rc;
|
||||||
|
|
||||||
|
socket_init(pf, pa);
|
||||||
|
|
||||||
|
@@ -1392,6 +1395,7 @@ int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
|
||||||
|
drop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ Info("Recvfrom: Checking/waiting for next packet");
|
||||||
|
/* loop until select()/poll() returns valid */
|
||||||
|
do {
|
||||||
|
struct pollfd readfd;
|
||||||
|
@@ -1424,9 +1428,9 @@ int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
|
||||||
|
#if HAVE_STRUCT_MSGHDR_MSGCONTROLLEN
|
||||||
|
msgh.msg_controllen = sizeof(ctrlbuff);
|
||||||
|
#endif
|
||||||
|
- if (xiogetpacketsrc(xfd->fd, &msgh) < 0) {
|
||||||
|
- return STAT_RETRYLATER;
|
||||||
|
- }
|
||||||
|
+ while ((rc = xiogetpacketsrc(xfd->fd, &msgh)) < 0 &&
|
||||||
|
+ errno == EINTR) ;
|
||||||
|
+ if (rc < 0) return STAT_RETRYLATER;
|
||||||
|
palen = msgh.msg_namelen;
|
||||||
|
|
||||||
|
Notice1("receiving packet from %s"/*"src"*/,
|
||||||
|
@@ -1497,24 +1501,21 @@ int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* server: continue loop with listen */
|
||||||
|
xio_waitingfor = pid;
|
||||||
|
|
||||||
|
+ do {
|
||||||
|
#if HAVE_PSELECT
|
||||||
|
- {
|
||||||
|
+ {
|
||||||
|
struct timespec timeout = { LONG_MAX, 0 };
|
||||||
|
Pselect(0, NULL, NULL, NULL, &timeout, &oldset);
|
||||||
|
Sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||||
|
- }
|
||||||
|
+ }
|
||||||
|
#else /* ! HAVE_PSELECT */
|
||||||
|
- /* now we are ready to handle signals */
|
||||||
|
- Sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||||
|
-
|
||||||
|
- while (!xio_hashappened) {
|
||||||
|
- Sleep(1); /* any signal speeds up return */
|
||||||
|
- }
|
||||||
|
+ /* now we are ready to handle signals */
|
||||||
|
+ Sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||||
|
+ Sleep(1); /* any signal speeds up return */
|
||||||
|
#endif /* ! HAVE_PSELECT */
|
||||||
|
- xio_waitingfor = 0; /* so this child will not set hashappened again */
|
||||||
|
+ } while (!xio_hashappened) ;
|
||||||
|
xio_hashappened = false;
|
||||||
|
|
||||||
|
if (xio_childstatus != 0) {
|
||||||
|
@@ -1639,9 +1640,12 @@ int retropt_socket_pf(struct opt *opts, int *pf) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-/* this function calls recvmsg(..., MSG_PEEK, ...) to obtain information about
|
||||||
|
- the arriving packet. in msgh the msg_name pointer must refer to an (empty)
|
||||||
|
- sockaddr storage. */
|
||||||
|
+/* This function calls recvmsg(..., MSG_PEEK, ...) to obtain information about
|
||||||
|
+ the arriving packet, thus it does not "consume" the packet.
|
||||||
|
+ In msgh the msg_name pointer must refer to an (empty) sockaddr storage.
|
||||||
|
+ Returns STAT_OK on success, or STAT_RETRYLATER when an error occurred,
|
||||||
|
+ including EINTR.
|
||||||
|
+ */
|
||||||
|
int xiogetpacketsrc(int fd, struct msghdr *msgh) {
|
||||||
|
char peekbuff[1];
|
||||||
|
#if HAVE_STRUCT_IOVEC
|
||||||
|
diff --git a/xioread.c b/xioread.c
|
||||||
|
index 24f3c88..b89e78a 100644
|
||||||
|
--- a/xioread.c
|
||||||
|
+++ b/xioread.c
|
||||||
|
@@ -118,6 +118,7 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) {
|
||||||
|
socklen_t fromlen = sizeof(from);
|
||||||
|
char infobuff[256];
|
||||||
|
char ctrlbuff[1024]; /* ancillary messages */
|
||||||
|
+ int rc;
|
||||||
|
|
||||||
|
msgh.msg_name = &from;
|
||||||
|
msgh.msg_namelen = fromlen;
|
||||||
|
@@ -127,9 +128,10 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) {
|
||||||
|
#if HAVE_STRUCT_MSGHDR_MSGCONTROLLEN
|
||||||
|
msgh.msg_controllen = sizeof(ctrlbuff);
|
||||||
|
#endif
|
||||||
|
- if (xiogetpacketsrc(pipe->fd, &msgh) < 0) {
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
+ while ((rc = xiogetpacketsrc(pipe->fd, &msgh)) < 0 &&
|
||||||
|
+ errno == EINTR) ;
|
||||||
|
+ if (rc < 0) return -1;
|
||||||
|
+
|
||||||
|
do {
|
||||||
|
bytes =
|
||||||
|
Recvfrom(pipe->fd, buff, bufsiz, 0, &from.soa, &fromlen);
|
||||||
|
@@ -313,6 +315,7 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) {
|
||||||
|
char infobuff[256];
|
||||||
|
struct msghdr msgh = {0};
|
||||||
|
char ctrlbuff[1024]; /* ancillary messages */
|
||||||
|
+ int rc;
|
||||||
|
|
||||||
|
socket_init(pipe->para.socket.la.soa.sa_family, &from);
|
||||||
|
/* get source address */
|
||||||
|
@@ -324,9 +327,10 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) {
|
||||||
|
#if HAVE_STRUCT_MSGHDR_MSGCONTROLLEN
|
||||||
|
msgh.msg_controllen = sizeof(ctrlbuff);
|
||||||
|
#endif
|
||||||
|
- if (xiogetpacketsrc(pipe->fd, &msgh) < 0) {
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
+ while ((rc = xiogetpacketsrc(pipe->fd, &msgh)) < 0 &&
|
||||||
|
+ errno == EINTR) ;
|
||||||
|
+ if (rc < 0) return -1;
|
||||||
|
+
|
||||||
|
xiodopacketinfo(&msgh, true, false);
|
||||||
|
if (xiocheckpeer(pipe, &from, &pipe->para.socket.la) < 0) {
|
||||||
|
Recvfrom(pipe->fd, buff, bufsiz, 0, &from.soa, &fromlen); /* drop */
|
||||||
102
SOURCES/socat-1.7.4.1-ipv6-peername-segfault.patch
Normal file
102
SOURCES/socat-1.7.4.1-ipv6-peername-segfault.patch
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
commit 1477334905be18c08bd6dc77be5a62e36b573de4
|
||||||
|
Author: Gerhard Rieger <gerhard@dest-unreach.org>
|
||||||
|
Date: Tue Oct 26 19:26:18 2021 +0200
|
||||||
|
|
||||||
|
OpenSSL server could be crashed by client cert with IPv6 address in SubjectAltname
|
||||||
|
|
||||||
|
diff --git a/test.sh b/test.sh
|
||||||
|
index 6ca21f3..c0e98a3 100755
|
||||||
|
--- a/test.sh
|
||||||
|
+++ b/test.sh
|
||||||
|
@@ -15040,6 +15040,60 @@ PORT=$((PORT+1))
|
||||||
|
N=$((N+1))
|
||||||
|
|
||||||
|
|
||||||
|
+# Bug fix, OpenSSL server could be crashed by client cert with IPv6 address in SubjectAltname
|
||||||
|
+NAME=OPENSSL_CLIENT_IP6_CN
|
||||||
|
+case "$TESTS" in
|
||||||
|
+*%$N%*|*%functions%*|*%bugs%*|*%openssl%*|*%ip6%*|*%socket%*|*%$NAME%*)
|
||||||
|
+TEST="$NAME: Test if OpenSSL server may be crashed by client cert with IPv6 address"
|
||||||
|
+# Socat 1.7.4.1 had a bug that caused OpenSSL server to crash with SIGSEGV when
|
||||||
|
+# it checked a client certificate containing IPv6 address in SubjectAltName and
|
||||||
|
+# no openssl-commonname option was given
|
||||||
|
+if ! eval $NUMCOND; then :;
|
||||||
|
+elif ! testfeats openssl >/dev/null; then
|
||||||
|
+ $PRINTF "test $F_n $TEST... ${YELLOW}OPENSSL not available${NORMAL}\n" $N
|
||||||
|
+ numCANT=$((numCANT+1))
|
||||||
|
+ listCANT="$listCANT $N"
|
||||||
|
+elif ! testfeats tcp ip4 >/dev/null || ! runsip4 >/dev/null; then
|
||||||
|
+ $PRINTF "test $F_n $TEST... ${YELLOW}TCP/IPv4 not available${NORMAL}\n" $N
|
||||||
|
+ numCANT=$((numCANT+1))
|
||||||
|
+ listCANT="$listCANT $N"
|
||||||
|
+else
|
||||||
|
+gentestcert testsrv
|
||||||
|
+gentestaltcert testalt
|
||||||
|
+tf="$td/test$N.stdout"
|
||||||
|
+te="$td/test$N.stderr"
|
||||||
|
+tdiff="$td/test$N.diff"
|
||||||
|
+da="test$N $(date) $RANDOM"
|
||||||
|
+CMD0="$TRACE $SOCAT $opts -u OPENSSL-LISTEN:$PORT,reuseaddr,cert=./testsrv.pem,cafile=./testalt.crt -"
|
||||||
|
+CMD1="$TRACE $SOCAT $opts -u - OPENSSL-CONNECT:localhost:$PORT,cafile=testsrv.crt,cert=testalt.pem,verify=0"
|
||||||
|
+printf "test $F_n $TEST... " $N
|
||||||
|
+$CMD0 >/dev/null >"${tf}0" 2>"${te}0" &
|
||||||
|
+pid0=$!
|
||||||
|
+waittcp4port $PORT 1
|
||||||
|
+echo "$da" |$CMD1 2>"${te}1"
|
||||||
|
+rc1=$?
|
||||||
|
+kill $pid0 2>/dev/null; wait
|
||||||
|
+if [ $rc1 -eq 0 ] && echo "$da" |diff - "${tf}0" >$tdiff; then
|
||||||
|
+ $PRINTF "$OK\n"
|
||||||
|
+ numOK=$((numOK+1))
|
||||||
|
+else
|
||||||
|
+ $PRINTF "$FAILED\n"
|
||||||
|
+ echo "$CMD0 &" >&2
|
||||||
|
+ cat "${te}0" >&2
|
||||||
|
+ echo "$CMD1" >&2
|
||||||
|
+ cat "${te}1" >&2
|
||||||
|
+ numFAIL=$((numFAIL+1))
|
||||||
|
+ listFAIL="$listFAIL $N"
|
||||||
|
+fi
|
||||||
|
+fi # NUMCOND
|
||||||
|
+ ;;
|
||||||
|
+esac
|
||||||
|
+PORT=$((PORT+1))
|
||||||
|
+N=$((N+1))
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+# end of common tests
|
||||||
|
+
|
||||||
|
##################################################################################
|
||||||
|
#=================================================================================
|
||||||
|
# here come tests that might affect your systems integrity. Put normal tests
|
||||||
|
diff --git a/xio-openssl.c b/xio-openssl.c
|
||||||
|
index 94fe44e..dc47798 100644
|
||||||
|
--- a/xio-openssl.c
|
||||||
|
+++ b/xio-openssl.c
|
||||||
|
@@ -1775,15 +1775,17 @@ static int openssl_handle_peer_certificate(struct single *xfd,
|
||||||
|
#if WITH_IP6
|
||||||
|
case 16: /* IPv6 */
|
||||||
|
inet_ntop(AF_INET6, data, aBuffer, sizeof(aBuffer));
|
||||||
|
- xioip6_pton(peername, &ip6bin);
|
||||||
|
- if (memcmp(data, &ip6bin, sizeof(ip6bin)) == 0) {
|
||||||
|
- Debug2("subjectAltName \"%s\" matches peername \"%s\"",
|
||||||
|
- aBuffer, peername);
|
||||||
|
- ok = 1;
|
||||||
|
- } else {
|
||||||
|
- Info2("subjectAltName \"%s\" does not match peername \"%s\"",
|
||||||
|
- aBuffer, peername);
|
||||||
|
- }
|
||||||
|
+ if (peername != NULL) {
|
||||||
|
+ xioip6_pton(peername, &ip6bin);
|
||||||
|
+ if (memcmp(data, &ip6bin, sizeof(ip6bin)) == 0) {
|
||||||
|
+ Debug2("subjectAltName \"%s\" matches peername \"%s\"",
|
||||||
|
+ aBuffer, peername);
|
||||||
|
+ ok = 1;
|
||||||
|
+ } else {
|
||||||
|
+ Info2("subjectAltName \"%s\" does not match peername \"%s\"",
|
||||||
|
+ aBuffer, peername);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
101
SOURCES/socat-1.7.4.1-tcp-address-with-connect-timeout.patch
Normal file
101
SOURCES/socat-1.7.4.1-tcp-address-with-connect-timeout.patch
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
diff --git a/test.sh b/test.sh
|
||||||
|
index 99323ad..2869658 100755
|
||||||
|
--- a/test.sh
|
||||||
|
+++ b/test.sh
|
||||||
|
@@ -15017,6 +15017,60 @@ PORT=$((PORT+1))
|
||||||
|
N=$((N+1))
|
||||||
|
|
||||||
|
|
||||||
|
+
|
||||||
|
+# Test TCP with options connect-timeout and retry.
|
||||||
|
+# Up to 1.7.4.3 this terminated immediately on connection refused
|
||||||
|
+NAME=TCP_TIMEOUT_RETRY
|
||||||
|
+case "$TESTS" in
|
||||||
|
+*%$N%*|*%functions%*|*%bugs%*|*%tcp%*|*%socket%*|*%$NAME%*)
|
||||||
|
+TEST="$NAME: TCP with options connect-timeout and retry"
|
||||||
|
+# In background run a delayed echo server
|
||||||
|
+# In foreground start TCP with connect-timeout and retry. On first attempt the
|
||||||
|
+# server is not listening; when socat makes a second attempt that succeeds, the
|
||||||
|
+# bug is absent and 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="sleep 1 && $TRACE $SOCAT $opts TCP-L:$PORT,reuseaddr PIPE"
|
||||||
|
+CMD1="$TRACE $SOCAT $opts - TCP:$LOCALHOST:$PORT,connect-timeout=2,retry=1,interval=2"
|
||||||
|
+printf "test $F_n $TEST... " $N
|
||||||
|
+eval "$CMD0" >/dev/null 2>"${te}0" &
|
||||||
|
+pid0=$!
|
||||||
|
+echo "$da" |$CMD1 >"${tf}1" 2>"${te}1"
|
||||||
|
+rc1=$?
|
||||||
|
+kill $pid0 2>/dev/null; wait
|
||||||
|
+if [ $rc1 -ne 0 ]; then
|
||||||
|
+ $PRINTF "$FAILED\n"
|
||||||
|
+ echo "$CMD0 &" >&2
|
||||||
|
+ cat "${te}0" >&2
|
||||||
|
+ echo "$CMD1" >&2
|
||||||
|
+ cat "${te}1" >&2
|
||||||
|
+ numFAIL=$((numFAIL+1))
|
||||||
|
+ listFAIL="$listFAIL $N"
|
||||||
|
+elif echo "$da" |diff - "${tf}1" >$tdiff; then
|
||||||
|
+ $PRINTF "$OK\n"
|
||||||
|
+ if [ "$VERBOSE" ]; then
|
||||||
|
+ echo "$CMD0 &" >&2
|
||||||
|
+ echo "$CMD1" >&2
|
||||||
|
+ fi
|
||||||
|
+ numOK=$((numOK+1))
|
||||||
|
+else
|
||||||
|
+ $PRINTF "$FAILED\n"
|
||||||
|
+ echo "$CMD0 &" >&2
|
||||||
|
+ cat "${te}0" >&2
|
||||||
|
+ echo "$CMD1" >&2
|
||||||
|
+ cat "${te}1" >&2
|
||||||
|
+ numFAIL=$((numFAIL+1))
|
||||||
|
+ listFAIL="$listFAIL $N"
|
||||||
|
+fi
|
||||||
|
+fi # NUMCOND
|
||||||
|
+ ;;
|
||||||
|
+esac
|
||||||
|
+PORT=$((PORT+1))
|
||||||
|
+N=$((N+1))
|
||||||
|
+
|
||||||
|
# end of common tests
|
||||||
|
|
||||||
|
##################################################################################
|
||||||
|
diff --git a/xio-socket.c b/xio-socket.c
|
||||||
|
index c1495e8..d6b935c 100644
|
||||||
|
--- a/xio-socket.c
|
||||||
|
+++ b/xio-socket.c
|
||||||
|
@@ -859,6 +859,8 @@ int _xioopen_connect(struct single *xfd, union sockaddr_union *us, size_t uslen,
|
||||||
|
xfd->para.socket.connect_timeout.tv_usec != 0) {
|
||||||
|
struct timeval timeout;
|
||||||
|
struct pollfd writefd;
|
||||||
|
+ int err;
|
||||||
|
+ socklen_t errlen = sizeof(err);
|
||||||
|
int result;
|
||||||
|
|
||||||
|
Info4("connect(%d, %s, "F_Zd"): %s",
|
||||||
|
@@ -894,7 +896,21 @@ int _xioopen_connect(struct single *xfd, union sockaddr_union *us, size_t uslen,
|
||||||
|
#endif
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
- /* otherwise OK */
|
||||||
|
+ /* otherwise OK or network error */
|
||||||
|
+ result = Getsockopt(xfd->fd, SOL_SOCKET, SO_ERROR, &err, &errlen);
|
||||||
|
+ if (result != 0) {
|
||||||
|
+ Msg2(level, "getsockopt(%d, SOL_SOCKET, SO_ERROR, ...): %s",
|
||||||
|
+ xfd->fd, strerror(err));
|
||||||
|
+ return STAT_RETRYLATER;
|
||||||
|
+ }
|
||||||
|
+ Debug2("getsockopt(%d, SOL_SOCKET, SO_ERROR, { %d }) -> 0",
|
||||||
|
+ xfd->fd, err);
|
||||||
|
+ if (err != 0) {
|
||||||
|
+ Msg4(level, "connect(%d, %s, "F_Zd"): %s",
|
||||||
|
+ xfd->fd, sockaddr_info(them, themlen, infobuff, sizeof(infobuff)),
|
||||||
|
+ themlen, strerror(err));
|
||||||
|
+ return STAT_RETRYLATER;
|
||||||
|
+ }
|
||||||
|
Fcntl_l(xfd->fd, F_SETFL, fcntl_flags);
|
||||||
|
} else {
|
||||||
|
Warn4("connect(%d, %s, "F_Zd"): %s",
|
||||||
@ -3,14 +3,25 @@
|
|||||||
Summary: Bidirectional data relay between two data channels ('netcat++')
|
Summary: Bidirectional data relay between two data channels ('netcat++')
|
||||||
Name: socat
|
Name: socat
|
||||||
Version: 1.7.4.1
|
Version: 1.7.4.1
|
||||||
Release: 2%{?dist}
|
Release: 9%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Url: http://www.dest-unreach.org/socat/
|
Url: http://www.dest-unreach.org/socat/
|
||||||
Source: http://www.dest-unreach.org/socat/download/%{name}-%{version}.tar.gz
|
Source: http://www.dest-unreach.org/socat/download/%{name}-%{version}.tar.gz
|
||||||
Group: Applications/Internet
|
|
||||||
|
|
||||||
Patch1: socat-1.7.4.4-CVE-2024-54661.patch
|
Patch1: socat-1.7.3.3-warn.patch
|
||||||
|
# https://issues.redhat.com/browse/RHEL-32438
|
||||||
|
# Based on: https://repo.or.cz/socat.git/commit/1477334905be18c08bd6dc77be5a62e36b573de4
|
||||||
|
Patch2: socat-1.7.4.1-ipv6-peername-segfault.patch
|
||||||
|
Patch3: socat-1.7.4.1-CVE-2024-54661.patch
|
||||||
|
# https://issues.redhat.com/browse/RHEL-107884
|
||||||
|
# Based on: https://repo.or.cz/socat.git/commit/ed4780553fd05bb8ed8a29462698090482be3393
|
||||||
|
Patch4: socat-1.7.4.1-tcp-address-with-connect-timeout.patch
|
||||||
|
# https://issues.redhat.com/browse/RHEL-143222
|
||||||
|
# Based on: https://repo.or.cz/socat.git/commit/45d87df2fd32756b56f8a48c2d6cdb476342aa20
|
||||||
|
Patch5: socat-1.7.4.1-handle-EINTR-on-recvmsg.patch
|
||||||
|
|
||||||
|
BuildRequires: make
|
||||||
|
BuildRequires: gcc
|
||||||
BuildRequires: openssl-devel readline-devel ncurses-devel
|
BuildRequires: openssl-devel readline-devel ncurses-devel
|
||||||
BuildRequires: autoconf kernel-headers > 2.6.18
|
BuildRequires: autoconf kernel-headers > 2.6.18
|
||||||
# for make test
|
# for make test
|
||||||
@ -28,7 +39,6 @@ line editor (readline), a program, or a combination of two of these.
|
|||||||
%setup -q
|
%setup -q
|
||||||
iconv -f iso8859-1 -t utf-8 CHANGES > CHANGES.utf8
|
iconv -f iso8859-1 -t utf-8 CHANGES > CHANGES.utf8
|
||||||
mv CHANGES.utf8 CHANGES
|
mv CHANGES.utf8 CHANGES
|
||||||
|
|
||||||
%autopatch -p1
|
%autopatch -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -41,7 +51,7 @@ mv CHANGES.utf8 CHANGES
|
|||||||
--enable-listen --enable-proxy --enable-exec \
|
--enable-listen --enable-proxy --enable-exec \
|
||||||
--enable-system --enable-pty --enable-readline \
|
--enable-system --enable-pty --enable-readline \
|
||||||
--enable-openssl --enable-sycls --enable-filan \
|
--enable-openssl --enable-sycls --enable-filan \
|
||||||
--enable-retry #--enable-fips
|
--enable-retry # --enable-fips
|
||||||
|
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
@ -49,15 +59,19 @@ make %{?_smp_mflags}
|
|||||||
make DESTDIR=%{buildroot} install
|
make DESTDIR=%{buildroot} install
|
||||||
install -d %{buildroot}/%{_docdir}/socat
|
install -d %{buildroot}/%{_docdir}/socat
|
||||||
install -m 0644 *.sh %{buildroot}/%{_docdir}/socat/
|
install -m 0644 *.sh %{buildroot}/%{_docdir}/socat/
|
||||||
install -m 0644 *.sh %{buildroot}/%{_docdir}/socat/
|
|
||||||
echo ".so man1/socat.1" | gzip > %{buildroot}/%{_mandir}/man1/filan.1.gz
|
echo ".so man1/socat.1" | gzip > %{buildroot}/%{_mandir}/man1/filan.1.gz
|
||||||
cp -a %{buildroot}/%{_mandir}/man1/filan.1.gz %{buildroot}/%{_mandir}/man1/procan.1.gz
|
cp -a %{buildroot}/%{_mandir}/man1/filan.1.gz %{buildroot}/%{_mandir}/man1/procan.1.gz
|
||||||
|
|
||||||
%check
|
%check
|
||||||
export TERM=ansi
|
export TERM=ansi
|
||||||
export OD_C=/usr/bin/od
|
export OD_C=/usr/bin/od
|
||||||
# intermittently, a test sometimes just fails and hangs, mostly on arm
|
# intermittently, a test sometimes just fails and some just hang
|
||||||
#timeout 30m make test
|
# HANGS on x86_64: 93, 323
|
||||||
|
# FAILED on x86_64: 61 215 306 307
|
||||||
|
# FAILED on ppc64le: 58 239
|
||||||
|
# FAILED on armv7hl: 154 155 318 319
|
||||||
|
#sed -i 's/NUMCOND=true/NUMCOND="test \\$N -ne 93 -a \\$N -ne 323"/' test.sh
|
||||||
|
#make test
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc BUGREPORTS CHANGES DEVELOPMENT EXAMPLES FAQ PORTING
|
%doc BUGREPORTS CHANGES DEVELOPMENT EXAMPLES FAQ PORTING
|
||||||
@ -69,21 +83,67 @@ export OD_C=/usr/bin/od
|
|||||||
%doc %{_mandir}/man1/*
|
%doc %{_mandir}/man1/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Tue Jun 3 2025 Stepan Broz <sbroz@redhat.com> - 1.7.4.1-2
|
* Fri Jan 30 2026 Martin Osvald <mosvald@redhat.com> - 1.7.4.1-9
|
||||||
|
- Handle EINTR on recvmsg()
|
||||||
|
Resolves: RHEL-143222
|
||||||
|
|
||||||
|
* Thu Aug 07 2025 Martin Osvald <mosvald@redhat.com> - 1.7.4.1-8
|
||||||
|
- Fix for: Client may exit 0 despite connection being reset
|
||||||
|
Resolves: RHEL-107884
|
||||||
|
|
||||||
|
* Wed Jun 04 2025 Martin Osvald <mosvald@redhat.com> - 1.7.4.1-7
|
||||||
- add fix for CVE-2024-54661
|
- add fix for CVE-2024-54661
|
||||||
Resolves: RHEL-70095
|
Resolves: RHEL-94843
|
||||||
- switch to autopatch, remove unused patches
|
- switch to autopatch, remove unused patches
|
||||||
|
|
||||||
* Tue Mar 30 2021 Paul Wouters <pwouters@redhat.com> - 1.7.4.1-1
|
* Mon Apr 15 2024 Martin Osvald <mosvald@redhat.com> - 1.7.4.1-6
|
||||||
- Resolves: rhbz#1805132 socat does not recognize IP addresses of the SAN extensions in ssl mode
|
- Fix IPv6 peername segfault (RHEL-32438)
|
||||||
- Resolves: rhbz#1870279 Transfer via socat fails with openssl enabled
|
|
||||||
- Resolves: rhbz#1914989 Socat udp4-recvfrom cause endless loop error when target is not vaild
|
|
||||||
|
|
||||||
* Sun Dec 01 2019 Paul Wouters <pwouters@redhat.com> - 1.7.3.3-2
|
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1.7.4.1-5
|
||||||
- Resolves: rhbz#1682464 socat changes blocked until gating tests are added
|
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||||
|
Related: rhbz#1991688
|
||||||
|
|
||||||
* Wed Nov 06 2019 Paul Wouters <pwouters@redhat.com> - 1.7.3.3-1
|
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.7.4.1-4
|
||||||
- Resolves: rhbz#1723581 socat-1.7.3.3 is available
|
- Rebuilt for RHEL 9 BETA for openssl 3.0
|
||||||
|
Related: rhbz#1971065
|
||||||
|
|
||||||
|
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.7.4.1-3
|
||||||
|
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||||
|
|
||||||
|
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.4.1-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jan 11 10:35:54 EST 2021 Paul Wouters <pwouters@redhat.com> - 1.7.4.1-1
|
||||||
|
- Resolves: rhbz#1914653 socat-1.7.4.1 is available
|
||||||
|
|
||||||
|
* Mon Jan 4 09:34:27 EST 2021 Paul Wouters <pwouters@redhat.com> - 1.7.4.0-1
|
||||||
|
- Resolves: rhbz#1912161 socat-1.7.4.0 is available
|
||||||
|
|
||||||
|
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.3.4-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.3.4-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jan 06 2020 Paul Wouters <pwouters@redhat.com> - 1.7.3.4-1
|
||||||
|
- Resolves: rhbz#1787954 socat-1.7.3.4 is available
|
||||||
|
|
||||||
|
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.3.3-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jun 24 2019 Paul Wouters <pwouters@redhat.com> - 1.7.3.3-1
|
||||||
|
- Resolves: rhbz#1696931 socat-1.7.3.3 is available
|
||||||
|
- Resolves: rhbz#1612274 Man page scan results for socat
|
||||||
|
- Disabled --enable-fips as its requires fipsld which we don't have.
|
||||||
|
|
||||||
|
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.7.3.2-9
|
||||||
|
- Rebuild for readline 8.0
|
||||||
|
|
||||||
|
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.3.2-8
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.3.2-7
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||||
|
|
||||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.3.2-6
|
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.3.2-6
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user