summaryrefslogtreecommitdiff
path: root/canohost.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-11-15 15:25:10 +1100
committerDamien Miller <djm@mindrot.org>1999-11-15 15:25:10 +1100
commit2ccf661cbe0924a1549a74b5a4f970e90f94d6a9 (patch)
tree8bb7ea3cbe9d473e7f46b7084f563cc593cc5d47 /canohost.c
parentcedfecc99e73f9661d4dc3cea8c88e57c6e0b487 (diff)
- Merged more OpenBSD CVS changes:
[auth-krb4.c] - disconnect if getpeername() fails - missing xfree(*client) [canohost.c] - disconnect if getpeername() fails - fix comment: we _do_ disconnect if ip-options are set [sshd.c] - disconnect if getpeername() fails - move checking of remote port to central place [auth-rhosts.c] move checking of remote port to central place [log-server.c] avoid extra fd per sshd, from millert@ [readconf.c] print _all_ bad config-options in ssh(1), too [readconf.h] print _all_ bad config-options in ssh(1), too [ssh.c] print _all_ bad config-options in ssh(1), too [sshconnect.c] disconnect if getpeername() fails - OpenBSD's changes to sshd.c broke the PAM stuff, re-merged it.
Diffstat (limited to 'canohost.c')
-rw-r--r--canohost.c17
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"
17RCSID("$Id: canohost.c,v 1.1 1999/10/27 03:42:43 damien Exp $"); 17RCSID("$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. */