summaryrefslogtreecommitdiff
path: root/canohost.c
diff options
context:
space:
mode:
Diffstat (limited to 'canohost.c')
-rw-r--r--canohost.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/canohost.c b/canohost.c
index 6ca60e6b4..2345cc35c 100644
--- a/canohost.c
+++ b/canohost.c
@@ -1,3 +1,4 @@
1/* $OpenBSD: canohost.c,v 1.61 2006/08/03 03:34:41 deraadt Exp $ */
1/* 2/*
2 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -12,10 +13,23 @@
12 */ 13 */
13 14
14#include "includes.h" 15#include "includes.h"
15RCSID("$OpenBSD: canohost.c,v 1.48 2005/12/28 22:46:06 stevesk Exp $");
16 16
17#include "packet.h" 17#include <sys/types.h>
18#include <sys/socket.h>
19
20#include <netinet/in.h>
21#include <arpa/inet.h>
22
23#include <ctype.h>
24#include <errno.h>
25#include <netdb.h>
26#include <stdio.h>
27#include <stdlib.h>
28#include <string.h>
29#include <stdarg.h>
30
18#include "xmalloc.h" 31#include "xmalloc.h"
32#include "packet.h"
19#include "log.h" 33#include "log.h"
20#include "canohost.h" 34#include "canohost.h"
21 35
@@ -43,6 +57,9 @@ get_remote_hostname(int sock, int use_dns)
43 cleanup_exit(255); 57 cleanup_exit(255);
44 } 58 }
45 59
60 if (from.ss_family == AF_INET)
61 check_ip_options(sock, ntop);
62
46 ipv64_normalise_mapped(&from, &fromlen); 63 ipv64_normalise_mapped(&from, &fromlen);
47 64
48 if (from.ss_family == AF_INET6) 65 if (from.ss_family == AF_INET6)
@@ -52,9 +69,6 @@ get_remote_hostname(int sock, int use_dns)
52 NULL, 0, NI_NUMERICHOST) != 0) 69 NULL, 0, NI_NUMERICHOST) != 0)
53 fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed"); 70 fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed");
54 71
55 if (from.ss_family == AF_INET)
56 check_ip_options(sock, ntop);
57
58 if (!use_dns) 72 if (!use_dns)
59 return xstrdup(ntop); 73 return xstrdup(ntop);
60 74
@@ -87,7 +101,7 @@ get_remote_hostname(int sock, int use_dns)
87 */ 101 */
88 for (i = 0; name[i]; i++) 102 for (i = 0; name[i]; i++)
89 if (isupper(name[i])) 103 if (isupper(name[i]))
90 name[i] = tolower(name[i]); 104 name[i] = (char)tolower(name[i]);
91 /* 105 /*
92 * Map it back to an IP address and check that the given 106 * Map it back to an IP address and check that the given
93 * address actually is an address of this host. This is 107 * address actually is an address of this host. This is
@@ -102,7 +116,7 @@ get_remote_hostname(int sock, int use_dns)
102 hints.ai_socktype = SOCK_STREAM; 116 hints.ai_socktype = SOCK_STREAM;
103 if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { 117 if (getaddrinfo(name, NULL, &hints, &aitop) != 0) {
104 logit("reverse mapping checking getaddrinfo for %.700s " 118 logit("reverse mapping checking getaddrinfo for %.700s "
105 "failed - POSSIBLE BREAK-IN ATTEMPT!", name); 119 "[%s] failed - POSSIBLE BREAK-IN ATTEMPT!", name, ntop);
106 return xstrdup(ntop); 120 return xstrdup(ntop);
107 } 121 }
108 /* Look for the address from the list of addresses. */ 122 /* Look for the address from the list of addresses. */