Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:cipriancraciun:opensuse-tumbleweed-extras
openssh
openssh-8.9p1-custom-1.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openssh-8.9p1-custom-1.patch of Package openssh
From 515a3c38197cfdc211891df43c13434be1046471 Mon Sep 17 00:00:00 2001 From: Ciprian Dorin Craciun <ciprian@volution.ro> Date: Sat, 15 Apr 2017 14:45:36 +0300 Subject: [PATCH 1/3] Add `%I` option to `ProxyCommand` which expands to the resolved IP of the remote as resolved from the local machine (thus before jumping) --- sshconnect.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/sshconnect.c b/sshconnect.c index ebecc837..69ce3033 100644 --- a/sshconnect.c +++ b/sshconnect.c @@ -86,28 +86,62 @@ static void warn_changed_key(struct sshkey *); /* Expand a proxy command */ static char * expand_proxy_command(const char *proxy_command, const char *user, const char *host, const char *host_arg, int port) { char *tmp, *ret, strport[NI_MAXSERV]; const char *keyalias = options.host_key_alias ? options.host_key_alias : host_arg; + char *address, straddr[NI_MAXHOST]; + struct addrinfo hints, *addressinfo; + struct sockaddr_in *sockinfo; + int gaierr; + + if (port <= 0) + port = default_ssh_port(); snprintf(strport, sizeof strport, "%d", port); + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = options.address_family == -1 ? + AF_UNSPEC : options.address_family; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_NUMERICSERV; + if ((gaierr = getaddrinfo(host, strport, &hints, &addressinfo)) != 0) { + debug("%s: could not resolve name %.100s as address: %s", + __func__, host, ssh_gai_strerror(gaierr)); + addressinfo = NULL; + } + if (addressinfo != NULL && addressinfo->ai_next != NULL) { + debug("%s: getaddrinfo %.100s returned multiple addresses", + __func__, host); + } + + if (addressinfo == NULL) + address = host; + else { + sockinfo = (struct sockaddr_in *) addressinfo->ai_addr; + address = inet_ntop(sockinfo->sin_family, &sockinfo->sin_addr, straddr, sizeof(straddr)); + if (address == NULL) + address = host; + freeaddrinfo(addressinfo); + } + xasprintf(&tmp, "exec %s", proxy_command); ret = percent_expand(tmp, "h", host, "k", keyalias, "n", host_arg, "p", strport, "r", options.user, + "I", address, (char *)NULL); free(tmp); return ret; } /* * Connect to the given ssh server using a proxy command that passes a * a connected fd back to us. */ static int -- 2.36.1
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