summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/monitor.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2002-09-09 16:49:11 +0000
committerume <ume@FreeBSD.org>2002-09-09 16:49:11 +0000
commit03b3b7821749b83a01f99c9197e5913e82deef5b (patch)
treebc8f37e43084c3da731c1102b41eddf16bd03714 /crypto/openssh/monitor.c
parentf005a7d8a019151f00fed1e56fd983935498ec67 (diff)
downloadFreeBSD-src-03b3b7821749b83a01f99c9197e5913e82deef5b.zip
FreeBSD-src-03b3b7821749b83a01f99c9197e5913e82deef5b.tar.gz
sshd didn't handle actual size of struct sockaddr correctly,
and did copy it as long as just size of struct sockaddr. So, If connection is via IPv6, sshd didn't log hostname into utmp correctly. This problem occured only under FreeBSD because of our hack. However, this is potential problem of OpenSSH-portable, and they agreed to fix this. Though, there is no fixed version of OpenSSH-portable available yet, since this problem is serious for IPv6 users, I commit the fix. Reported by: many people Reviewed by: current@ and stable@ (no objection) MFC after: 3 days
Diffstat (limited to 'crypto/openssh/monitor.c')
-rw-r--r--crypto/openssh/monitor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/openssh/monitor.c b/crypto/openssh/monitor.c
index e5b7301..1d929c2 100644
--- a/crypto/openssh/monitor.c
+++ b/crypto/openssh/monitor.c
@@ -1113,8 +1113,8 @@ mm_record_login(Session *s, struct passwd *pw)
* the address be 0.0.0.0.
*/
memset(&from, 0, sizeof(from));
+ fromlen = sizeof(from);
if (packet_connection_is_on_socket()) {
- fromlen = sizeof(from);
if (getpeername(packet_get_connection_in(),
(struct sockaddr *) & from, &fromlen) < 0) {
debug("getpeername: %.100s", strerror(errno));
@@ -1124,7 +1124,7 @@ mm_record_login(Session *s, struct passwd *pw)
/* Record that there was a login on that tty from the remote host. */
record_login(s->pid, s->tty, pw->pw_name, pw->pw_uid,
get_remote_name_or_ip(utmp_len, options.verify_reverse_mapping),
- (struct sockaddr *)&from);
+ (struct sockaddr *)&from, fromlen);
}
static void
OpenPOWER on IntegriCloud