i.nsswitch revision 7c478bd95313f5f23a4c958a745db2134aa03244
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (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 2004 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
fi
done
exit 0