s4:winbind Implement logic for getgroups to work
[Samba/ekacnet.git] / testsuite / smbd / sec_ctx.exp
blob9ced9e5846304c62b016af081659d66dda8098b8
2 # @(#) Test the push_sec_ctx() and pop_sec_ctx() functions
6 # Unix SMB/Netbios implementation.
7 # Copyright (C) Tim Potter 2000
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, see <http://www.gnu.org/licenses/>.
23 load_lib "compile.exp"
24 load_lib "util-defs.exp"
26 # Non-root test
28 set test_desc "change sec_ctx as non-root"
29 set test_prog "sec_ctx_nonroot"
30 simple_make "sec_ctx" $test_prog
31 set output [util_start "$srcdir/$subdir/$test_prog"]
33 if { [regexp "child killed" $output] } {
34 pass $test_desc
35 file delete "$srcdir/$subdir/$test_prog" "$srcdir/$subdir/$test_prog.o"
36 } else {
37 fail $test_desc
40 # Run tests from C files as root
42 set sec_ctx_tests [list \
43 { "security contexts are stackable" "sec_ctx_stack" } \
44 { "over/underflow tests" "sec_ctx_flow" } \
45 { "torture test" "sec_ctx_torture" } \
46 { "current_user global" "sec_ctx_current_user" } \
47 { "group membership" "sec_ctx_groups" } \
48 { "become root" "sec_ctx_root" } \
51 foreach { test } $sec_ctx_tests {
52 set test_desc [lindex $test 0]
53 set test_file [lindex $test 1]
55 simple_make "sec_ctx" $test_file
56 set output [util_start "sudo $srcdir/$subdir/$test_file" ]
58 if { [regexp "PASS" $output] } {
59 pass $test_desc
60 file delete "$srcdir/$subdir/$test_file" "$srcdir/$subdir/$test_file.o"
61 } else {
62 fail $test_desc
63 puts $output