CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Tue Jan 29 11:11:56 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: fnmatch.c fts_open.c glob.c strmode.c strsuftollx.c Log Message: fix __RCSIDs back to escaped upstream versions To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 othersrc/libexec/tnftpd/libnetbsd/fnmatch.c cvs rdiff -u -r1.13 -r1.14 othersrc/libexec/tnftpd/libnetbsd/fts_open.c cvs rdiff -u -r1.7 -r1.8 othersrc/libexec/tnftpd/libnetbsd/glob.c cvs rdiff -u -r1.4 -r1.5 othersrc/libexec/tnftpd/libnetbsd/strmode.c cvs rdiff -u -r1.6 -r1.7 othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/fnmatch.c diff -u othersrc/libexec/tnftpd/libnetbsd/fnmatch.c:1.5 othersrc/libexec/tnftpd/libnetbsd/fnmatch.c:1.6 --- othersrc/libexec/tnftpd/libnetbsd/fnmatch.c:1.5 Thu Jan 24 02:57:10 2019 +++ othersrc/libexec/tnftpd/libnetbsd/fnmatch.c Tue Jan 29 11:11:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fnmatch.c,v 1.5 2019/01/24 02:57:10 lukem Exp $ */ +/* $NetBSD: fnmatch.c,v 1.6 2019/01/29 11:11:56 lukem Exp $ */ /* from NetBSD: fnmatch.c,v 1.26 2014/10/12 22:32:33 christos Exp */ /* @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; #else -__RCSID("$NetBSD: fnmatch.c,v 1.5 2019/01/24 02:57:10 lukem Exp $"); +__RCSID(" NetBSD: fnmatch.c,v 1.26 2014/10/12 22:32:33 christos Exp "); #endif #endif /* LIBC_SCCS and not lint */ Index: othersrc/libexec/tnftpd/libnetbsd/fts_open.c diff -u othersrc/libexec/tnftpd/libnetbsd/fts_open.c:1.13 othersrc/libexec/tnftpd/libnetbsd/fts_open.c:1.14 --- othersrc/libexec/tnftpd/libnetbsd/fts_open.c:1.13 Thu Jan 24 02:52:48 2019 +++ othersrc/libexec/tnftpd/libnetbsd/fts_open.c Tue Jan 29 11:11:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fts_open.c,v 1.13 2019/01/24 02:52:48 lukem Exp $ */ +/* $NetBSD: fts_open.c,v 1.14 2019/01/29 11:11:56 lukem Exp $ */ /* from NetBSD: fts.c,v 1.49 2016/05/31 07:49:09 pgoyette Exp */ /*- @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #else -__RCSID("$NetBSD: fts_open.c,v 1.13 2019/01/24 02:52:48 lukem Exp $"); +__RCSID(" NetBSD: fts.c,v 1.49 2016/05/31 07:49:09 pgoyette Exp "); #endif #endif /* LIBC_SCCS and not lint */ Index: othersrc/libexec/tnftpd/libnetbsd/glob.c diff -u othersrc/libexec/tnftpd/libnetbsd/glob.c:1.7 othersrc/libexec/tnftpd/libnetbsd/glob.c:1.8 --- othersrc/libexec/tnftpd/libnetbsd/glob.c:1.7 Thu Jan 24 04:25:23 2019 +++ othersrc/libexec/tnftpd/libnetbsd/glob.c Tue Jan 29 11:11:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: glob.c,v 1.7 2019/01/24 04:25:23 lukem Exp $ */ +/* $NetBSD: glob.c,v 1.8 2019/01/29 11:11:56 lukem Exp $ */ /* from: NetBSD: glob.c,v 1.38 2017/05/08 14:42:16 christos Exp */ /* @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; #else -__RCSID("$NetBSD: glob.c,v 1.7 2019/01/24 04:25:23 lukem Exp $"); +__RCSID(" NetBSD: glob.c,v 1.38 2017/05/08 14:42:16 christos Exp "); #endif #endif /* LIBC_SCCS and not lint */ Index: othersrc/libexec/tnftpd/libnetbsd/strmode.c diff -u othersrc/libexec/tnftpd/libnetbsd/strmode.c:1.4 othersrc/libexec/tnftpd/libnetbsd/strmode.c:1.5 --- othersrc/libexec/tnftpd/libnetbsd/strmode.c:1.4 Tue Jan 29 07:57:17 2019 +++ othersrc/libexec/tnftpd/libnetbsd/strmode.c Tue Jan 29 11:11:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: strmode.c,v 1.4 2019/01/29 07:57:17 lukem Exp $ */ +/* $NetBSD: strmode.c,v 1.5 2019/01/29 11:11:56 lukem Exp $ */ /* from NetBSD: strmode.c,v 1.19 2012/06/25 22:32:46 abs Exp */ /*- @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)strmode.c 8.3 (Berkeley) 8/15/94"; #else -__RCSID("$NetBSD: strmode.c,v 1.4 2019/01/29 07:57:17 lukem Exp $"); +__RCSID(" NetBSD: strmode.c,v 1.19 2012/06/25 22:32:46 abs Exp "); #endif #endif /* LIBC_SCCS and not lint */ Index: othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c diff -u othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c:1.6 othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c:1.7 --- othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c:1.6 Tue Jan 29 08:25:50 2019 +++ othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c Tue Jan 29 11:11:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: strsuftollx.c,v 1.6 2019/01/29 08:25:50 lukem Exp $ */ +/* $NetBSD: strsuftollx.c,v 1.7 2019/01/29 11:11:56 lukem Exp $ */ /* from NetBSD: strsuftoll.c,v 1.9 2011/10/22 22:08:47 christos Exp */ /*- @@ -73,7 +73,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: strsuftollx.c,v 1.6 2019/01/29 08:25:50 lukem Exp $"); +__RCSID(" NetBSD: strsuftoll.c,v 1.9 2011/10/22 22:08:47 christos Exp "); #endif /* LIBC_SCCS and not lint */ #ifdef _LIBC
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Tue Jan 29 08:25:50 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: strsuftollx.c Log Message: sync to NetBSD strsuftoll.c 1.9 Update from NetBSD src/lib/libc/stdlib/strsuftoll.c 1.1 to 1.9. Notable changes: - Minimize changes from upstream NetBSD source - 1.5: print max rather than min when number parsed is greater than max. - 1.6: explicitly use base 10, to match comments and dd - 1.9: Put a recursion limit to avoid DoS attacks (Maksymilian Arciemowicz). To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c diff -u othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c:1.5 othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c:1.6 --- othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c:1.5 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/strsuftollx.c Tue Jan 29 08:25:50 2019 @@ -1,8 +1,8 @@ -/* $NetBSD: strsuftollx.c,v 1.5 2008/09/21 16:35:25 lukem Exp $ */ -/* from NetBSD: strsuftoll.c,v 1.1 2002/11/29 12:58:17 lukem Exp */ +/* $NetBSD: strsuftollx.c,v 1.6 2019/01/29 08:25:50 lukem Exp $ */ +/* from NetBSD: strsuftoll.c,v 1.9 2011/10/22 22:08:47 christos Exp */ /*- - * Copyright (c) 2001-2002 The NetBSD Foundation, Inc. + * Copyright (c) 2001-2002,2004 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -64,34 +64,110 @@ #include "tnftpd.h" +#if 0 + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: strsuftollx.c,v 1.6 2019/01/29 08:25:50 lukem Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#ifdef _LIBC +#include "namespace.h" +#endif + +#endif + +#if !HAVE_STRSUFTOLL + +#if 0 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _LIBC +# ifdef __weak_alias +__weak_alias(strsuftoll, _strsuftoll) +__weak_alias(strsuftollx, _strsuftollx) +# endif +#endif /* LIBC */ + +#endif + /* * Convert an expression of the following forms to a (u)int64_t. * 1) A positive decimal number. * 2) A positive decimal number followed by a b (mult by 512). * 3) A positive decimal number followed by a k (mult by 1024). * 4) A positive decimal number followed by a m (mult by 1048576). - * 5) A positive decimal number followed by a w (mult by sizeof int) - * 6) Two or more positive decimal numbers (with/without k,b or w). + * 5) A positive decimal number followed by a g (mult by 1073741824). + * 6) A positive decimal number followed by a t (mult by 1099511627776). + * 7) A positive decimal number followed by a w (mult by sizeof int) + * 8) Two or more positive decimal numbers (with/without k,b or w). * separated by x (also * for backwards compatibility), specifying * the product of the indicated values. - * Returns the result upon successful conversion, or returns with 0 - * and sets ebuf to an appropriate error message. + * Returns the result upon successful conversion, or exits with an + * appropriate error. + * */ + +#if 0 + /* LONGLONG */ long long -strsuftollx(const char *desc, const char *val, -long long min, long long max, char *ebuf, size_t ebuflen) +strsuftoll(const char *desc, const char *val, +long long min, long long max) +{ + long long result; + char errbuf[100]; + + result = strsuftollx(desc, val, min, max, errbuf, sizeof(errbuf)); + if (*errbuf != '\0') + errx(EXIT_FAILURE, "%s", errbuf); + return result; +} + +#endif + +/* + * As strsuftoll(), but returns the error message into the provided buffer + * rather than exiting with it. + */ +/* LONGLONG */ +static long long +__strsuftollx(const char *desc, const char *val, +long long min, long long max, char *ebuf, size_t ebuflen, size_t depth) { long long num, t; char *expr; - errno = 0; - ebuf[0] = '\0'; + _DIAGASSERT(desc != NULL); + _DIAGASSERT(val != NULL); + _DIAGASSERT(ebuf != NULL); + + if (depth > 16) { + snprintf(ebuf, ebuflen, "%s: Recursion limit exceeded", desc); + return 0; + } while (isspace((unsigned char)*val)) /* Skip leading space */ val++; - num = strtoll(val, , 0); + errno = 0; + num = strtoll(val, , 10); if (errno == ERANGE) goto erange; /* Overflow */ @@ -108,28 +184,28 @@ strsuftollx(const char *desc, const char break; case 'k': t = num; - num *= 1024; /* 1 kilobyte */ + num *= 1024; /* 1 kibibyte */ if (t > num) goto erange; ++expr; break; case 'm': t = num; - num *= 1048576; /* 1 megabyte */ + num *= 1048576; /* 1 mebibyte */ if (t > num) goto erange; ++expr; break; case 'g': t = num; - num *= 1073741824; /* 1 gigabyte */ + num *= 1073741824; /* 1
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Tue Jan 29 07:57:17 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: strmode.c Log Message: sync to NetBSD strmode.c 1.19 Update from NetBSD src/lib/libc/string/strmode.c 1.11 to 1.19: - Minimize changes from upstream NetBSD source. - 1.14: Conditionally support S_IFDOOR. - 1.15: Move UCB-licensed code from 4-clause to 3-clause licence. [already done] - 1.16: Conditionally support S_IFSOCK. - 1.19: ANSI definitions. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/libexec/tnftpd/libnetbsd/strmode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/strmode.c diff -u othersrc/libexec/tnftpd/libnetbsd/strmode.c:1.3 othersrc/libexec/tnftpd/libnetbsd/strmode.c:1.4 --- othersrc/libexec/tnftpd/libnetbsd/strmode.c:1.3 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/strmode.c Tue Jan 29 07:57:17 2019 @@ -1,5 +1,5 @@ -/* $NetBSD: strmode.c,v 1.3 2008/09/21 16:35:25 lukem Exp $ */ -/* from NetBSD: strmode.c,v 1.11 1999/09/20 04:39:47 lukem Exp */ +/* $NetBSD: strmode.c,v 1.4 2019/01/29 07:57:17 lukem Exp $ */ +/* from NetBSD: strmode.c,v 1.19 2012/06/25 22:32:46 abs Exp */ /*- * Copyright (c) 1990, 1993 @@ -32,12 +32,37 @@ #include "tnftpd.h" +#if 0 + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)strmode.c 8.3 (Berkeley) 8/15/94"; +#else +__RCSID("$NetBSD: strmode.c,v 1.4 2019/01/29 07:57:17 lukem Exp $"); +#endif +#endif /* LIBC_SCCS and not lint */ + +#include "namespace.h" +#include +#include + +#include +#include + +#endif + +#if !HAVE_STRMODE void -strmode(mode, p) - mode_t mode; - char *p; +strmode(mode_t mode, char *p) { + _DIAGASSERT(p != NULL); + /* print type */ switch (mode & S_IFMT) { case S_IFDIR: /* directory */ @@ -65,9 +90,11 @@ strmode(mode, p) case S_IFLNK: /* symbolic link */ *p++ = 'l'; break; +#ifdef S_IFSOCK case S_IFSOCK: /* socket */ *p++ = 's'; break; +#endif #ifdef S_IFIFO case S_IFIFO: /* fifo */ *p++ = 'p'; @@ -78,6 +105,11 @@ strmode(mode, p) *p++ = 'w'; break; #endif +#ifdef S_IFDOOR + case S_IFDOOR: /* door */ + *p++ = 'D'; + break; +#endif default: /* unknown */ *p++ = '?'; break; @@ -154,3 +186,4 @@ strmode(mode, p) *p++ = ' '; /* will be a '+' if ACL's implemented */ *p = '\0'; } +#endif /* !HAVE_STRMODE */
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Tue Jan 29 07:44:36 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: strlcpy.c Log Message: strlcpy.c: fix copyright Fix copyright per NetBSD src/lib/libc/string/Attic/strlcpy.c rev 1.14 by removing duplicate copy of Todd Miller's copyright statement. Confirmed against OpenBSD src/lib/libc/string/strlcpy.c rev 1.7 per the OpenBSD RCSID in the comment. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/libexec/tnftpd/libnetbsd/strlcpy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/strlcpy.c diff -u othersrc/libexec/tnftpd/libnetbsd/strlcpy.c:1.3 othersrc/libexec/tnftpd/libnetbsd/strlcpy.c:1.4 --- othersrc/libexec/tnftpd/libnetbsd/strlcpy.c:1.3 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/strlcpy.c Tue Jan 29 07:44:36 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: strlcpy.c,v 1.3 2008/09/21 16:35:25 lukem Exp $ */ +/* $NetBSD: strlcpy.c,v 1.4 2019/01/29 07:44:36 lukem Exp $ */ /* from NetBSD: strlcpy.c,v 1.14 2003/10/27 00:12:42 lukem Exp */ /* from OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp */ @@ -18,33 +18,6 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* - * Copyright (c) 1998 Todd C. Miller - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - *notice, this list of conditions and the following disclaimer. - * 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. The name of the author may not be used to endorse or promote products - *derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include "tnftpd.h" /*
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Thu Jan 24 04:27:39 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: fparseln.c Log Message: remove obsolete rcsid To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/libexec/tnftpd/libnetbsd/fparseln.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/fparseln.c diff -u othersrc/libexec/tnftpd/libnetbsd/fparseln.c:1.3 othersrc/libexec/tnftpd/libnetbsd/fparseln.c:1.4 --- othersrc/libexec/tnftpd/libnetbsd/fparseln.c:1.3 Wed Jan 23 05:34:09 2019 +++ othersrc/libexec/tnftpd/libnetbsd/fparseln.c Thu Jan 24 04:27:39 2019 @@ -1,5 +1,4 @@ -/* $NetBSD: fparseln.c,v 1.3 2019/01/23 05:34:09 lukem Exp $ */ -/* from NetBSD: fparseln.c,v 1.5 1997/12/01 02:58:41 lukem Exp */ +/* $NetBSD: fparseln.c,v 1.4 2019/01/24 04:27:39 lukem Exp $ */ /* from NetBSD: fparseln.c,v 1.10 2009/10/21 01:07:45 snj Exp */ /*
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Thu Jan 24 04:25:23 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: glob.c Log Message: sync to NetBSD glob.c 1.38 Update from NetBSD src/lib/libc/gen/glob.c 1.34 to 1.38: - Minimize changes from upstream NetBSD source. - 1.35: Use unsigned foo not u_FOO. [Already done] - 1.36: Bump the glob limits to 512KB for total string size and 64K path entries. The old limits were too small for some important FTP use cases like a pkgsrc repository. - 1.37: Switch from a recursive pattern matching algorithm to handle '*' to a backtracking one. Avoids DoS attacks with patterns "a*a*a*a*a*...b" matching against "..." https://research.swtch.com/glob - 1.38: Use the symbolic M_ALL and trim with M_MASK. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 othersrc/libexec/tnftpd/libnetbsd/glob.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/glob.c diff -u othersrc/libexec/tnftpd/libnetbsd/glob.c:1.6 othersrc/libexec/tnftpd/libnetbsd/glob.c:1.7 --- othersrc/libexec/tnftpd/libnetbsd/glob.c:1.6 Wed Mar 20 08:54:53 2013 +++ othersrc/libexec/tnftpd/libnetbsd/glob.c Thu Jan 24 04:25:23 2019 @@ -1,5 +1,5 @@ -/* $NetBSD: glob.c,v 1.6 2013/03/20 08:54:53 lukem Exp $ */ -/* from: NetBSD: glob.c,v 1.34 2013/02/21 18:17:43 christos Exp */ +/* $NetBSD: glob.c,v 1.7 2019/01/24 04:25:23 lukem Exp $ */ +/* from: NetBSD: glob.c,v 1.38 2017/05/08 14:42:16 christos Exp */ /* * Copyright (c) 1989, 1993 @@ -33,6 +33,19 @@ * SUCH DAMAGE. */ +#if 0 + +#include +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; +#else +__RCSID("$NetBSD: glob.c,v 1.7 2019/01/24 04:25:23 lukem Exp $"); +#endif +#endif /* LIBC_SCCS and not lint */ + +#endif + /* * glob(3) -- a superset of the one defined in POSIX 1003.2. * @@ -61,8 +74,17 @@ #include "tnftpd.h" +#define NO_GETPW_R + +#undef TILDE /* XXX: AIX 4.1.5 has this in */ + +#ifndef __UNCONST +#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#endif + #if 0 +#include "namespace.h" #include #include @@ -70,6 +92,7 @@ #include #include #include +#include #include #include #include @@ -77,13 +100,15 @@ #include #include +#ifdef HAVE_NBTOOL_CONFIG_H +#define NO_GETPW_R #endif -#define NO_GETPW_R +#endif -#define GLOB_LIMIT_STRING 65536 /* number of readdirs */ +#define GLOB_LIMIT_STRING 524288 /* number of readdirs */ #define GLOB_LIMIT_STAT 128 /* number of stat system calls */ -#define GLOB_LIMIT_READDIR 16384 /* total buffer size of path strings */ +#define GLOB_LIMIT_READDIR 65536 /* total buffer size of path strings */ #define GLOB_LIMIT_PATH 1024 /* number of path elements */ #define GLOB_LIMIT_BRACE 128 /* Number of brace calls */ @@ -94,17 +119,12 @@ struct glob_limit { size_t l_brace; }; -#undef TILDE /* XXX: AIX 4.1.5 has this in */ - /* * XXX: For NetBSD 1.4.x compatibility. (kill me l8r) */ #ifndef _DIAGASSERT #define _DIAGASSERT(a) #endif -#ifndef __UNCONST -#define __UNCONST(a) ((void *)(unsigned long)(a)) -#endif #define DOLLAR '$' #define DOT '.' @@ -935,39 +955,45 @@ nospace: /* - * pattern matching function for filenames. Each occurrence of the * - * pattern causes a recursion level. + * pattern matching function for filenames. */ static int match(const Char *name, const Char *pat, const Char *patend) { int ok, negate_range; Char c, k; + const Char *patNext, *nameNext, *nameStart, *nameEnd; _DIAGASSERT(name != NULL); _DIAGASSERT(pat != NULL); _DIAGASSERT(patend != NULL); - - while (pat < patend) { - c = *pat++; + patNext = pat; + nameStart = nameNext = name; + nameEnd = NULL; + + while (pat < patend || *name) { + c = *pat; + if (*name == EOS) + nameEnd = name; switch (c & M_MASK) { case M_ALL: - while (pat < patend && (*pat & M_MASK) == M_ALL) -pat++; /* eat consecutive '*' */ - if (pat == patend) -return 1; - for (; !match(name, pat, patend); name++) -if (*name == EOS) - return 0; - return 1; + while ((pat[1] & M_MASK) == M_ALL) pat++; + patNext = pat; + nameNext = name + 1; + pat++; + continue; case M_ONE: - if (*name++ == EOS) -return 0; - break; + if (*name == EOS) +break; + pat++; + name++; + continue; case M_SET: ok = 0; - if ((k = *name++) == EOS) -return 0; + if ((k = *name) == EOS) +break; + pat++; + name++; if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS) ++pat; while (((c = *pat++) & M_MASK) != M_END) @@ -978,15 +1004,24 @@ match(const Char *name, const Char *pat, } else if (c == k) ok = 1; if (ok == negate_range) -return 0; - break; +break; + continue; default: - if (*name++ != c) -return 0; - break; + if (*name != c)
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Thu Jan 24 02:57:10 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: fnmatch.c Log Message: fnmatch.c: minimise changes from NetBSD src To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 othersrc/libexec/tnftpd/libnetbsd/fnmatch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/fnmatch.c diff -u othersrc/libexec/tnftpd/libnetbsd/fnmatch.c:1.4 othersrc/libexec/tnftpd/libnetbsd/fnmatch.c:1.5 --- othersrc/libexec/tnftpd/libnetbsd/fnmatch.c:1.4 Wed Jan 23 05:13:48 2019 +++ othersrc/libexec/tnftpd/libnetbsd/fnmatch.c Thu Jan 24 02:57:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fnmatch.c,v 1.4 2019/01/23 05:13:48 lukem Exp $ */ +/* $NetBSD: fnmatch.c,v 1.5 2019/01/24 02:57:10 lukem Exp $ */ /* from NetBSD: fnmatch.c,v 1.26 2014/10/12 22:32:33 christos Exp */ /* @@ -35,11 +35,35 @@ #include "tnftpd.h" +#if 0 + +#include +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; +#else +__RCSID("$NetBSD: fnmatch.c,v 1.5 2019/01/24 02:57:10 lukem Exp $"); +#endif +#endif /* LIBC_SCCS and not lint */ + /* * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6. * Compares a filename or pathname to a pattern. */ +#include "namespace.h" + +#include +#include +#include +#include + +#ifdef __weak_alias +__weak_alias(fnmatch,_fnmatch) +#endif + +#endif + #define EOS '\0' static inline int @@ -59,6 +83,8 @@ rangematch(const char *pattern, int test int negate, ok, need; char c, c2; + _DIAGASSERT(pattern != NULL); + /* * A bracket expression starting with an unquoted circumflex * character produces unspecified results (IEEE 1003.2-1992, @@ -101,6 +127,9 @@ fnmatchx(const char *pattern, const char const char *stringstart, *r; char c, test; + _DIAGASSERT(pattern != NULL); + _DIAGASSERT(string != NULL); + if (recursion-- == 0) return FNM_NORES;
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Thu Jan 24 02:52:48 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: ftpfts.h fts_open.c Log Message: sync to fts.c 1.49, fts.h 1.19 Update from NetBSD src/lib/libc/gen/fts.c 1.38 to 1.49. Update from NetBSD src/include/fts.h 1.18 to 1.19. Notable changes: - Minimize changes from upstream NetBSD methods. - Bump fts_level from short to int to avoid a potential DoS. - Make sure fts_statp is NULL when FTS_NOSTAT is set. - Use [non-standard] O_CLOEXEC instead of fcntl(FD_CLOEXEC). - Avoid potential integer overflow. - Fix double free in fts_read()/fts_close(). - Use calloc(1, ...) instead of malloc(...) & memset. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 othersrc/libexec/tnftpd/libnetbsd/ftpfts.h cvs rdiff -u -r1.12 -r1.13 othersrc/libexec/tnftpd/libnetbsd/fts_open.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/ftpfts.h diff -u othersrc/libexec/tnftpd/libnetbsd/ftpfts.h:1.8 othersrc/libexec/tnftpd/libnetbsd/ftpfts.h:1.9 --- othersrc/libexec/tnftpd/libnetbsd/ftpfts.h:1.8 Sun Mar 1 02:50:11 2009 +++ othersrc/libexec/tnftpd/libnetbsd/ftpfts.h Thu Jan 24 02:52:48 2019 @@ -1,5 +1,5 @@ -/* $NetBSD: ftpfts.h,v 1.8 2009/03/01 02:50:11 lukem Exp $ */ -/* from NetBSD: fts.h,v 1.18 2009/01/11 03:04:12 christos Exp */ +/* $NetBSD: ftpfts.h,v 1.9 2019/01/24 02:52:48 lukem Exp $ */ +/* from NetBSD: fts.h,v 1.19 2009/08/16 19:33:38 christos Exp */ /* * Copyright (c) 1989, 1993 @@ -53,6 +53,9 @@ #ifndef __fts_dev_t #define __fts_dev_t dev_t #endif +#ifndef __fts_level_t +#define __fts_level_t int +#endif typedef struct { struct _ftsent *fts_cur; /* current node */ @@ -64,7 +67,7 @@ typedef struct { unsigned int fts_pathlen; /* sizeof(path) */ unsigned int fts_nitems; /* elements in the sort array */ int (*fts_compar) /* compare function */ - (const struct _ftsent **, const struct _ftsent **); + (const struct _ftsent **, const struct _ftsent **); #define FTS_COMFOLLOW 0x001 /* follow command line symlinks */ #define FTS_LOGICAL 0x002 /* logical walk */ @@ -100,7 +103,7 @@ typedef struct _ftsent { #define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTLEVEL 0 - short fts_level; /* depth (-1 to N) */ + __fts_level_t fts_level; /* depth (-1 to N) */ #define FTS_D 1 /* preorder directory */ #define FTS_DC 2 /* directory that causes cycles */ Index: othersrc/libexec/tnftpd/libnetbsd/fts_open.c diff -u othersrc/libexec/tnftpd/libnetbsd/fts_open.c:1.12 othersrc/libexec/tnftpd/libnetbsd/fts_open.c:1.13 --- othersrc/libexec/tnftpd/libnetbsd/fts_open.c:1.12 Sun Mar 1 03:23:00 2009 +++ othersrc/libexec/tnftpd/libnetbsd/fts_open.c Thu Jan 24 02:52:48 2019 @@ -1,5 +1,5 @@ -/* $NetBSD: fts_open.c,v 1.12 2009/03/01 03:23:00 lukem Exp $ */ -/* from NetBSD: fts.c,v 1.38 2009/02/28 14:34:18 pgoyette Exp */ +/* $NetBSD: fts_open.c,v 1.13 2019/01/24 02:52:48 lukem Exp $ */ +/* from NetBSD: fts.c,v 1.49 2016/05/31 07:49:09 pgoyette Exp */ /*- * Copyright (c) 1990, 1993, 1994 @@ -32,6 +32,40 @@ #include "tnftpd.h" +#if 0 + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; +#else +__RCSID("$NetBSD: fts_open.c,v 1.13 2019/01/24 02:52:48 lukem Exp $"); +#endif +#endif /* LIBC_SCCS and not lint */ + +#include "namespace.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#if ! HAVE_NBTOOL_CONFIG_H +#define HAVE_STRUCT_DIRENT_D_NAMLEN +#endif + +#endif + static FTSENT *fts_alloc(FTS *, const char *, size_t); static FTSENT *fts_build(FTS *, int); static void fts_free(FTSENT *); @@ -42,9 +76,9 @@ static size_t fts_pow2(size_t); static int fts_palloc(FTS *, size_t); static void fts_padjust(FTS *, FTSENT *); static FTSENT *fts_sort(FTS *, FTSENT *, size_t); -static unsigned short fts_stat(FTS *, FTSENT *, int); +static unsigned short fts_stat(FTS *, FTSENT *, int); static int fts_safe_changedir(const FTS *, const FTSENT *, int, - const char *); +const char *); #if defined(ALIGNBYTES) && defined(ALIGN) #define FTS_ALLOC_ALIGNED 1 @@ -52,6 +86,23 @@ static int fts_safe_changedir(const FTS #undef FTS_ALLOC_ALIGNED #endif +#ifndef ftsent_namelen_truncate +#define ftsent_namelen_truncate(a) \ +((a) > UINT_MAX ? UINT_MAX : (unsigned int)(a)) +#endif +#ifndef ftsent_pathlen_truncate +#define ftsent_pathlen_truncate(a) \ +((a) > UINT_MAX ? UINT_MAX : (unsigned int)(a)) +#endif +#ifndef fts_pathlen_truncate +#define fts_pathlen_truncate(a) \ +((a) > UINT_MAX ? UINT_MAX : (unsigned int)(a)) +#endif +#ifndef fts_nitems_truncate +#define fts_nitems_truncate(a) \ +((a) > UINT_MAX ? UINT_MAX : (unsigned int)(a)) +#endif + #define ISDOT(a) (a[0]
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Wed Jan 23 05:34:09 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: fparseln.c Log Message: sync to fparseln.c 1.10 Update from NetBSD src/lib/libc/stdio/fparseln.c 1.5 to 1.10: - Don't report spurious empty lines eg after 2 comment lines, or on EOF after a single comment line. - No escape character means no escaped characters. - Remove 3rd and 4th clauses in christos' license. OK christos. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/libexec/tnftpd/libnetbsd/fparseln.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/fparseln.c diff -u othersrc/libexec/tnftpd/libnetbsd/fparseln.c:1.2 othersrc/libexec/tnftpd/libnetbsd/fparseln.c:1.3 --- othersrc/libexec/tnftpd/libnetbsd/fparseln.c:1.2 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/fparseln.c Wed Jan 23 05:34:09 2019 @@ -1,5 +1,6 @@ -/* $NetBSD: fparseln.c,v 1.2 2008/09/21 16:35:25 lukem Exp $ */ +/* $NetBSD: fparseln.c,v 1.3 2019/01/23 05:34:09 lukem Exp $ */ /* from NetBSD: fparseln.c,v 1.5 1997/12/01 02:58:41 lukem Exp */ +/* from NetBSD: fparseln.c,v 1.10 2009/10/21 01:07:45 snj Exp */ /* * Copyright (c) 1997 Christos Zoulas. All rights reserved. @@ -12,11 +13,6 @@ * 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 Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - *derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -46,7 +42,7 @@ isescaped(const char *sp, const char *p, /* No escape character */ if (esc == '\0') - return 1; + return 0; /* Count the number of escape characters that precede ours */ for (ne = 0, cp = p; --cp >= sp && *cp == esc; ne++) @@ -118,13 +114,19 @@ fparseln(FILE *fp, size_t *size, size_t cp = [s - 1]; if (*cp == con && !isescaped(ptr, cp, esc)) { -s--; /* forget escape */ +s--; /* forget continuation char */ cnt = 1; } } - if (s == 0 && buf != NULL) - continue; + if (s == 0) { + /* + * nothing to add, skip realloc except in case + * we need a minimal buf to return an empty line + */ + if (cnt || buf != NULL) +continue; + } if ((cp = realloc(buf, len + s + 1)) == NULL) { free(buf); @@ -175,10 +177,10 @@ fparseln(FILE *fp, size_t *size, size_t #ifdef TEST -int main(int, char *[]); +int main(int, char **); int -main(int argc, char *argv[]) +main(int argc, char **argv) { char *ptr; size_t size, line;
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Wed Jan 23 05:20:01 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: err.c Log Message: Remove the 3rd clause from my BSD-derived license. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 othersrc/libexec/tnftpd/libnetbsd/err.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/err.c diff -u othersrc/libexec/tnftpd/libnetbsd/err.c:1.4 othersrc/libexec/tnftpd/libnetbsd/err.c:1.5 --- othersrc/libexec/tnftpd/libnetbsd/err.c:1.4 Wed Jan 23 02:44:57 2019 +++ othersrc/libexec/tnftpd/libnetbsd/err.c Wed Jan 23 05:20:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.4 2019/01/23 02:44:57 lukem Exp $ */ +/* $NetBSD: err.c,v 1.5 2019/01/23 05:20:01 lukem Exp $ */ /* * Copyright 1997-2002 Luke Mewburn . @@ -12,8 +12,6 @@ * 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. The name of the author may not be used to endorse or promote products - *derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Wed Jan 23 05:13:48 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: fnmatch.c ftpfnmatch.h Log Message: sync to fnmatch.c 1.26, fnmatch.h Update from NetBSD src/lib/libc/gen/fnmatch.c 1.18 to 1.26. Update from NetBSD src/include/fnmatch.h 1.8 to 1.13. Notable changes: - Implement FNM_LEADING_DIR. - Limit recursions to avoid DoS attacks. From Maksymilian Arciemowicz. - Treat a backslash followed by NUL as NUL. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/libexec/tnftpd/libnetbsd/fnmatch.c \ othersrc/libexec/tnftpd/libnetbsd/ftpfnmatch.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/fnmatch.c diff -u othersrc/libexec/tnftpd/libnetbsd/fnmatch.c:1.3 othersrc/libexec/tnftpd/libnetbsd/fnmatch.c:1.4 --- othersrc/libexec/tnftpd/libnetbsd/fnmatch.c:1.3 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/fnmatch.c Wed Jan 23 05:13:48 2019 @@ -1,5 +1,5 @@ -/* $NetBSD: fnmatch.c,v 1.3 2008/09/21 16:35:25 lukem Exp $ */ -/* from NetBSD: fnmatch.c,v 1.18 2000/06/28 01:13:36 thorpej Exp */ +/* $NetBSD: fnmatch.c,v 1.4 2019/01/23 05:13:48 lukem Exp $ */ +/* from NetBSD: fnmatch.c,v 1.26 2014/10/12 22:32:33 christos Exp */ /* * Copyright (c) 1989, 1993, 1994 @@ -42,38 +42,83 @@ #define EOS '\0' -static const char *rangematch(const char *, int, int); - -static int +static inline int foldcase(int ch, int flags) { if ((flags & FNM_CASEFOLD) != 0 && isupper(ch)) - return (tolower(ch)); - return (ch); + return tolower(ch); + return ch; } #define FOLDCASE(ch, flags) foldcase((unsigned char)(ch), (flags)) -int -fnmatch(const char *pattern, const char *string, int flags) +static const char * +rangematch(const char *pattern, int test, int flags) { - const char *stringstart; + int negate, ok, need; + char c, c2; + + /* + * A bracket expression starting with an unquoted circumflex + * character produces unspecified results (IEEE 1003.2-1992, + * 3.13.2). This implementation treats it like '!', for + * consistency with the regular expression syntax. + * J.T. Conklin (conk...@ngai.kaleida.com) + */ + if ((negate = (*pattern == '!' || *pattern == '^')) != 0) + ++pattern; + + need = 1; + for (ok = 0; (c = FOLDCASE(*pattern++, flags)) != ']' || need;) { + need = 0; + if (c == '/') + return (void *)-1; + if (c == '\\' && !(flags & FNM_NOESCAPE)) + c = FOLDCASE(*pattern++, flags); + if (c == EOS) + return NULL; + if (*pattern == '-' + && (c2 = FOLDCASE(*(pattern + 1), flags)) != EOS && + c2 != ']') { + pattern += 2; + if (c2 == '\\' && !(flags & FNM_NOESCAPE)) +c2 = FOLDCASE(*pattern++, flags); + if (c2 == EOS) +return NULL; + if (c <= test && test <= c2) +ok = 1; + } else if (c == test) + ok = 1; + } + return ok == negate ? NULL : pattern; +} + + +static int +fnmatchx(const char *pattern, const char *string, int flags, size_t recursion) +{ + const char *stringstart, *r; char c, test; - for (stringstart = string;;) + if (recursion-- == 0) + return FNM_NORES; + + for (stringstart = string;;) { switch (c = FOLDCASE(*pattern++, flags)) { case EOS: - return (*string == EOS ? 0 : FNM_NOMATCH); + if ((flags & FNM_LEADING_DIR) && *string == '/') +return 0; + return *string == EOS ? 0 : FNM_NOMATCH; case '?': if (*string == EOS) -return (FNM_NOMATCH); +return FNM_NOMATCH; if (*string == '/' && (flags & FNM_PATHNAME)) -return (FNM_NOMATCH); +return FNM_NOMATCH; if (*string == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) -return (FNM_NOMATCH); +return FNM_NOMATCH; ++string; break; case '*': @@ -85,91 +130,71 @@ fnmatch(const char *pattern, const char if (*string == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) -return (FNM_NOMATCH); +return FNM_NOMATCH; /* Optimize for pattern with * at end or before /. */ if (c == EOS) { if (flags & FNM_PATHNAME) - return (strchr(string, '/') == NULL ? - 0 : FNM_NOMATCH); + return (flags & FNM_LEADING_DIR) || + strchr(string, '/') == NULL ? + 0 : FNM_NOMATCH; else - return (0); + return 0; } else if (c == '/' && flags & FNM_PATHNAME) { if ((string = strchr(string, '/')) == NULL) - return (FNM_NOMATCH); + return FNM_NOMATCH; break; } /* General case, use recursion. */ while ((test = FOLDCASE(*string, flags)) != EOS) { -if (!fnmatch(pattern, string, - flags & ~FNM_PERIOD)) - return (0); +int e; +switch ((e = fnmatchx(pattern, string, +flags & ~FNM_PERIOD, recursion))) { +case FNM_NOMATCH: + break; +default: +
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Wed Jan 23 02:44:57 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: err.c Log Message: whitespace fixup consistent tab indenting, not a mix of spaces and tabs To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/libexec/tnftpd/libnetbsd/err.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/err.c diff -u othersrc/libexec/tnftpd/libnetbsd/err.c:1.3 othersrc/libexec/tnftpd/libnetbsd/err.c:1.4 --- othersrc/libexec/tnftpd/libnetbsd/err.c:1.3 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/err.c Wed Jan 23 02:44:57 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.3 2008/09/21 16:35:25 lukem Exp $ */ +/* $NetBSD: err.c,v 1.4 2019/01/23 02:44:57 lukem Exp $ */ /* * Copyright 1997-2002 Luke Mewburn . @@ -34,61 +34,61 @@ extern char *__progname; void err(int eval, const char *fmt, ...) { - va_list ap; -int sverrno; + va_list ap; + int sverrno; sverrno = errno; -(void)fprintf(stderr, "%s: ", __progname); + (void)fprintf(stderr, "%s: ", __progname); va_start(ap, fmt); -if (fmt != NULL) { -(void)vfprintf(stderr, fmt, ap); -(void)fprintf(stderr, ": "); -} + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } va_end(ap); -(void)fprintf(stderr, "%s\n", strerror(sverrno)); -exit(eval); + (void)fprintf(stderr, "%s\n", strerror(sverrno)); + exit(eval); } void errx(int eval, const char *fmt, ...) { - va_list ap; + va_list ap; -(void)fprintf(stderr, "%s: ", __progname); + (void)fprintf(stderr, "%s: ", __progname); va_start(ap, fmt); -if (fmt != NULL) -(void)vfprintf(stderr, fmt, ap); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); va_end(ap); -(void)fprintf(stderr, "\n"); -exit(eval); + (void)fprintf(stderr, "\n"); + exit(eval); } void warn(const char *fmt, ...) { - va_list ap; -int sverrno; + va_list ap; + int sverrno; sverrno = errno; -(void)fprintf(stderr, "%s: ", __progname); + (void)fprintf(stderr, "%s: ", __progname); va_start(ap, fmt); -if (fmt != NULL) { -(void)vfprintf(stderr, fmt, ap); -(void)fprintf(stderr, ": "); -} + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } va_end(ap); -(void)fprintf(stderr, "%s\n", strerror(sverrno)); + (void)fprintf(stderr, "%s\n", strerror(sverrno)); } void warnx(const char *fmt, ...) { - va_list ap; + va_list ap; -(void)fprintf(stderr, "%s: ", __progname); + (void)fprintf(stderr, "%s: ", __progname); va_start(ap, fmt); -if (fmt != NULL) -(void)vfprintf(stderr, fmt, ap); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); va_end(ap); -(void)fprintf(stderr, "\n"); + (void)fprintf(stderr, "\n"); }
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Wed Jan 23 02:37:28 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: daemon.c Log Message: sync to daemon.c 1.10 Update to NetBSD src/lib/libc/gen/daemon.c 1.10 from 1.9: - Update old-style definitions to ANSI To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/libexec/tnftpd/libnetbsd/daemon.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/daemon.c diff -u othersrc/libexec/tnftpd/libnetbsd/daemon.c:1.3 othersrc/libexec/tnftpd/libnetbsd/daemon.c:1.4 --- othersrc/libexec/tnftpd/libnetbsd/daemon.c:1.3 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/daemon.c Wed Jan 23 02:37:28 2019 @@ -1,5 +1,5 @@ -/* $NetBSD: daemon.c,v 1.3 2008/09/21 16:35:25 lukem Exp $ */ -/* from NetBSD: daemon.c,v 1.9 2003/08/07 16:42:46 agc Exp */ +/* $NetBSD: daemon.c,v 1.4 2019/01/23 02:37:28 lukem Exp $ */ +/* from NetBSD: daemon.c,v 1.10 2012/06/25 22:32:43 abs Exp */ /*- * Copyright (c) 1990, 1993 @@ -33,8 +33,7 @@ #include "tnftpd.h" int -daemon(nochdir, noclose) - int nochdir, noclose; +daemon(int nochdir, int noclose) { int fd;
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Wed Jan 23 02:32:36 UTC 2019 Modified Files: othersrc/libexec/tnftpd/libnetbsd: arpa_ftp.h Log Message: sync to arpa/ftp.h 1.7 Update to NetBSD src/include/arpa/ftp.h revision 1.7 from revision 1.5: - 1.6: Move UCB-licensed code from 4-clause to 3-clause licence. [already done] - 1.7: Welcome to the constant age! To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/libexec/tnftpd/libnetbsd/arpa_ftp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/arpa_ftp.h diff -u othersrc/libexec/tnftpd/libnetbsd/arpa_ftp.h:1.3 othersrc/libexec/tnftpd/libnetbsd/arpa_ftp.h:1.4 --- othersrc/libexec/tnftpd/libnetbsd/arpa_ftp.h:1.3 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/arpa_ftp.h Wed Jan 23 02:32:36 2019 @@ -1,5 +1,5 @@ -/* $NetBSD: arpa_ftp.h,v 1.3 2008/09/21 16:35:25 lukem Exp $ */ -/* from NetBSD: ftp.h,v 1.5 1998/02/10 00:32:50 perry Exp */ +/* $NetBSD: arpa_ftp.h,v 1.4 2019/01/23 02:32:36 lukem Exp $ */ +/* from NetBSD: ftp.h,v 1.7 2017/01/12 18:42:53 christos Exp */ /* * Copyright (c) 1983, 1989, 1993 @@ -55,7 +55,7 @@ #define TYPE_L 4 /* local byte size */ #ifdef FTP_NAMES -char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; +const char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; #endif /* @@ -65,7 +65,7 @@ char *typenames[] = {"0", "ASCII", "EBC #define FORM_T 2 /* telnet format effectors */ #define FORM_C 3 /* carriage control (ASA) */ #ifdef FTP_NAMES -char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; +const char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; #endif /* @@ -75,7 +75,7 @@ char *formnames[] = {"0", "Nonprint", " #define STRU_R 2 /* record structure */ #define STRU_P 3 /* page structure */ #ifdef FTP_NAMES -char *strunames[] = {"0", "File", "Record", "Page" }; +const char *strunames[] = {"0", "File", "Record", "Page" }; #endif /* @@ -85,7 +85,7 @@ char *strunames[] = {"0", "File", "Reco #define MODE_B 2 /* block */ #define MODE_C 3 /* compressed */ #ifdef FTP_NAMES -char *modenames[] = {"0", "Stream", "Block", "Compressed" }; +const char *modenames[] = {"0", "Stream", "Block", "Compressed" }; #endif /*
CVS commit: othersrc/libexec/tnftpd/libnetbsd
Module Name:othersrc Committed By: lukem Date: Wed Mar 20 08:54:55 UTC 2013 Modified Files: othersrc/libexec/tnftpd/libnetbsd: ftpglob.h glob.c Log Message: sync to: othersrc/usr.bin/tnftp/libnetbsd/ftpglob.h 1.6 othersrc/usr.bin/tnftp/libnetbsd/glob.c 1.10 for: replace glob with newer copy that does not suffer from DoS exhaustion attacks. XXX: Needs more testing. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 othersrc/libexec/tnftpd/libnetbsd/ftpglob.h cvs rdiff -u -r1.5 -r1.6 othersrc/libexec/tnftpd/libnetbsd/glob.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/libexec/tnftpd/libnetbsd/ftpglob.h diff -u othersrc/libexec/tnftpd/libnetbsd/ftpglob.h:1.4 othersrc/libexec/tnftpd/libnetbsd/ftpglob.h:1.5 --- othersrc/libexec/tnftpd/libnetbsd/ftpglob.h:1.4 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/ftpglob.h Wed Mar 20 08:54:52 2013 @@ -1,5 +1,5 @@ -/* $NetBSD: ftpglob.h,v 1.4 2008/09/21 16:35:25 lukem Exp $ */ -/* from NetBSD: glob.h,v 1.21 2006/03/26 18:11:22 christos Exp */ +/* $NetBSD: ftpglob.h,v 1.5 2013/03/20 08:54:52 lukem Exp $ */ +/* from: NetBSD: glob.h,v 1.26 2010/09/06 14:38:56 christos Exp */ /* * Copyright (c) 1989, 1993 @@ -83,9 +83,13 @@ typedef struct { #define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ #define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ #define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ -#define GLOB_LIMIT 0x0400 /* Limit memory used by matches to ARG_MAX */ +#define GLOB_LIMIT 0x0400 /* Limit memory used by matches to ARG_MAX */ #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ -#define GLOB_QUOTE 0 /* source compatibility */ +/* GLOB_NOESCAPE 0x1000 above */ +#define GLOB_PERIOD 0x2000 /* Allow metachars to match leading periods. */ +#define GLOB_NO_DOTDIRS 0x4000 /* Make . and .. vanish from wildcards. */ +#define GLOB_STAR 0x8000 /* Use glob ** to recurse directories */ +#define GLOB_QUOTE 0 /* source compatibility */ #define GLOB_ABEND GLOB_ABORTED /* source compatibility */ Index: othersrc/libexec/tnftpd/libnetbsd/glob.c diff -u othersrc/libexec/tnftpd/libnetbsd/glob.c:1.5 othersrc/libexec/tnftpd/libnetbsd/glob.c:1.6 --- othersrc/libexec/tnftpd/libnetbsd/glob.c:1.5 Sun Sep 21 16:35:25 2008 +++ othersrc/libexec/tnftpd/libnetbsd/glob.c Wed Mar 20 08:54:53 2013 @@ -1,5 +1,5 @@ -/* $NetBSD: glob.c,v 1.5 2008/09/21 16:35:25 lukem Exp $ */ -/* from NetBSD: glob.c,v 1.16 2006/03/26 18:11:22 christos Exp */ +/* $NetBSD: glob.c,v 1.6 2013/03/20 08:54:53 lukem Exp $ */ +/* from: NetBSD: glob.c,v 1.34 2013/02/21 18:17:43 christos Exp */ /* * Copyright (c) 1989, 1993 @@ -51,14 +51,61 @@ * expand ~user/foo to the /home/dir/of/user/foo * GLOB_BRACE: * expand {1,2}{a,b} to 1a 1b 2a 2b + * GLOB_PERIOD: + * allow metacharacters to match leading dots in filenames. + * GLOB_NO_DOTDIRS: + * . and .. are hidden from wildcards, even if GLOB_PERIOD is set. * gl_matchc: * Number of matches in the current invocation of glob. */ #include tnftpd.h +#if 0 + +#include sys/param.h +#include sys/stat.h + +#include assert.h +#include ctype.h +#include dirent.h +#include errno.h +#include pwd.h +#include stdio.h +#include stddef.h +#include stdlib.h +#include string.h +#include unistd.h + +#endif + +#define NO_GETPW_R + +#define GLOB_LIMIT_STRING 65536 /* number of readdirs */ +#define GLOB_LIMIT_STAT 128 /* number of stat system calls */ +#define GLOB_LIMIT_READDIR 16384 /* total buffer size of path strings */ +#define GLOB_LIMIT_PATH 1024 /* number of path elements */ +#define GLOB_LIMIT_BRACE 128 /* Number of brace calls */ + +struct glob_limit { + size_t l_string; + size_t l_stat; + size_t l_readdir; + size_t l_brace; +}; + #undef TILDE /* XXX: AIX 4.1.5 has this in sys/ioctl.h */ +/* + * XXX: For NetBSD 1.4.x compatibility. (kill me l8r) + */ +#ifndef _DIAGASSERT +#define _DIAGASSERT(a) +#endif +#ifndef __UNCONST +#define __UNCONST(a) ((void *)(unsigned long)(a)) +#endif + #define DOLLAR '$' #define DOT '.' #define EOS '\0' @@ -111,31 +158,36 @@ typedef char Char; static int compare(const void *, const void *); static int g_Ctoc(const Char *, char *, size_t); -static int g_lstat(Char *, __gl_stat_t *, glob_t *); +static int g_lstat(Char *, __gl_stat_t *, glob_t *); static DIR *g_opendir(Char *, glob_t *); static Char *g_strchr(const Char *, int); static int g_stat(Char *, __gl_stat_t *, glob_t *); -static int glob0(const Char *, glob_t *); -static int glob1(Char *, glob_t *, size_t *); -static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *); -static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, - size_t *); -static int globextend(const Char *, glob_t *, size_t *); +static int glob0(const Char *, glob_t *, struct glob_limit *); +static int glob1(Char