Repository: qpid-dispatch Updated Branches: refs/heads/master c3c557a91 -> eefc9fa72
DISPATCH-443 - Limit the name-lookup on incoing connection to numeric host/service only. There's no reason to risk a long delay to get symbolic or reverse-DNS names. Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/eefc9fa7 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/eefc9fa7 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/eefc9fa7 Branch: refs/heads/master Commit: eefc9fa72ec7326f80b3eac0e28b12f115a0b7f6 Parents: c3c557a Author: Ted Ross <tr...@redhat.com> Authored: Wed Jul 6 16:41:27 2016 -0400 Committer: Ted Ross <tr...@redhat.com> Committed: Thu Jul 7 13:07:45 2016 -0400 ---------------------------------------------------------------------- src/posix/driver.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/eefc9fa7/src/posix/driver.c ---------------------------------------------------------------------- diff --git a/src/posix/driver.c b/src/posix/driver.c index b7a4958..2c068b3 100644 --- a/src/posix/driver.c +++ b/src/posix/driver.c @@ -388,7 +388,6 @@ qdpn_connector_t *qdpn_listener_accept(qdpn_listener_t *l, { if (!l || !l->pending) return NULL; char name[PN_NAME_MAX]; - char host[MAX_HOST]; char serv[MAX_SERV]; char hostip[MAX_HOST]; @@ -401,15 +400,14 @@ qdpn_connector_t *qdpn_listener_accept(qdpn_listener_t *l, qdpn_log_errno(l->driver, "accept"); return 0; } else { - int code; - if ((code = getnameinfo((struct sockaddr *) &addr, addrlen, host, MAX_HOST, serv, MAX_SERV, 0)) || - (code = getnameinfo((struct sockaddr *) &addr, addrlen, hostip, MAX_HOST, 0, 0, NI_NUMERICHOST))) { + int code = getnameinfo((struct sockaddr *) &addr, addrlen, hostip, MAX_HOST, serv, MAX_SERV, NI_NUMERICHOST | NI_NUMERICSERV); + if (code != 0) { qd_log(l->driver->log, QD_LOG_ERROR, "getnameinfo: %s\n", gai_strerror(code)); close(sock); return 0; } else { qdpn_configure_sock(l->driver, sock, true); - snprintf(name, PN_NAME_MAX-1, "%s:%s", host, serv); + snprintf(name, PN_NAME_MAX-1, "%s:%s", hostip, serv); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org