From 534979e6c7028c43b4b051eb2b08547e75a6490a Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 8 Jun 2015 00:54:54 +0200 Subject: [PATCH] inetd_match(): Fix bug in matcher, make sure to also compare protocol! Signed-off-by: Joachim Nilsson --- inetd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inetd.c b/inetd.c index fd090510..20f47498 100644 --- a/inetd.c +++ b/inetd.c @@ -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; }