summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--loginrec.c34
2 files changed, 37 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c85c7993..91b4c10bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,9 @@
120030103 120030103
2 - (djm) Bug #461: ssh-copy-id fails with no arguments. Patch from 2 - (djm) Bug #461: ssh-copy-id fails with no arguments. Patch from
3 cjwatson@debian.org 3 cjwatson@debian.org
4 4 - (djm) Bug #460: Filling utmp[x]->ut_addr_v6 if present. Patch from
5 cjwatson@debian.org
6
520030101 720030101
6 - (stevesk) [session.c sshlogin.c sshlogin.h] complete portable 8 - (stevesk) [session.c sshlogin.c sshlogin.h] complete portable
7 parts of pass addrlen with sockaddr * fix. 9 parts of pass addrlen with sockaddr * fix.
@@ -921,4 +923,4 @@
921 save auth method before monitor_reset_key_state(); bugzilla bug #284; 923 save auth method before monitor_reset_key_state(); bugzilla bug #284;
922 ok provos@ 924 ok provos@
923 925
924$Id: ChangeLog,v 1.2538 2003/01/03 03:34:06 djm Exp $ 926$Id: ChangeLog,v 1.2539 2003/01/03 03:42:27 djm Exp $
diff --git a/loginrec.c b/loginrec.c
index 02c3106a3..a0d14dbdf 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -163,7 +163,7 @@
163#include "log.h" 163#include "log.h"
164#include "atomicio.h" 164#include "atomicio.h"
165 165
166RCSID("$Id: loginrec.c,v 1.44 2002/09/26 00:38:49 tim Exp $"); 166RCSID("$Id: loginrec.c,v 1.45 2003/01/03 03:42:28 djm Exp $");
167 167
168#ifdef HAVE_UTIL_H 168#ifdef HAVE_UTIL_H
169# include <util.h> 169# include <util.h>
@@ -609,6 +609,9 @@ void
609construct_utmp(struct logininfo *li, 609construct_utmp(struct logininfo *li,
610 struct utmp *ut) 610 struct utmp *ut)
611{ 611{
612# ifdef HAVE_ADDR_V6_IN_UTMP
613 struct sockaddr_in6 *sa6;
614# endif
612 memset(ut, '\0', sizeof(*ut)); 615 memset(ut, '\0', sizeof(*ut));
613 616
614 /* First fill out fields used for both logins and logouts */ 617 /* First fill out fields used for both logins and logouts */
@@ -661,6 +664,19 @@ construct_utmp(struct logininfo *li,
661 if (li->hostaddr.sa.sa_family == AF_INET) 664 if (li->hostaddr.sa.sa_family == AF_INET)
662 ut->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr; 665 ut->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr;
663# endif 666# endif
667# ifdef HAVE_ADDR_V6_IN_UTMP
668 /* this is just a 128-bit IPv6 address */
669 if (li->hostaddr.sa.sa_family == AF_INET6) {
670 sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa);
671 memcpy(ut->ut_addr_v6, sa6->sin6_addr.s6_addr, 16);
672 if (IN6_IS_ADDR_V4MAPPED(&sa6->sin6_addr)) {
673 ut->ut_addr_v6[0] = ut->ut_addr_v6[3];
674 ut->ut_addr_v6[1] = 0;
675 ut->ut_addr_v6[2] = 0;
676 ut->ut_addr_v6[3] = 0;
677 }
678 }
679# endif
664} 680}
665#endif /* USE_UTMP || USE_WTMP || USE_LOGIN */ 681#endif /* USE_UTMP || USE_WTMP || USE_LOGIN */
666 682
@@ -689,6 +705,9 @@ set_utmpx_time(struct logininfo *li, struct utmpx *utx)
689void 705void
690construct_utmpx(struct logininfo *li, struct utmpx *utx) 706construct_utmpx(struct logininfo *li, struct utmpx *utx)
691{ 707{
708# ifdef HAVE_ADDR_V6_IN_UTMP
709 struct sockaddr_in6 *sa6;
710# endif
692 memset(utx, '\0', sizeof(*utx)); 711 memset(utx, '\0', sizeof(*utx));
693# ifdef HAVE_ID_IN_UTMPX 712# ifdef HAVE_ID_IN_UTMPX
694 line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id)); 713 line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id));
@@ -725,6 +744,19 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx)
725 if (li->hostaddr.sa.sa_family == AF_INET) 744 if (li->hostaddr.sa.sa_family == AF_INET)
726 utx->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr; 745 utx->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr;
727# endif 746# endif
747# ifdef HAVE_ADDR_V6_IN_UTMP
748 /* this is just a 128-bit IPv6 address */
749 if (li->hostaddr.sa.sa_family == AF_INET6) {
750 sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa);
751 memcpy(ut->ut_addr_v6, sa6->sin6_addr.s6_addr, 16);
752 if (IN6_IS_ADDR_V4MAPPED(&sa6->sin6_addr)) {
753 ut->ut_addr_v6[0] = ut->ut_addr_v6[3];
754 ut->ut_addr_v6[1] = 0;
755 ut->ut_addr_v6[2] = 0;
756 ut->ut_addr_v6[3] = 0;
757 }
758 }
759# endif
728# ifdef HAVE_SYSLEN_IN_UTMPX 760# ifdef HAVE_SYSLEN_IN_UTMPX
729 /* ut_syslen is the length of the utx_host string */ 761 /* ut_syslen is the length of the utx_host string */
730 utx->ut_syslen = MIN(strlen(li->hostname), sizeof(utx->ut_host)); 762 utx->ut_syslen = MIN(strlen(li->hostname), sizeof(utx->ut_host));