svc-rbac revision c11c3631128bd03ca6eb2504d1d2c1b5ec1c130f
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 2010 Sun Microsystems, Inc. All rights reserved.
2N/A# Use is subject to license terms.
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/A
2N/Airbac=/usr/sadm/install/scripts/i.rbac
2N/A
2N/Aif [ ! -x $irbac ]
2N/Athen
2N/A echo "${irbac}: not found."
2N/A exit $SMF_EXIT_ERR_FATAL
2N/Afi
2N/A
2N/Acase "$1" in
2N/Astart|refresh)
2N/A ;;
2N/Astop)
2N/A exit $SMF_EXIT_OK;;
2N/A*)
2N/A echo "Usage: $0 { start | refresh | stop }"
exit $SMF_EXIT_ERR_FATAL;;
esac
for f in $files
do
d=${f}.d
if [ ! -d ${d} ]
then
# No directory, nothing to do
continue
fi
# cache user/owner of file to update
ownergroup=`ls -ln $f | awk '{printf("%s:%s\n", $3, $4);'}`
#
# List all the files in the directory and the destination file
# in the order of their timestamp. Most recent files are
# displayed first. When we find the destination file, we're
# done as the rest of the files are older and they are already
# incorporated.
#
update=0
for frag in `ls -t $f $d/* 2> /dev/null`
do
if [ "$frag" = "$f" ]
then
break
fi
if [ -f "$frag" ]
then
update=1
echo $frag $f | $irbac
fi
done
if [ $update -eq 1 ]
then
chown $ownergroup $f
fi
done
exit $SMF_EXIT_OK