From 6d9e1ecb81731ca15ba6cc4533739c4010cca2d6 Mon Sep 17 00:00:00 2001 From: James Morris Date: Sun, 20 Oct 2024 12:16:42 -0400 Subject: [PATCH] issue-72 - Correct datatype, add test, originally reported by max-privatevoid --- ci/test_nsncd.sh | 2 +- ci/test_nspawn.sh | 2 ++ src/handlers.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ci/test_nsncd.sh b/ci/test_nsncd.sh index 4be4d6c..6b512eb 100755 --- a/ci/test_nsncd.sh +++ b/ci/test_nsncd.sh @@ -8,7 +8,7 @@ rc=0 # basic lookups getent passwd nsncdtest || rc=1 getent group nsncdtest || rc=1 - +id bug72 | grep 2709991565 || rc=1 # we expect all of these to succeed for i in $(seq 1 100); do getent services 65000 || rc=1 diff --git a/ci/test_nspawn.sh b/ci/test_nspawn.sh index 04ed3aa..b92c6ba 100755 --- a/ci/test_nspawn.sh +++ b/ci/test_nspawn.sh @@ -19,6 +19,8 @@ sudo sed '$ a netgroup: files' -i /etc/nsswitch.conf rc=0 sudo useradd nsncdtest +sudo groupadd bug72 --gid 2709991565 +sudo useradd bug72 --gid 2709991565 cp /etc/services ./services # simple service lookups diff --git a/src/handlers.rs b/src/handlers.rs index 4e3b1bd..628656e 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -949,7 +949,7 @@ fn serialize_initgroups(groups: Vec) -> Result> { result.extend_from_slice(header.as_slice()); for group in groups.iter() { - result.extend_from_slice(&i32::to_ne_bytes(group.as_raw().try_into()?)); + result.extend_from_slice(&u32::to_ne_bytes(group.as_raw().try_into()?)); } Ok(result)