mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Unix: allow connecting to Unix sockets by absolute path.
Now you can type an absolute pathname (starting with '/') into the hostname box in Unix GUI PuTTY, or into the hostname slot on the Unix Plink command line, and the effect will be that PuTTY makes an AF_UNIX connection to the specified Unix-domain socket in place of a TCP/IP connection. I don't _yet_ know of anyone running SSH on a Unix-domain socket, but at the very least it'll be useful to me for debugging and testing, and I'm pretty sure there will be other specialist uses sooner or later.
This commit is contained in:
parent
37d91aabff
commit
ee456a48ad
@ -186,6 +186,11 @@ void sk_cleanup(void)
|
||||
|
||||
SockAddr *sk_namelookup(const char *host, char **canonicalname, int address_family)
|
||||
{
|
||||
if (host[0] == '/') {
|
||||
*canonicalname = dupstr(host);
|
||||
return unix_sock_addr(host);
|
||||
}
|
||||
|
||||
SockAddr *ret = snew(SockAddr);
|
||||
#ifndef NO_IPV6
|
||||
struct addrinfo hints;
|
||||
@ -604,7 +609,7 @@ static int try_connect(NetSocket *sock)
|
||||
}
|
||||
}
|
||||
|
||||
if (sock->nodelay) {
|
||||
if (sock->nodelay && family != AF_UNIX) {
|
||||
int b = 1;
|
||||
if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *) &b, sizeof(b)) < 0) {
|
||||
@ -706,7 +711,6 @@ static int try_connect(NetSocket *sock)
|
||||
break;
|
||||
#endif
|
||||
case AF_UNIX:
|
||||
assert(sock->port == 0); /* to catch confused people */
|
||||
assert(strlen(sock->addr->hostname) < sizeof u.su.sun_path);
|
||||
u.su.sun_family = AF_UNIX;
|
||||
strcpy(u.su.sun_path, sock->addr->hostname);
|
||||
|
Loading…
Reference in New Issue
Block a user