1 #!/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
25 #
26
27 #
28 # ID: xattr_001
29 #
30 # DESCRIPTION:
31 # Verify creating,reading and writing xattrs on smbfs works as expected
32 #
33 # STRATEGY:
34 # 1. Create an xattr on a file using runat
35 # 2. Read an empty xattr directory
36 # 3. Write the xattr using runat and cat
37 # 3. Read the xattr using runat
38 # 4. Delete the xattr
39 # 5. List the xattr namespace successfully, checking for deletion
40 #
41
42 . $STF_SUITE/include/libtest.ksh
43
44 tc_id=xattr_001
45 tc_desc="Verify creating,reading and writing xattrs on smbfs works as expected"
46 print_test_case $tc_id - $tc_desc
47
48 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
49 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
50 set -x
51 fi
52
53 server=$(server_name) || return
54
55 testdir_init $TDIR
56 smbmount_clean $TMNT
57 smbmount_init $TMNT
58
59 cmd="mount -F smbfs //$TUSER:$TPASS@$server/public $TMNT"
60 cti_execute -i '' FAIL $cmd
61 if [[ $? != 0 ]]; then
62 cti_fail "FAIL: smbmount can't mount the public share"
63 return
64 else
65 cti_report "PASS: smbmount can mount the public share"
66 fi
67
68 smbmount_getmntopts $TMNT |grep /xattr/ >/dev/null
69 if [[ $? != 0 ]]; then
70 smbmount_clean $TMNT
71 cti_unsupported "UNSUPPORTED (no xattr in this mount)"
72 return
73 fi
74
75 cti_execute_cmd "touch $TMNT/test_file"
76 create_xattr $TMNT/test_file passwd /etc/passwd
77 verify_write_xattr $TMNT/test_file passwd
78 delete_xattr $TMNT/test_file passwd
79
80 smbmount_clean $TMNT
81 cti_pass "$tc_id: PASS"