Key service table on protocol number, not name

This commit is contained in:
dmiller 2022-09-16 01:10:19 +00:00
parent 6c6d4e33b5
commit 3a32543db0
4 changed files with 65 additions and 58 deletions

View file

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