summaryrefslogtreecommitdiff
path: root/libexec/ftpd/logwtmp.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2004-11-11 01:14:10 +0000
committerchristos <christos@NetBSD.org>2004-11-11 01:14:10 +0000
commit3b40bfaefe2be81e2af159144fb6ee094fe93804 (patch)
treed86c3616ea34cfda0fd0220ca483426316dcf751 /libexec/ftpd/logwtmp.c
parent4050e4b376af1cd8fb246be7bcb995494ce3f800 (diff)
Don't write trash in ut_ss; either initialize it to 0, or put in the proper
information.
Diffstat (limited to 'libexec/ftpd/logwtmp.c')
-rw-r--r--libexec/ftpd/logwtmp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libexec/ftpd/logwtmp.c b/libexec/ftpd/logwtmp.c
index 5b9818e4c3c..a20c42093b9 100644
--- a/libexec/ftpd/logwtmp.c
+++ b/libexec/ftpd/logwtmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: logwtmp.c,v 1.22 2004/08/09 12:56:48 lukem Exp $ */
+/* $NetBSD: logwtmp.c,v 1.23 2004/11/11 01:14:10 christos Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: logwtmp.c,v 1.22 2004/08/09 12:56:48 lukem Exp $");
+__RCSID("$NetBSD: logwtmp.c,v 1.23 2004/11/11 01:14:10 christos Exp $");
#endif
#endif /* not lint */
@@ -95,7 +95,8 @@ ftpd_logwtmp(const char *line, const char *name, const char *host)
#ifdef SUPPORT_UTMPX
void
-ftpd_logwtmpx(const char *line, const char *name, const char *host, int status, int utx_type)
+ftpd_logwtmpx(const char *line, const char *name, const char *host,
+ struct sockinet *haddr, int status, int utx_type)
{
struct utmpx ut;
struct stat buf;
@@ -106,6 +107,10 @@ ftpd_logwtmpx(const char *line, const char *name, const char *host, int status,
(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
(void)strncpy(ut.ut_name, name, sizeof(ut.ut_name));
(void)strncpy(ut.ut_host, host, sizeof(ut.ut_host));
+ if (haddr)
+ (void)memcpy(&ut.ut_ss, &haddr->si_su, haddr->su_len);
+ else
+ (void)memset(&ut.ut_ss, 0, sizeof(ut.ut_ss));
ut.ut_type = utx_type;
if (WIFEXITED(status))
ut.ut_exit.e_exit = (uint16_t)WEXITSTATUS(status);