From 1e14adff84faae136f27ac538a5038415288527e Mon Sep 17 00:00:00 2001 From: James Morris Date: Mon, 21 Oct 2024 19:50:38 -0400 Subject: [PATCH] Getservbyport should refuse port 0 issue-142 If nsncd queries sssd for port 0, ENOMEM is returned causing error logs. This has been confirmed by using the getservbyport_r man page example and amending nsswitch.conf --- src/handlers.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/handlers.rs b/src/handlers.rs index 4e3b1bd..a553a24 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -204,6 +204,9 @@ impl FromStr for ServiceWithPort { impl ServiceWithPort { fn lookup(&self) -> Result> { + if self.port == 0 { + return Ok(None) + } let proto = match &self.proto { Some(p) => Some(CString::new(p.clone())?), None => None,