summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-04-29 20:01:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:17 -0500
commita99b9d72b2838dfec2b2b0037effc722f0c2a873 (patch)
treec9295b20db0ff3c33eaf47c624c713abec7906cf /source4
parente002300f238dd0937dd9f768e366c006945e8baa (diff)
downloadsamba-a99b9d72b2838dfec2b2b0037effc722f0c2a873.tar.gz
samba-a99b9d72b2838dfec2b2b0037effc722f0c2a873.tar.bz2
samba-a99b9d72b2838dfec2b2b0037effc722f0c2a873.zip
r15329: I'm sick of this patch being in my local tree...
Use inet_ntop to convert IPv6 names to strings. Don't do a reverse lookup. Andrew Bartlett (This used to be commit bf57b213c2c4c835037456deea7d522f2fc905e6)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/socket/socket_ipv6.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c
index 90eb27b811..9b6dcbf985 100644
--- a/source4/lib/socket/socket_ipv6.c
+++ b/source4/lib/socket/socket_ipv6.c
@@ -302,7 +302,8 @@ static struct socket_address *ipv6_tcp_get_peer_addr(struct socket_context *sock
socklen_t len = sizeof(*peer_addr);
struct socket_address *peer;
int ret;
- struct hostent *he;
+ char addr[128];
+ const char *addr_ret;
peer = talloc(mem_ctx, struct socket_address);
if (!peer) {
@@ -326,18 +327,18 @@ static struct socket_address *ipv6_tcp_get_peer_addr(struct socket_context *sock
peer->sockaddrlen = len;
- he = gethostbyaddr((char *)&peer_addr->sin6_addr, len, AF_INET6);
-
- if (!he || !he->h_name) {
+ addr_ret = inet_ntop(AF_INET6, &peer_addr->sin6_addr, addr, sizeof(addr));
+ if (addr_ret == NULL) {
talloc_free(peer);
return NULL;
}
-
- peer->addr = talloc_strdup(mem_ctx, he->h_name);
- if (!peer->addr) {
+
+ peer->addr = talloc_strdup(peer, addr_ret);
+ if (peer->addr == NULL) {
talloc_free(peer);
return NULL;
}
+
peer->port = ntohs(peer_addr->sin6_port);
return peer;