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 2008 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26 # ident "@(#)tp_disable_011.ksh 1.3 08/06/11 SMI"
27 #
28
29 #
30 # Disable test case
31 #
32
33 #__stc_assertion_start
34 #
35 #ID: disable011
36 #
37 #DESCRIPTION:
38 #
39 # Attempt disable/enable with insufficient privileges
40 #
41 #STRATEGY:
42 #
43 # Setup:
44 # - Create first share group with default properties.
45 # - Populate first group with one share.
46 # - Create second (control) share group with default properties.
47 # - Populate second group with one share.
48 # Test:
49 # - Try to disable first group with insufficient privileges.
50 # The operation should fail.
51 # - Verify that second group is still enabled.
52 # - Disable first group with sufficient privileges..
53 # - Verify that second group is still enabled.
54 # - Try to enable first group with insufficient privileges.
55 # The operation should fail.
56 # - Verify that second group is still enabled.
57 # - Enable first group with sufficient privileges.
58 # - Verify that second group is still enabled.
59 # Cleanup:
60 # - Forcibly delete all share groups.
61 #
62 # STRATEGY_NOTES:
63 # - * Legacy methods will be used so long as they are still
64 # present.
65 # - Return status is checked for all share-related commands
66 # executed.
67 # - For all commands that modify the share configuration, the
68 # associated reporting commands will be executed and output
69 # checked to verify the expected changes have occurred.
70 #
71 #KEYWORDS:
72 #
73 # disable/enable
74 #
75 #TESTABILITY: explicit
76 #
77 #AUTHOR: andre.molyneux@sun.com
78 #
79 #REVIEWERS: TBD
80 #
81 #TEST_AUTOMATION_LEVEL: automated
82 #
83 #CODING_STATUS: COMPLETE
84 #
85 #__stc_assertion_end
86 function disable011 {
87 tet_result PASS
88 tc_id="disable011"
89 tc_desc="Attempt disable/enable with insufficient privileges"
90 cmd_list=""
91 unset GROUPS
92 print_test_case $tc_id - $tc_desc
93 #
94 # Setup
95 #
96 # Create and populate first share group
97 create ${TG[0]}
98 add_share POS ${TG[0]} "" ${MP[0]}
99
100 # Create and populate 'control' share group that will not be enabled/disabled
101 create ${TG[1]}
102 add_share POS ${TG[1]} "" ${MP[1]}
103
104 #
105 # Perform disable/enable operations
106 #
107 # Attempt disable command with insufficient privileges. We expect the
108 # dry run to succeed (as permissions aren't checked during a dry run)
109 # but the actual command should fail.
110 cmd_prefix="su - nobody -c \""
111 cmd_postfix="\""
112 disable POS "-n" ${TG[0]}
113 cmd_prefix="su - nobody -c \""
114 cmd_postfix="\""
115 disable NEG "" ${TG[0]}
116
117 # Verify that ${TG[1]} is still enabled
118 verify_group_state ${TG[1]}
119
120 # Execute disable command with sufficient privileges
121 disable POS "" ${TG[0]}
122
123 # Verify that ${TG[1]} is still enabled
124 verify_group_state ${TG[1]}
125
126 # Attempt enable command with insufficient privileges. We expect the
127 # dry run to succeed (as permissions aren't checked during a dry run)
128 # but the actual command should fail.
129 cmd_prefix="su - nobody -c \""
130 cmd_postfix="\""
131 enable POS "-n" ${TG[0]}
132 cmd_prefix="su - nobody -c \""
133 cmd_postfix="\""
134 enable NEG "" ${TG[0]}
135
136 # Verify that ${TG[1]} is still enabled
137 verify_group_state ${TG[1]}
138
139 # Execute enable command with sufficient privileges
140 enable POS "" ${TG[0]}
141
142 # Verify that ${TG[1]} is still enabled
143 verify_group_state ${TG[1]}
144
145 #
146 # Cleanup
147 #
148 # Delete all test groups
149 delete_all_test_groups
150 report_cmds $tc_id POS
151 }