1 #
2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 # Get the TESTROOT directory;
28 set TESTROOT $env(TESTROOT)
29
30 # include common code and init section
31 source [file join ${TESTROOT} tcl.init]
32 source [file join ${TESTROOT} testproc]
33
34 # connect to the test server
35 Connect
36
37 # setting local variables
38 set TNAME $argv0
39 set bfh [get_fh "$BASEDIRS"]
40 set expcode "OK"
41
42
43 # Start testing
44 # -----------------------------------------------------------------
45 # a: Verify Solaris server has FATTR4_ACL in supported_attrs list
46 set ASSERTION "Verify Solaris server has FATTR4_ACL in supported_attrs list"
47 set tag "$TNAME{a}"
48 putmsg stdout 0 "$tag: $ASSERTION"
49
50 # Get a list of the supported attributes
51 set attr {supported_attrs}
52 set res [compound { Putfh $bfh; Lookup $env(TEXTFILE); Getfh; Getattr $attr }]
53 set cont [ckres "Getattr($attr)" $status $expcode $res $FAIL]
54 set ACL_SUPPORT 0
55
56 if { ![string equal $cont "false"] } {
57 putmsg stdout 1 "\nres=<$res>\n"
58 set ffh [lindex [lindex $res 2] 2]
59 set slist [lindex [lindex [lindex [lindex $res 3] 2] 0] 1]
60
61 # Verify Solaris has "acl" in the supported_attrs list
62 if {($env(SRVOS) == "Solaris")} {
63 if { [ lsearch -exact $slist "acl" ] < 0 } {
64 putmsg stdout 0 \
65 "\tTest FAIL: did not find <acl> in the supported_attrs list"
66 putmsg stdout 1 "\t\tslist: <$slist>"
67 } else {
68 # Attempt Getattr of acl attribute
69 set res2 [compound { Putfh $ffh; Getattr acl }]
70 set cont [ckres "Getattr/acl" $status $expcode $res2 $FAIL]
71 if {$cont == "true"} {
72 putmsg stdout 1 "\nres2=<$res2>\n"
73 set aclres [lindex [lindex [lindex [lindex $res2 1] 2] 0] 1]
74 if { [ lsearch -regexp $aclres "OWNER" ] < 0 } {
75 putmsg stdout 0 \
76 "\tTest FAIL: Getattr/acl did not return correct ace's?"
77 putmsg stdout 1 "\t\taclres=<$aclres>"
78 } else {
79 putmsg stdout 0 "\tTest PASS"
80 set ACL_SUPPORT 1
81 }
82 }
83 }
84 } else {
85 putmsg stdout 0 "\t Test NOTINUSE: unknown acl support for this server."
86 }
87 }
88
89
90 # ----------------------------------------------------------------------
91 # b: Verify Solaris server has minimum ACL_SUPPORT of a filesystem object
92 set ASSERTION "Verify Solaris server has minimum ACL_SUPPORT of a FS object"
93 set tag "$TNAME{b}"
94 putmsg stdout 0 "$tag: $ASSERTION"
95
96 # Based on {a}, "acl" is in the supported_attrs list of Solaris system
97 # So, we want to verify "aclsupport" will have at least ALLOW+DENY for Solaris.
98 putmsg stdout 1 "ACL_SUPPORT set from assertion{a} is <$ACL_SUPPORT>\n"
99 if {($env(SRVOS) == "Solaris")} {
100 if { $ACL_SUPPORT != 1 } {
101 putmsg stdout 0 \
102 "\tTest UNRESOLVED: <acl> is NOT supported well in this server?"
103 putmsg stdout 0 \
104 "\t\tcheck assertion{a} for possible reason."
105 } else {
106 # Verify the server should have the minimum ACL support
107 # which includes ALLOW_ACL and DENY_ACL
108 set res [compound { Putfh $bfh; Getattr aclsupport }]
109 set cont [ckres "Getattr" $status $expcode $res $FAIL]
110 if { ![string equal $cont "false"] } {
111 set ALLOW_ACL 1
112 set DENY_ACL 2
113 set minsupp [expr $ALLOW_ACL | $DENY_ACL]
114 set aclsupp [lindex [lindex [lindex [lindex $res 1] 2] 0] 1]
115 putmsg stdout 1 "\tres=<$res>"
116 putmsg stdout 1 "\tminsupp=<$minsupp>, aclsupp=<$aclsupp>"
117 if { [expr $aclsupp & $minsupp] != $minsupp } {
118 putmsg stdout 0 \
119 "\tTest FAIL: aclsupport does not have min support"
120 putmsg stdout 0 \
121 "\t\taclsupp=$<aclsupp>, expected minsupp=<$minsupp>"
122 } else {
123 putmsg stdout 0 "\tTest PASS"
124 }
125 }
126 }
127 } else {
128 putmsg stdout 0 "\t Test NOTINUSE: unknown acl support for this server."
129 }
130
131
132 # ----------------------------------------------------------------------
133 # c: Verify archive attr is not in the supported_list of Solaris server
134 set ASSERTION "Verify ARCHIVE is not in supported_list of Solaris server"
135 set tag "$TNAME{c}"
136 putmsg stdout 0 "$tag: $ASSERTION"
137 set ARCHIVE_SUPPORT 0
138
139 # Get a list of the supported attributes
140 set attr {supported_attrs}
141 set res [compound { Putfh $bfh; Lookup $env(EXECFILE); Getfh; Getattr $attr }]
142 set cont [ckres "Getattr($attr)" $status $expcode $res $FAIL]
143
144 if { ![string equal $cont "false"] } {
145 putmsg stdout 1 "\nres=<$res>\n"
146 set ffh [lindex [lindex $res 2] 2]
147 set slist [lindex [lindex [lindex [lindex $res 3] 2] 0] 1]
148 set attr2 {archive}
149
150 # Verify Solaris does not have "archive" in the supported_attrs list
151 if {($env(SRVOS) == "Solaris")} {
152 if { [ lsearch -exact $slist $attr2 ] < 0 } {
153 # Attempt Getattr of this non-supported attribute
154 set res2 [compound { Putfh $ffh; Getattr $attr2 }]
155 set cont [ckres "Getattr/$attr2" $status $expcode $res2 $FAIL]
156 if {$cont == "true"} {
157 putmsg stdout 1 "\nres2=<$res2>\n"
158 set alist [lindex [lindex $res2 1] 2]
159 if { [ lsearch -regexp $alist $attr2 ] < 0 } {
160 putmsg stdout 0 "\tTest PASS"
161 } else {
162 putmsg stdout 0 \
163 "\tTest FAIL: Getattr/$attr returned unexpected value"
164 putmsg stdout 1 "\t\talist=<$alist>"
165 }
166 }
167 } else {
168 putmsg stdout 0 \
169 "\tTest FAIL: Solaris server does not support <$attr2>"
170 putmsg stdout 0 \
171 "\t\t but found <$attr2> in the supported_attrs list"
172 putmsg stdout 1 "\t\tslist: <$slist>"
173 set ARCHIVE_SUPPORT 1
174 }
175 } else {
176 putmsg stdout 0 \
177 "\t Test NOTINUSE: unknown $attr2 support for this server."
178 set ARCHIVE_SUPPORT 2
179 }
180 }
181
182 # ----------------------------------------------------------------------
183 # d: Verify Solaris server return false to FATTR4_CASE_INSENSITIVE
184 set ASSERTION "Verify Solaris server return false to FATTR4_CASE_INSENSITIVE"
185 set tag "$TNAME{d}"
186 putmsg stdout 0 "$tag: $ASSERTION"
187
188 set CASE_SUPPORT 0
189
190 # Get a list of the supported attributes
191 set attr {supported_attrs}
192 set res [compound { Putfh $bfh; Lookup $env(DIR0711); Getfh; Getattr $attr }]
193 set cont [ckres "Getattr($attr)" $status $expcode $res $FAIL]
194
195 if { ![string equal $cont "false"] } {
196 putmsg stdout 1 "\nres=<$res>\n"
197 set ffh [lindex [lindex $res 2] 2]
198 set slist [lindex [lindex [lindex [lindex $res 3] 2] 0] 1]
199 set attr2 {case_insensitive}
200
201 # CASE_INSENSITIVE should be in supported_attrs list to return a value
202 if {($env(SRVOS) == "Solaris")} {
203 if { [ lsearch -exact $slist $attr2 ] < 0 } {
204 putmsg stdout 0 \
205 "\tTest FAIL: <$attr2> is expected to be in Solaris server's"
206 putmsg stdout 0 \
207 "\t\t supported_attrs list, to return FALSE value; but didn't find it."
208 putmsg stdout 1 "\t\tslist: <$slist>"
209 } else {
210 # Attempt Getattr of this attribute to check the value
211 set res2 [compound { Putfh $ffh; Getattr $attr2 }]
212 set cont [ckres "Getattr/$attr2" $status $expcode $res2 $FAIL]
213 if {$cont == "true"} {
214 putmsg stdout 1 "\nres2=<$res2>\n"
215 set cival [lindex [lindex [lindex [lindex $res2 1] 2] 0] 1]
216 if { [string compare -nocase $cival "false"] == 0} {
217 putmsg stdout 0 "\tTest PASS"
218 set CASE_SUPPORT 1
219 } else {
220 putmsg stdout 0 \
221 "\tTest FAIL: Getattr/$attr2 returned unexpected value"
222 putmsg stdout 0 \
223 "\t\t cival=<$cival>, expected=<false>"
224 }
225 }
226 }
227 } else {
228 putmsg stdout 0 \
229 "\t Test NOTINUSE: unknown $attr2 support for this server."
230 }
231 }
232
233
234 # Verify server doesn't allow SETATTR of read-only attributes
235 set expcode "INVAL"
236
237 # ----------------------------------------------------------------------
238 # e: Verify server returns INVAL if Setattr of <aclsupport> attr (readonly)
239 set ASSERTION "Try to Setattr{aclsupport}; expect $expcode"
240 set tag "$TNAME{e}"
241 putmsg stdout 0 "$tag: $ASSERTION"
242
243 if { $ACL_SUPPORT == 1 } {
244 # send a SETATTR request to "aclsupport" attribute
245 set res [compound { Putfh $bfh; Setattr {0 0} {{aclsupport "true"}} }]
246 ckres "Setattr(aclsupport)" $status $expcode $res $PASS
247 } else {
248 putmsg stdout 0 "\t Test NOTINUSE: acl is not supported by this server."
249 }
250
251
252 # ----------------------------------------------------------------------
253 # f: Verify server returns INVAL if Setattr of <case_insensitive> attr
254 set ASSERTION "Try to Setattr{case_insensitive}; expect $expcode"
255 set tag "$TNAME{f}"
256 putmsg stdout 0 "$tag: $ASSERTION"
257
258 if { $CASE_SUPPORT == 1 } {
259 # send a SETATTR request to "aclsupport" attribute
260 set res [compound { Putfh $bfh; \
261 Setattr {0 0} {{case_insensitive "true"}} }]
262 ckres "Setattr(aclsupport)" $status $expcode $res $PASS
263 } else {
264 putmsg stdout 0 \
265 "\t Test NOTINUSE: case_insensitive is not supported by this server."
266 }
267
268
269 # Test server behaves if we try to SETATTR of read-only attributes
270 set expcode "ATTRNOTSUPP"
271
272 # ----------------------------------------------------------------------
273 # g: Verify server returns ATTRNOSUPP if Setattr of <archive> attr (readonly)
274 set ASSERTION "Try to Setattr{archive,RO_attr}; expect $expcode"
275 set tag "$TNAME{g}"
276 putmsg stdout 0 "$tag: $ASSERTION"
277
278 if { $ARCHIVE_SUPPORT == 0 } {
279 # send a SETATTR request to "archive" attribute
280 set res [compound { Putfh $bfh; Lookup $env(RWFILE); \
281 Setattr {0 0} {{archive "false"}}; Getattr $attr }]
282 ckres "Setattr(archive)" $status $expcode $res $PASS
283 } else {
284 putmsg stdout 0 \
285 "\t Test NOTINUSE: support for ARCHIVE attr is unknown at this server."
286 }
287
288
289 Disconnect
290 exit $PASS