r13926@Kushana: nickm | 2007-08-03 00:55:23 -0700

Fix compilation with HAVE_GETADDRINFO unset


svn:r11042
This commit is contained in:
Nick Mathewson 2007-08-03 07:57:31 +00:00
parent 500899cc53
commit 652d4e0248
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,8 @@
Changes in version 0.2.0.5-alpha - 2007-??-?? Changes in version 0.2.0.5-alpha - 2007-??-??
o Major bugfixes (compilation): o Major bugfixes (compilation):
- Try to fix win32 compilation again: Improve checking for ipv6 types. - Try to fix win32 compilation again: Improve checking for ipv6 types.
- Fix compile on platforms without getaddrinfo: bug found by Li-Hui
Zhou.
o Minor featuers (security): o Minor featuers (security):
- Warn about unsafe ControlPort configurations. - Warn about unsafe ControlPort configurations.

View File

@ -1128,11 +1128,11 @@ tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr)
if (ent) { if (ent) {
addr->sa.sin_family = ent->h_addrtype; addr->sa.sin_family = ent->h_addrtype;
if (ent->h_addrtype == AF_INET) { if (ent->h_addrtype == AF_INET) {
memcpy(addr->sa.sin_addr, ent->h_addr, sizeof(struct in_addr)); memcpy(&addr->sa.sin_addr, ent->h_addr, sizeof(struct in_addr));
} else if (ent->h_addrtype == AF_INET6) { } else if (ent->h_addrtype == AF_INET6) {
memcpy(addr->sa.sin6_addr, ent->h_addr, sizeof(struct in6_addr)); memcpy(&addr->sa6.sin6_addr, ent->h_addr, sizeof(struct in6_addr));
} else { } else {
tor_assert(0) /* gethostbyname() returned a bizarre addrtype */ tor_assert(0); /* gethostbyname() returned a bizarre addrtype */
} }
return 0; return 0;
} }