From 9de73d88ee823a2376e3acc905939d0eba644a63 Mon Sep 17 00:00:00 2001 From: James Morris Date: Sat, 12 Oct 2024 09:43:35 -0400 Subject: [PATCH] Add a specific test to exercise buffer resize --- ci/test_nsncd.sh | 1 + ci/test_nspawn.sh | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ci/test_nsncd.sh b/ci/test_nsncd.sh index 5858d7b..4be4d6c 100755 --- a/ci/test_nsncd.sh +++ b/ci/test_nsncd.sh @@ -16,6 +16,7 @@ for i in $(seq 1 100); do getent services 65000/udp || rc=1 getent services foo1/tcp || rc=1 getent services foo1/udp || rc=1 + getent services bufresize/tcp > /dev/null|| rc=1 netgroup trusted-machines || rc=1 getent netgroup trusted-machines || rc=1 innetgr -h machine1 trusted-machines || rc=1 diff --git a/ci/test_nspawn.sh b/ci/test_nspawn.sh index 1121dca..04ed3aa 100755 --- a/ci/test_nspawn.sh +++ b/ci/test_nspawn.sh @@ -1,6 +1,6 @@ #!/bin/bash -sudo debootstrap stable /stable-chroot http://deb.debian.org/debian/ +sudo debootstrap stable /stable-chroot http://deb.debian.org/debian/ &> /dev/null sudo dpkg -i nsncd*.deb sdns="sudo systemd-nspawn --quiet --no-pager --bind-ro /var/run/nscd/socket:/var/run/nscd/socket -D /stable-chroot" @@ -19,8 +19,18 @@ sudo sed '$ a netgroup: files' -i /etc/nsswitch.conf rc=0 sudo useradd nsncdtest -echo -e "foo1\t65000/tcp" | sudo tee -a /etc/services -echo -e "foo1\t65000/udp" | sudo tee -a /etc/services +cp /etc/services ./services + +# simple service lookups +echo -e "foo1\t65000/tcp" >> services +echo -e "foo1\t65000/udp" >> services +# huge service lookup to exercise buffer resize +echo -en "bufresize\t65001/tcp " >> services +for i in $(seq 1000); do echo -n "alias${i} "; done >> services +echo "" >> services +sudo mv services /etc/services + +tail -5 /etc/services echo -e "trusted-machines (machine1,user1,domain1), (machine2,user2,domain2), (machine3,user3,domain3)\n" | sudo tee -a /etc/netgroup # copy in and execute tests inside the chroot