summaryrefslogtreecommitdiff
path: root/debian/patches/getsockname-error.patch
blob: b4dbc2c9fb7e946136e69ccf696213d927cb83bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From 18e1479bf4586a14b88dab082af10a8981b9d48d Mon Sep 17 00:00:00 2001
From: Damien Miller <djm@mindrot.org>
Date: Sat, 15 Feb 2014 02:08:20 +0000
Subject: Skip get_sock_port call for c->sock==-1

Origin: upstream, https://bugzilla.mindrot.org/show_bug.cgi?id=2200
Bug-Debian: http://bugs.debian.org/738693
Last-Update: 2014-02-15

Patch-Name: getsockname-error.patch
---
 channels.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/channels.c b/channels.c
index e741f29..8e66265 100644
--- a/channels.c
+++ b/channels.c
@@ -1386,7 +1386,7 @@ port_open_helper(Channel *c, char *rtype)
 	int direct;
 	char buf[1024];
 	char *local_ipaddr = get_local_ipaddr(c->sock);
-	int local_port = get_sock_port(c->sock, 1);
+	int local_port = c->sock == -1 ? 65536 : get_sock_port(c->sock, 1);
 	char *remote_ipaddr = get_peer_ipaddr(c->sock);
 	int remote_port = get_peer_port(c->sock);