2 ###############################################################################
3 # (c) Copyright Hewlett-Packard Development Company, L.P., 2007
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of version 2 the GNU General Public License as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ###############################################################################
19 # Successfully newrole to another role and verify the audit
20 # The test starts at lspp_test_r which has access to staff_r
21 # verify that using newrole to change roles works, and that it is audited
23 source testcase.bash ||
exit 2
27 exp_context
=staff_u
:staff_r
:staff_t
:SystemLow-SystemHigh
28 auid
=$
(cat /proc
/self
/loginuid
)
32 spawn newrole -r staff_r
34 -nocase Authenticating {exp_continue}
35 -nocase \"Password: \" {send \"$PASSWD\\r\"; exp_continue}
36 -re \".*is not a valid context$\" {exit -1}
37 -re \"bash: .*Permission denied$\" {exp_continue}
38 -re \"\[.*staff_r.*\]# $\" {exit 0}
44 exit_fail
"newrole failed to change roles"
47 msg_1
="newrole: old-context=${old_context} new-context=${exp_context}.*"
48 augrok
-q type=USER_ROLE_CHANGE auid
=$auid \
49 msg_1
=~
"$msg_1" || exit_fail
"missing: \"$msg_1\""