1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

-Reflect function name change.

-Added more description.
-Many grammer fix.
-Fix hard sentence break.
-Many other man style fix.

Thanks for bde finding out the problem.
Thanks for sheldon for the patient and thorough review.
:-)

Submitted by: bde
Reviewed by: sheldonh
This commit is contained in:
Yoshinobu Inoue 2000-03-02 15:57:06 +00:00
parent d72d02311f
commit a56a8ad111
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57699

View File

@ -32,7 +32,7 @@
.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93 .\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd February 15, 1996 .Dd March 3, 2000
.Dt RCMD 3 .Dt RCMD 3
.Os BSD 4.2 .Os BSD 4.2
.Sh NAME .Sh NAME
@ -42,8 +42,7 @@
.Nm ruserok , .Nm ruserok ,
.Nm rcmd_af , .Nm rcmd_af ,
.Nm rresvport_af , .Nm rresvport_af ,
.Nm iruserok_af , .Nm iruserok_sa
.Nm ruserok_af
.Nd routines for returning a stream to a remote command .Nd routines for returning a stream to a remote command
.Sh SYNOPSIS .Sh SYNOPSIS
.Fd #include <unistd.h> .Fd #include <unistd.h>
@ -60,9 +59,7 @@
.Ft int .Ft int
.Fn rresvport_af "int *port" "int af" .Fn rresvport_af "int *port" "int af"
.Ft int .Ft int
.Fn iruserok_af "void *raddr" "int superuser" "const char *ruser" "const char *luser" "int af" .Fn iruserok_sa "const void *addr" "int addrlen" "int superuser" "const char *ruser" "const char *luser"
.Ft int
.Fn ruserok_af "const char *rhost" "int superuser" "const char *ruser" "const char *luser" "int af"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn rcmd .Fn rcmd
@ -93,7 +90,7 @@ looks up the host
.Fa *ahost .Fa *ahost
using using
.Xr gethostbyname 3 , .Xr gethostbyname 3 ,
returning \-1 if the host does not exist. returning -1 if the host does not exist.
Otherwise Otherwise
.Fa *ahost .Fa *ahost
is set to the standard name of the host is set to the standard name of the host
@ -137,13 +134,14 @@ The protocol is described in detail in
.Pp .Pp
The The
.Fn rresvport .Fn rresvport
function is used to obtain a socket with a privileged function is used to obtain a socket to which an address with a Privileged
address bound to it. This socket is suitable for use Internet port is bound.
by This socket is suitable for use by
.Fn rcmd .Fn rcmd
and several other functions. Privileged Internet ports are those and several other functions.
in the range 0 to 1023. Only the super-user Privileged Internet ports are those in the range 0 to 1023.
is allowed to bind an address of this sort to a socket. Only the super-user is allowed to bind an address of this sort
to a socket.
.Pp .Pp
The The
.Fn iruserok .Fn iruserok
@ -174,7 +172,7 @@ file; otherwise
.Fn iruserok .Fn iruserok
and and
.Fn ruserok .Fn ruserok
return \-1. return -1.
If the local domain (as obtained from If the local domain (as obtained from
.Xr gethostname 3 ) .Xr gethostname 3 )
is the same as the remote domain, only the machine name need be specified. is the same as the remote domain, only the machine name need be specified.
@ -186,18 +184,59 @@ It requires trusting the local DNS at most, while the
.Fn ruserok .Fn ruserok
function requires trusting the entire DNS, which can be spoofed. function requires trusting the entire DNS, which can be spoofed.
.Pp .Pp
Functions with ``_af'' suffix, i.e. The functions with an
.Fn rcmd_af ,
.Fn rresvport_af ,
.Fn iruserok_af
and
.Fn ruserok_af ,
works just as same as functions without ``_af'', and is capable of
handling both IPv6 port and IPv4 port.
Functions without
.Dq Li _af .Dq Li _af
works for IPv4 only. suffix or
To switch address family, .Dq Li _sa
suffix, i.e.,
.Fn rcmd_af,
.Fn rresvport_af
and
.Fn iruserok_sa ,
work the same as functions without an
.Dq Li _af
suffix nor
.Dq Li _sa
suffix, except that they are capable of handling both IPv6 and IPv4 ports.
.Pp
The
.Dq Li _af
suffix means the function has an additional
.Fa af
argument which is used to specify address family,
such as
.Dv AF_INET
for IPv4, and
.Dv AF_INET6
for IPv6.
The
.Fa af
argument extension is implemented for functions
which have no binary address argument.
Instead, the
.Fa af
argument specifies which address family is desired.
.Pp
The
.Dq Li _sa
suffix means the function has general socket address and
length arguments instead of protocol dependent address argument.
As the socket address is a protocol independent data structure,
IPv4 and IPv6 socket address can be passed as desired.
.Fa sa
argument extension is implemented for functions
which pass a protocol dependent binary address argument.
The argument needs to be replaced with a more general format
to support multiple address families in a general way.
.Pp
The functions without an
.Dq Li _af
suffix nor
.Dq Li _sa
suffix work for IPv4 only, except for
.Fn ruserok
which can handle both IPv6 and IPv4.
.To switch the address family, the
.Fa af .Fa af
argument must be filled with argument must be filled with
.Dv AF_INET , .Dv AF_INET ,
@ -212,13 +251,14 @@ The
.Fn rcmd .Fn rcmd
function function
returns a valid socket descriptor on success. returns a valid socket descriptor on success.
It returns \-1 on error and prints a diagnostic message on the standard error. It returns -1 on error and prints a diagnostic message
on the standard error.
.Pp .Pp
The The
.Fn rresvport .Fn rresvport
function function
returns a valid, bound socket descriptor on success. returns a valid, bound socket descriptor on success.
It returns \-1 on error with the global value It returns -1 on error with the global value
.Va errno .Va errno
set according to the reason for failure. set according to the reason for failure.
The error code The error code
@ -233,20 +273,27 @@ is overloaded to mean ``All network ports in use.''
.Xr rlogind 8 , .Xr rlogind 8 ,
.Xr rshd 8 .Xr rshd 8
.Pp .Pp
W. Stevens and M. Thomas, ``Advanced Socket API for IPv6,'' .Rs
RFC2292. .%A W. Stevens and M. Thomas
.%T ``Advanced Socket API for IPv6,''
RFC2292,
.Re
.Rs
.%A W. Stevens, M. Thomas and E. Nordmark
.%T ``Advanced Socket API for IPv6,''
draft-ietf-ipngwg-rfc2292bis-01.txt,
.Re
.Sh HISTORY .Sh HISTORY
These These
functions appeared in functions appeared in
.Bx 4.2 . .Bx 4.2 .
.Fn rresvport_af .Fn rresvport_af
appeared in RFC2292, and implemented by WIDE project appeared in RFC2292, and was implemented by the WIDE project
for Hydrangea IPv6 protocol stack kit. for the Hydrangea IPv6 protocol stack kit.
.Fn rcmd_af .Fn rcmd_af
appeared in draft-ietf-ipngwg-rfc2292bis-01.txt, appeared in draft-ietf-ipngwg-rfc2292bis-01.txt,
and implemented by WIDE/KAME IPv6 protocol stack kit. and was implemented in the WIDE/KAME IPv6 protocol stack kit.
.Fn iruserok_af .Fn iruserok_sa
and appeared in discussion on the IETF ipngwg mailing list,
.Fn rusreok_af and was implemented in
are proposed and implemented by WIDE project .Fx 4.0 .
for Hydrangea IPv6 protocol stack kit.