diff options
author | Hiroki Sato <hrs@FreeBSD.org> | 2015-09-19 23:48:06 +0000 |
---|---|---|
committer | Hiroki Sato <hrs@FreeBSD.org> | 2015-09-19 23:48:06 +0000 |
commit | fb0e28f0e1e24ac10fd33bdd19b87d866e4e06b9 (patch) | |
tree | e3d888dc72796b57c7580334cf296ae31cfd6d4e /usr.sbin/inetd | |
parent | 157d2c335599e203a46867204e03e46115f5261d (diff) | |
download | src-test2-fb0e28f0e1e24ac10fd33bdd19b87d866e4e06b9.tar.gz src-test2-fb0e28f0e1e24ac10fd33bdd19b87d866e4e06b9.zip |
Notes
Diffstat (limited to 'usr.sbin/inetd')
-rw-r--r-- | usr.sbin/inetd/inetd.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 3932a1548760..09690ab837e7 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -327,16 +327,7 @@ main(int argc, char **argv) struct request_info req; int denied; char *service = NULL; - union { - struct sockaddr peer_un; - struct sockaddr_in peer_un4; - struct sockaddr_in6 peer_un6; - struct sockaddr_storage peer_max; - } p_un; -#define peer p_un.peer_un -#define peer4 p_un.peer_un4 -#define peer6 p_un.peer_un6 -#define peermax p_un.peer_max + struct sockaddr_storage peer; int i; struct addrinfo hints, *res; const char *servname; @@ -656,24 +647,24 @@ main(int argc, char **argv) } else ctrl = sep->se_fd; if (dolog && !ISWRAP(sep)) { - char pname[INET6_ADDRSTRLEN] = "unknown"; + char pname[NI_MAXHOST] = "unknown"; socklen_t sl; - sl = sizeof peermax; + sl = sizeof(peer); if (getpeername(ctrl, (struct sockaddr *) - &peermax, &sl)) { - sl = sizeof peermax; + &peer, &sl)) { + sl = sizeof(peer); if (recvfrom(ctrl, buf, sizeof(buf), MSG_PEEK, - (struct sockaddr *)&peermax, + (struct sockaddr *)&peer, &sl) >= 0) { - getnameinfo((struct sockaddr *)&peermax, - peer.sa_len, + getnameinfo((struct sockaddr *)&peer, + peer.ss_len, pname, sizeof(pname), NULL, 0, NI_NUMERICHOST); } } else { - getnameinfo((struct sockaddr *)&peermax, - peer.sa_len, + getnameinfo((struct sockaddr *)&peer, + peer.ss_len, pname, sizeof(pname), NULL, 0, NI_NUMERICHOST); } @@ -2098,7 +2089,7 @@ inetd_setproctitle(const char *a, int s) { socklen_t size; struct sockaddr_storage ss; - char buf[80], pbuf[INET6_ADDRSTRLEN]; + char buf[80], pbuf[NI_MAXHOST]; size = sizeof(ss); if (getpeername(s, (struct sockaddr *)&ss, &size) == 0) { @@ -2114,7 +2105,7 @@ int check_loop(const struct sockaddr *sa, const struct servtab *sep) { struct servtab *se2; - char pname[INET6_ADDRSTRLEN]; + char pname[NI_MAXHOST]; for (se2 = servtab; se2; se2 = se2->se_next) { if (!se2->se_bi || se2->se_socktype != SOCK_DGRAM) @@ -2328,7 +2319,7 @@ cpmip(const struct servtab *sep, int ctrl) } } if ((cnt * 60) / (CHTSIZE * CHTGRAN) > sep->se_maxcpm) { - char pname[INET6_ADDRSTRLEN]; + char pname[NI_MAXHOST]; getnameinfo((struct sockaddr *)&rss, ((struct sockaddr *)&rss)->sa_len, |