NetBSD re-synchronization of the source tree

This brings our tree to NetBSD 7.0, as found on -current on the
10-10-2015.

This updates:
 - LLVM to 3.6.1
 - GCC to GCC 5.1
 - Replace minix/commands/zdump with usr.bin/zdump
 - external/bsd/libelf has moved to /external/bsd/elftoolchain/
 - Import ctwm
 - Drop sprintf from libminc

Change-Id: I149836ac18e9326be9353958bab9b266efb056f0
This commit is contained in:
2015-10-15 17:01:16 +02:00
parent 8933525b85
commit 0a6a1f1d05
32425 changed files with 2998623 additions and 1342348 deletions

View File

@@ -1,21 +1,25 @@
# $NetBSD: Makefile,v 1.63 2011/08/14 11:46:28 christos Exp $
# $NetBSD: Makefile,v 1.64 2015/01/25 15:53:49 christos Exp $
# @(#)Makefile 8.2 (Berkeley) 4/4/94
.include <bsd.own.mk>
PROG= ftpd
SRCS= cmds.c conf.c ftpd.c ftpcmd.y logutmp.c logwtmp.c popen.c
.ifdef __MINIX
.if defined(__MINIX)
WARNS= # BJG too many warnings with clang right now
CPPFLAGS+=-I${.CURDIR}
.else
CPPFLAGS+=-I${.CURDIR} -DSUPPORT_UTMP -DSUPPORT_UTMPX -DLOGIN_CAP
.endif
.endif # defined(__MINIX)
DPADD+= ${LIBCRYPT} ${LIBUTIL}
LDADD+= -lcrypt -lutil
MAN= ftpd.conf.5 ftpusers.5 ftpd.8
MLINKS= ftpusers.5 ftpchroot.5
SRCS+= pfilter.c
LDADD+= -lblacklist
DPADD+= ${LIBBLACKLIST}
.if defined(NO_INTERNAL_LS)
CPPFLAGS+=-DNO_INTERNAL_LS
.else

View File

@@ -1,4 +1,4 @@
/* $NetBSD: cmds.c,v 1.33 2013/07/03 14:15:47 christos Exp $ */
/* $NetBSD: cmds.c,v 1.34 2015/08/10 07:32:49 shm Exp $ */
/*
* Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: cmds.c,v 1.33 2013/07/03 14:15:47 christos Exp $");
__RCSID("$NetBSD: cmds.c,v 1.34 2015/08/10 07:32:49 shm Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -249,8 +249,10 @@ mlsd(const char *path)
goto mlsdperror;
dout = dataconn("MLSD", (off_t)-1, "w");
if (dout == NULL)
if (dout == NULL) {
(void) closedir(dirp);
return;
}
memset(&f, 0, sizeof(f));
f.stat = &sb;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: ftpcmd.y,v 1.93 2011/09/16 16:13:17 plunky Exp $ */
/* $NetBSD: ftpcmd.y,v 1.94 2015/08/10 07:45:50 shm Exp $ */
/*-
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
#if 0
static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
#else
__RCSID("$NetBSD: ftpcmd.y,v 1.93 2011/09/16 16:13:17 plunky Exp $");
__RCSID("$NetBSD: ftpcmd.y,v 1.94 2015/08/10 07:45:50 shm Exp $");
#endif
#endif /* not lint */
@@ -193,7 +193,7 @@ cmd
| PASS SP password CRLF
{
pass($3);
memset($3, 0, strlen($3));
explicit_memset($3, 0, strlen($3));
free($3);
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: ftpd.c,v 1.200 2013/07/31 19:50:47 christos Exp $ */
/* $NetBSD: ftpd.c,v 1.202 2015/08/10 07:32:49 shm Exp $ */
/*
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994\
#if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: ftpd.c,v 1.200 2013/07/31 19:50:47 christos Exp $");
__RCSID("$NetBSD: ftpd.c,v 1.202 2015/08/10 07:32:49 shm Exp $");
#endif
#endif /* not lint */
@@ -165,6 +165,8 @@ __RCSID("$NetBSD: ftpd.c,v 1.200 2013/07/31 19:50:47 christos Exp $");
#include <security/pam_appl.h>
#endif
#include "pfilter.h"
#define GLOBAL
#include "extern.h"
#include "pathnames.h"
@@ -264,8 +266,8 @@ static enum send_status
#if !defined(__minix)
static enum send_status
send_data_with_mmap(int, int, const struct stat *, int);
static void logrusage(const struct rusage *, const struct rusage *);
#endif /* !defined(__minix) */
static void logrusage(const struct rusage *, const struct rusage *);
static void logout_utmp(void);
int main(int, char *[]);
@@ -473,6 +475,8 @@ main(int argc, char *argv[])
if (EMPTYSTR(confdir))
confdir = _DEFAULT_CONFDIR;
pfilter_open();
if (dowtmp) {
#ifdef SUPPORT_UTMPX
ftpd_initwtmpx();
@@ -1409,6 +1413,7 @@ do_pass(int pass_checked, int pass_rval, const char *passwd)
if (rval) {
reply(530, "%s", rval == 2 ? "Password expired." :
"Login incorrect.");
pfilter_notify(1, rval == 2 ? "exppass" : "badpass");
if (logging) {
syslog(LOG_NOTICE,
"FTP LOGIN FAILED FROM %s", remoteloghost);
@@ -1452,6 +1457,7 @@ do_pass(int pass_checked, int pass_rval, const char *passwd)
*remote_ip = 0;
remote_ip[sizeof(remote_ip) - 1] = 0;
if (!auth_hostok(lc, remotehost, remote_ip)) {
pfilter_notify(1, "bannedhost");
syslog(LOG_INFO|LOG_AUTH,
"FTP LOGIN FAILED (HOST) as %s: permission denied.",
pw->pw_name);
@@ -1608,8 +1614,8 @@ do_pass(int pass_checked, int pass_rval, const char *passwd)
setsid();
#if !defined(__minix)
setlogin(pw->pw_name);
#endif
#endif /* !defined(__minix) */
#endif
if (dropprivs ||
(curclass.type != CLASS_REAL &&
ntohs(ctrl_addr.su_port) > IPPORT_RESERVED + 1)) {
@@ -1694,9 +1700,7 @@ retrieve(const char *argv[], const char *name)
int (*closefunc)(FILE *) = NULL;
int dolog, sendrv, closerv, stderrfd, isconversion, isdata, isls;
struct timeval start, finish, td, *tdp;
#if !defined(__minix)
struct rusage rusage_before, rusage_after;
#endif /* !defined(__minix) */
const char *dispname;
const char *error;
@@ -1777,25 +1781,19 @@ retrieve(const char *argv[], const char *name)
if (dout == NULL)
goto done;
#if !defined(__minix)
(void)getrusage(RUSAGE_SELF, &rusage_before);
#endif /* !defined(__minix) */
(void)gettimeofday(&start, NULL);
sendrv = send_data(fin, dout, &st, isdata);
(void)gettimeofday(&finish, NULL);
#if !defined(__minix)
(void)getrusage(RUSAGE_SELF, &rusage_after);
#endif /* !defined(__minix) */
closedataconn(dout); /* close now to affect timing stats */
timersub(&finish, &start, &td);
tdp = &td;
done:
if (dolog) {
logxfer("get", byte_count, name, NULL, tdp, error);
#if !defined(__minix)
if (tdp != NULL)
logrusage(&rusage_before, &rusage_after);
#endif /* !defined(__minix) */
}
closerv = (*closefunc)(fin);
if (sendrv == 0) {
@@ -2243,14 +2241,14 @@ send_data_with_mmap(int filefd, int netfd, const struct stat *st, int isdata)
goto try_read;
return (SS_FILE_ERROR);
}
#ifndef __minix
#if !defined(__minix)
(void) madvise(win, mapsize, MADV_SEQUENTIAL);
#endif
#endif /* !defined(__minix) */
error = write_data(netfd, win, mapsize, &bufrem, &then,
isdata);
#ifndef __minix
#if !defined(__minix)
(void) madvise(win, mapsize, MADV_DONTNEED);
#endif
#endif /* !defined(__minix) */
munmap(win, mapsize);
if (urgflag && handleoobcmd())
return (SS_ABORTED);
@@ -3500,8 +3498,10 @@ send_file_list(const char *whichf)
while ((dir = readdir(dirp)) != NULL) {
char nbuf[MAXPATHLEN];
if (urgflag && handleoobcmd())
if (urgflag && handleoobcmd()) {
(void) closedir(dirp);
goto cleanup_send_file_list;
}
if (ISDOTDIR(dir->d_name) || ISDOTDOTDIR(dir->d_name))
continue;
@@ -3524,8 +3524,10 @@ send_file_list(const char *whichf)
if (dout == NULL) {
dout = dataconn("file list", (off_t)-1,
"w");
if (dout == NULL)
if (dout == NULL) {
(void) closedir(dirp);
goto cleanup_send_file_list;
}
transflag = 1;
}
p = nbuf;
@@ -3672,7 +3674,6 @@ logxfer(const char *command, off_t bytes, const char *file1, const char *file2,
}
}
#if !defined(__minix)
/*
* Log the resource usage.
*
@@ -3697,7 +3698,6 @@ logrusage(const struct rusage *rusage_before,
rusage_after->ru_majflt - rusage_before->ru_majflt,
rusage_after->ru_nswap - rusage_before->ru_nswap);
}
#endif /* !defined(__minix) */
/*
* Determine if `password' is valid for user given in `pw'.

View File

@@ -1,4 +1,4 @@
/* $NetBSD: logwtmp.c,v 1.25 2006/09/23 16:03:50 xtraeme Exp $ */
/* $NetBSD: logwtmp.c,v 1.27 2015/08/09 20:34:24 shm Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: logwtmp.c,v 1.25 2006/09/23 16:03:50 xtraeme Exp $");
__RCSID("$NetBSD: logwtmp.c,v 1.27 2015/08/09 20:34:24 shm Exp $");
#endif
#endif /* not lint */
@@ -124,13 +124,12 @@ ftpd_logwtmpx(const char *line, const char *name, const char *host,
if (fdx < 0)
return;
if (fstat(fdx, &buf) == 0) {
(void)memset(&ut, 0, sizeof(ut));
(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
(void)strncpy(ut.ut_name, name, sizeof(ut.ut_name));
(void)strncpy(ut.ut_host, host, sizeof(ut.ut_host));
if (haddr)
(void)memcpy(&ut.ut_ss, &haddr->si_su, haddr->su_len);
else
(void)memset(&ut.ut_ss, 0, sizeof(ut.ut_ss));
ut.ut_type = utx_type;
if (WIFEXITED(status))
ut.ut_exit.e_exit = (uint16_t)WEXITSTATUS(status);

24
libexec/ftpd/pfilter.c Normal file
View File

@@ -0,0 +1,24 @@
#include <stdio.h>
#include <blacklist.h>
#include "pfilter.h"
static struct blacklist *blstate;
void
pfilter_open(void)
{
if (blstate == NULL)
blstate = blacklist_open();
}
void
pfilter_notify(int what, const char *msg)
{
pfilter_open();
if (blstate == NULL)
return;
blacklist_r(blstate, what, 0, msg);
}

2
libexec/ftpd/pfilter.h Normal file
View File

@@ -0,0 +1,2 @@
void pfilter_open(void);
void pfilter_notify(int, const char *);