diff --git a/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/Makefile b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/Makefile new file mode 100644 index 0000000..c9b7367 --- /dev/null +++ b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist +# Description: What the test does +# Author: Arjun Shankar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE named.hesiod zone-entry hesiod.conf + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Arjun Shankar " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: What the test does" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 20m" >> $(METADATA) + @echo "RunFor: glibc" >> $(METADATA) + @echo "Requires: bind bind-utils glibc nss_hesiod" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1305132" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/PURPOSE b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/PURPOSE new file mode 100644 index 0000000..19a6cbb --- /dev/null +++ b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist +Description: What the test does +Author: Arjun Shankar diff --git a/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/hesiod.conf b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/hesiod.conf new file mode 100644 index 0000000..8e8c699 --- /dev/null +++ b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/hesiod.conf @@ -0,0 +1,2 @@ +rhs=.bz1305132 +lhs=.ns diff --git a/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/main.fmf b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/main.fmf new file mode 100644 index 0000000..4adbb0f --- /dev/null +++ b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/main.fmf @@ -0,0 +1,17 @@ +summary: Test for bz1305132 (Revisit name server list management in libresolv) +description: '' +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1305132 +contact: Arjun Shankar +component: + - glibc +test: ./runtest.sh +framework: beakerlib +recommend: + - bind + - bind-utils + - glibc + - nss_hesiod +duration: 20m +extra-summary: /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist +extra-task: /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist diff --git a/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/named.hesiod b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/named.hesiod new file mode 100644 index 0000000..356a6a9 --- /dev/null +++ b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/named.hesiod @@ -0,0 +1,17 @@ +; SOA and NS records. +@ IN SOA ns.bz1305132. hostmaster.bz1305132. ( + 20160915 ; serial + 3600 ; refresh every hour + 1200 ; retry every 20 minutes + 604800 ; expire after 1 week + 86400 ) ; minimum TTL 1 day + + IN NS ns.bz1305132. + +ns.bz1305132. A 127.0.0.1 + +; Actual Hesiod data. +libc.group TXT "libc:*:123:gnu" +123.gid CNAME libc.group +gnu.passwd TXT "gnu:*:4567:123:GNU:/home/gnu:/bin/bash" +4567.uid CNAME gnu.passwd diff --git a/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/runtest.sh b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/runtest.sh new file mode 100755 index 0000000..acb470c --- /dev/null +++ b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/runtest.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist +# Description: What the test does +# Author: Arjun Shankar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="glibc" +REQUIRES="glibc bind" + +rlJournalStart + rlPhaseStartSetup + rlFileBackup /etc/hosts + rlAssertRpm --all + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp named.hesiod zone-entry hesiod.conf $TmpDir" + rlRun "pushd $TmpDir" + + # set up hesiod as a query source + rlFileBackup --clean "/etc/nsswitch.conf" + rlRun "sed -i 's/^\(\s*group\s*:.*\)$/# \1/' /etc/nsswitch.conf" + rlRun "echo 'group: files hesiod' >> /etc/nsswitch.conf" + rlRun "sed -i 's/^\(\s*passwd\s*:.*\)$/# \1/' /etc/nsswitch.conf" + rlRun "echo 'passwd: files hesiod' >> /etc/nsswitch.conf" + rlFileBackup --clean "/etc/hesiod.conf" + rlRun "cp hesiod.conf /etc/" + + # set up a hesiod server + rlServiceStop "named" + rlRun "sleep 10" + rlFileBackup --clean "/etc/named.conf" + rlRun "cat zone-entry >> /etc/named.conf" + rlFileBackup --clean "/var/named/named.hesiod" + rlRun "cp named.hesiod /var/named" + rlServiceStart "named" + rlRun "sleep 10" + rlPhaseEnd + + rlPhaseStartTest + # point the resolver at local hesiod server + # (we want to do this as late as possible since it disables the default + # DNS server from being used) + rlRun "cp /etc/resolv.conf /etc/resolv.conf.bz1305132.bak" + rlRun "echo 'nameserver 127.0.0.1' > /etc/resolv.conf" + rlRun "groups gnu > groups.out" + rlAssertGrep "gnu\s*:\s*libc" groups.out + rlRun "cp /etc/resolv.conf.bz1305132.bak /etc/resolv.conf" + rlPhaseEnd + + rlPhaseStartCleanup + rlServiceStop "named" + rlRun "sleep 10" + rlRun "popd" + rlFileRestore + rlServiceRestore "named" + rlRun "sleep 10" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/zone-entry b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/zone-entry new file mode 100644 index 0000000..3b7fb6a --- /dev/null +++ b/tests/Regression/bz1305132-segfault-in-hesiod-getgrouplist/zone-entry @@ -0,0 +1,6 @@ + +zone "ns.bz1305132" { + type master; + file "named.hesiod"; +}; +