ia64/xen-unstable

view tools/xenstore/testsuite/06dirpermissions.test @ 6552:a9873d384da4

Merge.
author adsharma@los-vmm.sc.intel.com
date Thu Aug 25 12:24:48 2005 -0700 (2005-08-25)
parents 112d44270733 fa0754a9f64f
children dfaf788ab18c
line source
1 # Root directory: owned by tool, everyone has read access.
2 expect 0 READ
3 getperm /
5 # Create directory: inherits from root.
6 mkdir /dir
7 expect 0 READ
8 getperm /dir
9 setid 1
10 expect 0 READ
11 getperm /dir
12 dir /dir
13 expect write failed: Permission denied
14 write /dir/test create contents2
16 # Remove everyone's read access to directoy.
17 setid 0
18 setperm /dir 0 NONE
19 setid 1
20 expect dir failed: Permission denied
21 dir /dir
22 expect read failed: Permission denied
23 read /dir/test create contents2
24 expect write failed: Permission denied
25 write /dir/test create contents2
27 # Grant everyone write access to directory.
28 setid 0
29 setperm /dir 0 WRITE
30 setid 1
31 expect getperm failed: Permission denied
32 getperm /dir
33 expect dir failed: Permission denied
34 dir /dir
35 write /dir/test create contents
36 setid 0
37 expect 1 WRITE
38 getperm /dir/test
39 setperm /dir/test 0 NONE
40 expect contents
41 read /dir/test
43 # Grant everyone both read and write access.
44 setperm /dir 0 READ/WRITE
45 setid 1
46 expect 0 READ/WRITE
47 getperm /dir
48 expect test
49 dir /dir
50 write /dir/test2 create contents
51 expect contents
52 read /dir/test2
53 setperm /dir/test2 1 NONE
55 # Change so that user 1 owns it, noone else can do anything.
56 setid 0
57 setperm /dir 1 NONE
58 expect 1 NONE
59 getperm /dir
60 expect test
61 expect test2
62 dir /dir
63 write /dir/test3 create contents
65 # User 2 can do nothing. Can't even tell if file exists.
66 setid 2
67 expect setperm failed: Permission denied
68 setperm /dir 2 NONE
69 expect getperm failed: Permission denied
70 getperm /dir
71 expect dir failed: Permission denied
72 dir /dir
73 expect read failed: Permission denied
74 read /dir/test
75 expect read failed: Permission denied
76 read /dir/test2
77 expect read failed: Permission denied
78 read /dir/test3
79 expect read failed: Permission denied
80 read /dir/test4
81 expect write failed: Permission denied
82 write /dir/test none contents
83 expect write failed: Permission denied
84 write /dir/test create contents
85 expect write failed: Permission denied
86 write /dir/test excl contents
87 expect write failed: Permission denied
88 write /dir/test4 none contents
89 expect write failed: Permission denied
90 write /dir/test4 create contents
91 expect write failed: Permission denied
92 write /dir/test4 excl contents
94 # Tools can always access things.
95 setid 0
96 expect 1 NONE
97 getperm /dir
98 expect test
99 expect test2
100 expect test3
101 dir /dir
102 write /dir/test4 create contents
104 # Inherited by child.
105 mkdir /dir/subdir
106 expect 1 NONE
107 getperm /dir/subdir
108 write /dir/subfile excl contents
109 expect 1 NONE
110 getperm /dir/subfile
112 # But for domains, they own it.
113 setperm /dir/subdir 2 READ/WRITE
114 expect 2 READ/WRITE
115 getperm /dir/subdir
116 setid 3
117 write /dir/subdir/subfile excl contents
118 expect 3 READ/WRITE
119 getperm /dir/subdir/subfile
121 # Inheritence works through multiple directories, too.
122 write /dir/subdir/1/2/3/4 excl contents
123 expect 3 READ/WRITE
124 getperm /dir/subdir/1/2/3/4
125 mkdir /dir/subdir/a/b/c/d
126 expect 3 READ/WRITE
127 getperm /dir/subdir/a/b/c/d