From bd06f28812dd675e68fdd568d5e14b7cddb9a777 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/handlers.rs b/src/handlers.rs index 4e3b1bd..3c6d3a4 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -204,6 +204,11 @@ impl FromStr for ServiceWithPort { impl ServiceWithPort { fn lookup(&self) -> Result> { + //issue-142 + //port 0 lookups to sssd return ENOMEM + if self.port == 0 { + return Ok(None); + } let proto = match &self.proto { Some(p) => Some(CString::new(p.clone())?), None => None,