Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1
openssh
openssh-6.6p1-IPv6_X_forwarding.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openssh-6.6p1-IPv6_X_forwarding.patch of Package openssh
# HG changeset patch # Parent 1984a8c1f27fa2130ebc787d3d969a1026d9abca 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-6.6p1/channels.c b/openssh-6.6p1/channels.c --- a/openssh-6.6p1/channels.c +++ b/openssh-6.6p1/channels.c @@ -3588,18 +3588,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); @@ -3607,30 +3608,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