diff options
author | Damien Miller <djm@mindrot.org> | 2000-01-14 15:45:46 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-01-14 15:45:46 +1100 |
commit | 34132e54cbd221d17d373fc54f4e3f7b85727f7f (patch) | |
tree | 7c73917b1082ff91786f9e02d25b853bedd1d472 /login.c | |
parent | 25e4256ad4f453d8a7c1866243ec1984f859b1de (diff) | |
download | openssh-git-34132e54cbd221d17d373fc54f4e3f7b85727f7f.tar.gz |
- Merged OpenBSD IPv6 patch:
- [sshd.c sshd.8 sshconnect.c ssh.h ssh.c servconf.h servconf.c scp.1]
[scp.c packet.h packet.c login.c log.c canohost.c channels.c]
[hostfile.c sshd_config]
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new
features: sshd allows multiple ListenAddress and Port options. note
that libwrap is not IPv6-ready. (based on patches from
fujiwara@rcac.tdi.co.jp)
- [ssh.c canohost.c]
more hints (hints.ai_socktype=SOCK_STREAM) for getaddrinfo,
from itojun@
- [channels.c]
listen on _all_ interfaces for X11-Fwd (hints.ai_flags = AI_PASSIVE)
- [packet.h]
allow auth-kerberos for IPv4 only
- [scp.1 sshd.8 servconf.h scp.c]
document -4, -6, and 'ssh -L 2022/::1/22'
- [ssh.c]
'ssh @host' is illegal (null user name), from
karsten@gedankenpolizei.de
- [sshconnect.c]
better error message
- [sshd.c]
allow auth-kerberos for IPv4 only
- Big IPv6 merge:
- Cleanup overrun in sockaddr copying on RHL 6.1
- Replacements for getaddrinfo, getnameinfo, etc based on versions
from patch from KIKUCHI Takahiro <kick@kyoto.wide.ad.jp>
- Replacement for missing structures on systems that lack IPv6
- record_login needed to know about AF_INET6 addresses
- Borrowed more code from OpenBSD: rresvport_af and requisites
Diffstat (limited to 'login.c')
-rw-r--r-- | login.c | 42 |
1 files changed, 36 insertions, 6 deletions
@@ -18,7 +18,7 @@ */ #include "includes.h" -RCSID("$Id: login.c,v 1.17 2000/01/02 00:45:33 damien Exp $"); +RCSID("$Id: login.c,v 1.18 2000/01/14 04:45:50 damien Exp $"); #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) # include <utmpx.h> @@ -137,7 +137,7 @@ get_last_login_time(uid_t uid, const char *logname, void record_login(int pid, const char *ttyname, const char *user, uid_t uid, - const char *host, struct sockaddr_in * addr) + const char *host, struct sockaddr * addr) { #if defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) struct lastlog ll; @@ -173,7 +173,22 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid, strncpy(u.ut_host, host, sizeof(u.ut_host)); #endif #if defined(HAVE_ADDR_IN_UTMP) - u.ut_addr = addr->sin_addr.s_addr; + switch (addr->sa_family) { + case AF_INET: { + struct sockaddr_in *in = (struct sockaddr_in*)addr; + memcpy(&(u.ut_addr), &(in->sin_addr), sizeof(&(in->sin_addr))); + break; + } +#if defined(HAVE_ADDR_V6_IN_UTMP) + case AF_INET6: { + struct sockaddr_in6 *in6 = (struct sockaddr_in6*)addr; + memcpy(u.ut_addr_v6, &(in6->sin6_addr), sizeof(&(in6->sin6_addr))); + break; + } +#endif + default: + break; + } #endif #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) @@ -192,9 +207,24 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid, strncpy(utx.ut_host, host, sizeof(utx.ut_host)); # endif /* HAVE_SYSLEN_IN_UTMPX */ # endif -# if defined(HAVE_ADDR_IN_UTMPX) - utx.ut_addr = addr->sin_addr.s_addr; -# endif +#if defined(HAVE_ADDR_IN_UTMPX) + switch (addr->sa_family) { + case AF_INET: { + struct sockaddr_in *in = (struct sockaddr_in*)addr; + memcpy(&(utx.ut_addr), &(in->sin_addr), sizeof(&(in->sin_addr))); + break; + } +#if defined(HAVE_ADDR_V6_IN_UTMPX) + case AF_INET6: { + struct sockaddr_in6 *in6 = (struct sockaddr_in6*)addr; + memcpy(utx.ut_addr_v6, &(in6->sin6_addr), sizeof(&(in6->sin6_addr))); + break; + } +#endif + default: + break; + } +#endif #endif /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */ /*#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) && !defined(HAVE_LOGIN)*/ |