merge nsswitch into main branch

This commit is contained in:
lukem 1999-01-15 13:04:10 +00:00
parent de3b78d72a
commit 97cc62d6c3
3 changed files with 261 additions and 38 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.26 1998/08/22 05:36:32 tv Exp $
# $NetBSD: Makefile,v 1.27 1999/01/15 13:05:19 lukem Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
# missing: dump.5 plot.5
@ -6,11 +6,11 @@
MAN= a.out.5 acct.5 ar.5 core.5 daily.conf.5 dir.5 disktab.5 ethers.5 fs.5 \
fstab.5 genassym.cf.5 group.5 hosts.5 hosts.equiv.5 ifaliases.5 \
intro.5 ld.so.conf.5 link.5 lkm.conf.5 monthly.conf.5 motd.5 \
netgroup.5 networks.5 passwd.5 phones.5 printcap.5 protocols.5 \
ranlib.5 rc.conf.5 remote.5 resolv.conf.5 rpc.5 security.conf.5 \
services.5 shells.5 stab.5 ttyaction.5 types.5 utmp.5 weekly.conf.5
MLINKS= dir.5 dirent.5 fs.5 inode.5 hosts.equiv.5 rhosts.5
MLINKS+=utmp.5 wtmp.5 utmp.5 lastlog.5 passwd.5 master.passwd.5
netgroup.5 networks.5 nsswitch.conf.5 passwd.5 phones.5 printcap.5 \
protocols.5 ranlib.5 rc.conf.5 remote.5 resolv.conf.5 rpc.5 \
security.conf.5 services.5 shells.5 stab.5 ttyaction.5 types.5 utmp.5 \
weekly.conf.5
MLINKS= dir.5 dirent.5 fs.5 inode.5 utmp.5 wtmp.5 utmp.5 lastlog.5
SUBDIR= man5.i386

View File

@ -0,0 +1,250 @@
.\" $NetBSD: nsswitch.conf.5,v 1.3 1999/01/15 13:05:19 lukem Exp $
.\"
.\" Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Luke Mewburn.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Luke Mewburn.
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
.\" OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
.\" TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
.\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 16, 1998
.Dt NSSWITCH.CONF 5
.Os NetBSD
.Sh NAME
.Nm nsswitch.conf
.Nd name-service switch configuration file
.Sh DESCRIPTION
The
.Nm
file specifies how the
.Xr nsdispatch 3
(name-service switch dispatcher) routines in the C library should operate.
.Pp
The configuration file controls how a process looks up various databases
containing information regarding hosts, users (passwords), groups,
netgroups, etc.
Each database comes from a source (such as local files, DNS, NIS, and
NIS+), and the order to look up the sources is specified in
.Nm nsswitch.conf .
.Pp
If, for any reason, if the file doesn't exist, or has missing or corrupt
entries,
.Xr nsdispatch 3
will default to an entry of
.Va files
for the requested database.
.Pp
Each entry in
.Nm
consists of a database name, and a space separated list of sources.
Each source can have an optional trailing criterion that determines
whether the next listed source is used, or the search terminates at
the current source.
Each criterion consists of one or more status codes, and actions to
take if that status code occurs.
.Ss Sources
The following sources are implemented:
.Bl -column "compat" -offset indent -compact
.Sy Source Description
.It files Local files, such as
.Pa /etc/hosts ,
and
.Pa /etc/passwd .
.It dns Internet Domain Name System.
.Dq hosts
uses
.Sy IN
class entries, all other databases use
.Sy HS
class (Hesiod) entries.
.It nis NIS (formally YP)
.It compat support
.Sq +/-
in the
.Dq passwd
and
.Dq group
databases.
If this is present, it must be the only source for that entry.
.El
.Ss Databases
The following databases are used by the following C library functions:
.Bl -column "netgroup" -offset indent -compact
.Sy Database Used by
.It group
.Xr getpwent 3
.It hosts
.Xr gethostbyname 3 ,
.Xr gethostbyaddr 3
.It netgroup
.Xr getnetgrent 3
.It passwd
.Xr getpwent 3
.It shells
.Xr getusershell 3
.El
.Ss Status codes
The following status codes are available:
.Bl -column "tryagain" -offset indent -compact
.Sy Status Description
.It success The requested entry was found.
.It notfound The entry is not present at this source.
.It unavail The source is not responding, or entry is corrupt.
.It tryagain The source is busy, and may respond to retries.
.El
.Ss Actions
For each of the status codes, one of two actions is possible:
.Bl -column "continue" -offset indent -compact
.Sy Action Description
.It continue Try the next source
.It return Return with the current result
.El
.Ss Format of file
A
.Tn BNF
description of the syntax of
.Nm
is:
.Bl -column "<criterion>" -offset indent
.It <entry> ::=
<database> ":" [<source> [<criteria>]]*
.It <criteria> ::=
"[" <criterion>+ "]"
.It <criterion> ::=
<status> "=" <action>
.It <status> ::=
"success" | "notfound" | "unavail" | "tryagain"
.It <action> ::=
"return" | "continue"
.El
.Pp
Each entry starts on a new line in the file.
A
.Sq #
delimits a comment to end of line.
Blank lines are ignored.
A
.Sq \e
at the end of a line escapes the newline, and causes the next line to
be a continuation of the current line.
All entries are case-insensitive.
.Pp
The default criteria is to return on
.Dq success ,
and continue on anything else (i.e,
.Li [success=return notfound=continue unavail=continue tryagain=continue]
).
.Ss Compat mode: +/- syntax
In historical multi-source implementations, the
.Sq +
and
.Sq -
characters are used to signify the importing of user password and
group information from NIS.
Although
.Nm
provides alternative methods of accessing distributed sources such as
NIS, specifying a sole source of
.Dq compat
will provide the historical behaviour.
.Pp
An alternative source for the information accessed via
.Sq +/-
can be used by specifying
.Dq passwd_compat: source .
.Dq source
in this case can be
.Sq dns ,
.Sq nis ,
or
.Sq nisplus .
.Ss Notes
Historically, many of the databases had enumeration functions, often of
the form
.Fn getXXXent .
These made sense when the databases were in local files, but don't make
sense or have lesser relevance when there are possibly multiple sources,
each of an unknown size.
The interfaces are still provided for compatibility, but the source
may not be able to provide complete entries, or duplicate entries may
be retreived if multiple sources that contain similar information are
specified.
.Pp
To ensure compatibility with previous and current implementations, the
.Dq compat
source must appear alone for a given database.
.Sh FILES
.Bl -tag -width /etc/nsswitch.conf -compact
.It Pa /etc/nsswitch.conf
The file
.Nm
resides in
.Pa /etc .
.El
.Sh EXAMPLES
To lookup hosts in
.Pa /etc/hosts
and then from the DNS, and lookup user information from NIS then files, use:
.Bl -column "passwd:" -offset indent
.It hosts: files dns
.It passwd: nis [notfound=return] files
.It group: nis [notfound=return] files
.El
The criteria
.Dq [notfound=return]
sets a policy of "if the user is notfound in nis, don't try files."
This treats nis as the authoritive source of information, except
when the server is down.
.Pp
If the older-style "+/-" syntax for
.Pa /etc/passwd
is required, use:
.Bl -column "passwd:" -offset indent
.It passwd: compat
.It group: compat
.El
.Sh SEE ALSO
.Xr nsdispatch 3 ,
.Xr resolv.conf 5 ,
.Xr named 8 ,
.Xr ypbind 8
.Sh HISTORY
The
.Nm
file format first appeared in
.Nx 1.4 .
.Sh AUTHORS
Luke Mewburn
.Aq lukem@netbsd.org
wrote this freely distributable name-service switch implementation,
using ideas from the
.Tn ULTRIX
.Xr svc.conf 5
and
.Tn Solaris
.Xr nsswitch.conf 4
manual pages.

View File

@ -1,4 +1,4 @@
.\" $NetBSD: resolv.conf.5,v 1.9 1997/07/14 01:49:25 mikel Exp $
.\" $NetBSD: resolv.conf.5,v 1.10 1999/01/15 13:04:10 lukem Exp $
.\"
.\" Copyright (c) 1986, 1991 The Regents of the University of California.
.\" All rights reserved.
@ -33,7 +33,7 @@
.\"
.\" @(#)resolver.5 5.12 (Berkeley) 5/10/91
.\"
.Dd May 10, 1991
.Dd January 16, 1999
.Dt RESOLV.CONF 5
.Os BSD 4
.Sh NAME
@ -88,36 +88,8 @@ the domain part is taken to be everything after the first `.'.
Finally, if the host name does not contain a domain part, the root
domain is assumed.
.It Sy lookup
This keyword is used by the library routines
.Xr gethostbyname 3
and
.Xr gethostbyaddr 3 .
It specifies which databases should be searched,
and the order to do so.
The legal space-separated values are
.Bl -tag -width bind
.It Sy bind
use the Domain Name server by querying the
.Xr named 8
.It Sy file
search for entries in
.Nm /etc/hosts
.It Sy yp
talk to the YP system if
.Xr ypbind 8
is running
.El
.Pp
If the
.Sy lookup
keyword is not used in the system's
.Pa resolv.conf
file then the assumed order is
.Sy bind file .
Furthermore, if the system's
.Pa resolv.conf
file does not exist, then the only database used is
.Sy file .
This keyword has been deprecated by the functionality described in
.Xr nsswitch.conf 5 .
.Pp
.It Sy search
Search list for host-name lookup.
@ -218,6 +190,7 @@ resides in
.Sh SEE ALSO
.Xr gethostbyname 3 ,
.Xr resolver 3 ,
.Xr nsswitch.conf 5 ,
.Xr hostname 7 ,
.Xr named 8
.Rs