~bug-zappers/ubuntu/lucid/samba/bugzapping

« back to all changes in this revision

Viewing changes to testsuite/smbd/sec_ctx.exp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-10-15 12:31:58 UTC
  • Revision ID: james.westby@ubuntu.com-20041015123158-aokykzdqkdgy6dfx
Tags: upstream-3.0.7
ImportĀ upstreamĀ versionĀ 3.0.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
24
load_lib "compile.exp"
 
25
load_lib "util-defs.exp"
 
26
 
 
27
# Non-root test
 
28
 
 
29
set test_desc "change sec_ctx as non-root"
 
30
set test_prog "sec_ctx_nonroot"
 
31
simple_make "sec_ctx" $test_prog
 
32
set output [util_start "$srcdir/$subdir/$test_prog"]
 
33
 
 
34
if { [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
 
 
43
set 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
 
 
52
foreach { 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
}