i.devpolicy revision 7c478bd95313f5f23a4c958a745db2134aa03244
1873N/A#!/bin/sh
2887N/A#
1873N/A# CDDL HEADER START
1873N/A#
1873N/A# The contents of this file are subject to the terms of the
1873N/A# Common Development and Distribution License, Version 1.0 only
1873N/A# (the "License"). You may not use this file except in compliance
1873N/A# with the License.
1873N/A#
1873N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1873N/A# or http://www.opensolaris.org/os/licensing.
1873N/A# See the License for the specific language governing permissions
1873N/A# and limitations under the License.
1873N/A#
1873N/A# When distributing Covered Code, include this CDDL HEADER in each
1873N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1873N/A# If applicable, add the following below this CDDL HEADER, with the
1873N/A# fields enclosed by brackets "[]" replaced with your own identifying
1873N/A# information: Portions Copyright [yyyy] [name of copyright owner]
1873N/A#
1873N/A# CDDL HEADER END
1873N/A#
1873N/A#
1873N/A# ident "%Z%%M% %I% %E% SMI"
1873N/A#
3215N/A# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
6184N/A# Use is subject to license terms.
1873N/A#
1873N/A# NOTE: When a change is made to the source file for
3949N/A# /etc/security/device_policy a corresponding change must be made to
3949N/A# this class-action script.
3949N/A#
3949N/Awhile read src dest
3816N/Ado
3816N/A if [ ! -f $dest ] ; then
3816N/A cp $src $dest
3949N/A continue
1873N/A fi
3949N/A
3949N/A # changes
3949N/A cp $dest $dest.$$
3949N/A sed < $dest.$$ > $dest \
3949N/A -e '/md:admin/s/read_priv_set=sys_config/ /' \
3949N/A -e '/^[sm]d[: ]/d' \
3949N/A -e '/^ssd[: ]/d' \
3949N/A -e '/^fssnap:\* /d' \
3949N/A -e '/^icmp[ ]*read_priv_set=net_rawaccess[ ]*write_priv_set=net_rawaccess$/d' \
3949N/A -e '/^icmp6[ ]*read_priv_set=net_rawaccess[ ]*write_priv_set=net_rawaccess$/d'
3816N/A
3949N/A rm -f $dest.$$
3949N/A
3949N/A # potential additions
3949N/A additions="bge dnet ibd icmp icmp6 openeepr random vni ipf pfil"
3949N/A
3949N/A for dev in $additions
3949N/A do
3949N/A # if an entry for this driver exists in the source
3949N/A # file...
3949N/A grep "$dev" $src > /dev/null 2>&1
3949N/A if [ $? = 0 ] ; then
3949N/A # ...and no entry exists in the destination
3949N/A # file...
1873N/A grep "$dev" $dest > /dev/null 2>&1
3949N/A if [ $? != 0 ] ; then
3949N/A # ...then add the entry from
3949N/A # the source file to the
3949N/A # destination file.
2055N/A grep "$dev" $src >> $dest
3949N/A fi
3949N/A fi
3949N/A done
3949N/A
3949N/A # potential deletions
3949N/A deletions="elx"
3949N/A
3949N/A for dev in $deletions
3949N/A do
3949N/A # if an entry for this driver exists in the destination
3949N/A # file...
3949N/A grep "$dev" $dest > /dev/null 2>&1
3949N/A if [ $? = 0 ] ; then
3949N/A # ...and no entry exists in the source
3949N/A # file...
3949N/A grep "$dev" $src > /dev/null 2>&1
3949N/A if [ $? != 0 ] ; then
1873N/A # ...then remove the entry from
3949N/A # the destination file.
1873N/A cp $dest $dest.$$
1873N/A grep -v "$dev" $dest.$$ > $dest
1873N/A rm -f $dest.$$
1873N/A fi
1873N/A fi
1873N/A done
1873N/Adone
1873N/A
3949N/Aexit 0
3949N/A