diff options
Diffstat (limited to 'canohost.c')
-rw-r--r-- | canohost.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/canohost.c b/canohost.c index 85d97292b..08f798758 100644 --- a/canohost.c +++ b/canohost.c | |||
@@ -14,7 +14,7 @@ Functions for returning the canonical host name of the remote site. | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$Id: canohost.c,v 1.1 1999/10/27 03:42:43 damien Exp $"); | 17 | RCSID("$Id: canohost.c,v 1.2 1999/11/15 04:25:10 damien Exp $"); |
18 | 18 | ||
19 | #include "packet.h" | 19 | #include "packet.h" |
20 | #include "xmalloc.h" | 20 | #include "xmalloc.h" |
@@ -35,9 +35,8 @@ char *get_remote_hostname(int socket) | |||
35 | memset(&from, 0, sizeof(from)); | 35 | memset(&from, 0, sizeof(from)); |
36 | if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0) | 36 | if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0) |
37 | { | 37 | { |
38 | error("getpeername failed: %.100s", strerror(errno)); | 38 | debug("getpeername failed: %.100s", strerror(errno)); |
39 | strlcpy(name, "UNKNOWN", sizeof name); | 39 | fatal_cleanup(); |
40 | goto check_ip_options; | ||
41 | } | 40 | } |
42 | 41 | ||
43 | /* Map the IP address to a host name. */ | 42 | /* Map the IP address to a host name. */ |
@@ -99,7 +98,7 @@ char *get_remote_hostname(int socket) | |||
99 | 98 | ||
100 | check_ip_options: | 99 | check_ip_options: |
101 | 100 | ||
102 | /* If IP options are supported, make sure there are none (log and clear | 101 | /* If IP options are supported, make sure there are none (log and disconnect |
103 | them if any are found). Basically we are worried about source routing; | 102 | them if any are found). Basically we are worried about source routing; |
104 | it can be used to pretend you are somebody (ip-address) you are not. | 103 | it can be used to pretend you are somebody (ip-address) you are not. |
105 | That itself may be "almost acceptable" under certain circumstances, | 104 | That itself may be "almost acceptable" under certain circumstances, |
@@ -184,8 +183,8 @@ const char *get_remote_ipaddr() | |||
184 | memset(&from, 0, sizeof(from)); | 183 | memset(&from, 0, sizeof(from)); |
185 | if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0) | 184 | if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0) |
186 | { | 185 | { |
187 | error("getpeername failed: %.100s", strerror(errno)); | 186 | debug("getpeername failed: %.100s", strerror(errno)); |
188 | return NULL; | 187 | fatal_cleanup(); |
189 | } | 188 | } |
190 | 189 | ||
191 | /* Get the IP address in ascii. */ | 190 | /* Get the IP address in ascii. */ |
@@ -207,8 +206,8 @@ int get_peer_port(int sock) | |||
207 | memset(&from, 0, sizeof(from)); | 206 | memset(&from, 0, sizeof(from)); |
208 | if (getpeername(sock, (struct sockaddr *)&from, &fromlen) < 0) | 207 | if (getpeername(sock, (struct sockaddr *)&from, &fromlen) < 0) |
209 | { | 208 | { |
210 | error("getpeername failed: %.100s", strerror(errno)); | 209 | debug("getpeername failed: %.100s", strerror(errno)); |
211 | return 0; | 210 | fatal_cleanup(); |
212 | } | 211 | } |
213 | 212 | ||
214 | /* Return port number. */ | 213 | /* Return port number. */ |