summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/netoptions
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2000-09-06 18:16:48 +0000
committernectar <nectar@FreeBSD.org>2000-09-06 18:16:48 +0000
commit748554442d0ac4467fdac2ce9d42006588fd4481 (patch)
treeaed2ddbcac97f46f60ee9c2063a3345553f6a1ee /etc/rc.d/netoptions
parent59ffb36b778f8e629622726f6bd32dfa4fda7e35 (diff)
downloadFreeBSD-src-748554442d0ac4467fdac2ce9d42006588fd4481.zip
FreeBSD-src-748554442d0ac4467fdac2ce9d42006588fd4481.tar.gz
Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be looked up using flat files, NIS, or Hesiod. = Hesiod has been added to libc (see hesiod(3)). = A library routine for parsing nsswitch.conf and invoking callback functions as specified has been added to libc (see nsdispatch(3)). = The following C library functions have been modified to use nsdispatch: . getgrent, getgrnam, getgrgid . getpwent, getpwnam, getpwuid . getusershell . getaddrinfo . gethostbyname, gethostbyname2, gethostbyaddr . getnetbyname, getnetbyaddr . getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr = host.conf has been removed from src/etc. rc.network has been modified to warn that host.conf is no longer used at boot time. In addition, if there is a host.conf but no nsswitch.conf, the latter is created at boot time from the former. Obtained from: NetBSD
Diffstat (limited to 'etc/rc.d/netoptions')
-rw-r--r--etc/rc.d/netoptions29
1 files changed, 29 insertions, 0 deletions
diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions
index 51e02cd..168f3bd 100644
--- a/etc/rc.d/netoptions
+++ b/etc/rc.d/netoptions
@@ -13,6 +13,18 @@
network_pass1() {
echo -n 'Doing initial network setup:'
+ # Convert host.conf to nsswitch.conf if necessary
+ if [ -f "/etc/host.conf" ]; then
+ echo ""
+ echo "Warning: /etc/host.conf is no longer used"
+ if [ -f "/etc/nsswitch.conf" ]; then
+ echo " /etc/nsswitch.conf will be used instead"
+ else
+ echo " /etc/nsswitch.conf will be created for you"
+ convert_host_conf /etc/host.conf /etc/nsswitch.conf
+ fi
+ fi
+
# Set the host name if it is not already set
#
if [ -z "`hostname -s`" ]; then
@@ -681,3 +693,20 @@ network_pass4() {
echo '.'
network_pass4_done=YES
}
+
+convert_host_conf() {
+ host_conf=$1; shift;
+ nsswitch_conf=$1; shift;
+ awk ' \
+ /^[:blank:]*#/ { next } \
+ /(hosts|local|file)/ { nsswitch[c] = "files"; c++; next } \
+ /(dns|bind)/ { nsswitch[c] = "dns"; c++; next } \
+ /nis/ { nsswitch[c] = "nis"; c++; next } \
+ { printf "Warning: unrecognized line [%s]", $0 > "/dev/stderr" } \
+ END { \
+ printf "hosts: "; \
+ for (i in nsswitch) printf "%s ", nsswitch[i]; \
+ printf "\n"; \
+ }' < $host_conf > $nsswitch_conf
+}
+
OpenPOWER on IntegriCloud