Simplify (and correct) the previous ut_ss filling code.

This commit is contained in:
christos 2005-07-10 19:57:07 +00:00
parent 4479ffee96
commit 40282604c3
2 changed files with 6 additions and 16 deletions

View file

@ -1,8 +1,8 @@
$NetBSD: distinfo,v 1.11 2005/06/23 04:49:26 christos Exp $
$NetBSD: distinfo,v 1.12 2005/07/10 19:57:07 christos Exp $
SHA1 (proftpd-1.2.10.tar.gz) = ea12d139b8b47168cabcd993b137b2360bba1465
RMD160 (proftpd-1.2.10.tar.gz) = c96cadc6bfef0f77f2d44ed901b55474c6f6a464
Size (proftpd-1.2.10.tar.gz) = 1182176 bytes
SHA1 (patch-aa) = 3784f6aed87b327741685d45d453aa2ac98dd98b
SHA1 (patch-ab) = cc760fc91846a0fc595e2e76d5a1ef582915034d
SHA1 (patch-ac) = fc6cb354338338d724d78151c37b256a80842307
SHA1 (patch-ac) = 5c05fb0c21288af6cd718f8792cc829bc348dd47

View file

@ -1,7 +1,7 @@
$NetBSD: patch-ac,v 1.1 2005/06/23 04:49:26 christos Exp $
$NetBSD: patch-ac,v 1.2 2005/07/10 19:57:07 christos Exp $
--- src/log.c.orig 2004-08-07 18:22:42.000000000 -0400
+++ src/log.c 2005-06-23 00:42:29.000000000 -0400
+++ src/log.c 2005-07-10 15:50:13.000000000 -0400
@@ -59,7 +59,8 @@
int res = 0;
static int fd = -1;
@ -23,7 +23,7 @@ $NetBSD: patch-ac,v 1.1 2005/06/23 04:49:26 christos Exp $
if (fdx < 0 &&
(fdx = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0)) < 0) {
pr_log_pri(PR_LOG_WARNING, "wtmpx %s: %s", WTMPX_FILE, strerror(errno));
@@ -89,14 +94,30 @@
@@ -89,14 +94,20 @@
sstrncpy(utx.ut_id, "ftp", sizeof(utx.ut_user));
sstrncpy(utx.ut_line, line, sizeof(utx.ut_line));
sstrncpy(utx.ut_host, host, sizeof(utx.ut_host));
@ -31,17 +31,7 @@ $NetBSD: patch-ac,v 1.1 2005/06/23 04:49:26 christos Exp $
utx.ut_pid = getpid();
-#ifdef __sparcv9
+#if defined(__NetBSD__) && defined(HAVE_UTMPX_H)
+ {
+ /* XXX: may return (size_t) -1 */
+ size_t len = pr_netaddr_get_inaddr_len(ip);
+ if (len > sizeof(utx.ut_ss))
+ len = sizeof(utx.ut_ss);
+# ifndef USE_IPV6
+ memcpy(&utx.ut_ss, pr_netaddr_get_inaddr(ip), len);
+# else
+ memcpy(&utx.ut_ss, pr_netaddr_get_inaddr(ip), len);
+# endif /* !USE_IPV6 */
+ }
+ memcpy(&utx.ut_ss, &ip->na_addr, sizeof(ip->na_addr));
+ gettimeofday(&utx.ut_tv, NULL);
+#else /* SVR4 */
+ utx.ut_syslen = strlen(utx.ut_host)+1;