xref: /titanic_52/usr/src/lib/libsecdb/svc-rbac (revision 5bbb4db2c3f208d12bf0fd11769728f9e5ba66a2)
1#! /usr/bin/sh
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 2009 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27
28. /lib/svc/share/smf_include.sh
29
30files='/etc/user_attr /etc/security/auth_attr /etc/security/exec_attr
31    /etc/security/prof_attr'
32
33PKGINST=
34export PKGINST
35
36irbac=/usr/sadm/install/scripts/i.rbac
37
38if [ ! -x $irbac ]
39then
40	echo "${irbac}: not found."
41	exit $SMF_EXIT_ERR_FATAL
42fi
43
44case "$1" in
45start|refresh)
46	;;
47stop)
48	exit $SMF_EXIT_OK;;
49*)
50	echo "Usage: $0 { start | refresh | stop }"
51	exit $SMF_EXIT_ERR_FATAL;;
52esac
53
54for f in $files
55do
56	d=${f}.d
57	if [ ! -d ${d} ]
58	then
59		# No directory, nothing to do
60		continue
61	fi
62	#
63	# List all the files in the directory and the destination file
64	# in the order of their timestamp.  Most recent files are
65	# displayed first.  When we find the destination file, we're
66	# done as the rest of the files are older and they are already
67	# incorporated.
68	#
69	for frag in `ls -t $f $d/* 2> /dev/null`
70	do
71		if [ "$frag" = "$f" ]
72		then
73			break
74		fi
75		if [ -f "$frag" ]
76		then
77			echo $frag $f | $irbac
78		fi
79	done
80done
81
82exit $SMF_EXIT_OK
83