inetd_match(): Fix bug in matcher, make sure to also compare protocol!

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-06-08 00:54:54 +02:00
1 parent 6a27ad8997
commit 534979e6c7
1 file changed
+4 -2
+4 -2
View File
@@ -378,11 +378,13 @@ int inetd_match(inetd_t *inetd, char *service, char *proto, char *port)
return 1;
} else {
struct servent *sv = NULL;
struct protoent *pv = NULL;
if (getent(service, proto, &sv, NULL))
if (getent(service, proto, &sv, &pv))
return 0;
if (inetd->port == ntohs(sv->s_port))
if (inetd->proto == ntohs(pv->p_proto) &&
inetd->port == ntohs(sv->s_port))
return 1;
}