From b679e031951b7f825547e2b258bf697e6e80304c Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 7 Jan 2011 13:19:32 -0500 Subject: [PATCH] Add support for regress tests using testsudoers --- plugins/sudoers/Makefile.in | 5 +++-- plugins/sudoers/regress/testsudoers/test1.ok | 8 ++++++++ plugins/sudoers/regress/testsudoers/test1.sh | 20 ++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 plugins/sudoers/regress/testsudoers/test1.ok create mode 100755 plugins/sudoers/regress/testsudoers/test1.sh diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in index 70acbf194..c5e016f5f 100644 --- a/plugins/sudoers/Makefile.in +++ b/plugins/sudoers/Makefile.in @@ -353,10 +353,11 @@ uninstall: rm -f $(DESTDIR)$(sudoersdir)/sudoers check: check_iolog_path - ./check_iolog_path $(srcdir)/regress/iolog_path/data + @./check_iolog_path $(srcdir)/regress/iolog_path/data + @for t in $(srcdir)/regress/testsudoers/test*.sh; do SRCDIR=$(srcdir) $(SHELL) $$t; done clean: - -$(LIBTOOL) --mode=clean rm -f $(PROGS) *.lo *.o *.la *.a stamp-* core *.core core.* + -$(LIBTOOL) --mode=clean rm -f $(PROGS) *.lo *.o *.la *.a stamp-* core *.core core.* test*.out mostlyclean: clean diff --git a/plugins/sudoers/regress/testsudoers/test1.ok b/plugins/sudoers/regress/testsudoers/test1.ok new file mode 100644 index 000000000..f980873c3 --- /dev/null +++ b/plugins/sudoers/regress/testsudoers/test1.ok @@ -0,0 +1,8 @@ +Parses OK. + +Entries for user root: + +ALL = ALL + host matched + +Command unmatched diff --git a/plugins/sudoers/regress/testsudoers/test1.sh b/plugins/sudoers/regress/testsudoers/test1.sh new file mode 100755 index 000000000..974a40548 --- /dev/null +++ b/plugins/sudoers/regress/testsudoers/test1.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Test for NULL dereference with "sudo -g group" when the sudoers rule +# has no runas user or group listed. +# This is RedHat bug Bug 667103. +# + +WANT=${SRCDIR-.}/regress/testsudoers/test1.ok +GOT=test1.out +./testsudoers -g wheel root id > $GOT </dev/null; then + echo "testsudoers 1: OK" +else + echo "testsudoers 1: FAILED" + diff $WANT $GOT +fi -- 2.40.0