check: $(TEST_PROGS) visudo testsudoers
@./check_iolog_path $(srcdir)/regress/iolog_path/data
@./check_fill
- @for t in $(srcdir)/regress/*/test*.sh; do SRCDIR=$(srcdir) $(SHELL) $$t; done
+ @passed=0; failed=0; total=0; \
+ for t in $(srcdir)/regress/sudoers/*.in; do \
+ dir=`dirname $$t`; \
+ dirbase=`basename $$dir`; \
+ base=`basename $$t .in`; \
+ out="$${base}.out"; \
+ toke="$${base}.toke"; \
+ ./testsudoers -dt <$$t >$$out 2>$$toke; \
+ if cmp $$out $$dir/$$out.ok >/dev/null; then \
+ passed=`expr $$passed + 1`; \
+ echo "$$dirbase/$$base (parse): OK"; \
+ else \
+ failed=`expr $$failed + 1`; \
+ echo "$$dirbase/$$base: FAIL"; \
+ diff $$out $$dir/$$out.ok; \
+ fi; \
+ total=`expr $$total + 1`; \
+ if cmp $$toke $$dir/$$toke.ok >/dev/null; then \
+ passed=`expr $$passed + 1`; \
+ echo "$$dirbase/$$base (toke): OK"; \
+ else \
+ failed=`expr $$failed + 1`; \
+ echo "$$dirbase/$$base (toke): FAIL"; \
+ diff $$out $$dir/$$out.ok; \
+ fi; \
+ total=`expr $$total + 1`; \
+ done; \
+ echo "$$dirbase: $$passed/$$total tests passed; $$failed/$$total tests failed"
+ @passed=0; failed=0; total=0; \
+ for t in $(srcdir)/regress/*/*.sh; do \
+ dir=`dirname $$t`; \
+ dirbase=`basename $$dir`; \
+ base=`basename $$t .sh`; \
+ out="$${base}.out"; \
+ err="$${base}.err"; \
+ $(SHELL) $$t >$$out 2>$$err; \
+ if cmp $$out $$dir/$$out.ok >/dev/null; then \
+ passed=`expr $$passed + 1`; \
+ echo "$$dirbase/$$base: OK"; \
+ else \
+ failed=`expr $$failed + 1`; \
+ echo "$$dirbase/$$base: FAIL"; \
+ diff $$out $$dir/$$out.ok; \
+ fi; \
+ total=`expr $$total + 1`; \
+ if test -s $$dir/$$err.ok; then \
+ if cmp $$err $$dir/$$err.ok >/dev/null; then \
+ passed=`expr $$passed + 1`; \
+ echo "$$dirbase/$$base (stderr): OK"; \
+ else \
+ failed=`expr $$failed + 1`; \
+ echo "$$dirbase/$$base (stderr): FAIL"; \
+ diff $$out $$dir/$$out.ok; \
+ fi; \
+ total=`expr $$total + 1`; \
+ elif test -s $$err; then \
+ cat $$err 1>&2; \
+ fi; \
+ done; \
+ echo "$$dirbase: $$passed/$$total tests passed; $$failed/$$total tests failed"
clean:
-$(LIBTOOL) --mode=clean rm -f $(PROGS) *.lo *.o *.la *.a stamp-* core *.core core.* *.out
-#!/bin/sh
#
# Verify that all command tags are parsed OK.
# See http://www.sudo.ws/bugs/show_bug.cgi?id=437
#
-
-WANT=${SRCDIR-.}/regress/visudo/test1.ok
-GOT=vs_test1.out
-./visudo -c -f- > $GOT <<EOF
user1 ALL = LOG_INPUT: LOG_OUTPUT: /usr/bin/su -:\
ALL = NOLOG_INPUT: NOLOG_OUTPUT: /usr/bin/id
user2 ALL = NOPASSWD: NOEXEC: SETENV: /usr/bin/vi:\
ALL = PASSWD: EXEC: NOSETENV: /usr/bin/echo
-EOF
-
-# Check results
-if cmp $WANT $GOT >/dev/null; then
- echo "visudo 1: OK"
-else
- echo "visudo 1: FAILED"
- diff $WANT $GOT
-fi
--- /dev/null
+Parses OK.
+
+
+
+user1 ALL = /usr/bin/su - : ALL = /usr/bin/id
+user2 ALL = NOPASSWD: NOEXEC: /usr/bin/vi : ALL = PASSWD: EXEC: /usr/bin/echo
--- /dev/null
+#
+#
+#
+#
+WORD(5) ALL = LOG_INPUT LOG_OUTPUT COMMAND ARG : ALL = NOLOG_INPUT NOLOG_OUTPUT COMMAND
+WORD(5) ALL = NOPASSWD NOEXEC SETENV COMMAND : ALL = PASSWD EXEC NOSETENV COMMAND
-#!/bin/sh
-#
-# Test quoted words in sudoers.
-# Note that a backslash in double quotes is treated literally unless
-# it is escaping a double quote.
-#
-
-WANT=${SRCDIR-.}/regress/testsudoers/test2.out
-GOT=ts_test2.out
-./testsudoers -d > $GOT <<EOF
# Check quoted user name in User_Alias
User_Alias UA1 = "foo"
User_Alias UA2 = "foo.bar"
"%:C/non_UNIX_0 c" "hostf" = ("root") ALL
"%:C/non\'UNIX_3 c" "hostg" = ("root") ALL
"+netgr" "hosth" = ("root") ALL
-EOF
-
-# Check results
-if cmp $WANT $GOT >/dev/null; then
- echo "testsudoers 2: OK"
-else
- echo "testsudoers 2: FAILED"
- diff $WANT $GOT
-fi
--- /dev/null
+#
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR WORD(4)
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR WORD(4)
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR WORD(4)
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR WORD(4)
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR WORD(4)
+
+#
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR USERGROUP
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR USERGROUP
+
+#
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR USERGROUP
+USERALIAS ALIAS = BEGINSTR STRBODY BACKSLASH STRBODY BACKSLASH STRBODY ENDSTR USERGROUP
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR USERGROUP
+USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR USERGROUP
+USERALIAS ALIAS = BEGINSTR STRBODY BACKSLASH STRBODY ENDSTR USERGROUP
+
+#
+RUNASALIAS ALIAS = BEGINSTR STRBODY ENDSTR WORD(4)
+RUNASALIAS ALIAS = BEGINSTR STRBODY ENDSTR WORD(4)
+RUNASALIAS ALIAS = BEGINSTR STRBODY ENDSTR WORD(4)
+RUNASALIAS ALIAS = BEGINSTR STRBODY ENDSTR WORD(4)
+
+#
+DEFAULTS_HOST BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
+DEFAULTS_HOST BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
+
+#
+DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
+DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
+DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
+DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
+DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
+
+#
+DEFAULTS_RUNAS BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
+DEFAULTS_RUNAS BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
+
+#
+#
+#
+#
+
+#
+BEGINSTR STRBODY ENDSTR WORD(4) BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY ENDSTR WORD(4) BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY ENDSTR WORD(4) BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY ENDSTR WORD(4) BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY ENDSTR WORD(4) BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+
+#
+BEGINSTR STRBODY ENDSTR USERGROUP BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY ENDSTR USERGROUP BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY ENDSTR USERGROUP BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY BACKSLASH STRBODY BACKSLASH STRBODY ENDSTR USERGROUP BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY ENDSTR USERGROUP BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY ENDSTR USERGROUP BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY BACKSLASH STRBODY ENDSTR USERGROUP BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
+BEGINSTR STRBODY ENDSTR NETGROUP BEGINSTR STRBODY ENDSTR WORD(4) = ( BEGINSTR STRBODY ENDSTR WORD(4) ) ALL
--- /dev/null
+# Test whitespace in User_List as part of a per-user Defaults entry
+User_Alias FOO = foo, bar
+Defaults:FOO env_reset
+Defaults:foo,bar env_reset
+Defaults:foo,\ bar env_reset
+Defaults:foo, bar env_reset
--- /dev/null
+#
+USERALIAS ALIAS = WORD(5) , WORD(5)
+DEFAULTS_USER ALIAS DEFVAR
+DEFAULTS_USER WORD(5) , WORD(5) DEFVAR
+DEFAULTS_USER WORD(5) , WORD(5) DEFVAR
+DEFAULTS_USER WORD(5) , WORD(5) DEFVAR
# This is RedHat bug Bug 667103.
#
-WANT=${SRCDIR-.}/regress/testsudoers/test1.ok
-GOT=ts_test1.out
-./testsudoers -g wheel root id > $GOT <<EOF
+./testsudoers -g wheel root id <<EOF
root ALL = ALL
EOF
-
-# Check results
-if cmp $WANT $GOT >/dev/null; then
- echo "testsudoers 1: OK"
-else
- echo "testsudoers 1: FAILED"
- diff $WANT $GOT
-fi
+++ /dev/null
-#!/bin/sh
-#
-# Test whitespace in User_List as part of a per-user Defaults entry
-#
-
-WANT=${SRCDIR-.}/regress/testsudoers/test3.ok
-GOT=ts_test3.out
-./testsudoers -d > $GOT <<EOF
-User_Alias FOO = foo, bar
-Defaults:FOO env_reset
-Defaults:foo,bar env_reset
-Defaults:foo,\ bar env_reset
-Defaults:foo, bar env_reset
-EOF
-
-# Check results
-if cmp $WANT $GOT >/dev/null; then
- echo "testsudoers 3: OK"
-else
- echo "testsudoers 3: FAILED"
- diff $WANT $GOT
-fi
+++ /dev/null
-stdin: parsed OK