source: trunk/server/testsuite/smbd/sec_ctx.exp

Last change on this file was 414, checked in by Herwig Bauernfeind, 16 years ago

Samba 3.5.0: Initial 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 3 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, see <http://www.gnu.org/licenses/>.
21#
22
23load_lib "compile.exp"
24load_lib "util-defs.exp"
25
26# Non-root test
27
28set test_desc "change sec_ctx as non-root"
29set test_prog "sec_ctx_nonroot"
30simple_make "sec_ctx" $test_prog
31set output [util_start "$srcdir/$subdir/$test_prog"]
32
33if { [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
38}
39
40# Run tests from C files as root
41
42set 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" } \
49 ]
50
51foreach { test } $sec_ctx_tests {
52 set test_desc [lindex $test 0]
53 set test_file [lindex $test 1]
54
55 simple_make "sec_ctx" $test_file
56 set output [util_start "sudo $srcdir/$subdir/$test_file" ]
57
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
64 }
65
66}
Note: See TracBrowser for help on using the repository browser.