diff options
Diffstat (limited to 'src/lib/libc/net/getnameinfo.3')
-rw-r--r-- | src/lib/libc/net/getnameinfo.3 | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/libc/net/getnameinfo.3 b/src/lib/libc/net/getnameinfo.3 index ccb46faece..b83b9d5079 100644 --- a/src/lib/libc/net/getnameinfo.3 +++ b/src/lib/libc/net/getnameinfo.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: getnameinfo.3,v 1.34 2004/12/21 01:01:47 itojun Exp $ | 1 | .\" $OpenBSD: getnameinfo.3,v 1.35 2004/12/21 03:40:31 jaredy Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") | 3 | .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") |
4 | .\" Copyright (C) 2000, 2001 Internet Software Consortium. | 4 | .\" Copyright (C) 2000, 2001 Internet Software Consortium. |
@@ -26,7 +26,8 @@ | |||
26 | .Fd #include <sys/socket.h> | 26 | .Fd #include <sys/socket.h> |
27 | .Fd #include <netdb.h> | 27 | .Fd #include <netdb.h> |
28 | .Ft int | 28 | .Ft int |
29 | .Fn getnameinfo "const struct sockaddr *sa" "socklen_t salen" "char *host" "size_t hostlen" "char *serv" "size_t servlen" "int flags" | 29 | .Fn getnameinfo "const struct sockaddr *sa" "socklen_t salen" "char *host" \ |
30 | "size_t hostlen" "char *serv" "size_t servlen" "int flags" | ||
30 | .Sh DESCRIPTION | 31 | .Sh DESCRIPTION |
31 | The | 32 | The |
32 | .Fn getnameinfo | 33 | .Fn getnameinfo |
@@ -68,7 +69,7 @@ The maximum value for | |||
68 | is | 69 | is |
69 | .Dv NI_MAXHOST | 70 | .Dv NI_MAXHOST |
70 | and | 71 | and |
71 | the maximum value for | 72 | the maximum value for |
72 | .Fa servlen | 73 | .Fa servlen |
73 | is | 74 | is |
74 | .Dv NI_MAXSERV , | 75 | .Dv NI_MAXSERV , |
@@ -95,7 +96,7 @@ instead of a host name. | |||
95 | A name is required. | 96 | A name is required. |
96 | If the host name cannot be found in DNS and this flag is set, | 97 | If the host name cannot be found in DNS and this flag is set, |
97 | a non-zero error code is returned. | 98 | a non-zero error code is returned. |
98 | If the host name is not found and the flag is not set, the | 99 | If the host name is not found and the flag is not set, the |
99 | address is returned in numeric form. | 100 | address is returned in numeric form. |
100 | .It NI_NUMERICSERV | 101 | .It NI_NUMERICSERV |
101 | The service name is returned as a digit string representing the port number. | 102 | The service name is returned as a digit string representing the port number. |
@@ -107,7 +108,7 @@ to be called with a second argument of | |||
107 | .Dq udp | 108 | .Dq udp |
108 | instead of its default of | 109 | instead of its default of |
109 | .Dq tcp . | 110 | .Dq tcp . |
110 | This is required for the few ports (512-514) that have different services | 111 | This is required for the few ports (512\-514) that have different services |
111 | for | 112 | for |
112 | .Tn UDP | 113 | .Tn UDP |
113 | and | 114 | and |
@@ -222,8 +223,9 @@ when it is actually | |||
222 | .Pp | 223 | .Pp |
223 | To prevent such attacks, the use of | 224 | To prevent such attacks, the use of |
224 | .Dv NI_NAMEREQD | 225 | .Dv NI_NAMEREQD |
225 | is recommended when you use the result of | 226 | is recommended when the result of |
226 | .Fn getnameinfo | 227 | .Fn getnameinfo |
228 | is used | ||
227 | for access control purposes: | 229 | for access control purposes: |
228 | .Bd -literal -offset indent | 230 | .Bd -literal -offset indent |
229 | struct sockaddr *sa; | 231 | struct sockaddr *sa; |
@@ -241,7 +243,7 @@ if (error == 0) { | |||
241 | if (getaddrinfo(addr, "0", &hints, &res) == 0) { | 243 | if (getaddrinfo(addr, "0", &hints, &res) == 0) { |
242 | /* malicious PTR record */ | 244 | /* malicious PTR record */ |
243 | freeaddrinfo(res); | 245 | freeaddrinfo(res); |
244 | printf("bogus PTR record\\n"); | 246 | printf("bogus PTR record\en"); |
245 | return -1; | 247 | return -1; |
246 | } | 248 | } |
247 | /* addr is FQDN as a result of PTR lookup */ | 249 | /* addr is FQDN as a result of PTR lookup */ |