From ebc230662977241a9fd9c68034de849772d39438 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 4 Sep 2002 16:45:09 +1000 Subject: [PATCH] - stevesk@cvs.openbsd.org 2002/08/29 15:57:25 [monitor.c session.c sshlogin.c sshlogin.h] pass addrlen with sockaddr *; from Hajimu UMEMOTO NOTE: there are also p-specific parts to this patch. ok markus@ --- ChangeLog | 6 +++++- monitor.c | 6 +++--- session.c | 6 +++--- sshlogin.c | 4 ++-- sshlogin.h | 4 ++-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb0016c14..dd497ebce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,10 @@ - stevesk@cvs.openbsd.org 2002/08/27 17:18:40 [ssh_config.5] some warning text for ForwardAgent and ForwardX11; ok markus@ + - stevesk@cvs.openbsd.org 2002/08/29 15:57:25 + [monitor.c session.c sshlogin.c sshlogin.h] + pass addrlen with sockaddr *; from Hajimu UMEMOTO + NOTE: there are also p-specific parts to this patch. ok markus@ 20020820 - OpenBSD CVS Sync @@ -1579,4 +1583,4 @@ - (stevesk) entropy.c: typo in debug message - (djm) ssh-keygen -i needs seeded RNG; report from markus@ -$Id: ChangeLog,v 1.2437 2002/09/04 06:40:37 djm Exp $ +$Id: ChangeLog,v 1.2438 2002/09/04 06:45:09 djm Exp $ diff --git a/monitor.c b/monitor.c index 8e7ccf894..e039f7a28 100644 --- a/monitor.c +++ b/monitor.c @@ -25,7 +25,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: monitor.c,v 1.23 2002/08/02 14:43:15 millert Exp $"); +RCSID("$OpenBSD: monitor.c,v 1.24 2002/08/29 15:57:25 stevesk Exp $"); #include @@ -1002,8 +1002,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)); @@ -1013,7 +1013,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 diff --git a/session.c b/session.c index 0e78aca34..566bd900e 100644 --- a/session.c +++ b/session.c @@ -33,7 +33,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: session.c,v 1.147 2002/08/22 21:45:41 markus Exp $"); +RCSID("$OpenBSD: session.c,v 1.148 2002/08/29 15:57:25 stevesk Exp $"); #include "ssh.h" #include "ssh1.h" @@ -671,8 +671,8 @@ do_pre_login(Session *s) * 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)); @@ -737,7 +737,7 @@ do_login(Session *s, const char *command) record_login(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); #ifdef USE_PAM /* diff --git a/sshlogin.c b/sshlogin.c index e76f94534..4cd1c0059 100644 --- a/sshlogin.c +++ b/sshlogin.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshlogin.c,v 1.4 2002/06/23 03:30:17 deraadt Exp $"); +RCSID("$OpenBSD: sshlogin.c,v 1.5 2002/08/29 15:57:25 stevesk Exp $"); #include "loginrec.h" @@ -65,7 +65,7 @@ get_last_login_time(uid_t uid, const char *logname, */ void record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid, - const char *host, struct sockaddr * addr) + const char *host, struct sockaddr * addr, socklen_t addrlen) { struct logininfo *li; diff --git a/sshlogin.h b/sshlogin.h index bd30278e0..287c0d9f6 100644 --- a/sshlogin.h +++ b/sshlogin.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sshlogin.h,v 1.3 2001/06/26 17:27:25 markus Exp $ */ +/* $OpenBSD: sshlogin.h,v 1.4 2002/08/29 15:57:25 stevesk Exp $ */ /* * Author: Tatu Ylonen @@ -16,7 +16,7 @@ void record_login(pid_t, const char *, const char *, uid_t, - const char *, struct sockaddr *); + const char *, struct sockaddr *, socklen_t); void record_logout(pid_t, const char *, const char *); u_long get_last_login_time(uid_t, const char *, char *, u_int);