diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | canohost.c | 13 | ||||
-rw-r--r-- | canohost.h | 4 | ||||
-rw-r--r-- | session.c | 19 |
4 files changed, 24 insertions, 17 deletions
@@ -23,6 +23,9 @@ | |||
23 | - markus@cvs.openbsd.org 2001/04/05 15:45:43 | 23 | - markus@cvs.openbsd.org 2001/04/05 15:45:43 |
24 | [ssh.1] | 24 | [ssh.1] |
25 | ssh defaults to protocol v2; from quisar@quisar.ambre.net | 25 | ssh defaults to protocol v2; from quisar@quisar.ambre.net |
26 | - stevesk@cvs.openbsd.org 2001/04/05 15:48:18 | ||
27 | [canohost.c canohost.h session.c] | ||
28 | move get_remote_name_or_ip() to canohost.[ch]; for portable. ok markus@ | ||
26 | 29 | ||
27 | 20010405 | 30 | 20010405 |
28 | - OpenBSD CVS Sync | 31 | - OpenBSD CVS Sync |
@@ -4895,4 +4898,4 @@ | |||
4895 | - Wrote replacements for strlcpy and mkdtemp | 4898 | - Wrote replacements for strlcpy and mkdtemp |
4896 | - Released 1.0pre1 | 4899 | - Released 1.0pre1 |
4897 | 4900 | ||
4898 | $Id: ChangeLog,v 1.1069 2001/04/05 23:29:59 mouring Exp $ | 4901 | $Id: ChangeLog,v 1.1070 2001/04/05 23:32:17 mouring Exp $ |
diff --git a/canohost.c b/canohost.c index 52921f5b0..927508f58 100644 --- a/canohost.c +++ b/canohost.c | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: canohost.c,v 1.23 2001/02/10 01:33:32 markus Exp $"); | 15 | RCSID("$OpenBSD: canohost.c,v 1.24 2001/04/05 15:48:19 stevesk Exp $"); |
16 | 16 | ||
17 | #include "packet.h" | 17 | #include "packet.h" |
18 | #include "xmalloc.h" | 18 | #include "xmalloc.h" |
@@ -251,6 +251,17 @@ get_remote_ipaddr() | |||
251 | return canonical_host_ip; | 251 | return canonical_host_ip; |
252 | } | 252 | } |
253 | 253 | ||
254 | const char * | ||
255 | get_remote_name_or_ip(u_int utmp_len, int reverse_mapping_check) | ||
256 | { | ||
257 | static const char *remote = ""; | ||
258 | if (utmp_len > 0) | ||
259 | remote = get_canonical_hostname(reverse_mapping_check); | ||
260 | if (utmp_len == 0 || strlen(remote) > utmp_len) | ||
261 | remote = get_remote_ipaddr(); | ||
262 | return remote; | ||
263 | } | ||
264 | |||
254 | /* Returns the local/remote port for the socket. */ | 265 | /* Returns the local/remote port for the socket. */ |
255 | 266 | ||
256 | int | 267 | int |
diff --git a/canohost.h b/canohost.h index da60b3af9..89bd5c3b4 100644 --- a/canohost.h +++ b/canohost.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: canohost.h,v 1.4 2001/02/03 10:08:37 markus Exp $ */ | 1 | /* $OpenBSD: canohost.h,v 1.5 2001/04/05 15:48:19 stevesk Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -25,6 +25,8 @@ const char *get_canonical_hostname(int reverse_mapping_check); | |||
25 | */ | 25 | */ |
26 | const char *get_remote_ipaddr(void); | 26 | const char *get_remote_ipaddr(void); |
27 | 27 | ||
28 | const char *get_remote_name_or_ip(u_int utmp_len, int reverse_mapping_check); | ||
29 | |||
28 | /* Returns the ipaddr/port number of the peer of the socket. */ | 30 | /* Returns the ipaddr/port number of the peer of the socket. */ |
29 | char * get_peer_ipaddr(int socket); | 31 | char * get_peer_ipaddr(int socket); |
30 | int get_peer_port(int sock); | 32 | int get_peer_port(int sock); |
@@ -33,7 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include "includes.h" | 35 | #include "includes.h" |
36 | RCSID("$OpenBSD: session.c,v 1.69 2001/03/25 13:16:11 stevesk Exp $"); | 36 | RCSID("$OpenBSD: session.c,v 1.70 2001/04/05 15:48:18 stevesk Exp $"); |
37 | 37 | ||
38 | #include "ssh.h" | 38 | #include "ssh.h" |
39 | #include "ssh1.h" | 39 | #include "ssh1.h" |
@@ -677,17 +677,6 @@ do_exec_pty(Session *s, const char *command) | |||
677 | } | 677 | } |
678 | } | 678 | } |
679 | 679 | ||
680 | const char * | ||
681 | get_remote_name_or_ip(void) | ||
682 | { | ||
683 | static const char *remote = ""; | ||
684 | if (utmp_len > 0) | ||
685 | remote = get_canonical_hostname(options.reverse_mapping_check); | ||
686 | if (utmp_len == 0 || strlen(remote) > utmp_len) | ||
687 | remote = get_remote_ipaddr(); | ||
688 | return remote; | ||
689 | } | ||
690 | |||
691 | /* administrative, login(1)-like work */ | 680 | /* administrative, login(1)-like work */ |
692 | void | 681 | void |
693 | do_login(Session *s, const char *command) | 682 | do_login(Session *s, const char *command) |
@@ -726,7 +715,8 @@ do_login(Session *s, const char *command) | |||
726 | 715 | ||
727 | /* Record that there was a login on that tty from the remote host. */ | 716 | /* Record that there was a login on that tty from the remote host. */ |
728 | record_login(pid, s->tty, pw->pw_name, pw->pw_uid, | 717 | record_login(pid, s->tty, pw->pw_name, pw->pw_uid, |
729 | get_remote_name_or_ip(), (struct sockaddr *)&from); | 718 | get_remote_name_or_ip(utmp_len, options.reverse_mapping_check), |
719 | (struct sockaddr *)&from); | ||
730 | 720 | ||
731 | #ifdef USE_PAM | 721 | #ifdef USE_PAM |
732 | /* | 722 | /* |
@@ -1308,7 +1298,8 @@ do_child(Session *s, const char *command) | |||
1308 | } | 1298 | } |
1309 | /* we have to stash the hostname before we close our socket. */ | 1299 | /* we have to stash the hostname before we close our socket. */ |
1310 | if (options.use_login) | 1300 | if (options.use_login) |
1311 | hostname = get_remote_name_or_ip(); | 1301 | hostname = get_remote_name_or_ip(utmp_len, |
1302 | options.reverse_mapping_check); | ||
1312 | /* | 1303 | /* |
1313 | * Close the connection descriptors; note that this is the child, and | 1304 | * Close the connection descriptors; note that this is the child, and |
1314 | * the server will still have the socket open, and it is important | 1305 | * the server will still have the socket open, and it is important |