1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Store port numbers in host byte order in number-to-service mapping.

I don't know why these were in network byte order. Every single
interaction had a htons on entrance and ntohs on exit.
This commit is contained in:
david
2012-09-25 05:24:16 +00:00
parent b084226813
commit a0601febeb
4 changed files with 23 additions and 26 deletions

View File

@@ -173,7 +173,7 @@ void Port::getNmapServiceName(char *namebuf, int buflen) const {
} else {
struct servent *service;
service = nmap_getservbyport(htons(portno), IPPROTO2STR(proto));
service = nmap_getservbyport(portno, IPPROTO2STR(proto));
if (service != NULL)
service_name = service->s_name;
else
@@ -293,7 +293,7 @@ void PortList::getServiceDeductions(u16 portno, int protocol, struct serviceDedu
/* Look up the service name. */
*sd = serviceDeductions();
service = nmap_getservbyport(htons(portno), IPPROTO2STR(protocol));
service = nmap_getservbyport(portno, IPPROTO2STR(protocol));
if (service != NULL)
sd->name = service->s_name;
else
@@ -360,7 +360,7 @@ void PortList::setServiceProbeResults(u16 portno, int protocol,
Just look up the service name if none is provided. */
if (sname == NULL) {
struct servent *service;
service = nmap_getservbyport(htons(portno), IPPROTO2STR(protocol));
service = nmap_getservbyport(portno, IPPROTO2STR(protocol));
if (service != NULL)
sname = service->s_name;
}