diff options
author | itojun <itojun> | 2000-05-27 08:46:57 +0000 |
---|---|---|
committer | itojun <itojun> | 2000-05-27 08:46:57 +0000 |
commit | f702df62e2ce6b3f4675d92de614a568db9868cc (patch) | |
tree | aae4e5b4cbf49afb150d5a36123934fedca89dfc /net/pchar | |
parent | 7f3088c487c6173a7c02dc21da6fc03f612dc8d3 (diff) | |
download | pkgsrc-f702df62e2ce6b3f4675d92de614a568db9868cc.tar.gz |
correct misuse of getaddrinfo (patch already sent to the original
author).
Diffstat (limited to 'net/pchar')
-rw-r--r-- | net/pchar/files/patch-sum | 3 | ||||
-rw-r--r-- | net/pchar/patches/patch-aa | 59 |
2 files changed, 62 insertions, 0 deletions
diff --git a/net/pchar/files/patch-sum b/net/pchar/files/patch-sum new file mode 100644 index 00000000000..0cbed497736 --- /dev/null +++ b/net/pchar/files/patch-sum @@ -0,0 +1,3 @@ +$NetBSD: patch-sum,v 1.1 2000/05/27 08:46:57 itojun Exp $ + +MD5 (patch-aa) = 0a7f0af5473afac9e15ec106e17301a9 diff --git a/net/pchar/patches/patch-aa b/net/pchar/patches/patch-aa new file mode 100644 index 00000000000..d20fc0e775a --- /dev/null +++ b/net/pchar/patches/patch-aa @@ -0,0 +1,59 @@ +$NetBSD: patch-aa,v 1.3 2000/05/27 08:46:58 itojun Exp $ + +Index: PctestIpv6.cc +=================================================================== +RCS file: /cvsroot/apps/pchar/PctestIpv6.cc,v +retrieving revision 1.1.1.1 +retrieving revision 1.3 +diff -u -r1.1.1.1 -r1.3 +--- PctestIpv6.cc 2000/05/27 08:18:36 1.1.1.1 ++++ PctestIpv6.cc 2000/05/27 08:41:33 1.3 +@@ -210,28 +210,28 @@ + // + char *PctestIpv6::GetName(void *a) + { +- struct addrinfo *host, hints; +- char *h_name; +- int error_num; ++ static char hbuf[NI_MAXHOST]; ++ struct sockaddr_in6 sin6; ++ int niflags; + +- memset(&hints, 0, sizeof(hints)); +- hints.ai_family = PF_INET6; +- getaddrinfo((char *) a, NULL, &hints, &host); ++ memset(&sin6, 0, sizeof(sin6)); ++ sin6.sin6_family = AF_INET6; ++#ifdef HAVE_SOCKADDR_SA_LEN ++ sin6.sin6_len = sizeof(struct sockaddr_in6); ++#endif ++ memcpy(&sin6.sin6_addr, a, sizeof(sin6.sin6_addr)); ++ /* XXX scope */ + +- if (host) { +- +- h_name = host->ai_canonname; +- /* +- * XXX We don't free the addrinfo, since we return the canonname field. +- */ +- +- /* freeaddrinfo(host); */ +- return h_name; +- } +- else { +- return (GetPrintableAddress(a)); +- } +- ++#if 0 ++ niflags = NumericFlag ? NI_NUMERICHOST : 0; ++#else ++ niflags = NI_NUMERICHOST; ++#endif ++ if (getnameinfo((struct sockaddr *)&sin6, sizeof(struct sockaddr_in6), ++ hbuf, sizeof(hbuf), NULL, 0, niflags) == 0) { ++ return hbuf; ++ } else ++ return "(invalid)"; + } + + // |