Deleted Added
full compact
15a16,17
> *
> * $FreeBSD: head/contrib/tcp_wrappers/socket.c 56977 2000-02-03 10:27:03Z shin $
32a35,40
> #ifdef INET6
> #ifndef USE_GETIPNODEBY
> #include <resolv.h>
> #endif
> #endif
>
76a85,88
> #ifdef INET6
> static struct sockaddr_storage client;
> static struct sockaddr_storage server;
> #else
78a91
> #endif
106a120,122
> #ifdef INET6
> request->client->sin = (struct sockaddr *)&client;
> #else
107a124
> #endif
119a137,139
> #ifdef INET6
> request->server->sin = (struct sockaddr *)&server;
> #else
120a141
> #endif
127a149,170
> #ifdef INET6
> struct sockaddr *sin = host->sin;
> char *ap;
> int alen;
>
> if (!sin)
> return;
> switch (sin->sa_family) {
> case AF_INET:
> ap = (char *)&((struct sockaddr_in *)sin)->sin_addr;
> alen = sizeof(struct in_addr);
> break;
> case AF_INET6:
> ap = (char *)&((struct sockaddr_in6 *)sin)->sin6_addr;
> alen = sizeof(struct in6_addr);
> break;
> default:
> return;
> }
> host->addr[0] = '\0';
> inet_ntop(sin->sa_family, ap, host->addr, sizeof(host->addr));
> #else
131a175
> #endif
138a183,194
> #ifdef INET6
> struct sockaddr *sin = host->sin;
> char addr[128];
> #ifdef USE_GETIPNODEBY
> int h_error;
> #else
> u_long res_options;
> #endif
> struct hostent *hp = NULL;
> char *ap;
> int alen;
> #else
140a197
> #endif
149a207,233
> #ifdef INET6
> if (sin != NULL) {
> switch (sin->sa_family) {
> case AF_INET:
> if (((struct sockaddr_in *)sin)->sin_addr.s_addr == 0) {
> strcpy(host->name, paranoid); /* name is bad, clobber it */
> return;
> }
> ap = (char *) &((struct sockaddr_in *)sin)->sin_addr;
> alen = sizeof(struct in_addr);
> break;
> case AF_INET6:
> ap = (char *) &((struct sockaddr_in6 *)sin)->sin6_addr;
> alen = sizeof(struct in6_addr);
> break;
> defalut:
> strcpy(host->name, paranoid); /* name is bad, clobber it */
> return;
> }
> #ifdef USE_GETIPNODEBY
> hp = getipnodebyaddr(ap, alen, sin->sa_family, &h_error);
> #else
> hp = gethostbyaddr(ap, alen, sin->sa_family);
> #endif
> }
> if (hp) {
> #else
152a237
> #endif
154a240,242
> #if defined(INET6) && defined(USE_GETIPNODEBY)
> freehostent(hp);
> #endif
168a257,283
> #ifdef INET6
> #ifdef USE_GETIPNODEBY
> hp = getipnodebyname(host->name, sin->sa_family,
> AI_V4MAPPED | AI_ADDRCONFIG | AI_ALL, &h_error);
> #else
> if ((_res.options & RES_INIT) == 0) {
> if (res_init() < 0) {
> inet_ntop(sin->sa_family, ap, addr, sizeof(addr));
> tcpd_warn("can't verify hostname: res_init() for %s failed",
> addr);
> strcpy(host->name, paranoid); /* name is bad, clobber it */
> return;
> }
> }
> res_options = _res.options;
> if (sin->sa_family == AF_INET6)
> _res.options |= RES_USE_INET6;
> else
> _res.options &= ~RES_USE_INET6;
> hp = gethostbyname2(host->name,
> (sin->sa_family == AF_INET6 &&
> IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)sin)->sin6_addr)) ?
> AF_INET : sin->sa_family);
> _res.options = res_options;
> #endif
> if (!hp) {
> #else
169a285
> #endif
175a292,300
> #ifdef INET6
> #ifdef USE_GETIPNODEBY
> tcpd_warn("can't verify hostname: getipnodebyname(%s, %s) failed",
> #else
> tcpd_warn("can't verify hostname: gethostbyname2(%s, %s) failed",
> #endif
> host->name,
> (sin->sa_family == AF_INET) ? "AF_INET" : "AF_INET6");
> #else
177a303
> #endif
200a327,334
> #ifdef INET6
> if (memcmp(hp->h_addr_list[i], ap, alen) == 0) {
> #ifdef USE_GETIPNODEBY
> freehostent(hp);
> #endif
> return; /* name is good, keep it */
> }
> #else
204a339
> #endif
212a348,349
> #ifdef INET6
> inet_ntop(sin->sa_family, ap, addr, sizeof(addr));
213a351,353
> addr, STRING_LENGTH, hp->h_name);
> #else
> tcpd_warn("host name/address mismatch: %s != %.*s",
214a355
> #endif
216a358,361
> #if defined(INET6) && defined(USE_GETIPNODEBY)
> if (hp)
> freehostent(hp);
> #endif
225a371,373
> #ifdef INET6
> struct sockaddr_storage sin;
> #else
226a375
> #endif