Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ftpd add support for -W; don't log to wtmp (orthogon...



details:   https://anonhg.NetBSD.org/src/rev/b68d41db3733
branches:  trunk
changeset: 495347:b68d41db3733
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed Jul 26 13:53:33 2000 +0000

description:
add support for -W; don't log to wtmp (orthogonal of -U which logs to utmp).
inspired by similar option in wuftpd.

diffstat:

 libexec/ftpd/ftpd.8    |  12 ++++++++++--
 libexec/ftpd/ftpd.c    |  23 ++++++++++++++++-------
 libexec/ftpd/version.h |   4 ++--
 3 files changed, 28 insertions(+), 11 deletions(-)

diffs (135 lines):

diff -r 04c250cb6995 -r b68d41db3733 libexec/ftpd/ftpd.8
--- a/libexec/ftpd/ftpd.8       Wed Jul 26 13:45:52 2000 +0000
+++ b/libexec/ftpd/ftpd.8       Wed Jul 26 13:53:33 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ftpd.8,v 1.58 2000/07/26 13:45:52 lukem Exp $
+.\"    $NetBSD: ftpd.8,v 1.59 2000/07/26 13:53:33 lukem Exp $
 .\"
 .\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -76,7 +76,7 @@
 Internet File Transfer Protocol server
 .Sh SYNOPSIS
 .Nm
-.Op Fl dHlrsU
+.Op Fl dHlrsUW
 .Op Fl a Ar anondir
 .Op Fl c Ar confdir
 .Op Fl C Ar user
@@ -183,6 +183,14 @@
 is empty or
 .Sq -
 then don't display any version information.
+.It Fl W
+By default each
+.Tn FTP
+session is logged to
+.Pa /var/run/wtmp ,
+making them visible to commands such as
+.Xr last 1 .
+This option prevents that from occurring.
 .El
 .Pp
 The file
diff -r 04c250cb6995 -r b68d41db3733 libexec/ftpd/ftpd.c
--- a/libexec/ftpd/ftpd.c       Wed Jul 26 13:45:52 2000 +0000
+++ b/libexec/ftpd/ftpd.c       Wed Jul 26 13:53:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftpd.c,v 1.101 2000/07/23 14:40:48 lukem Exp $ */
+/*     $NetBSD: ftpd.c,v 1.102 2000/07/26 13:53:34 lukem Exp $ */
 
 /*
  * Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
@@ -109,7 +109,7 @@
 #if 0
 static char sccsid[] = "@(#)ftpd.c     8.5 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: ftpd.c,v 1.101 2000/07/23 14:40:48 lukem Exp $");
+__RCSID("$NetBSD: ftpd.c,v 1.102 2000/07/26 13:53:34 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -173,6 +173,7 @@
 int    stru;                   /* avoid C keyword */
 int    mode;
 int    doutmp;                 /* update utmp file */
+int    dowtmp;                 /* update wtmp file */
 int    dropprivs;              /* if privileges should or have been dropped */
 int    mapped;                 /* IPv4 connection on AF_INET6 socket */
 off_t  file_size;
@@ -241,7 +242,8 @@
        logging = 0;
        pdata = -1;
        sflag = 0;
-       doutmp = 0;
+       doutmp = 0;             /* default: don't log to utmp */
+       dowtmp = 1;             /* default: DO log to wtmp */
        dropprivs = 0;
        mapped = 0;
        usedefault = 1;
@@ -251,7 +253,7 @@
        gidcount = 0;
 
        version = FTPD_VERSION;
-       while ((ch = getopt(argc, argv, "a:c:C:dh:Hlrst:T:u:UvV:")) != -1) {
+       while ((ch = getopt(argc, argv, "a:c:C:dh:Hlrst:T:u:UvV:W")) != -1) {
                switch (ch) {
                case 'a':
                        anondir = optarg;
@@ -311,6 +313,10 @@
                                version = xstrdup(optarg);
                        break;
 
+               case 'W':
+                       dowtmp = 0;
+                       break;
+
                default:
                        if (optopt == 'a' || optopt == 'C')
                                exit(1);
@@ -755,7 +761,8 @@
 {
 
        if (logged_in) {
-               logwtmp(ttyline, "", "");
+               if (dowtmp)
+                       logwtmp(ttyline, "", "");
                if (doutmp)
                        logout(utmp.ut_line);
        }
@@ -883,7 +890,8 @@
        gidcount = getgroups(sizeof(gidlist), gidlist);
 
                        /* open wtmp before chroot */
-       logwtmp(ttyline, pw->pw_name, remotehost);
+       if (dowtmp)
+               logwtmp(ttyline, pw->pw_name, remotehost);
 
                        /* open utmp before chroot */
        if (doutmp) {
@@ -2036,7 +2044,8 @@
        transflag = 0;
 
        if (logged_in) {
-               logwtmp(ttyline, "", "");
+               if (dowtmp)
+                       logwtmp(ttyline, "", "");
                if (doutmp)
                        logout(utmp.ut_line);
 #ifdef KERBEROS
diff -r 04c250cb6995 -r b68d41db3733 libexec/ftpd/version.h
--- a/libexec/ftpd/version.h    Wed Jul 26 13:45:52 2000 +0000
+++ b/libexec/ftpd/version.h    Wed Jul 26 13:53:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.18 2000/07/23 14:40:48 lukem Exp $       */
+/*     $NetBSD: version.h,v 1.19 2000/07/26 13:55:28 lukem Exp $       */
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,5 +36,5 @@
  */
 
 #ifndef FTPD_VERSION
-#define        FTPD_VERSION    "NetBSD-ftpd 20000723"
+#define        FTPD_VERSION    "NetBSD-ftpd 20000726"
 #endif



Home | Main Index | Thread Index | Old Index