2N/A#! /usr/bin/sh
2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
2N/A
2N/A#
2N/A# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A#
2N/A
2N/A. /lib/svc/share/smf_include.sh
2N/A
2N/Afiles='/etc/user_attr /etc/security/auth_attr /etc/security/exec_attr
2N/A /etc/security/prof_attr'
2N/A
2N/APKGINST=
2N/Aexport PKGINST
2N/APATH=/usr/bin
2N/Aexport PATH
2N/A
2N/Airbac=/usr/sadm/install/scripts/i.rbac
2N/A
2N/Aif [[ ! -x $irbac ]]; then
2N/A echo "${irbac}: not found."
2N/A exit $SMF_EXIT_ERR_FATAL
2N/Afi
2N/A
2N/Aeval $(grep '^phrase=' $irbac)
2N/Aif [[ -z "$phrase" ]]; then
2N/A echo "${irbac}: can't determine \$phrase."
2N/A exit $SMF_EXIT_ERR_FATAL
2N/Afi
2N/A
2N/Afor f in $files; do
2N/A #
2N/A # The current library reads the fragments directly for all databases;
2N/A # in order to make upgrades possible, we need to run i.rbac only once
2N/A # to remove the older entries.
2N/A #
2N/A if ! grep -s "$phrase" $f > /dev/null 2>&1; then
2N/A echo /dev/null $f | $irbac
2N/A chown root:sys $f
2N/A else
2N/A #
2N/A # When we find one updated file, then the rest is also
2N/A # updated and we bail out.
2N/A #
2N/A break
2N/A fi
2N/Adone
2N/A
2N/Aexit $SMF_EXIT_OK