getaddrinfo.c (54b4b13c4aeea1f00acd809286a9d7c9fa1accfa) | getaddrinfo.c (144361386696582c04592f200a4c2e3339c81a25) |
---|---|
1/* $KAME: getaddrinfo.c,v 1.15 2000/07/09 04:37:24 itojun Exp $ */ 2 3/*- 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 7 * All rights reserved. 8 * --- 1939 unchanged lines hidden (view full) --- 1948 error = EAI_AGAIN; 1949 goto free; 1950 case NS_UNAVAIL: 1951 error = EAI_FAIL; 1952 goto free; 1953 case NS_NOTFOUND: 1954 error = EAI_NONAME; 1955 goto free; | 1/* $KAME: getaddrinfo.c,v 1.15 2000/07/09 04:37:24 itojun Exp $ */ 2 3/*- 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 7 * All rights reserved. 8 * --- 1939 unchanged lines hidden (view full) --- 1948 error = EAI_AGAIN; 1949 goto free; 1950 case NS_UNAVAIL: 1951 error = EAI_FAIL; 1952 goto free; 1953 case NS_NOTFOUND: 1954 error = EAI_NONAME; 1955 goto free; |
1956 case NS_ADDRFAMILY: 1957 error = EAI_ADDRFAMILY; 1958 goto free; |
|
1956 case NS_SUCCESS: 1957 error = 0; 1958 for (cur = result; cur; cur = cur->ai_next) { 1959 GET_PORT(cur, servname); 1960 /* canonname should be filled already */ 1961 } 1962 break; 1963 } --- 372 unchanged lines hidden (view full) --- 2336 free(buf); 2337 free(buf2); 2338 return NS_NOTFOUND; 2339 } 2340 2341 if (res_searchN(hostname, &q, res) < 0) { 2342 free(buf); 2343 free(buf2); | 1959 case NS_SUCCESS: 1960 error = 0; 1961 for (cur = result; cur; cur = cur->ai_next) { 1962 GET_PORT(cur, servname); 1963 /* canonname should be filled already */ 1964 } 1965 break; 1966 } --- 372 unchanged lines hidden (view full) --- 2339 free(buf); 2340 free(buf2); 2341 return NS_NOTFOUND; 2342 } 2343 2344 if (res_searchN(hostname, &q, res) < 0) { 2345 free(buf); 2346 free(buf2); |
2344 return NS_NOTFOUND; | 2347 if (res->res_h_errno == NO_DATA) 2348 return (NS_ADDRFAMILY); 2349 return (NS_NOTFOUND); |
2345 } 2346 /* prefer IPv6 */ 2347 if (q.next) { 2348 ai = getanswer(buf2, q2.n, q2.name, q2.qtype, pai, res); 2349 if (ai != NULL) { 2350 cur->ai_next = ai; 2351 while (cur && cur->ai_next) 2352 cur = cur->ai_next; --- 5 unchanged lines hidden (view full) --- 2358 if (ai != NULL) 2359 cur->ai_next = ai; 2360 } 2361 free(buf); 2362 free(buf2); 2363 if (sentinel.ai_next == NULL) 2364 switch (res->res_h_errno) { 2365 case HOST_NOT_FOUND: | 2350 } 2351 /* prefer IPv6 */ 2352 if (q.next) { 2353 ai = getanswer(buf2, q2.n, q2.name, q2.qtype, pai, res); 2354 if (ai != NULL) { 2355 cur->ai_next = ai; 2356 while (cur && cur->ai_next) 2357 cur = cur->ai_next; --- 5 unchanged lines hidden (view full) --- 2363 if (ai != NULL) 2364 cur->ai_next = ai; 2365 } 2366 free(buf); 2367 free(buf2); 2368 if (sentinel.ai_next == NULL) 2369 switch (res->res_h_errno) { 2370 case HOST_NOT_FOUND: |
2371 return (NS_NOTFOUND); |
|
2366 case NO_DATA: | 2372 case NO_DATA: |
2367 return NS_NOTFOUND; | 2373 return (NS_ADDRFAMILY); |
2368 case TRY_AGAIN: | 2374 case TRY_AGAIN: |
2369 return NS_TRYAGAIN; | 2375 return (NS_TRYAGAIN); |
2370 default: | 2376 default: |
2371 return NS_UNAVAIL; | 2377 return (NS_UNAVAIL); |
2372 } 2373 *((struct addrinfo **)rv) = sentinel.ai_next; | 2378 } 2379 *((struct addrinfo **)rv) = sentinel.ai_next; |
2374 return NS_SUCCESS; | 2380 return (NS_SUCCESS); |
2375} 2376 2377static void 2378_sethtent(FILE **hostf) 2379{ 2380 if (!*hostf) 2381 *hostf = fopen(_PATH_HOSTS, "re"); 2382 else --- 653 unchanged lines hidden --- | 2381} 2382 2383static void 2384_sethtent(FILE **hostf) 2385{ 2386 if (!*hostf) 2387 *hostf = fopen(_PATH_HOSTS, "re"); 2388 else --- 653 unchanged lines hidden --- |