diff options
author | nectar <nectar@FreeBSD.org> | 2000-09-06 18:16:48 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2000-09-06 18:16:48 +0000 |
commit | 748554442d0ac4467fdac2ce9d42006588fd4481 (patch) | |
tree | aed2ddbcac97f46f60ee9c2063a3345553f6a1ee /etc | |
parent | 59ffb36b778f8e629622726f6bd32dfa4fda7e35 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | etc/Makefile | 2 | ||||
-rw-r--r-- | etc/host.conf | 7 | ||||
-rw-r--r-- | etc/hosts | 2 | ||||
-rw-r--r-- | etc/network.subr | 29 | ||||
-rw-r--r-- | etc/rc.d/netoptions | 29 | ||||
-rw-r--r-- | etc/rc.d/network1 | 29 | ||||
-rw-r--r-- | etc/rc.d/network2 | 29 | ||||
-rw-r--r-- | etc/rc.d/network3 | 29 | ||||
-rw-r--r-- | etc/rc.d/routing | 29 | ||||
-rw-r--r-- | etc/rc.network | 29 |
10 files changed, 205 insertions, 9 deletions
diff --git a/etc/Makefile b/etc/Makefile index 3c6bd20..333a324 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -6,7 +6,7 @@ SUBDIR= sendmail BIN1= amd.map apmd.conf auth.conf \ crontab csh.cshrc csh.login csh.logout \ dhclient.conf dm.conf fbtab ftpusers gettytab group \ - hosts hosts.allow host.conf hosts.equiv hosts.lpd \ + hosts hosts.allow hosts.equiv hosts.lpd \ inetd.conf login.access login.conf \ motd modems networks newsyslog.conf \ pam.conf phones pim6dd.conf pim6sd.conf \ diff --git a/etc/host.conf b/etc/host.conf deleted file mode 100644 index f6d2875..0000000 --- a/etc/host.conf +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ -# First try the /etc/hosts file -hosts -# Now try the nameserver next. -bind -# If you have YP/NIS configured, uncomment the next line -# nis @@ -4,7 +4,7 @@ # This file should contain the addresses and aliases # for local hosts that share this file. # In the presence of the domain name service or NIS, this file may -# not be consulted at all; see /etc/host.conf for the resolution order. +# not be consulted at all; see /etc/nsswitch.conf for the resolution order. # # ::1 localhost localhost.my.domain myname.my.domain diff --git a/etc/network.subr b/etc/network.subr index 51e02cd..168f3bd 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -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 +} + 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 +} + diff --git a/etc/rc.d/network1 b/etc/rc.d/network1 index 51e02cd..168f3bd 100644 --- a/etc/rc.d/network1 +++ b/etc/rc.d/network1 @@ -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 +} + diff --git a/etc/rc.d/network2 b/etc/rc.d/network2 index 51e02cd..168f3bd 100644 --- a/etc/rc.d/network2 +++ b/etc/rc.d/network2 @@ -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 +} + diff --git a/etc/rc.d/network3 b/etc/rc.d/network3 index 51e02cd..168f3bd 100644 --- a/etc/rc.d/network3 +++ b/etc/rc.d/network3 @@ -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 +} + diff --git a/etc/rc.d/routing b/etc/rc.d/routing index 51e02cd..168f3bd 100644 --- a/etc/rc.d/routing +++ b/etc/rc.d/routing @@ -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 +} + diff --git a/etc/rc.network b/etc/rc.network index 51e02cd..168f3bd 100644 --- a/etc/rc.network +++ b/etc/rc.network @@ -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 +} + |