Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:Update
openssh.9940
openssh-7.2p2-IPv6_X_forwarding.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openssh-7.2p2-IPv6_X_forwarding.patch of Package openssh.9940
# HG changeset patch # Parent 0b261a26ee99ca7a61b487df291a8ce859d36d7a Correctly parse DISPLAY variable for cases where it contains an IPv6 address (which should - but not always is - in (square) brackets). bnc#847710 - https://bugzilla.novell.com/show_bug.cgi?id=847710 diff --git a/openssh-7.2p2/channels.c b/openssh-7.2p2/channels.c --- a/openssh-7.2p2/channels.c +++ b/openssh-7.2p2/channels.c @@ -4056,18 +4056,19 @@ x11_connect_display(void) /* OK, we now have a connection to the display. */ return sock; } #endif /* * Check if it is a unix domain socket. Unix domain displays are in * one of the following formats: unix:d[.s], :d[.s], ::d[.s] */ + cp = strrchr(display, ':'); if (strncmp(display, "unix:", 5) == 0 || - display[0] == ':') { + (display[0] == ':' && ((cp - display) < 2)) ) { /* Connect to the unix domain socket. */ if (sscanf(strrchr(display, ':') + 1, "%u", &display_number) != 1) { error("Could not parse display number from DISPLAY: %.100s", display); return -1; } /* Create a socket. */ sock = connect_local_xsocket(display_number); @@ -4075,30 +4076,39 @@ x11_connect_display(void) return -1; /* OK, we now have a connection to the display. */ return sock; } /* * Connect to an inet socket. The DISPLAY value is supposedly * hostname:d[.s], where hostname may also be numeric IP address. + * Note that IPv6 numberic addresses contain colons (e.g. ::1:0) */ strlcpy(buf, display, sizeof(buf)); - cp = strchr(buf, ':'); + cp = strrchr(buf, ':'); if (!cp) { error("Could not find ':' in DISPLAY: %.100s", display); return -1; } *cp = 0; /* buf now contains the host name. But first we parse the display number. */ if (sscanf(cp + 1, "%u", &display_number) != 1) { error("Could not parse display number from DISPLAY: %.100s", display); return -1; } + + /* Remove brackets surrounding IPv6 addresses if there are any. */ + if (buf[0] == '[' && (cp = strchr(buf, ']'))) { + *cp = 0; + cp = buf + 1; + } else { + cp = buf; + } /* Look up the host address */ memset(&hints, 0, sizeof(hints)); hints.ai_family = IPv4or6; hints.ai_socktype = SOCK_STREAM; snprintf(strport, sizeof strport, "%u", 6000 + display_number); if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) { error("%.100s: unknown host. (%s)", buf,
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor