source: trunk-3.0/testsuite/smbd/sec_ctx.exp@ 103

Last change on this file since 103 was 1, checked in by Paul Smedley, 19 years ago

Initial code import

File size: 1.9 KB
Line 
1#
2# @(#) Test the push_sec_ctx() and pop_sec_ctx() functions
3#
4
5#
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 2 of the License, or
12# (at your option) any later version.
13#
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.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22#
23
24load_lib "compile.exp"
25load_lib "util-defs.exp"
26
27# Non-root test
28
29set test_desc "change sec_ctx as non-root"
30set test_prog "sec_ctx_nonroot"
31simple_make "sec_ctx" $test_prog
32set output [util_start "$srcdir/$subdir/$test_prog"]
33
34if { [regexp "child killed" $output] } {
35 pass $test_desc
36 file delete "$srcdir/$subdir/$test_prog" "$srcdir/$subdir/$test_prog.o"
37} else {
38 fail $test_desc
39}
40
41# Run tests from C files as root
42
43set sec_ctx_tests [list \
44 { "security contexts are stackable" "sec_ctx_stack" } \
45 { "over/underflow tests" "sec_ctx_flow" } \
46 { "torture test" "sec_ctx_torture" } \
47 { "current_user global" "sec_ctx_current_user" } \
48 { "group membership" "sec_ctx_groups" } \
49 { "become root" "sec_ctx_root" } \
50 ]
51
52foreach { test } $sec_ctx_tests {
53 set test_desc [lindex $test 0]
54 set test_file [lindex $test 1]
55
56 simple_make "sec_ctx" $test_file
57 set output [util_start "sudo $srcdir/$subdir/$test_file" ]
58
59 if { [regexp "PASS" $output] } {
60 pass $test_desc
61 file delete "$srcdir/$subdir/$test_file" "$srcdir/$subdir/$test_file.o"
62 } else {
63 fail $test_desc
64 puts $output
65 }
66
67}
Note: See TracBrowser for help on using the repository browser.