summaryrefslogtreecommitdiff
path: root/canohost.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-05 12:13:41 +1100
committerDamien Miller <djm@mindrot.org>2002-02-05 12:13:41 +1100
commitc5d8635d6a9425289bd0cbfa83b90a4e42e6a72a (patch)
tree9a431368be8d4ee5e8742c44870b34a3dfd457f7 /canohost.c
parent43cba34b649a2df8c170e17a5655d060830a386e (diff)
- markus@cvs.openbsd.org 2002/01/29 14:32:03
[auth2.c auth.c auth-options.c auth-rhosts.c auth-rh-rsa.c canohost.c servconf.c servconf.h session.c sshd.8 sshd_config] s/ReverseMappingCheck/VerifyReverseMapping/ and avoid confusion; ok stevesk@
Diffstat (limited to 'canohost.c')
-rw-r--r--canohost.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/canohost.c b/canohost.c
index 4f2e576b2..5eb67f676 100644
--- a/canohost.c
+++ b/canohost.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: canohost.c,v 1.29 2001/12/19 07:18:56 deraadt Exp $"); 15RCSID("$OpenBSD: canohost.c,v 1.30 2002/01/29 14:32:03 markus Exp $");
16 16
17#include "packet.h" 17#include "packet.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -27,7 +27,7 @@ static void check_ip_options(int, char *);
27 */ 27 */
28 28
29static char * 29static char *
30get_remote_hostname(int socket, int reverse_mapping_check) 30get_remote_hostname(int socket, int verify_reverse_mapping)
31{ 31{
32 struct sockaddr_storage from; 32 struct sockaddr_storage from;
33 int i; 33 int i;
@@ -90,7 +90,7 @@ get_remote_hostname(int socket, int reverse_mapping_check)
90 if (isupper(name[i])) 90 if (isupper(name[i]))
91 name[i] = tolower(name[i]); 91 name[i] = tolower(name[i]);
92 92
93 if (!reverse_mapping_check) 93 if (!verify_reverse_mapping)
94 return xstrdup(name); 94 return xstrdup(name);
95 /* 95 /*
96 * Map it back to an IP address and check that the given 96 * Map it back to an IP address and check that the given
@@ -174,14 +174,14 @@ check_ip_options(int socket, char *ipaddr)
174 */ 174 */
175 175
176const char * 176const char *
177get_canonical_hostname(int reverse_mapping_check) 177get_canonical_hostname(int verify_reverse_mapping)
178{ 178{
179 static char *canonical_host_name = NULL; 179 static char *canonical_host_name = NULL;
180 static int reverse_mapping_checked = 0; 180 static int verify_reverse_mapping_done = 0;
181 181
182 /* Check if we have previously retrieved name with same option. */ 182 /* Check if we have previously retrieved name with same option. */
183 if (canonical_host_name != NULL) { 183 if (canonical_host_name != NULL) {
184 if (reverse_mapping_checked != reverse_mapping_check) 184 if (verify_reverse_mapping_done != verify_reverse_mapping)
185 xfree(canonical_host_name); 185 xfree(canonical_host_name);
186 else 186 else
187 return canonical_host_name; 187 return canonical_host_name;
@@ -190,11 +190,11 @@ get_canonical_hostname(int reverse_mapping_check)
190 /* Get the real hostname if socket; otherwise return UNKNOWN. */ 190 /* Get the real hostname if socket; otherwise return UNKNOWN. */
191 if (packet_connection_is_on_socket()) 191 if (packet_connection_is_on_socket())
192 canonical_host_name = get_remote_hostname( 192 canonical_host_name = get_remote_hostname(
193 packet_get_connection_in(), reverse_mapping_check); 193 packet_get_connection_in(), verify_reverse_mapping);
194 else 194 else
195 canonical_host_name = xstrdup("UNKNOWN"); 195 canonical_host_name = xstrdup("UNKNOWN");
196 196
197 reverse_mapping_checked = reverse_mapping_check; 197 verify_reverse_mapping_done = verify_reverse_mapping;
198 return canonical_host_name; 198 return canonical_host_name;
199} 199}
200 200
@@ -281,11 +281,11 @@ get_remote_ipaddr(void)
281} 281}
282 282
283const char * 283const char *
284get_remote_name_or_ip(u_int utmp_len, int reverse_mapping_check) 284get_remote_name_or_ip(u_int utmp_len, int verify_reverse_mapping)
285{ 285{
286 static const char *remote = ""; 286 static const char *remote = "";
287 if (utmp_len > 0) 287 if (utmp_len > 0)
288 remote = get_canonical_hostname(reverse_mapping_check); 288 remote = get_canonical_hostname(verify_reverse_mapping);
289 if (utmp_len == 0 || strlen(remote) > utmp_len) 289 if (utmp_len == 0 || strlen(remote) > utmp_len)
290 remote = get_remote_ipaddr(); 290 remote = get_remote_ipaddr();
291 return remote; 291 return remote;