From nobody@FreeBSD.org  Mon May 10 03:05:45 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E9E3916A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 10 May 2004 03:05:44 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7001343D3F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 10 May 2004 03:05:44 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i4AA5hNt061648
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 10 May 2004 03:05:43 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i4AA5fpQ061646;
	Mon, 10 May 2004 03:05:41 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200405101005.i4AA5fpQ061646@www.freebsd.org>
Date: Mon, 10 May 2004 03:05:41 -0700 (PDT)
From: Flemming Jacobsen <fj@batmule.dk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Add options ti last to ignore ftp logins (usefull for busy ftp servers) [PATCH]
X-Send-Pr-Version: www-2.3

>Number:         66445
>Category:       bin
>Synopsis:       [patch] Add options to last(1) to ignore ftp logins (useful for busy ftp servers)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 10 03:10:22 PDT 2004
>Closed-Date:    Wed May 07 22:00:38 UTC 2008
>Last-Modified:  Wed May 07 22:00:38 UTC 2008
>Originator:     Flemming Jacobsen
>Release:        5.2.1-RELEASE-p3
>Organization:
DKUUG
>Environment:
FreeBSD ra.dkuug.dk 5.2.1-RELEASE-p3 FreeBSD 5.2.1-RELEASE-p3 #1: Fri Mar 19 05:46:43 CET 2004     fj@nyra.dkuug.dk:/usr/obj/usr/src/sys/RA  i386

>Description:
On a busy ftp server last is almost useless wothout using some kind of grep -v, if wou want to know about your co-admins.
>How-To-Repeat:
do 'last -10' on a busy ftp server. Observe that no "shell-logins" are seen.
>Fix:
A patch to fix this is located at: http://www.batmule.dk/FreeBSD/last.ignoreftp.diff

It's pasted below for competeness:

--- last.1.orig Mon May 10 11:10:40 2004
+++ last.1      Mon May 10 11:35:54 2004
@@ -145,6 +145,12 @@
 .It Fl h Ar host
 .Ar Host
 names may be names or internet numbers.
+.It Fl i
+Ignore all anonymous ftp logins while displaying. 
+This is usefull on a busy ftp server.
+.It Fl I
+Ignore all ftp logins while displaying. 
+This is usefull on a busy ftp server.
 .It Fl n Ar maxrec
 Limit the report to
 .Ar maxrec

--- last.c.orig Mon May 10 11:10:34 2004
+++ last.c      Mon May 10 11:52:34 2004
@@ -98,6 +98,11 @@
                                                 * report users logged in
                                                 * at this snapshot time
                                                 */
+static int     ignoreftp=0;                    /* if == 1, ignore annonymous
+                                                * ftp logins
+                                                * if ==2, ignore all ftp 
+                                                * logins
+                                                */
 
 void    addarg(int, char *);
 time_t  dateconv(char *);
@@ -114,7 +119,7 @@
 usage(void)
 {
        (void)fprintf(stderr,
-"usage: last [-swy] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host]\n"
+"usage: last [-iIswy] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host]\n"
 "            [-n maxrec] [-t tty] [user ...]\n");
        exit(1);
 }
@@ -130,7 +135,7 @@
 
        maxrec = -1;
        snaptime = 0;
-       while ((ch = getopt(argc, argv, "0123456789d:f:h:n:st:wy")) != -1)
+       while ((ch = getopt(argc, argv, "0123456789d:f:h:iIn:st:wy")) != -1)
                switch (ch) {
                case '0': case '1': case '2': case '3': case '4':
                case '5': case '6': case '7': case '8': case '9':
@@ -157,6 +162,12 @@
                        hostconv(optarg);
                        addarg(HOST_TYPE, optarg);
                        break;
+               case 'i':
+                       ignoreftp=1;
+                       break;
+               case 'I':
+                       ignoreftp=2;
+                       break;
                case 'n':
                        errno = 0;
                        maxrec = strtol(optarg, &p, 10);
@@ -336,6 +347,10 @@
        time_t  delta;                          /* time difference */
        time_t  t;
 
+       if( !strcmp("ftp",bp->ut_name) && ignoreftp)            /* anon ftp */
+         return;
+       if( !strcmp("ftp",bp->ut_line) && ignoreftp == 2)       /* ftp */
+         return;
        if (maxrec != -1 && !maxrec--)
                exit(0);
        t = _int_to_time(bp->ut_time);

>Release-Note:
>Audit-Trail:

From: Yar Tikhiy <yar@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, fj@batmule.dk
Cc:  
Subject: Re: bin/66445: Add options to last(1) to ignore ftp logins (usefull for busy ftp servers) [PATCH]
Date: Thu, 16 Dec 2004 09:16:27 +0300

 According to the KISS principle of Unix, one should use such tools
 as grep(1) or awk(1) to exclude some lines from last(1) output.
 Have you considered that?
 
 -- 
 Yar

From: Maxim Konovalov <maxim@macomnet.ru>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/66445: Add options to last(1) to ignore ftp logins (usefull
 for busy ftp servers) [PATCH]
Date: Thu, 16 Dec 2004 15:25:57 +0300 (MSK)

 Moreover, there is ftpd -W option.
 
 -- 
 Maxim Konovalov

From: Flemming Jacobsen <fj@batmule.dk>
To: Yar Tikhiy <yar@freebsd.org>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/66445: Add options to last(1) to ignore ftp logins (usefull for busy ftp servers) [PATCH]
Date: Sat, 8 Jan 2005 08:51:18 +0100

 Yar Tikhiy wrote:
 > According to the KISS principle of Unix, one should use such tools
 > as grep(1) or awk(1) to exclude some lines from last(1) output.
 > Have you considered that?
 
 This can be seen as violating KISS, yes.
 And if people want to dump the patch for that reason, i have no
 complaints. This patch is for convinience, not for critical
 functionality.
 
 As for ftpd -W, it doesn't log regular ftp logins, which is
 really bad for security.
 
 Maybe a better lolution would be to teach ftpd not to log annon
 logins to wtmp.
 
 -- 
 Flemming Jacobsen                                  Email: fj@batmule.dk
    ---===   If speed kills, Windows users may live forever.   ===---

From: Yar Tikhiy <yar@comp.chem.msu.su>
To: Flemming Jacobsen <fj@batmule.dk>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/66445: Add options to last(1) to ignore ftp logins (usefull for busy ftp servers) [PATCH]
Date: Wed, 12 Jan 2005 03:56:23 +0300

 On Sat, Jan 08, 2005 at 08:51:18AM +0100, Flemming Jacobsen wrote:
 > Yar Tikhiy wrote:
 > > According to the KISS principle of Unix, one should use such tools
 > > as grep(1) or awk(1) to exclude some lines from last(1) output.
 > > Have you considered that?
 > 
 > This can be seen as violating KISS, yes.
 > And if people want to dump the patch for that reason, i have no
 > complaints. This patch is for convinience, not for critical
 > functionality.
 
 You see, the problem with your patch is violating not KISS itself,
 but the well-established Unix tradition of specialized command-line
 tools.  Filtering ftp login records out isn't a job for last(1).
 
 > As for ftpd -W, it doesn't log regular ftp logins, which is
 > really bad for security.
 > 
 > Maybe a better lolution would be to teach ftpd not to log annon
 > logins to wtmp.
 
 I hope I found a possible solution.
 What do you think about changing the -W switch behaviour so that
 it would turn off logging anonymous and guest FTP logins if specified
 once or turn wtmp logging completely if specified twice on the command
 line?  E.g.,
 
 	ftpd -W # don't log anonymous and guest logins
 	ftpd -WW # don't touch wtmp at all
 
 -- 
 Yar

From: Volker <volker@vwsoft.com>
To: bug-followup@FreeBSD.org, fj@batmule.dk
Cc:  
Subject: Re: bin/66445: [patch] Add options to last(1) to ignore ftp logins
 (useful for busy ftp servers)
Date: Thu, 14 Feb 2008 02:18:16 +0100

 Flemming,
 
 I just found your PR hocking in GNATS for quite some time. I'm sorry
 to see that is hasn't been handled in a way which is acceptable to you.
 
 But I'm also wondering if you agree to close this PR before it turns 4
 years old?
 
 As a side note, I also think ftpd (or any other ftp daemon) should
 handle the login logging better. You may probably check if 'ftpd -lW'
 is giving the functionality you need.
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Thu Feb 14 06:25:19 UTC 2008 
State-Changed-Why:  
Note that submitter has been asked for feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66445 
State-Changed-From-To: feedback->closed 
State-Changed-By: vwe 
State-Changed-When: Wed May 7 22:00:31 UTC 2008 
State-Changed-Why:  

We're sorry to not see any feedback received for quite some time. 
If you think this is still an issue that should be worked on, 
please provide the requested information and we'll be happy to 
re-open this ticket. 
Thank you for bringing this problem to attention! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66445 
>Unformatted:
