mirror of
https://github.com/nmap/nmap.git
synced 2025-12-23 07:59:03 +00:00
Straighten out port computation in nsock_connect_internal.
There was a bug here where AF_INET6 was used instead of AF_UNIX in the HAVE_SYS_UN_H section. This masked another bug, which was that the HAVE_SYS_UN_H section inadvertently extended into what was supposed to be the HAVE_IPV6 section.
This commit is contained in:
@@ -153,17 +153,18 @@ void nsock_connect_internal(mspool *ms, msevent *nse, int type, int proto, struc
|
|||||||
} else {
|
} else {
|
||||||
if (ss->ss_family == AF_INET) {
|
if (ss->ss_family == AF_INET) {
|
||||||
sin->sin_port = htons(port);
|
sin->sin_port = htons(port);
|
||||||
#if HAVE_SYS_UN_H
|
}
|
||||||
} else if (ss->ss_family == AF_INET6) {
|
|
||||||
#else
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
assert(ss->ss_family == AF_INET6);
|
|
||||||
#if HAVE_IPV6
|
#if HAVE_IPV6
|
||||||
|
else if (ss->ss_family == AF_INET6) {
|
||||||
sin6->sin6_port = htons(port);
|
sin6->sin6_port = htons(port);
|
||||||
#else
|
}
|
||||||
fatal("IPv6 address passed to nsock_connect_* call, but nsock was not compiled w/IPv6 support");
|
|
||||||
#endif
|
#endif
|
||||||
|
#if HAVE_SYS_UN_H
|
||||||
|
else if (ss->ss_family == AF_UNIX) {
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
fatal("Unknown address family %d\n", ss->ss_family);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(sslen <= sizeof(iod->peer));
|
assert(sslen <= sizeof(iod->peer));
|
||||||
|
|||||||
Reference in New Issue
Block a user