projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sk_address_is_local() failed to cope when presented with a Unix-domain socket.
[u/mdw/putty]
/
unix
/
uxnet.c
diff --git
a/unix/uxnet.c
b/unix/uxnet.c
index
96d3aa5
..
8e95a65
100644
(file)
--- a/
unix/uxnet.c
+++ b/
unix/uxnet.c
@@
-301,7
+301,9
@@
static int sk_nextaddr(SockAddr addr, SockAddrStep *step)
void sk_getaddr(SockAddr addr, char *buf, int buflen)
{
void sk_getaddr(SockAddr addr, char *buf, int buflen)
{
-
+ /* XXX not clear what we should return for Unix-domain sockets; let's
+ * hope the question never arises */
+ assert(addr->superfamily != UNIX);
if (addr->superfamily == UNRESOLVED) {
strncpy(buf, addr->hostname, buflen);
buf[buflen-1] = '\0';
if (addr->superfamily == UNRESOLVED) {
strncpy(buf, addr->hostname, buflen);
buf[buflen-1] = '\0';
@@
-359,9
+361,10
@@
static int sockaddr_is_loopback(struct sockaddr *sa)
int sk_address_is_local(SockAddr addr)
{
int sk_address_is_local(SockAddr addr)
{
-
if (addr->superfamily == UNRESOLVED)
return 0; /* we don't know; assume not */
if (addr->superfamily == UNRESOLVED)
return 0; /* we don't know; assume not */
+ else if (addr->superfamily == UNIX)
+ return 1;
else {
#ifndef NO_IPV6
return sockaddr_is_loopback(addr->ais->ai_addr);
else {
#ifndef NO_IPV6
return sockaddr_is_loopback(addr->ais->ai_addr);