Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ftpd Don't write trash in ut_ss; either initialize i...
details: https://anonhg.NetBSD.org/src/rev/308f0d4e0287
branches: trunk
changeset: 571102:308f0d4e0287
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 11 01:14:10 2004 +0000
description:
Don't write trash in ut_ss; either initialize it to 0, or put in the proper
information.
diffstat:
libexec/ftpd/extern.h | 7 ++++---
libexec/ftpd/ftpd.c | 18 +++++++++++-------
libexec/ftpd/logwtmp.c | 11 ++++++++---
3 files changed, 23 insertions(+), 13 deletions(-)
diffs (131 lines):
diff -r c078f444d338 -r 308f0d4e0287 libexec/ftpd/extern.h
--- a/libexec/ftpd/extern.h Thu Nov 11 01:01:22 2004 +0000
+++ b/libexec/ftpd/extern.h Thu Nov 11 01:14:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.50 2004/08/09 12:56:47 lukem Exp $ */
+/* $NetBSD: extern.h,v 1.51 2004/11/11 01:14:10 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -187,9 +187,10 @@
#ifdef SUPPORT_UTMPX
struct utmpx;
-
+struct sockinet;
void ftpd_loginx(const struct utmpx *);
-void ftpd_logwtmpx(const char *, const char *, const char *, int, int);
+void ftpd_logwtmpx(const char *, const char *, const char *,
+ struct sockinet *, int, int);
#endif
#include <netinet/in.h>
diff -r c078f444d338 -r 308f0d4e0287 libexec/ftpd/ftpd.c
--- a/libexec/ftpd/ftpd.c Thu Nov 11 01:01:22 2004 +0000
+++ b/libexec/ftpd/ftpd.c Thu Nov 11 01:14:10 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ftpd.c,v 1.159 2004/11/05 21:45:36 dsl Exp $ */
+/* $NetBSD: ftpd.c,v 1.160 2004/11/11 01:14:10 christos Exp $ */
/*
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@
#if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: ftpd.c,v 1.159 2004/11/05 21:45:36 dsl Exp $");
+__RCSID("$NetBSD: ftpd.c,v 1.160 2004/11/11 01:14:10 christos Exp $");
#endif
#endif /* not lint */
@@ -236,7 +236,8 @@
static void end_login(void);
static FILE *getdatasock(const char *);
static char *gunique(const char *);
-static void login_utmp(const char *, const char *, const char *);
+static void login_utmp(const char *, const char *, const char *,
+ struct sockinet *);
static void logremotehost(struct sockinet *);
static void lostconn(int);
static void toolong(int);
@@ -1001,7 +1002,8 @@
}
static void
-login_utmp(const char *line, const char *name, const char *host)
+login_utmp(const char *line, const char *name, const char *host,
+ struct sockinet *haddr)
{
#if defined(SUPPORT_UTMPX) || defined(SUPPORT_UTMP)
struct timeval tv;
@@ -1020,10 +1022,11 @@
(void)strncpy(utmpx.ut_name, name, sizeof(utmpx.ut_name));
(void)strncpy(utmpx.ut_line, line, sizeof(utmpx.ut_line));
(void)strncpy(utmpx.ut_host, host, sizeof(utmpx.ut_host));
+ (void)memcpy(&utmpx.ut_ss, &haddr->si_su, haddr->su_len);
ftpd_loginx(&utmpx);
}
if (dowtmp)
- ftpd_logwtmpx(line, name, host, 0, USER_PROCESS);
+ ftpd_logwtmpx(line, name, host, haddr, 0, USER_PROCESS);
#endif
#ifdef SUPPORT_UTMP
if (doutmp) {
@@ -1054,7 +1057,8 @@
}
if (okwtmp) {
#ifdef SUPPORT_UTMPX
- ftpd_logwtmpx(ttyline, "", "", 0, DEAD_PROCESS);
+ ftpd_logwtmpx(ttyline, "", "", NULL, 0,
+ DEAD_PROCESS);
#endif
#ifdef SUPPORT_UTMP
ftpd_logwtmp(ttyline, "", "");
@@ -1183,7 +1187,7 @@
gidcount = getgroups(gidcount, gidlist);
/* open utmp/wtmp before chroot */
- login_utmp(ttyline, pw->pw_name, remotehost);
+ login_utmp(ttyline, pw->pw_name, remotehost, &his_addr);
logged_in = 1;
diff -r c078f444d338 -r 308f0d4e0287 libexec/ftpd/logwtmp.c
--- a/libexec/ftpd/logwtmp.c Thu Nov 11 01:01:22 2004 +0000
+++ b/libexec/ftpd/logwtmp.c Thu Nov 11 01:14:10 2004 +0000
@@ -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 @@
#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 @@
(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);
Home |
Main Index |
Thread Index |
Old Index