From cperon@staff.seccuris.com  Sun Aug 11 14:08:56 2002
Return-Path: <cperon@staff.seccuris.com>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2AEAE37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 11 Aug 2002 14:08:56 -0700 (PDT)
Received: from staff.seccuris.com (staff.seccuris.com [204.112.0.40])
	by mx1.FreeBSD.org (Postfix) with SMTP id 67E5F43E81
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 11 Aug 2002 14:08:55 -0700 (PDT)
	(envelope-from cperon@staff.seccuris.com)
Received: (qmail 97915 invoked by uid 1006); 11 Aug 2002 21:33:21 -0000
Message-Id: <20020811213321.97914.qmail@staff.seccuris.com>
Date: 11 Aug 2002 21:33:21 -0000
From: Chris S.J.Peron <maneo@bsdpro.com>
Reply-To: Chris S.J.Peron <maneo@bsdpro.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: lukem@netbsd.org
Subject: [PATCH] wtmp patch for lukemftpd
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41556
>Category:       bin
>Synopsis:       [patch] wtmp patch for ftpd(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    obrien
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 11 14:10:01 PDT 2002
>Closed-Date:    
>Last-Modified:  Sat Jun 14 06:08:13 UTC 2008
>Originator:     Chris S.J. Peron
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
none
>Environment:
System: FreeBSD xor.sqrt.ca 4.6-STABLE FreeBSD 4.6-STABLE #0: Sun Aug 11 10:56:44 CDT 2002     modulus@xor.sqrt.ca:/usr/src/sys/compile/opcode  i386

>Description:

	A bug in the preprocessor statements for lukemftpd prevent various
	functions defined in logwtmp.c from being executed. By default
	logins are not recorded in wtmp (which should be default according
	to the man page).
	
	Also, I am not so sure that the utmp code is working
	properly either but that is another subject all together.


	>>

	Please merge this diff in the source tree and have FreeBSD import
	the changes once they have been made upstream.

	<<

	BTW this is an excellent ftpd :-)
	All my servers are running it now. good job!
	
>How-To-Repeat:
	login to the ftp server, logout and use last(1) to check for the record.
	
>Fix:

diff -ur lukemftpd/CVS/Entries lukemftpd_hacked/CVS/Entries
--- lukemftpd/CVS/Entries	Sun Aug 11 15:46:59 2002
+++ lukemftpd_hacked/CVS/Entries	Sun Aug 11 15:10:17 2002
@@ -13,4 +13,4 @@
 /install-sh/1.1.1.1/Thu Jul 19 16:25:06 2001//
 /lukemftpd.h/1.1.1.2/Thu Mar 14 19:25:30 2002//
 /todo/1.1.1.2/Thu Mar 14 19:25:30 2002//
-D
+D/src////
Only in lukemftpd/CVS: Entries.Log
diff -ur lukemftpd/src/ftpd.c lukemftpd_hacked/src/ftpd.c
--- lukemftpd/src/ftpd.c	Thu Mar 14 13:25:32 2002
+++ lukemftpd_hacked/src/ftpd.c	Sun Aug 11 15:25:22 2002
@@ -859,7 +859,7 @@
 {
 
 	if (logged_in) {
-#ifdef NO_UTMP
+#ifndef NO_UTMP
 		if (dowtmp)
 			logwtmp(ttyline, "", "");
 		if (doutmp)
@@ -977,7 +977,7 @@
 	gidcount = getgroups(sizeof(gidlist), gidlist);
 
 			/* open wtmp before chroot */
-#ifdef NO_UTMP
+#ifndef NO_UTMP
 	if (dowtmp)
 		logwtmp(ttyline, pw->pw_name, remotehost);
 
@@ -2197,7 +2197,7 @@
 	transflag = 0;
 
 	if (logged_in) {
-#ifdef NO_UTMP
+#ifndef NO_UTMP
 		if (dowtmp)
 			logwtmp(ttyline, "", "");
 		if (doutmp)
	

OR:
have the CFLAGS variable in the Makefile -DNO_UTMP ?

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: johan 
State-Changed-When: Tue Aug 20 09:04:09 PDT 2002 
State-Changed-Why:  
Can you please talk to 'lukem@netbsd.org' about 
this change. He is the author of lukemftpd and 
as you say it should be change upstream. 

Can you also let us know the result and we can then  
import the next version of lukemftpd. 

Please followup by sending a mail to 
freebsd-gnats-submit@FreeBSD.org 
with the subject of this mail intact. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=41556 
Responsible-Changed-From-To: freebsd-bugs->obrien 
Responsible-Changed-By: obrien 
Responsible-Changed-When: Thu Aug 29 08:39:08 PDT 2002 
Responsible-Changed-Why:  
I'm running point on this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41556 

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@FreeBSD.org, maneo@bsdpro.com
Cc:  
Subject: Re: bin/41556: [PATCH] wtmp patch for lukemftpd
Date: Thu, 28 Feb 2008 20:56:07 +0000

 Hi,
 
 A version of lukemftp was imported into FreeBSD 4.9 which removed the 
 NO_UTMP definition
 and replaced it with SUPPORT_UTMP.   It appears that in the process of 
 restructuring the code this bug was fixed -
 I've tried to replicate this issue on 7.0 and the login is correctly 
 logged in wtmp.
 
 --
 Bruce
State-Changed-From-To: feedback->closed 
State-Changed-By: linimon 
State-Changed-When: Thu Feb 28 21:41:58 UTC 2008 
State-Changed-Why:  
brucec notes that this was fixed in the 4.9 timeframe. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41556 

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@FreeBSD.org, maneo@bsdpro.com
Cc:  
Subject: Re: bin/41556: [PATCH] wtmp patch for lukemftpd
Date: Sat, 10 May 2008 00:23:24 +0100

 This is a multi-part message in MIME format.
 --------------030507010907050903010300
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 It looks like I got confused between ftpd and lukemftpd - the former 
 does log to wtmp but the latter doesn't.
 
 The problem is that the Makefile in /usr/src/libexec/lukemftpd doesn't 
 define SUPPORT_UTMP so the utmp and wtmp functions never get called. 
 After adding the logwtmp.c and logutmp.c sources and defining 
 SUPPORT_UTMP, logins get logged to wtmp.   There's still a problem with 
 utmp though: logins appear to be written to /var/run/utmp but don't show 
 up using w(1).
 
 -- 
 Bruce Cran
 
 
 --------------030507010907050903010300
 Content-Type: text/plain;
  name="Makefile.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="Makefile.diff"
 
 --- Makefile.old	2008-05-10 00:14:52.000000000 +0100
 +++ Makefile	2008-05-10 00:16:05.000000000 +0100
 @@ -9,7 +9,7 @@
  PROG=	lukemftpd
  MAN=	lukemftpd.8 ftpd.conf.5 ftpusers.5
  MLINKS=	ftpusers.5 ftpchroot.5
 -SRCS=	cmds.c conf.c ftpd.c ftpcmd.y popen.c
 +SRCS=	cmds.c conf.c ftpd.c ftpcmd.y popen.c logutmp.c logwtmp.c
  SRCS+=	strsuftoll.c
  
  WFORMAT= 0
 @@ -21,6 +21,7 @@
  CFLAGS+= -include nbsd2fbsd.h
  CFLAGS+= -I${.CURDIR} -I${LUKEMFTPD} -I${LUKEMFTPD}/src
  CFLAGS+= -I${.CURDIR}/../../lib/libc/stdtime
 +CFLAGS+= -DSUPPORT_UTMP
  YFLAGS=
  
  LDADD=	-lcrypt -lutil
 
 --------------030507010907050903010300--
State-Changed-From-To: closed->open 
State-Changed-By: vwe 
State-Changed-When: Sat May 10 20:30:58 UTC 2008 
State-Changed-Why:  

re-open this as Bruce has checked and this is still an issue 
(read: it needs attention:) 

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