i.nsswitch revision 45916cd2fec6e79bca5dee0421bd39e3c2910d1e
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
#
echo '\nThe ipnodes policy has been changed to match the hosts' >> $1
echo 'policy. Please review the changes to the ipnodes policy' >> $1
echo 'Naming Administration Guide for more information' >> $1
echo 'about these changes.\n' >> $1
}
/hosts:[ ]*nisplus[ ][ ]*dns/i\\
#You must also set up the /etc/resolv.conf file for DNS name\\
#server lookup. See resolv.conf(4).
EOF
}
# original hosts entry
/^hosts:/p
# match ipnodes entry to hosts entry
s/^hosts: /ipnodes:/
# Add a commented out line for ipnodes in the example for adding DNS
# and update the comment found in nsswitch.conf, based on nsswitch.nisplus.
s/#Uncomment the following line/#Uncomment the following two lines/
/^#hosts:/p
s/^#hosts:/#ipnodes:/
# add ipnodes comment before ipnodes policy
/^ipnodes:/i\\
# Note that IPv4 addresses are searched for in all of the ipnodes databases\\
# before searching the hosts databases.
EOF
}
# find ipnodes comment and delete
/^# Uncomment the following line and comment out the above to resolve/d
/^# both IPv4 and IPv6 addresses from the ipnodes databases. Note that/d
/^# IPv4 addresses are searched in all of the ipnodes databases before/d
/^# searching the hosts databases. Before turning this option on, consult/d
/^# the Network Administration Guide for more details on using IPv6./d
/^#ipnodes:/d
# Add a commented out line for ipnodes in the example for adding DNS
# and update the comment found in nsswitch.conf, based on nsswitch.nisplus.
s/#Uncomment the following line/#Uncomment the following two lines/
/^#hosts:/p
s/^#hosts:/#ipnodes:/
# add new ipnodes comment before ipnodes policy
/^ipnodes:/i\\
# Note that IPv4 addresses are searched for in all of the ipnodes databases\\
# before searching the hosts databases.
EOF
}
do
if [ ! -f $dest ] ; then
else
if [ $? = 0 ] ; then
grep 'You must also set up the /etc/resolv.conf' \
if [ $? != 0 ]; then
fi
fi
if [ $? != 0 ]; then
sed -e 's/# "hosts:" and "services:" in this file are used only if the \/etc\/netconfig.*/# "hosts:" and "services:" in this file are used only if the/' \
-e 's/# file contains "switch.so" as a nametoaddr library for/# \/etc\/netconfig file has a "-" for nametoaddr_libs of/' > /tmp/d2.$$
fi
#
# If the file contains "xfn" in the "hosts:" line, omit it.
# The support for "xfn" has been removed
#
if [ $? = 0 ]; then
fi
# If the file doesn't have a "printers" database entry, add
# an appropriate entry. Default to everything if we can't
# figure out what is appropriate.
if [ $? != 0 ]; then
PRINTERS="files nis ldap nisplus"
if [ $? = 0 ] ; then
PRINTERS="files"
fi
if [ $? = 0 ] ; then
PRINTERS="files nis"
fi
if [ $? = 0 ] ; then
PRINTERS="files ldap"
fi
if [ $? = 0 ] ; then
PRINTERS="nisplus files"
fi
echo "printers: user ${PRINTERS}" >>$dest
else
#
# If the file contains "xfn" in the "printers:" line,
# omit it. The support for "xfn" has been removed
#
if [ $? = 0 ]; then
fi
fi
#
# If not there, add "ipnodes:" databases for unified host
# addresses. In all cases except the simple "hosts: files" one,
# add an ipnodes policy that matches the "hosts" policy and a
# comment regarding the search order of the "ipnodes" and
# "hosts" databases. All of this is followed by a blank line.
#
if [ $? != 0 ] ; then
if [ $? = 0 ]; then
sed '/^hosts:/p;s/^hosts.*/ipnodes: files/' \
if [ $? = 0 ]; then
fi
else
if [ $? = 0 ]; then
fi
fi
else
#
# The ipnodes policy is there (post S8), we just need
# to update the ipnodes policy to match the hosts
# policy.
#
if [ $? != 0 ]; then
#
# find ipnodes entry, delete it and replace it
# with one matching the hosts policy. Do this
# only if it's not been changed.
#
grep -s '^ipnodes:[ ]*files[ ]*$' \
if [ $? = 0 ]; then
sed -e '/^ipnodes:[ ]*files*$/d' \
-e '/^hosts:/p' \
-e 's/^hosts: /ipnodes:/' $dest \
> /tmp/d.$$
if [ $? = 0 ]; then
fi
fi
fi
#
# Now clean up the comments, if they haven't
# already been cleaned.
#
grep -s '^# Note that IPv4 addresses' \
if [ $? != 0 ]; then
if [ $? = 0 ]; then
fi
fi
fi
fi
#role-based access control databases
# Solaris 8 Beta refresh had audit_user, exec_attr and
# user_attr entries for dns, files, nis, nis+ and ldap.
# Remove them if they are present
sed -e '/^# role-based access control/d'\
-e '/^exec_attr:/d' \
-e '/^user_attr:/d' \
-e '/^# audit/d' \
-e '/^audit_user:/d' \
# If the file doesn't have user attr database entries, add
# appropriate entries. Default to everything if we can't
# figure out what is appropriate.
do
if [ $? != 0 ]; then
ATTR="files nis nisplus ldap"
if [ $? = 0 ] ; then
ATTR="files"
fi
if [ $? = 0 ] ; then
ATTR="files nis"
fi
2>&1
if [ $? = 0 ] ; then
ATTR="files nisplus"
fi
echo "${DB}: ${ATTR}" >> $dest
2>&1
if [ $? = 0 ] ; then
ATTR="files ldap"
fi
echo "${DB}: ${ATTR}" >> $dest
fi
done
# If the file doesn't have a "project" database entry, add
# an appropriate entry. Default to "files" if we can't
# figure out what is appropriate.
if [ $? != 0 ]; then
PROJECT="files"
if [ $? = 0 ] ; then
PROJECT="files"
fi
if [ $? = 0 ] ; then
PROJECT="files nis"
fi
if [ $? = 0 ] ; then
PROJECT="files ldap"
fi
echo "project: ${PROJECT}" >>$dest
fi
# sendmailvars bites the dust in S10
# If the file doesn't have Trusted Extensions networking
# database (TNdb) entries, add appropriate entries. Default
# to everything if we can't figure out what is appropriate.
do
if [ $? != 0 ]; then
ATTR="files ldap"
if [ $? = 0 ] ; then
ATTR="files"
fi
2>&1
if [ $? = 0 ] ; then
ATTR="files ldap"
fi
echo "${DB}: ${ATTR}" >> $dest
fi
done
fi
done
exit 0