- (djm) Bug #460: Filling utmp[x]->ut_addr_v6 if present. Patch from
cjwatson@debian.org
This commit is contained in:
parent
8aff5cbed7
commit
02e16ad95f
|
@ -1,7 +1,9 @@
|
||||||
20030103
|
20030103
|
||||||
- (djm) Bug #461: ssh-copy-id fails with no arguments. Patch from
|
- (djm) Bug #461: ssh-copy-id fails with no arguments. Patch from
|
||||||
cjwatson@debian.org
|
cjwatson@debian.org
|
||||||
|
- (djm) Bug #460: Filling utmp[x]->ut_addr_v6 if present. Patch from
|
||||||
|
cjwatson@debian.org
|
||||||
|
|
||||||
20030101
|
20030101
|
||||||
- (stevesk) [session.c sshlogin.c sshlogin.h] complete portable
|
- (stevesk) [session.c sshlogin.c sshlogin.h] complete portable
|
||||||
parts of pass addrlen with sockaddr * fix.
|
parts of pass addrlen with sockaddr * fix.
|
||||||
|
@ -921,4 +923,4 @@
|
||||||
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
||||||
ok provos@
|
ok provos@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.2538 2003/01/03 03:34:06 djm Exp $
|
$Id: ChangeLog,v 1.2539 2003/01/03 03:42:27 djm Exp $
|
||||||
|
|
34
loginrec.c
34
loginrec.c
|
@ -163,7 +163,7 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "atomicio.h"
|
#include "atomicio.h"
|
||||||
|
|
||||||
RCSID("$Id: loginrec.c,v 1.44 2002/09/26 00:38:49 tim Exp $");
|
RCSID("$Id: loginrec.c,v 1.45 2003/01/03 03:42:28 djm Exp $");
|
||||||
|
|
||||||
#ifdef HAVE_UTIL_H
|
#ifdef HAVE_UTIL_H
|
||||||
# include <util.h>
|
# include <util.h>
|
||||||
|
@ -609,6 +609,9 @@ void
|
||||||
construct_utmp(struct logininfo *li,
|
construct_utmp(struct logininfo *li,
|
||||||
struct utmp *ut)
|
struct utmp *ut)
|
||||||
{
|
{
|
||||||
|
# ifdef HAVE_ADDR_V6_IN_UTMP
|
||||||
|
struct sockaddr_in6 *sa6;
|
||||||
|
# endif
|
||||||
memset(ut, '\0', sizeof(*ut));
|
memset(ut, '\0', sizeof(*ut));
|
||||||
|
|
||||||
/* First fill out fields used for both logins and logouts */
|
/* First fill out fields used for both logins and logouts */
|
||||||
|
@ -661,6 +664,19 @@ construct_utmp(struct logininfo *li,
|
||||||
if (li->hostaddr.sa.sa_family == AF_INET)
|
if (li->hostaddr.sa.sa_family == AF_INET)
|
||||||
ut->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr;
|
ut->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr;
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef HAVE_ADDR_V6_IN_UTMP
|
||||||
|
/* this is just a 128-bit IPv6 address */
|
||||||
|
if (li->hostaddr.sa.sa_family == AF_INET6) {
|
||||||
|
sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa);
|
||||||
|
memcpy(ut->ut_addr_v6, sa6->sin6_addr.s6_addr, 16);
|
||||||
|
if (IN6_IS_ADDR_V4MAPPED(&sa6->sin6_addr)) {
|
||||||
|
ut->ut_addr_v6[0] = ut->ut_addr_v6[3];
|
||||||
|
ut->ut_addr_v6[1] = 0;
|
||||||
|
ut->ut_addr_v6[2] = 0;
|
||||||
|
ut->ut_addr_v6[3] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif /* USE_UTMP || USE_WTMP || USE_LOGIN */
|
#endif /* USE_UTMP || USE_WTMP || USE_LOGIN */
|
||||||
|
|
||||||
|
@ -689,6 +705,9 @@ set_utmpx_time(struct logininfo *li, struct utmpx *utx)
|
||||||
void
|
void
|
||||||
construct_utmpx(struct logininfo *li, struct utmpx *utx)
|
construct_utmpx(struct logininfo *li, struct utmpx *utx)
|
||||||
{
|
{
|
||||||
|
# ifdef HAVE_ADDR_V6_IN_UTMP
|
||||||
|
struct sockaddr_in6 *sa6;
|
||||||
|
# endif
|
||||||
memset(utx, '\0', sizeof(*utx));
|
memset(utx, '\0', sizeof(*utx));
|
||||||
# ifdef HAVE_ID_IN_UTMPX
|
# ifdef HAVE_ID_IN_UTMPX
|
||||||
line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id));
|
line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id));
|
||||||
|
@ -725,6 +744,19 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx)
|
||||||
if (li->hostaddr.sa.sa_family == AF_INET)
|
if (li->hostaddr.sa.sa_family == AF_INET)
|
||||||
utx->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr;
|
utx->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr;
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef HAVE_ADDR_V6_IN_UTMP
|
||||||
|
/* this is just a 128-bit IPv6 address */
|
||||||
|
if (li->hostaddr.sa.sa_family == AF_INET6) {
|
||||||
|
sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa);
|
||||||
|
memcpy(ut->ut_addr_v6, sa6->sin6_addr.s6_addr, 16);
|
||||||
|
if (IN6_IS_ADDR_V4MAPPED(&sa6->sin6_addr)) {
|
||||||
|
ut->ut_addr_v6[0] = ut->ut_addr_v6[3];
|
||||||
|
ut->ut_addr_v6[1] = 0;
|
||||||
|
ut->ut_addr_v6[2] = 0;
|
||||||
|
ut->ut_addr_v6[3] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
# ifdef HAVE_SYSLEN_IN_UTMPX
|
# ifdef HAVE_SYSLEN_IN_UTMPX
|
||||||
/* ut_syslen is the length of the utx_host string */
|
/* ut_syslen is the length of the utx_host string */
|
||||||
utx->ut_syslen = MIN(strlen(li->hostname), sizeof(utx->ut_host));
|
utx->ut_syslen = MIN(strlen(li->hostname), sizeof(utx->ut_host));
|
||||||
|
|
Loading…
Reference in New Issue