Deleted Added
full compact
canohost.c (126277) canohost.c (128460)
1/*
2 * Author: Tatu Ylonen <ylo@cs.hut.fi>
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved
5 * Functions for returning the canonical host name of the remote site.
6 *
7 * As far as I am concerned, the code I have written for this software
8 * can be used freely for any purpose. Any derived versions of this

--- 30 unchanged lines hidden (view full) ---

39 /* Get IP address of client. */
40 fromlen = sizeof(from);
41 memset(&from, 0, sizeof(from));
42 if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0) {
43 debug("getpeername failed: %.100s", strerror(errno));
44 cleanup_exit(255);
45 }
46
1/*
2 * Author: Tatu Ylonen <ylo@cs.hut.fi>
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved
5 * Functions for returning the canonical host name of the remote site.
6 *
7 * As far as I am concerned, the code I have written for this software
8 * can be used freely for any purpose. Any derived versions of this

--- 30 unchanged lines hidden (view full) ---

39 /* Get IP address of client. */
40 fromlen = sizeof(from);
41 memset(&from, 0, sizeof(from));
42 if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0) {
43 debug("getpeername failed: %.100s", strerror(errno));
44 cleanup_exit(255);
45 }
46
47 if (from.ss_family == AF_INET)
48 check_ip_options(socket, ntop);
49
47 ipv64_normalise_mapped(&from, &fromlen);
48
49 if (from.ss_family == AF_INET6)
50 fromlen = sizeof(struct sockaddr_in6);
51
52 if (getnameinfo((struct sockaddr *)&from, fromlen, ntop, sizeof(ntop),
53 NULL, 0, NI_NUMERICHOST) != 0)
54 fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed");
55
56 if (!use_dns)
57 return xstrdup(ntop);
58
50 ipv64_normalise_mapped(&from, &fromlen);
51
52 if (from.ss_family == AF_INET6)
53 fromlen = sizeof(struct sockaddr_in6);
54
55 if (getnameinfo((struct sockaddr *)&from, fromlen, ntop, sizeof(ntop),
56 NULL, 0, NI_NUMERICHOST) != 0)
57 fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed");
58
59 if (!use_dns)
60 return xstrdup(ntop);
61
59 if (from.ss_family == AF_INET)
60 check_ip_options(socket, ntop);
61
62 debug3("Trying to reverse map address %.100s.", ntop);
63 /* Map the IP address to a host name. */
64 if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name),
65 NULL, 0, NI_NAMEREQD) != 0) {
66 /* Host name not found. Use ip address. */
67 return xstrdup(ntop);
68 }
69

--- 323 unchanged lines hidden ---
62 debug3("Trying to reverse map address %.100s.", ntop);
63 /* Map the IP address to a host name. */
64 if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name),
65 NULL, 0, NI_NAMEREQD) != 0) {
66 /* Host name not found. Use ip address. */
67 return xstrdup(ntop);
68 }
69

--- 323 unchanged lines hidden ---