Use \*[Am] and \*[Gt], like before the previous revision; use .In; minor other changes.
This commit is contained in:
parent
2abf3ae985
commit
379e07e3ac
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: getnameinfo.3,v 1.33 2005/01/11 07:26:57 itojun Exp $
|
||||
.\" $NetBSD: getnameinfo.3,v 1.34 2005/01/12 14:44:11 wiz Exp $
|
||||
.\" $KAME: getnameinfo.3,v 1.37 2005/01/05 03:23:05 itojun Exp $
|
||||
.\" $OpenBSD: getnameinfo.3,v 1.36 2004/12/21 09:48:20 jmc Exp $
|
||||
.\"
|
||||
|
@ -24,9 +24,9 @@
|
|||
.Nm getnameinfo
|
||||
.Nd socket address structure to hostname and service name
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <sys/socket.h>
|
||||
.Fd #include <netdb.h>
|
||||
.In sys/types.h
|
||||
.In sys/socket.h
|
||||
.In netdb.h
|
||||
.Ft int
|
||||
.Fn getnameinfo "const struct sockaddr *sa" "socklen_t salen" "char *host" \
|
||||
"size_t hostlen" "char *serv" "size_t servlen" "int flags"
|
||||
|
@ -70,8 +70,7 @@ The maximum value for
|
|||
.Fa hostlen
|
||||
is
|
||||
.Dv NI_MAXHOST
|
||||
and
|
||||
the maximum value for
|
||||
and the maximum value for
|
||||
.Fa servlen
|
||||
is
|
||||
.Dv NI_MAXSERV ,
|
||||
|
@ -84,7 +83,7 @@ host name or service string plus a byte for the NUL terminator.
|
|||
The
|
||||
.Fa flags
|
||||
argument is formed by
|
||||
.Tn OR Ns 'ing
|
||||
.Sy OR Ns 'ing
|
||||
the following values:
|
||||
.Bl -tag -width "NI_NUMERICHOSTXX"
|
||||
.It Dv NI_NOFQDN
|
||||
|
@ -137,7 +136,7 @@ Observe that there is no hardcoded reference to a particular address family.
|
|||
struct sockaddr *sa; /* input */
|
||||
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
||||
|
||||
if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf,
|
||||
if (getnameinfo(sa, sa-\*[Gt]sa_len, hbuf, sizeof(hbuf), sbuf,
|
||||
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV)) {
|
||||
errx(1, "could not get numeric hostname");
|
||||
/*NOTREACHED*/
|
||||
|
@ -150,7 +149,7 @@ The following version checks if the socket address has a reverse address mapping
|
|||
struct sockaddr *sa; /* input */
|
||||
char hbuf[NI_MAXHOST];
|
||||
|
||||
if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0,
|
||||
if (getnameinfo(sa, sa-\*[Gt]sa_len, hbuf, sizeof(hbuf), NULL, 0,
|
||||
NI_NAMEREQD)) {
|
||||
errx(1, "could not resolve hostname");
|
||||
/*NOTREACHED*/
|
||||
|
@ -192,7 +191,7 @@ printf("host=%s\en", hbuf);
|
|||
.Rs
|
||||
.%A Craig Metz
|
||||
.%T Protocol Independence Using the Sockets API
|
||||
.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference"
|
||||
.%B "Proceedings of the FREENIX track: 2000 USENIX annual technical conference"
|
||||
.%D June 2000
|
||||
.Re
|
||||
.Sh STANDARDS
|
||||
|
@ -201,7 +200,7 @@ The
|
|||
function is defined by the
|
||||
.St -p1003.1g-2000
|
||||
draft specification and documented in
|
||||
.Tn "RFC 2553" ,
|
||||
.Sy "RFC 2553" ,
|
||||
.Dq Basic Socket Interface Extensions for IPv6 .
|
||||
.Sh CAVEATS
|
||||
.Fn getnameinfo
|
||||
|
@ -230,8 +229,7 @@ To prevent such attacks, the use of
|
|||
.Dv NI_NAMEREQD
|
||||
is recommended when the result of
|
||||
.Fn getnameinfo
|
||||
is used
|
||||
for access control purposes:
|
||||
is used for access control purposes:
|
||||
.Bd -literal -offset indent
|
||||
struct sockaddr *sa;
|
||||
socklen_t salen;
|
||||
|
@ -242,10 +240,10 @@ int error;
|
|||
error = getnameinfo(sa, salen, addr, sizeof(addr),
|
||||
NULL, 0, NI_NAMEREQD);
|
||||
if (error == 0) {
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
memset(\*[Am]hints, 0, sizeof(hints));
|
||||
hints.ai_socktype = SOCK_DGRAM; /*dummy*/
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
if (getaddrinfo(addr, "0", &hints, &res) == 0) {
|
||||
if (getaddrinfo(addr, "0", \*[Am]hints, \*[Am]res) == 0) {
|
||||
/* malicious PTR record */
|
||||
freeaddrinfo(res);
|
||||
printf("bogus PTR record\en");
|
||||
|
|
Loading…
Reference in New Issue