[Midnightbsd-cvs] src [11401] trunk/libexec/ftpd: sync ftpd with freebsd.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Jul 6 21:02:14 EDT 2018


Revision: 11401
          http://svnweb.midnightbsd.org/src/?rev=11401
Author:   laffer1
Date:     2018-07-06 21:02:14 -0400 (Fri, 06 Jul 2018)
Log Message:
-----------
sync ftpd with freebsd.

Modified Paths:
--------------
    trunk/libexec/ftpd/Makefile
    trunk/libexec/ftpd/config.h
    trunk/libexec/ftpd/extern.h
    trunk/libexec/ftpd/ftpchroot.5
    trunk/libexec/ftpd/ftpcmd.y
    trunk/libexec/ftpd/ftpd.8
    trunk/libexec/ftpd/ftpd.c
    trunk/libexec/ftpd/logwtmp.c
    trunk/libexec/ftpd/pathnames.h
    trunk/libexec/ftpd/popen.c

Property Changed:
----------------
    trunk/libexec/ftpd/ftpchroot.5
    trunk/libexec/ftpd/ftpcmd.y
    trunk/libexec/ftpd/ftpd.8

Modified: trunk/libexec/ftpd/Makefile
===================================================================
--- trunk/libexec/ftpd/Makefile	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/Makefile	2018-07-07 01:02:14 UTC (rev 11401)
@@ -1,6 +1,6 @@
+# $MidnightBSD$
 #	@(#)Makefile	8.2 (Berkeley) 4/4/94
-# $FreeBSD: src/libexec/ftpd/Makefile,v 1.57.6.1 2008/11/25 02:59:29 kensmith Exp $
-# $MidnightBSD$
+# $FreeBSD: stable/10/libexec/ftpd/Makefile 321267 2017-07-20 00:52:11Z ngie $
 
 .include <bsd.own.mk>
 
@@ -21,10 +21,9 @@
 DPADD+=	${LIBOPIE} ${LIBMD}
 LDADD+=	-lopie -lmd
 
-LSDIR=	../../bin/ls
-.PATH:	${.CURDIR}/${LSDIR}
+.PATH:	${SRCTOP}/bin/ls
 SRCS+=	ls.c cmp.c print.c util.c
-CFLAGS+=-Dmain=ls_main -I${.CURDIR}/${LSDIR}
+CFLAGS+=-Dmain=ls_main -I${SRCTOP}/bin/ls
 DPADD+=	${LIBM}
 LDADD+=	-lm
 

Modified: trunk/libexec/ftpd/config.h
===================================================================
--- trunk/libexec/ftpd/config.h	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/config.h	2018-07-07 01:02:14 UTC (rev 11401)
@@ -1,10 +1,10 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: src/libexec/ftpd/config.h,v 1.1 2001/07/19 17:45:14 obrien Exp $ */
+/* $FreeBSD: stable/10/libexec/ftpd/config.h 79979 2001-07-19 17:45:14Z obrien $ */
 
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
-/* $Id: config.h,v 1.2 2012-04-11 00:46:54 laffer1 Exp $ */
+/* $Id: config.h.in,v 1.15 2001/04/28 07:11:46 lukem Exp $ */
 
 
 /* Define if the closedir function returns void instead of int.  */

Modified: trunk/libexec/ftpd/extern.h
===================================================================
--- trunk/libexec/ftpd/extern.h	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/extern.h	2018-07-07 01:02:14 UTC (rev 11401)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/libexec/ftpd/extern.h,v 1.3 2012/04/11 00:46:54 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -11,11 +11,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -32,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)extern.h	8.2 (Berkeley) 4/4/94
- * $FreeBSD: src/libexec/ftpd/extern.h,v 1.19 2002/02/04 01:23:44 kris Exp $
+ * $FreeBSD: stable/10/libexec/ftpd/extern.h 262435 2014-02-24 08:21:49Z brueffer $
  */
 
 #include <sys/types.h>

Modified: trunk/libexec/ftpd/ftpchroot.5
===================================================================
--- trunk/libexec/ftpd/ftpchroot.5	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/ftpchroot.5	2018-07-07 01:02:14 UTC (rev 11401)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2003 FreeBSD Project
 .\" All rights reserved.
 .\"
@@ -22,8 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/libexec/ftpd/ftpchroot.5,v 1.3 2003/06/01 19:52:36 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/libexec/ftpd/ftpchroot.5 115634 2003-06-01 19:52:36Z ru $
 .\"
 .Dd January 26, 2003
 .Dt FTPCHROOT 5


Property changes on: trunk/libexec/ftpd/ftpchroot.5
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/libexec/ftpd/ftpcmd.y
===================================================================
--- trunk/libexec/ftpd/ftpcmd.y	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/ftpcmd.y	2018-07-07 01:02:14 UTC (rev 11401)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1985, 1988, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -10,11 +11,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -47,7 +44,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/libexec/ftpd/ftpcmd.y,v 1.66.6.2 2008/12/23 01:23:09 cperciva Exp $");
+__FBSDID("$FreeBSD: stable/10/libexec/ftpd/ftpcmd.y 262435 2014-02-24 08:21:49Z brueffer $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -1718,7 +1715,7 @@
  * Avoid expanding to a pathname including '\r' or '\n' in order to
  * not disrupt the FTP protocol.
  * The expansion found must be unique.
- * Return the result as a malloced string, or NULL if an error occured.
+ * Return the result as a malloced string, or NULL if an error occurred.
  *
  * Problem: this production is used for all pathname
  * processing, but only gives a 550 error reply.


Property changes on: trunk/libexec/ftpd/ftpcmd.y
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/libexec/ftpd/ftpd.8
===================================================================
--- trunk/libexec/ftpd/ftpd.8	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/ftpd.8	2018-07-07 01:02:14 UTC (rev 11401)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1985, 1988, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -9,11 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
+.\" 3. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
 .\"
@@ -30,8 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)ftpd.8	8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/libexec/ftpd/ftpd.8,v 1.69.2.1 2006/01/29 13:21:05 yar Exp $
-.\" $MidnightBSD: src/libexec/ftpd/ftpd.8,v 1.3 2012/04/11 00:46:54 laffer1 Exp $
+.\" $FreeBSD: stable/10/libexec/ftpd/ftpd.8 262435 2014-02-24 08:21:49Z brueffer $
 .\"
 .Dd January 21, 2010
 .Dt FTPD 8


Property changes on: trunk/libexec/ftpd/ftpd.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/libexec/ftpd/ftpd.c
===================================================================
--- trunk/libexec/ftpd/ftpd.c	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/ftpd.c	2018-07-07 01:02:14 UTC (rev 11401)
@@ -43,7 +43,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/10/libexec/ftpd/ftpd.c 262435 2014-02-24 08:21:49Z brueffer $");
+__FBSDID("$FreeBSD: stable/10/libexec/ftpd/ftpd.c 327019 2017-12-20 07:18:07Z delphij $");
 
 /*
  * FTP server.
@@ -421,6 +421,10 @@
 		}
 	}
 
+	/* handle filesize limit gracefully */
+	sa.sa_handler = SIG_IGN;
+	(void)sigaction(SIGXFSZ, &sa, NULL);
+
 	if (daemon_mode) {
 		int *ctl_sock, fd, maxfd = -1, nfds, i;
 		fd_set defreadfds, readfds;
@@ -1061,7 +1065,7 @@
 		}
 	}
 	if (logging)
-		strncpy(curname, name, sizeof(curname)-1);
+		strlcpy(curname, name, sizeof(curname));
 
 	pwok = 0;
 #ifdef USE_PAM
@@ -1186,14 +1190,14 @@
 #endif
 
 	(void) seteuid(0);
-	if (logged_in && dowtmp)
-		ftpd_logwtmp(wtmpid, NULL, NULL);
-	pw = NULL;
 #ifdef	LOGIN_CAP
 	setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN |
 		       LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH |
 		       LOGIN_SETENV));
 #endif
+	if (logged_in && dowtmp)
+		ftpd_logwtmp(wtmpid, NULL, NULL);
+	pw = NULL;
 #ifdef USE_PAM
 	if (pamh) {
 		if ((e = pam_setcred(pamh, PAM_DELETE_CRED)) != PAM_SUCCESS)
@@ -1465,7 +1469,7 @@
 		}
 	}
 	setusercontext(lc, pw, 0, LOGIN_SETALL &
-		       ~(LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV));
+		       ~(LOGIN_SETRESOURCES | LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV));
 #else
 	setlogin(pw->pw_name);
 	(void) initgroups(pw->pw_name, pw->pw_gid);
@@ -1507,6 +1511,10 @@
 		    (struct sockaddr *)&his_addr);
 	logged_in = 1;
 
+#ifdef	LOGIN_CAP
+	setusercontext(lc, pw, 0, LOGIN_SETRESOURCES);
+#endif
+
 	if (guest && stats && statfd < 0)
 #ifdef VIRTUAL_HOSTING
 		statfd = open(thishost->statfile, O_WRONLY|O_APPEND);
@@ -1672,14 +1680,14 @@
 	struct stat st;
 	int (*closefunc)(FILE *);
 	time_t start;
+	char line[BUFSIZ];
 
 	if (cmd == 0) {
 		fin = fopen(name, "r"), closefunc = fclose;
 		st.st_size = 0;
 	} else {
-		char line[BUFSIZ];
-
-		(void) snprintf(line, sizeof(line), cmd, name), name = line;
+		(void) snprintf(line, sizeof(line), cmd, name);
+		name = line;
 		fin = ftpd_popen(line, "r"), closefunc = ftpd_pclose;
 		st.st_size = -1;
 		st.st_blksize = BUFSIZ;
@@ -2757,6 +2765,11 @@
 
 	if (logged_in && dowtmp) {
 		(void) seteuid(0);
+#ifdef		LOGIN_CAP
+ 	        setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN |
+		       LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH |
+		       LOGIN_SETENV));
+#endif
 		ftpd_logwtmp(wtmpid, NULL, NULL);
 	}
 	/* beware of flushing buffers after a SIGPIPE */

Modified: trunk/libexec/ftpd/logwtmp.c
===================================================================
--- trunk/libexec/ftpd/logwtmp.c	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/logwtmp.c	2018-07-07 01:02:14 UTC (rev 11401)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/libexec/ftpd/logwtmp.c,v 1.2 2012/04/11 00:46:54 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1988, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -11,11 +11,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -39,7 +35,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/libexec/ftpd/logwtmp.c,v 1.13 2004/11/18 13:46:29 yar Exp $");
+__FBSDID("$FreeBSD: stable/10/libexec/ftpd/logwtmp.c 262435 2014-02-24 08:21:49Z brueffer $");
 
 #include <sys/types.h>
 #include <sys/stat.h>

Modified: trunk/libexec/ftpd/pathnames.h
===================================================================
--- trunk/libexec/ftpd/pathnames.h	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/pathnames.h	2018-07-07 01:02:14 UTC (rev 11401)
@@ -11,11 +11,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -32,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)pathnames.h	8.1 (Berkeley) 6/4/93
- * $FreeBSD: src/libexec/ftpd/pathnames.h,v 1.11 1999/08/28 00:09:31 peter Exp $
+ * $FreeBSD: stable/10/libexec/ftpd/pathnames.h 262435 2014-02-24 08:21:49Z brueffer $
  */
 
 #include <paths.h>

Modified: trunk/libexec/ftpd/popen.c
===================================================================
--- trunk/libexec/ftpd/popen.c	2018-07-07 01:01:21 UTC (rev 11400)
+++ trunk/libexec/ftpd/popen.c	2018-07-07 01:02:14 UTC (rev 11401)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/libexec/ftpd/popen.c,v 1.3 2012/04/11 00:46:54 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1988, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -14,11 +14,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -42,7 +38,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/libexec/ftpd/popen.c,v 1.26 2004/11/18 13:46:29 yar Exp $");
+__FBSDID("$FreeBSD: stable/10/libexec/ftpd/popen.c 262435 2014-02-24 08:21:49Z brueffer $");
 
 #include <sys/types.h>
 #include <sys/wait.h>



More information about the Midnightbsd-cvs mailing list