File openssh-7.2p2-X_forward_with_disabled_ipv6.patch of Package openssh.29886

From 82010e190543d35e00635873a7d70dc9f486ce02 Mon Sep 17 00:00:00 2001
From: Old openssh patches <pcerny@suse.com>
Date: Wed, 26 Oct 2022 09:53:24 +0200
Subject: [PATCH] openssh-7.2p2-X_forward_with_disabled_ipv6

# HG changeset patch
# Parent  a9e60634acb905a830a0f57ece296781ab08d0fb
Do not throw away already open sockets for X11 forwarding if another socket
family is not available for bind().
---
 channels.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/channels.c b/channels.c
index c9d2015e..500c7dcd 100644
--- a/channels.c
+++ b/channels.c
@@ -3943,6 +3943,15 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
 				debug2("bind port %d: %.100s", port, strerror(errno));
 				close(sock);
 
+				/* do not remove successfully opened
+				 * sockets if the request failed because
+				 * the protocol IPv4/6 is not available
+				 * (e.g. IPv6 may be disabled while being
+				 * supported)
+				 */
+				if (EADDRNOTAVAIL == errno)
+    					continue;
+
 				for (n = 0; n < num_socks; n++) {
 					close(socks[n]);
 				}
-- 
2.38.0

openSUSE Build Service is sponsored by