From owner-man-jp-reviewer@jp.freebsd.org  Thu May 11 23:59:36 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id XAA82838;
	Thu, 11 May 2000 23:59:36 +0900 (JST)
	(envelope-from owner-man-jp-reviewer@jp.FreeBSD.org)
Received: from basil.veltec.co.jp (camomile.veltec.co.jp [211.2.223.5])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id XAA82831
	for <man-jp-reviewer@jp.freebsd.org>; Thu, 11 May 2000 23:59:32 +0900 (JST)
	(envelope-from yuko@veltec.co.jp)
Received: from jade ([192.168.0.66])
	by basil.veltec.co.jp (8.10.0.Beta6/3.7W03/20/00) with ESMTP
	id e4BF5pt23633
	for <man-jp-reviewer@jp.freebsd.org>; Fri, 12 May 2000 00:05:51 +0900 (JST)
To: man-jp-reviewer@jp.freebsd.org
X-SMIME-fingerprint: A7:AE:D4:83:9D:5B:A5:F2:24:8F:F4:DC:87:3C:72:89
From: Yuko Sasaki <yuko@veltec.co.jp>
Message-Id: <200005120000.BJE98327.PLZV@veltec.co.jp>
X-Mailer: Winbiff [Version 2.31 beta1]
Date: Fri, 12 May 2000 00:00:33 +0900
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Reply-To: man-jp-reviewer@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: man-jp-reviewer 2462
Subject: [man-jp-reviewer 2462] (man2) nfssvc.2
Errors-To: owner-man-jp-reviewer@jp.freebsd.org
Sender: owner-man-jp-reviewer@jp.freebsd.org
X-Originator: yuko@veltec.co.jp

$B!V$G:G=i$K8=$l$^$7$?!#!W(B -> $B!V$G$O$8$a$FEP>l$7$^$7$?!#!W(B
$B!V?.9f!W(B -> $B!V%7%0%J%k!W(B
$B!V%9!<%Q!<!W(B -> $B!V%9!<%Q!W(B
------- $B$3$3$+$i(B --------------------------------------------------
.\" Copyright (c) 1989, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" 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 the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
.\"
.\"	@(#)nfssvc.2	8.1 (Berkeley) 6/9/93
.\" $FreeBSD: src/lib/libc/sys/nfssvc.2,v 1.6.2.1 1999/08/29 14:49:16 peter Exp $
.\"
.Dd June 9, 1993
.Dt NFSSVC 2
.Os
.Sh $BL>>N(B
.Nm nfssvc
.Nd NFS nfssvc - NFS $B%5!<%S%9(B
.Sh $B=q<0(B
.Fd #include <sys/param.h>
.Fd #include <sys/mount.h>
.Fd #include <sys/time.h>
.Fd #include <nfs/rpcv2.h>
.Fd #include <nfs/nfs.h>
.Fd #include <unistd.h>
.Ft int
.Fn nfssvc "int flags" "void *argstructp"
.Sh $B2r@b(B
.Fn nfssvc
$B4X?t$O!"(BNFS $B%G!<%b%s$,!">pJs$r%+!<%M%k$NCf$K$=$7$F%+!<%M%k$N30$KEO$7!"(B
$B%5!<%P%G!<%b%s$H$7$F(B
$B%+!<%M%k$KF~$k$N$K$b;HMQ$5$l$^$9!#(B
.Fa flags
$B0z?t$O!"%+!<%M%kFb$G$I$N$h$&$J=hCV$r<h$k$+$r<($9(B
$B$$$/$D$+$N%S%C%H$G9=@.$5$l$F$*$j!"(B
.Fa argstructp
$B$O%U%i%0Fb$G$I$N%S%C%H$,@_Dj$5$l$?$+$K=>$C$F(B
3 $B$D$N9=B$BN$N$&$A$N(B 1 $B$D$r;X$7$^$9!#(B
.Pp
$B%/%i%$%"%s%HB&$G$O!"(B
.Xr nfsiod 8
$B$O(B
.Fa flags
$B0z?t$r(B
.Dv NFSSVC_BIOD
$B$K@_Dj$7!"(B
.Fa argstructp
$B$r(B
.Dv NULL
$B$K@_Dj$7$F(B
.Fn nfssvc
$B$r8F$S=P$7!"%V%m%C%/F~=PNO%5!<%P%G!<%b%s$H$7$F%+!<%M%k$KF~$j$^$9!#(B
.Nm NQNFS
$B$N>l9g!"(B
.Xr mount_nfs 8
$B$O(B
.Dv NFSSVC_MNTD
$B%U%i%0$r@_Dj$7!"%*%W%7%g%s$G(B
.Dv NFSSVC_GOTAUTH
$B$H(B
.Dv NFSSVC_AUTHINFAIL
$B$NO@M}OB(B (or) $B$r<h$j!"(B
$B<!$N9=B$BN$r;X$9%]%$%s%?$H$H$b$K(B
.Fn nfssvc
$B$r8F$S=P$7$^$9!#(B
.Bd -literal
struct nfsd_cargs {
	char		*ncd_dirp;	/* $B%^%&%s%H%G%#%l%/%H%j%Q%9(B */
	uid_t		ncd_authuid;	/* $B%$%U%'%/%F%#%V(B uid */
	int		ncd_authtype;	/* $BG'>Z$N%?%$%W(B */
	int		ncd_authlen;	/* $BG'>ZJ8;zNs$ND9$5(B */
	u_char		*ncd_authstr;	/* $BG'>ZJ8;zNs(B */
	int		ncd_verflen;	/* $B$*$h$S8!>Z5!G=(B */
	u_char		*ncd_verfstr;
	NFSKERBKEY_T	ncd_key;	/* $B%;%C%7%g%s%-!<(B */
};
.Ed
.Pp
$B:G=i$N8F$S=P$7$K$O!"%^%&%s%H%]%$%s%H$K$D$$$F$N%5!<%S%9$r;XDj$9$k(B
.Dv NFSSVC_MNTD
$B%U%i%0$@$1$,@_Dj$5$l$F$$$^$9!#(B
$B%^%&%s%H%]%$%s%H$,(B Kerberos $B$r;HMQ$7$F$$$k>l9g!"(B
$B%/%i%$%"%s%HB&$,%f!<%6MQ$N(B``rcmd''$BG'>Z%A%1%C%H$rMW5a$9$k$?$S$K!"(B
.Xr mount_nfs 8
$B%G!<%b%s$O!"(Berrno == ENEEDAUTH $B$G(B
.Fn nfssvc
$B$+$iJV$j$^$9!#(B
.Xr mount_nfs 8
$B$O!"(BKerberos $B%A%1%C%H$rF@$h$&$H$7!"@.8y$9$k$H!"(B
ncd_authstr $B%U%#!<%k%I$K%A%1%C%H$rF~$l!"(B
nfsd_cargs $B9=B$BN$N(B ncd_authlen $B%U%#!<%k%I$H(B ncd_authtype $B%U%#!<%k%I$r(B
$B@_Dj$7$?8e$G!"%U%i%0(B
.Dv NFSSVC_MNTD
$B$*$h$S(B
.Dv NFSSVC_GOTAUTH
$B$r;XDj$7$F(B
.Fn nfssvc
$B$r8F$S=P$7$^$9!#(B
.Xr mount_nfs 8
$B$,%A%1%C%H$r<hF@$9$k$N$K<:GT$7$?>l9g!"(B
.Fn nfssvc
$B$O%U%i%0(B
.Dv NFSSVC_MNTD ,
.Dv NFSSVC_GOTAUTH
$B$*$h$S(B
.Dv NFSSVC_AUTHINFAIL
$B$H$H$b$K8F$S=P$5$l$F!"G'>Z$N;n$_$,(B
$B<:GT$7$?$3$H$rI=5-$7$^$9!#(B
.Pp
$B%5!<%PB&$G$O!"(B
.Fn nfssvc
$B$,%U%i%0(B
.Dv NFSSVC_NFSD
$B$H<!$N9=B$BN$r;X$9%]%$%s%?$H$H$b$K8F$S=P$5$l$F!"(B
.Xr nfsd 8
$B%G!<%b%s$H$7$F%+!<%M%k$KF~$j$^$9!#(B
.Bd -literal
struct nfsd_srvargs {
	struct nfsd	*nsd_nfsd;	/* $B%+!<%M%k(B nfsd struct $B$r;X$9%]%$%s%?(B */
	uid_t		nsd_uid;	/* cred $B$K%^%C%W$5$l$k%$%U%'%/%F%#%V(B uid*/
	u_long		nsd_haddr;	/* $B%/%i%$%"%s%H$N(B IP $B%"%I%l%9(B */
	struct ucred	nsd_cr;		/* Cred. uid $B$N%^%C%W08@h(B */
	int		nsd_authlen;	/* auth $BJ8;zNs$ND9$5(B ($BLa$j(B) */
	u_char		*nsd_authstr;	/* auth $BJ8;zNs(B ($BLa$j(B) */
	int		nsd_verflen;	/* $B$*$h$S8!>Z5!G=(B */
	u_char		*nsd_verfstr;
	struct timeval	nsd_timestamp;	/* $B8!>Z5!G=$+$i$N%?%$%`%9%?%s%W(B */
	u_long		nsd_ttl;	/* $B>Z=q(B ttl ($BIC(B) */
	NFSKERBKEY_T	nsd_key;	/* $B%;%C%7%g%s%-!<(B */
};
.Ed
.Pp
.Xr nfsd 8
$B%G!<%b%s$O!"(BKerberos $BG'>Z%A%1%C%H$r<u?.$9$k$?$S$K!"(B
.Fn nfssvc
$B$+$i(B errno == ENEEDAUTH $B$GJV$j$^$9!#(B
.Xr nfsd 8
$B$O!"%A%1%C%H$rG'>Z$7!"%U%#!<%k%I(B nsd_uid $B$K(B
$B;XDj$5$l$?(B``user id''$BMQ$N%5!<%P$K$D$$$F0lO"$N>Z=q$r@8@.$7$h$&$H$7$^$9!#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$kI,MW$,$"$j$^$9!#(B
------- $B$3$3$^$G(B --------------------------------------------------

------- $B86J8!&$3$3$+$i(B --------------------------------------------------
.\" Copyright (c) 1989, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" 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 the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
.\"
.\"	@(#)nfssvc.2	8.1 (Berkeley) 6/9/93
.\" $FreeBSD: src/lib/libc/sys/nfssvc.2,v 1.6.2.1 1999/08/29 14:49:16 peter Exp $
.\"
.Dd June 9, 1993
.Dt NFSSVC 2
.Os
.Sh NAME
.Nm nfssvc
.Nd NFS services
.Sh SYNOPSIS
.Fd #include <sys/param.h>
.Fd #include <sys/mount.h>
.Fd #include <sys/time.h>
.Fd #include <nfs/rpcv2.h>
.Fd #include <nfs/nfs.h>
.Fd #include <unistd.h>
.Ft int
.Fn nfssvc "int flags" "void *argstructp"
.Sh DESCRIPTION
The
.Fn nfssvc
function is used by the NFS daemons to pass information into and out
of the kernel and also to enter the kernel as a server daemon.
The
.Fa flags
argument consists of several bits that show what action is to be taken
once in the kernel and the
.Fa argstructp
points to one of three structures depending on which bits are set in
flags.
.Pp
On the client side,
.Xr nfsiod 8
calls
.Fn nfssvc
with the
.Fa flags
argument set to
.Dv NFSSVC_BIOD
and
.Fa argstructp
set to
.Dv NULL
to enter the kernel as a block I/O server daemon.
For
.Nm NQNFS ,
.Xr mount_nfs 8
calls
.Fn nfssvc
with the
.Dv NFSSVC_MNTD
flag, optionally or'd with the flags
.Dv NFSSVC_GOTAUTH
and
.Dv NFSSVC_AUTHINFAIL
along with a pointer to a
.Bd -literal
struct nfsd_cargs {
	char		*ncd_dirp;	/* Mount dir path */
	uid_t		ncd_authuid;	/* Effective uid */
	int		ncd_authtype;	/* Type of authenticator */
	int		ncd_authlen;	/* Length of authenticator string */
	u_char		*ncd_authstr;	/* Authenticator string */
	int		ncd_verflen;	/* and the verifier */
	u_char		*ncd_verfstr;
	NFSKERBKEY_T	ncd_key;	/* Session key */
};
.Ed
.Pp
structure.
The initial call has only the
.Dv NFSSVC_MNTD
flag set to specify service for the mount point.
If the mount point is using Kerberos, then the
.Xr mount_nfs 8
daemon will return from
.Fn nfssvc
with errno == ENEEDAUTH whenever the client side requires an ``rcmd''
authentication ticket for the user.
.Xr Mount_nfs 8
will attempt to get the Kerberos ticket, and if successful will call
.Fn nfssvc
with the flags
.Dv NFSSVC_MNTD
and
.Dv NFSSVC_GOTAUTH
after filling the ticket into the 
ncd_authstr field
and
setting the ncd_authlen and ncd_authtype
fields of the nfsd_cargs structure.
If
.Xr mount_nfs 8
failed to get the ticket,
.Fn nfssvc
will be called with the flags
.Dv NFSSVC_MNTD ,
.Dv NFSSVC_GOTAUTH
and
.Dv NFSSVC_AUTHINFAIL
to denote a failed authentication attempt.
.Pp
On the server side,
.Fn nfssvc
is called with the flag
.Dv NFSSVC_NFSD
and a pointer to a
.Bd -literal
struct nfsd_srvargs {
	struct nfsd	*nsd_nfsd;	/* Pointer to in kernel nfsd struct */
	uid_t		nsd_uid;	/* Effective uid mapped to cred */
	u_long		nsd_haddr;	/* Ip address of client */
	struct ucred	nsd_cr;		/* Cred. uid maps to */
	int		nsd_authlen;	/* Length of auth string (ret) */
	u_char		*nsd_authstr;	/* Auth string (ret) */
	int		nsd_verflen;	/* and the verfier */
	u_char		*nsd_verfstr;
	struct timeval	nsd_timestamp;	/* timestamp from verifier */
	u_long		nsd_ttl;	/* credential ttl (sec) */
	NFSKERBKEY_T	nsd_key;	/* Session key */
};
.Ed
.Pp
to enter the kernel as an
.Xr nfsd 8
daemon.
Whenever an
.Xr nfsd 8
daemon receives a Kerberos authentication ticket, it will return from
.Fn nfssvc
with errno == ENEEDAUTH.
The
.Xr nfsd 8
will attempt to authenticate the ticket and generate a set of credentials
on the server for the ``user id'' specified in the field nsd_uid.
This is done by first authenticating the Kerberos ticket and then mapping
the Kerberos principal to a local name and getting a set of credentials for
that user via.
.Xr getpwnam 3
and
.Xr getgrouplist 3 .
If successful, the
.Xr nfsd 8
will call
.Fn nfssvc
with the
.Dv NFSSVC_NFSD
and
.Dv NFSSVC_AUTHIN
flags set to pass the credential mapping in nsd_cr into the
kernel to be cached on the server socket for that client.
If the authentication failed,
.Xr nfsd 8
calls
.Fn nfssvc
with the flags
.Dv NFSSVC_NFSD
and
.Dv NFSSVC_AUTHINFAIL
to denote an authentication failure.
.Pp
The master
.Xr nfsd 8
server daemon calls
.Fn nfssvc
with the flag
.Dv NFSSVC_ADDSOCK
and a pointer to a
.Bd -literal
struct nfsd_args {
	int	sock;	/* Socket to serve */
	caddr_t	name;	/* Client address for connection based sockets */
	int	namelen;/* Length of name */
};
.Ed
.Pp
to pass a server side
.Tn NFS
socket into the kernel for servicing by the
.Xr nfsd 8
daemons.
.Sh RETURN VALUES
Normally
.Fn nfssvc
does not return unless the server
is terminated by a signal when a value of 0 is returned.
Otherwise, -1 is returned and the global variable
.Va errno
is set to specify the error.
.Sh ERRORS
.Bl -tag -width [ENEEDAUTH]
.It Bq Er ENEEDAUTH
This special error value
is really used for authentication support, particularly Kerberos,
as explained above.
.It Bq Er EPERM
The caller is not the super-user.
.El
.Sh SEE ALSO
.Xr mount_nfs 8 ,
.Xr nfsd 8 ,
.Xr nfsiod 8
.Sh HISTORY
The
.Fn nfssvc
function first appeared in
.Bx 4.4 .
.Sh BUGS
The
.Fn nfssvc
system call is designed specifically for the
.Tn NFS
support daemons and as such is specific to their requirements.
It should really return values to indicate the need for authentication
support, since
.Dv ENEEDAUTH
is not really an error.
Several fields of the argument structures are assumed to be valid and
sometimes to be unchanged from a previous call, such that
.Fn nfssvc
must be used with extreme care.
------- $B86J8!&$3$3$^$G(B --------------------------------------------------
