NetBSD Problem Report #53221
From www@NetBSD.org Sat Apr 28 13:20:16 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id CDB847A167
for <gnats-bugs@gnats.NetBSD.org>; Sat, 28 Apr 2018 13:20:16 +0000 (UTC)
Message-Id: <20180428132015.7B7047A1F6@mollari.NetBSD.org>
Date: Sat, 28 Apr 2018 13:20:15 +0000 (UTC)
From: nia.alarie@gmail.com
Reply-To: nia.alarie@gmail.com
To: gnats-bugs@NetBSD.org
Subject: add a -f option to ftpd, equivalent to -f in httpd
X-Send-Pr-Version: www-1.0
>Number: 53221
>Category: bin
>Synopsis: add a -f option to ftpd, equivalent to -f in httpd
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Apr 28 13:25:00 +0000 2018
>Closed-Date: Sat Apr 28 16:49:26 +0000 2018
>Last-Modified: Tue Oct 03 09:55:01 +0000 2023
>Originator: Nia Alarie
>Release: current
>Organization:
>Environment:
>Description:
ftpd runs as a libexec program by default, for use with servers such as inetd.
-D causes ftpd to run as a server and listen for incoming connections, and
detach from the controlling terminal.
This adds an option (-f) allowing ftpd to run as a server without detaching
from the terminal. For my specific use-case, this allows it to be controlled
by sysutils/daemontools.
This option is equivalent to the -f option in httpd.
>How-To-Repeat:
>Fix:
Index: ftpd.8
===================================================================
RCS file: /cvsroot/src/libexec/ftpd/ftpd.8,v
retrieving revision 1.86
diff -u -r1.86 ftpd.8
--- ftpd.8 3 Jul 2017 21:35:48 -0000 1.86
+++ ftpd.8 28 Apr 2018 12:48:33 -0000
@@ -65,7 +65,7 @@
Internet File Transfer Protocol server
.Sh SYNOPSIS
.Nm
-.Op Fl 46DdHlnQqrsUuWwX
+.Op Fl 46DdfHlnQqrsUuWwX
.Op Fl a Ar anondir
.Op Fl C Ar user Ns Op @ Ns Ar host
.Op Fl c Ar confdir
@@ -154,6 +154,10 @@
.Dq "\&%E"
escape sequence (see
.Sx Display file escape sequences )
+.It Fl f
+Stops the
+.Fl D
+flag from detaching from the tty and going into the background.
.It Fl H
Equivalent to
.Do
Index: ftpd.c
===================================================================
RCS file: /cvsroot/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.203
diff -u -r1.203 ftpd.c
--- ftpd.c 19 Jul 2016 21:25:38 -0000 1.203
+++ ftpd.c 28 Apr 2018 12:48:34 -0000
@@ -177,6 +177,7 @@
int data;
int Dflag;
+int fflag;
int sflag;
int stru; /* avoid C keyword */
int mode;
@@ -298,6 +299,7 @@
logging = 0;
pdata = -1;
Dflag = 0;
+ fflag = 0;
sflag = 0;
dataport = 0;
dopidfile = 1; /* default: DO use a pid file to count users */
@@ -323,7 +325,7 @@
openlog("ftpd", LOG_PID | LOG_NDELAY, LOG_FTP);
while ((ch = getopt(argc, argv,
- "46a:c:C:Dde:h:HlL:nP:qQrst:T:uUvV:wWX")) != -1) {
+ "46a:c:C:Dde:fh:HlL:nP:qQrst:T:uUvV:wWX")) != -1) {
switch (ch) {
case '4':
af = AF_INET;
@@ -377,6 +379,10 @@
emailaddr = optarg;
break;
+ case 'f':
+ fflag = 1;
+ break;
+
case 'h':
strlcpy(hostname, optarg, sizeof(hostname));
break;
@@ -505,7 +511,7 @@
struct pollfd *fds;
struct addrinfo hints, *res, *res0;
- if (daemon(1, 0) == -1) {
+ if (!fflag && daemon(1, 0) == -1) {
syslog(LOG_ERR, "failed to daemonize: %m");
exit(1);
}
>Release-Note:
>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53221 CVS commit: src/libexec/ftpd
Date: Sat, 28 Apr 2018 13:38:00 +0000
Module Name: src
Committed By: riastradh
Date: Sat Apr 28 13:38:00 UTC 2018
Modified Files:
src/libexec/ftpd: ftpd.8 ftpd.c
Log Message:
Add -f option to ftpd to stay in foreground with -D.
From nia in PR bin/53221.
To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/libexec/ftpd/ftpd.8
cvs rdiff -u -r1.203 -r1.204 src/libexec/ftpd/ftpd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sat, 28 Apr 2018 16:49:26 +0000
State-Changed-Why:
Applied, thanks for the patch!
From: "Luke Mewburn" <lukem@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53221 CVS commit: src/libexec/ftpd
Date: Tue, 29 Jan 2019 11:51:05 +0000
Module Name: src
Committed By: lukem
Date: Tue Jan 29 11:51:05 UTC 2019
Modified Files:
src/libexec/ftpd: version.h
Log Message:
NetBSD-ftpd 20180428
Update version to "NetBSD-ftpd 20180428" for changes:
- Fix violations of the sequence point rule.
- Check that stat and fstat succeed.
- Support blacklistd(8) hooks.
- Clear utmpx struct before writing it to wtmpx files.
- Fix directory stream leaks.
- Use explicit_memset(3) instead of memset(3) to clear password.
- Fix scope of variable. PR misc/50665.
- Ensure that closing socket exists. CID 603440.
- Add -f option to ftpd to stay in foreground with -D. PR bin/53221.
To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/libexec/ftpd/version.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Luke Mewburn" <lukem@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53221 CVS commit: othersrc/libexec/tnftpd/src
Date: Tue, 29 Jan 2019 12:06:33 +0000
Module Name: othersrc
Committed By: lukem
Date: Tue Jan 29 12:06:33 UTC 2019
Update of /cvsroot/othersrc/libexec/tnftpd/src
In directory ivanova.netbsd.org:/tmp/cvs-serv4616
Log Message:
Import NetBSD ftpd as at 20190129
Notable changes:
- Fix violations of the sequence point rule.
- Add volatile for gcc 5.
- Check that stat and fstat succeed.
- Support blacklistd(8) hooks.
- Clear utmpx struct before writing it to wtmpx files.
- Fix directory stream leaks.
- Use explicit_memset(3) instead of memset(3) to clear password.
- Fix scope of variable. PR misc/50665.
- Ensure that closing socket exists. CID 603440.
- Add -f option to ftpd to stay in foreground with -D. PR bin/53221.
- Update version to "NetBSD-ftpd 20180428".
Status:
Vendor Tag: NetBSD
Release Tags: NetBSD-20190129
U othersrc/libexec/tnftpd/src/ftpd.conf.5
C othersrc/libexec/tnftpd/src/popen.c
C othersrc/libexec/tnftpd/src/ftpcmd.y
C othersrc/libexec/tnftpd/src/ftpd.c
C othersrc/libexec/tnftpd/src/extern.h
U othersrc/libexec/tnftpd/src/ftpusers.5
N othersrc/libexec/tnftpd/src/pfilter.c
C othersrc/libexec/tnftpd/src/version.h
U othersrc/libexec/tnftpd/src/pathnames.h
U othersrc/libexec/tnftpd/src/logutmp.c
N othersrc/libexec/tnftpd/src/pfilter.h
C othersrc/libexec/tnftpd/src/ftpd.8
C othersrc/libexec/tnftpd/src/Makefile
U othersrc/libexec/tnftpd/src/conf.c
C othersrc/libexec/tnftpd/src/logwtmp.c
C othersrc/libexec/tnftpd/src/cmds.c
9 conflicts created by this import.
Use the following command to help the merge:
cvs checkout -jNetBSD:yesterday -jNetBSD othersrc/libexec/tnftpd/src
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53221 CVS commit: [netbsd-8] src/libexec/ftpd
Date: Tue, 3 Oct 2023 09:54:25 +0000
Module Name: src
Committed By: martin
Date: Tue Oct 3 09:54:24 UTC 2023
Modified Files:
src/libexec/ftpd [netbsd-8]: ftpd.8 ftpd.c
Log Message:
Pull up following revision(s) (requested by lukem in ticket #1900):
libexec/ftpd/ftpd.8: revision 1.87
libexec/ftpd/ftpd.c: revision 1.204
Add -f option to ftpd to stay in foreground with -D.
From nia in PR bin/53221.
To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.85.38.1 src/libexec/ftpd/ftpd.8
cvs rdiff -u -r1.203 -r1.203.6.1 src/libexec/ftpd/ftpd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.