diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-04-27 05:30:24 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-04-27 05:30:24 +0000 |
commit | 7a446f444044423260e4b8a703cf1647f6e4a596 (patch) | |
tree | 15e0587c25d9178375eeb6c69612a9cdc50086b1 /lib/libc/net/getaddrinfo.c | |
parent | 5acdb2c0f37f29e11dce060f6c257ec9b0b86b45 (diff) |
remove unused struct def. more sanity check for NULL.
Diffstat (limited to 'lib/libc/net/getaddrinfo.c')
-rw-r--r-- | lib/libc/net/getaddrinfo.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index f33ef91a041..5ab29a97cc5 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -1,10 +1,10 @@ -/* $OpenBSD: getaddrinfo.c,v 1.21 2000/04/26 16:05:20 itojun Exp $ */ -/* $KAME: getaddrinfo.c,v 1.14 2000/04/26 15:41:49 itojun Exp $ */ +/* $OpenBSD: getaddrinfo.c,v 1.22 2000/04/27 05:30:23 itojun Exp $ */ +/* $KAME: getaddrinfo.c,v 1.16 2000/04/27 03:37:43 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -116,18 +116,11 @@ static const char in_addrany[] = { 0, 0, 0, 0 }; static const char in6_addrany[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static const char in_loopback[] = { 127, 0, 0, 1 }; +static const char in_loopback[] = { 127, 0, 0, 1 }; static const char in6_loopback[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; -struct sockinet { - u_char si_len; - u_char si_family; - u_short si_port; - u_int32_t si_scope_id; -}; - static const struct afd { int a_af; int a_addrlen; @@ -226,7 +219,7 @@ static int addrconfig __P((const struct addrinfo *)); #endif #ifdef INET6 static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *)); -#endif +#endif static void _sethtent __P((void)); static void _endhtent __P((void)); @@ -612,6 +605,8 @@ explore_null(pai, servname, res) return 0; afd = find_afd(pai->ai_family); + if (afd == NULL) + return 0; if (pai->ai_flags & AI_PASSIVE) { GET_AI(cur->ai_next, afd, afd->a_addrany); @@ -664,6 +659,8 @@ explore_numeric(pai, hostname, servname, res) return 0; afd = find_afd(pai->ai_family); + if (afd == NULL) + return 0; switch (afd->a_af) { #if 0 /*X/Open spec*/ @@ -675,7 +672,7 @@ explore_numeric(pai, hostname, servname, res) GET_PORT(cur->ai_next, servname); while (cur && cur->ai_next) cur = cur->ai_next; - } else + } else ERR(EAI_FAMILY); /*xxx*/ } break; @@ -688,7 +685,7 @@ explore_numeric(pai, hostname, servname, res) GET_PORT(cur->ai_next, servname); while (cur && cur->ai_next) cur = cur->ai_next; - } else + } else ERR(EAI_FAMILY); /*xxx*/ } break; @@ -730,6 +727,9 @@ explore_numeric_scope(pai, hostname, servname, res) return 0; afd = find_afd(pai->ai_family); + if (afd == NULL) + return 0; + if (!afd->a_scoped) return explore_numeric(pai, hostname, servname, res); @@ -976,7 +976,7 @@ ip6_str2scopeid(scope, sin6) else return -1; } -#endif +#endif /* code duplicate with gethnamaddr.c */ |