Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jan 2003 17:57:35 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 23237 for review
Message-ID:  <200301060157.h061vZpW094544@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=23237

Change 23237 by marcel@marcel_vaio on 2003/01/05 17:57:04

	IFC @23235

Affected files ...

.. //depot/projects/ia64/contrib/lukemftpd/src/Makefile#1 branch
.. //depot/projects/ia64/contrib/lukemftpd/src/cmds.c#3 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/conf.c#3 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/extern.h#5 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/ftpcmd.y#3 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/ftpd.8#3 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/ftpd.c#3 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/ftpd.conf.5#4 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/ftpusers.5#4 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/logutmp.c#2 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/logwtmp.c#2 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/pathnames.h#2 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/popen.c#3 integrate
.. //depot/projects/ia64/contrib/lukemftpd/src/version.h#3 integrate
.. //depot/projects/ia64/etc/periodic/daily/470.status-named#4 integrate
.. //depot/projects/ia64/etc/periodic/security/800.loginfail#5 integrate
.. //depot/projects/ia64/etc/periodic/security/900.tcpwrap#3 integrate
.. //depot/projects/ia64/lib/Makefile#17 integrate
.. //depot/projects/ia64/lib/libc/net/gethostbynis.c#3 integrate
.. //depot/projects/ia64/lib/libc/sparc64/gen/_setjmp.S#5 integrate
.. //depot/projects/ia64/lib/libc/sparc64/gen/setjmp.S#4 integrate
.. //depot/projects/ia64/lib/libc/sparc64/gen/sigsetjmp.S#4 integrate
.. //depot/projects/ia64/lib/libc/stdlib/tdelete.c#5 integrate
.. //depot/projects/ia64/lib/libc/stdlib/tfind.c#4 integrate
.. //depot/projects/ia64/lib/libc/stdlib/tsearch.c#3 integrate
.. //depot/projects/ia64/lib/libc/stdlib/twalk.c#3 integrate
.. //depot/projects/ia64/lib/libc_r/arch/sparc64/_atomic_lock.S#1 branch
.. //depot/projects/ia64/lib/libc_r/uthread/pthread_private.h#15 integrate
.. //depot/projects/ia64/lib/libc_r/uthread/uthread_create.c#8 integrate
.. //depot/projects/ia64/lib/libc_r/uthread/uthread_init.c#9 integrate
.. //depot/projects/ia64/lib/libc_r/uthread/uthread_sig.c#8 integrate
.. //depot/projects/ia64/release/doc/en_US.ISO8859-1/hardware/common/dev.sgml#33 integrate
.. //depot/projects/ia64/release/doc/en_US.ISO8859-1/hardware/sparc64/Makefile#3 integrate
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/early-adopter/article.sgml#3 integrate
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/hardware/Makefile#2 integrate
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/hardware/common/hw.ent#2 integrate
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/hardware/i386/article.sgml#2 integrate
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/hardware/pc98/Makefile#1 branch
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/hardware/pc98/article.sgml#1 branch
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/hardware/pc98/proc-pc98.sgml#1 branch
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/hardware/sparc64/Makefile#2 integrate
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/hardware/sparc64/article.sgml#3 integrate
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/hardware/sparc64/proc-sparc64.sgml#1 branch
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/relnotes/Makefile#4 integrate
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/relnotes/i386/article.sgml#3 integrate
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/relnotes/ia64/Makefile#1 branch
.. //depot/projects/ia64/release/doc/ja_JP.eucJP/relnotes/ia64/article.sgml#1 branch
.. //depot/projects/ia64/sbin/ipfw/ipfw.8#15 integrate
.. //depot/projects/ia64/share/man/man4/Makefile#30 integrate
.. //depot/projects/ia64/share/man/man4/lmc.4#1 branch
.. //depot/projects/ia64/sys/dev/firewire/firewire.c#7 integrate
.. //depot/projects/ia64/sys/dev/firewire/firewire.h#4 integrate
.. //depot/projects/ia64/sys/dev/firewire/firewirereg.h#3 integrate
.. //depot/projects/ia64/sys/dev/firewire/fwohci.c#7 integrate
.. //depot/projects/ia64/sys/dev/firewire/fwohci_pci.c#8 integrate
.. //depot/projects/ia64/sys/dev/firewire/if_fwe.c#5 integrate
.. //depot/projects/ia64/sys/dev/firewire/sbp.c#8 integrate
.. //depot/projects/ia64/sys/dev/sab/sab.c#5 integrate
.. //depot/projects/ia64/sys/dev/sound/pcm/dsp.c#5 integrate
.. //depot/projects/ia64/sys/dev/wi/wi_hostap.c#13 integrate
.. //depot/projects/ia64/sys/fs/portalfs/portal_vnops.c#8 integrate
.. //depot/projects/ia64/sys/fs/specfs/spec_vnops.c#15 integrate
.. //depot/projects/ia64/sys/ia64/acpica/madt.c#13 integrate
.. //depot/projects/ia64/sys/ia64/conf/GENERIC#22 integrate
.. //depot/projects/ia64/sys/ia64/ia64/clock.c#14 integrate
.. //depot/projects/ia64/sys/ia64/ia64/interrupt.c#23 integrate
.. //depot/projects/ia64/sys/ia64/ia64/locore.s#11 integrate
.. //depot/projects/ia64/sys/ia64/ia64/mp_machdep.c#26 integrate
.. //depot/projects/ia64/sys/ia64/ia64/sapic.c#19 integrate
.. //depot/projects/ia64/sys/ia64/include/bus.h#7 integrate
.. //depot/projects/ia64/sys/ia64/include/clock.h#7 integrate
.. //depot/projects/ia64/sys/ia64/include/cpufunc.h#9 integrate
.. //depot/projects/ia64/sys/ia64/include/intr.h#3 integrate
.. //depot/projects/ia64/sys/ia64/include/intrcnt.h#5 integrate
.. //depot/projects/ia64/sys/kern/imgact_elf.c#27 integrate
.. //depot/projects/ia64/sys/kern/kern_mib.c#12 integrate
.. //depot/projects/ia64/sys/kern/kern_ntptime.c#7 integrate
.. //depot/projects/ia64/sys/kern/kern_tc.c#17 integrate
.. //depot/projects/ia64/sys/kern/uipc_socket.c#23 integrate
.. //depot/projects/ia64/sys/kern/vfs_bio.c#34 integrate
.. //depot/projects/ia64/sys/net/if_stf.c#11 integrate
.. //depot/projects/ia64/sys/netinet/tcp_syncache.c#16 integrate
.. //depot/projects/ia64/sys/netinet6/icmp6.c#12 integrate
.. //depot/projects/ia64/sys/pci/if_rl.c#19 integrate
.. //depot/projects/ia64/sys/pci/if_xl.c#16 integrate
.. //depot/projects/ia64/sys/pci/if_xlreg.h#5 integrate
.. //depot/projects/ia64/sys/sparc64/include/elf.h#5 integrate
.. //depot/projects/ia64/sys/sparc64/include/pmap.h#14 integrate
.. //depot/projects/ia64/sys/sparc64/sparc64/cache.c#9 integrate
.. //depot/projects/ia64/sys/sparc64/sparc64/pmap.c#30 integrate
.. //depot/projects/ia64/sys/sparc64/sparc64/tlb.c#6 integrate
.. //depot/projects/ia64/sys/sparc64/sparc64/tsb.c#12 integrate
.. //depot/projects/ia64/sys/sparc64/sparc64/vm_machdep.c#15 integrate
.. //depot/projects/ia64/sys/sys/imgact_elf.h#7 integrate
.. //depot/projects/ia64/sys/vm/vm_page.c#33 integrate
.. //depot/projects/ia64/sys/vm/vnode_pager.c#25 integrate
.. //depot/projects/ia64/usr.sbin/Makefile#28 integrate

Differences ...

==== //depot/projects/ia64/contrib/lukemftpd/src/cmds.c#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: cmds.c,v 1.16 2002/02/13 15:15:23 lukem Exp $	*/
+/*	$NetBSD: cmds.c,v 1.18 2002/10/12 08:35:16 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -98,7 +98,30 @@
  * SUCH DAMAGE.
  */
 
-#include "lukemftpd.h"
+
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: cmds.c,v 1.18 2002/10/12 08:35:16 darrenr Exp $");
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <arpa/ftp.h>
+
+#include <dirent.h>
+#include <errno.h>
+#include <setjmp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <tzfile.h>
+#include <unistd.h>
+#include <ctype.h>
+
+#ifdef KERBEROS5
+#include <krb5/krb5.h>
+#endif
 
 #include "extern.h"
 
@@ -307,11 +330,11 @@
 		*ep++ = '\0';
 	c = lookup(cmdtab, command);
 	if (c == NULL) {
-		reply(502, "Unknown command %s.", command);
+		reply(502, "Unknown command '%s'.", command);
 		return;
 	}
 	if (! CMD_IMPLEMENTED(c)) {
-		reply(501, "%s command not implemented.", c->name);
+		reply(502, "%s command not implemented.", c->name);
 		return;
 	}
 	if (! CMD_HAS_OPTIONS(c)) {
@@ -484,12 +507,14 @@
 {
 	FILE *fin;
 	int c;
+	int atstart;
 	char *argv[] = { INTERNAL_LS, "-lgA", "", NULL };
 
 	argv[2] = (char *)filename;
 	fin = ftpd_popen(argv, "r", STDOUT_FILENO);
 	reply(-211, "status of %s:", filename);
 /* XXX: use fgetln() or fparseln() here? */
+	atstart = 1;
 	while ((c = getc(fin)) != EOF) {
 		if (c == '\n') {
 			if (ferror(stdout)){
@@ -505,7 +530,10 @@
 			}
 			CPUTC('\r', stdout);
 		}
+		if (atstart && isdigit(c))
+			CPUTC(' ', stdout);
 		CPUTC(c, stdout);
+		atstart = (c == '\n');
 	}
 	(void) ftpd_pclose(fin);
 	reply(211, "End of Status");

==== //depot/projects/ia64/contrib/lukemftpd/src/conf.c#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.c,v 1.46 2001/12/04 13:54:12 lukem Exp $	*/
+/*	$NetBSD: conf.c,v 1.50 2002/11/16 03:10:34 itojun Exp $	*/
 
 /*-
  * Copyright (c) 1997-2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,35 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "lukemftpd.h"
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: conf.c,v 1.50 2002/11/16 03:10:34 itojun Exp $");
+#endif /* not lint */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <glob.h>
+#include <netdb.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stringlist.h>
+#include <syslog.h>
+#include <time.h>
+#include <unistd.h>
+#include <util.h>
+
+#ifdef KERBEROS5
+#include <krb5/krb5.h>
+#endif
 
 #include "extern.h"
 #include "pathnames.h"
@@ -91,6 +119,11 @@
 	curclass.timeout =	DEFAULT_TIMEOUT;
 	    /* curclass.type is set elsewhere */
 	curclass.umask =	DEFAULT_UMASK;
+	curclass.mmapsize =	0;
+	curclass.readsize =	0;
+	curclass.writesize =	0;
+	curclass.sendbufsize =	0;
+	curclass.sendlowat =	0;
 
 	CURCLASS_FLAGS_SET(checkportcmd);
 	CURCLASS_FLAGS_CLR(denyquick);
@@ -113,11 +146,10 @@
 	size_t		 len;
 	LLT		 llval;
 	int		 none, match;
-	char		*endp;
+	char		*endp, errbuf[100];
 	char		*class, *word, *arg, *template;
 	const char	*infile;
 	size_t		 line;
-	unsigned int	 timeout;
 	struct ftpconv	*conv, *cnext;
 
 	init_curclass();
@@ -136,7 +168,7 @@
 	template = NULL;
 	for (;
 	    (buf = fparseln(f, &len, &line, NULL, FPARSELN_UNESCCOMM |
-	    		FPARSELN_UNESCCONT | FPARSELN_UNESCESC)) != NULL;
+			    FPARSELN_UNESCCONT | FPARSELN_UNESCESC)) != NULL;
 	    free(buf)) {
 		none = match = 0;
 		p = buf;
@@ -160,24 +192,37 @@
 		       strcasecmp(class, "all") == 0) )
 			continue;
 
-#define CONF_FLAG(x) \
-	do { \
-		if (none || \
-		    (!EMPTYSTR(arg) && strcasecmp(arg, "off") == 0)) \
-			CURCLASS_FLAGS_CLR(x); \
-		else \
-			CURCLASS_FLAGS_SET(x); \
+#define CONF_FLAG(Field)						\
+	do {								\
+		if (none ||						\
+		    (!EMPTYSTR(arg) && strcasecmp(arg, "off") == 0))	\
+			CURCLASS_FLAGS_CLR(Field);			\
+		else							\
+			CURCLASS_FLAGS_SET(Field);			\
 	} while (0)
 
-#define CONF_STRING(x) \
-	do { \
-		if (none || EMPTYSTR(arg)) \
-			arg = NULL; \
-		else \
-			arg = xstrdup(arg); \
-		REASSIGN(curclass.x, arg); \
+#define CONF_STRING(Field)						\
+	do {								\
+		if (none || EMPTYSTR(arg))				\
+			arg = NULL;					\
+		else							\
+			arg = xstrdup(arg);				\
+		REASSIGN(curclass.Field, arg);				\
 	} while (0)
 
+#define CONF_LL(Field,Arg,Min,Max)					\
+	do {								\
+		if (none || EMPTYSTR(Arg))				\
+			goto nextline;					\
+		llval = strsuftollx(#Field, Arg, Min, Max,		\
+		    errbuf, sizeof(errbuf));				\
+		if (errbuf[0]) {					\
+			syslog(LOG_WARNING, "%s line %d: %s",		\
+			    infile, (int)line, errbuf);			\
+			goto nextline;					\
+		}							\
+		curclass.Field = llval;					\
+	} while(0)
 
 		if (0)  {
 			/* no-op */
@@ -314,61 +359,40 @@
 			CONF_STRING(homedir);
 
 		} else if (strcasecmp(word, "limit") == 0) {
-			int limit;
-
 			curclass.limit = DEFAULT_LIMIT;
 			REASSIGN(curclass.limitfile, NULL);
-			if (none || EMPTYSTR(arg))
-				continue;
-			limit = (int)strtol(arg, &endp, 10);
-			if (*endp != 0) {
-				syslog(LOG_WARNING,
-				    "%s line %d: invalid limit %s",
-				    infile, (int)line, arg);
-				continue;
-			}
-			curclass.limit = limit;
+			CONF_LL(limit, arg, -1, LLTMAX);
 			REASSIGN(curclass.limitfile,
 			    EMPTYSTR(p) ? NULL : xstrdup(p));
 
 		} else if (strcasecmp(word, "maxfilesize") == 0) {
 			curclass.maxfilesize = DEFAULT_MAXFILESIZE;
-			if (none || EMPTYSTR(arg))
-				continue;
-			llval = strsuftoll(arg);
-			if (llval == -1) {
-				syslog(LOG_WARNING,
-				    "%s line %d: invalid maxfilesize %s",
-				    infile, (int)line, arg);
-				continue;
-			}
-			curclass.maxfilesize = llval;
+			CONF_LL(maxfilesize, arg, -1, LLTMAX);
 
 		} else if (strcasecmp(word, "maxtimeout") == 0) {
 			curclass.maxtimeout = DEFAULT_MAXTIMEOUT;
-			if (none || EMPTYSTR(arg))
-				continue;
-			timeout = (unsigned int)strtoul(arg, &endp, 10);
-			if (*endp != 0) {
-				syslog(LOG_WARNING,
-				    "%s line %d: invalid maxtimeout %s",
-				    infile, (int)line, arg);
-				continue;
-			}
-			if (timeout < 30) {
-				syslog(LOG_WARNING,
-				    "%s line %d: maxtimeout %d < 30 seconds",
-				    infile, (int)line, timeout);
-				continue;
-			}
-			if (timeout < curclass.timeout) {
-				syslog(LOG_WARNING,
-				    "%s line %d: maxtimeout %d < timeout (%d)",
-				    infile, (int)line, timeout,
-				    curclass.timeout);
-				continue;
-			}
-			curclass.maxtimeout = timeout;
+			CONF_LL(maxtimeout, arg,
+			    MIN(30, curclass.timeout), LLTMAX);
+
+		} else if (strcasecmp(word, "mmapsize") == 0) {
+			curclass.mmapsize = 0;
+			CONF_LL(mmapsize, arg, 0, LLTMAX);
+
+		} else if (strcasecmp(word, "readsize") == 0) {
+			curclass.readsize = 0;
+			CONF_LL(readsize, arg, 0, LLTMAX);
+
+		} else if (strcasecmp(word, "writesize") == 0) {
+			curclass.writesize = 0;
+			CONF_LL(writesize, arg, 0, LLTMAX);
+
+		} else if (strcasecmp(word, "sendbufsize") == 0) {
+			curclass.sendbufsize = 0;
+			CONF_LL(sendbufsize, arg, 0, LLTMAX);
+
+		} else if (strcasecmp(word, "sendlowat") == 0) {
+			curclass.sendlowat = 0;
+			CONF_LL(sendlowat, arg, 0, LLTMAX);
 
 		} else if (strcasecmp(word, "modify") == 0) {
 			CONF_FLAG(modify);
@@ -383,107 +407,60 @@
 			CONF_FLAG(passive);
 
 		} else if (strcasecmp(word, "portrange") == 0) {
-			int minport, maxport;
-			char *min, *max;
+			long minport, maxport;
 
 			curclass.portmin = 0;
 			curclass.portmax = 0;
 			if (none || EMPTYSTR(arg))
 				continue;
-			min = arg;
-			NEXTWORD(p, max);
-			if (EMPTYSTR(max)) {
+			if (EMPTYSTR(p)) {
 				syslog(LOG_WARNING,
 				   "%s line %d: missing maxport argument",
 				   infile, (int)line);
 				continue;
 			}
-			minport = (int)strtol(min, &endp, 10);
-			if (*endp != 0 || minport < IPPORT_RESERVED ||
-			    minport > IPPORT_ANONMAX) {
-				syslog(LOG_WARNING,
-				    "%s line %d: invalid minport %s",
-				    infile, (int)line, min);
+			minport = strsuftollx("minport", arg, IPPORT_RESERVED,
+			    IPPORT_ANONMAX, errbuf, sizeof(errbuf));
+			if (errbuf[0]) {
+				syslog(LOG_WARNING, "%s line %d: %s",
+				    infile, (int)line, errbuf);
 				continue;
 			}
-			maxport = (int)strtol(max, &endp, 10);
-			if (*endp != 0 || maxport < IPPORT_RESERVED ||
-			    maxport > IPPORT_ANONMAX) {
-				syslog(LOG_WARNING,
-				    "%s line %d: invalid maxport %s",
-				    infile, (int)line, max);
+			maxport = strsuftollx("maxport", p, IPPORT_RESERVED,
+			    IPPORT_ANONMAX, errbuf, sizeof(errbuf));
+			if (errbuf[0]) {
+				syslog(LOG_WARNING, "%s line %d: %s",
+				    infile, (int)line, errbuf);
 				continue;
 			}
 			if (minport >= maxport) {
 				syslog(LOG_WARNING,
-				    "%s line %d: minport %d >= maxport %d",
+				    "%s line %d: minport %ld >= maxport %ld",
 				    infile, (int)line, minport, maxport);
 				continue;
 			}
-			curclass.portmin = minport;
-			curclass.portmax = maxport;
+			curclass.portmin = (int)minport;
+			curclass.portmax = (int)maxport;
 
 		} else if (strcasecmp(word, "private") == 0) {
 			CONF_FLAG(private);
 
 		} else if (strcasecmp(word, "rateget") == 0) {
-			curclass.maxrateget = 0;
-			curclass.rateget = 0;
-			if (none || EMPTYSTR(arg))
-				continue;
-			llval = strsuftoll(arg);
-			if (llval == -1) {
-				syslog(LOG_WARNING,
-				    "%s line %d: invalid rateget %s",
-				    infile, (int)line, arg);
-				continue;
-			}
-			curclass.maxrateget = llval;
-			curclass.rateget = llval;
+			curclass.maxrateget = curclass.rateget = 0;
+			CONF_LL(rateget, arg, 0, LLTMAX);
+			curclass.maxrateget = curclass.rateget;
 
 		} else if (strcasecmp(word, "rateput") == 0) {
-			curclass.maxrateput = 0;
-			curclass.rateput = 0;
-			if (none || EMPTYSTR(arg))
-				continue;
-			llval = strsuftoll(arg);
-			if (llval == -1) {
-				syslog(LOG_WARNING,
-				    "%s line %d: invalid rateput %s",
-				    infile, (int)line, arg);
-				continue;
-			}
-			curclass.maxrateput = llval;
-			curclass.rateput = llval;
+			curclass.maxrateput = curclass.rateput = 0;
+			CONF_LL(rateput, arg, 0, LLTMAX);
+			curclass.maxrateput = curclass.rateput;
 
 		} else if (strcasecmp(word, "sanenames") == 0) {
 			CONF_FLAG(sanenames);
 
 		} else if (strcasecmp(word, "timeout") == 0) {
 			curclass.timeout = DEFAULT_TIMEOUT;
-			if (none || EMPTYSTR(arg))
-				continue;
-			timeout = (unsigned int)strtoul(arg, &endp, 10);
-			if (*endp != 0) {
-				syslog(LOG_WARNING,
-				    "%s line %d: invalid timeout %s",
-				    infile, (int)line, arg);
-				continue;
-			}
-			if (timeout < 30) {
-				syslog(LOG_WARNING,
-				    "%s line %d: timeout %d < 30 seconds",
-				    infile, (int)line, timeout);
-				continue;
-			}
-			if (timeout > curclass.maxtimeout) {
-				syslog(LOG_WARNING,
-				    "%s line %d: timeout %d > maxtimeout (%d)",
-				    infile, (int)line, timeout,
-				    curclass.maxtimeout);
-				continue;
-			}
-			curclass.timeout = timeout;
+			CONF_LL(timeout, arg, 30, curclass.maxtimeout);
 
 		} else if (strcasecmp(word, "template") == 0) {
 			if (none)
@@ -491,19 +468,22 @@
 			REASSIGN(template, EMPTYSTR(arg) ? NULL : xstrdup(arg));
 
 		} else if (strcasecmp(word, "umask") == 0) {
-			mode_t fumask;
+			u_long fumask;
 
 			curclass.umask = DEFAULT_UMASK;
 			if (none || EMPTYSTR(arg))
 				continue;
-			fumask = (mode_t)strtoul(arg, &endp, 8);
-			if (*endp != 0 || fumask > 0777) {
+			errno = 0;
+			endp = NULL;
+			fumask = strtoul(arg, &endp, 8);
+			if (errno || *arg == '\0' || *endp != '\0' ||
+			    fumask > 0777) {
 				syslog(LOG_WARNING,
 				    "%s line %d: invalid umask %s",
 				    infile, (int)line, arg);
 				continue;
 			}
-			curclass.umask = fumask;
+			curclass.umask = (mode_t)fumask;
 
 		} else if (strcasecmp(word, "upload") == 0) {
 			CONF_FLAG(upload);
@@ -516,6 +496,8 @@
 			    infile, (int)line, word);
 			continue;
 		}
+ nextline:
+		;
 	}
 	REASSIGN(template, NULL);
 	fclose(f);
@@ -578,7 +560,7 @@
 		return;
 
 	memset(&gl, 0, sizeof(gl));
-	if (glob(curclass.notify, GLOB_LIMIT, NULL, &gl) != 0
+	if (glob(curclass.notify, GLOB_BRACE|GLOB_LIMIT, NULL, &gl) != 0
 	    || gl.gl_matchc == 0) {
 		globfree(&gl);
 		return;
@@ -669,8 +651,8 @@
 						cprintf(stdout, "unlimited");
 						lastnum = 0;
 					} else {
-						cprintf(stdout, "%d",
-						    curclass.limit);
+						cprintf(stdout, LLF,
+						    (LLT)curclass.limit);
 						lastnum = curclass.limit;
 					}
 					break;
@@ -891,51 +873,6 @@
 }
 
 /*
- * Convert the string `arg' to a long long, which may have an optional SI suffix
- * (`b', `k', `m', `g', `t'). Returns the number for success, -1 otherwise.
- */
-LLT
-strsuftoll(const char *arg)
-{
-	char *cp;
-	LLT val;
-
-	if (!isdigit((unsigned char)arg[0]))
-		return (-1);
-
-	val = STRTOLL(arg, &cp, 10);
-	if (cp != NULL) {
-		if (cp[0] != '\0' && cp[1] != '\0')
-			 return (-1);
-		switch (tolower((unsigned char)cp[0])) {
-		case '\0':
-		case 'b':
-			break;
-		case 'k':
-			val <<= 10;
-			break;
-		case 'm':
-			val <<= 20;
-			break;
-		case 'g':
-			val <<= 30;
-			break;
-#ifndef NO_LONG_LONG
-		case 't':
-			val <<= 40;
-			break;
-#endif
-		default:
-			return (-1);
-		}
-	}
-	if (val < 0)
-		return (-1);
-
-	return (val);
-}
-
-/*
  * Count the number of current connections, reading from
  *	/var/run/ftpd.pids-<class>
  * Does a kill -0 on each pid in that file, and only counts
@@ -959,15 +896,8 @@
 
 	if ((fd = open(fn, O_RDWR | O_CREAT, 0600)) == -1)
 		return;
-#if HAVE_LOCKF
 	if (lockf(fd, F_TLOCK, 0) == -1)
 		goto cleanup_count;
-#elif HAVE_FLOCK
-	if (flock(fd, LOCK_EX | LOCK_NB) != 0)
-		goto cleanup_count;
-#else
-    /* XXX: use fcntl ? */
-#endif
 	if (fstat(fd, &sb) == -1)
 		goto cleanup_count;
 	if ((pids = malloc(sb.st_size + sizeof(pid_t))) == NULL)
@@ -1005,14 +935,8 @@
 	(void)ftruncate(fd, count);
 
  cleanup_count:
-#if HAVE_LOCKF
 	if (lseek(fd, 0, SEEK_SET) != -1)
 		(void)lockf(fd, F_ULOCK, 0);
-#elif HAVE_FLOCK
-	(void)flock(fd, LOCK_UN);
-#else
-    /* XXX: use fcntl ? */
-#endif
 	close(fd);
 	REASSIGN(pids, NULL);
 }

==== //depot/projects/ia64/contrib/lukemftpd/src/extern.h#5 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.43 2001/12/04 13:54:12 lukem Exp $	*/
+/*	$NetBSD: extern.h,v 1.44 2002/05/30 00:24:47 enami Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -108,16 +108,9 @@
 # define ULLFP(x)	"%" x "lu"
 # define ULLT		unsigned long
 # define STRTOLL(x,y,z)	strtol(x,y,z)
+# define LLTMIN		LONG_MIN
+# define LLTMAX		LONG_MAX
 #else
-#if HAVE_PRINTF_QD
-# define LLF		"%qd"
-# define LLFP(x)	"%" x "qd"
-# define LLT		long long
-# define ULLF		"%qu"
-# define ULLFP(x)	"%" x "qu"
-# define ULLT		unsigned long long
-# define STRTOLL(x,y,z)	strtoll(x,y,z)
-#else
 # define LLF		"%lld"
 # define LLFP(x)	"%" x "lld"
 # define LLT		long long
@@ -125,7 +118,8 @@
 # define ULLFP(x)	"%" x "llu"
 # define ULLT		unsigned long long
 # define STRTOLL(x,y,z)	strtoll(x,y,z)
-#endif
+# define LLTMIN		LLONG_MIN
+# define LLTMAX		LLONG_MAX
 #endif
 
 #define FTP_BUFLEN	512
@@ -137,7 +131,7 @@
 char  **copyblk(char **);
 void	count_users(void);
 void	cprintf(FILE *, const char *, ...)
-	    ;
+	    __attribute__((__format__(__printf__, 2, 3)));
 void	cwd(const char *);
 FILE   *dataconn(const char *, off_t, const char *);
 void	delete(const char *);
@@ -177,7 +171,7 @@
 void	renamecmd(const char *, const char *);
 char   *renamefrom(const char *);
 void	reply(int, const char *, ...)
-	    ;
+	    __attribute__((__format__(__printf__, 2, 3)));
 void	retrieve(char *[], const char *);
 void	send_file_list(const char *);
 void	show_chdir_messages(int);
@@ -186,7 +180,6 @@
 void	statfilecmd(const char *);
 void	statxfer(void);
 void	store(const char *, const char *, int);
-LLT	strsuftoll(const char *);
 void	user(const char *);
 char   *xstrdup(const char *);
 void	yyerror(char *);
@@ -271,24 +264,29 @@
 	char		*display;	/* File to display upon chdir */
 	char		*homedir;	/* Directory to chdir(2) to at login */
 	classflag_t	 flags;		/* Flags; see classflag_t above */
-	int	 	 limit;		/* Max connections (-1 = unlimited) */
+	LLT		 limit;		/* Max connections (-1 = unlimited) */
 	char		*limitfile;	/* File to display if limit reached */
 	LLT		 maxfilesize;	/* Maximum file size of uploads */
 	LLT		 maxrateget;	/* Maximum get transfer rate throttle */
 	LLT		 maxrateput;	/* Maximum put transfer rate throttle */
-	unsigned int	 maxtimeout;	/* Maximum permitted timeout */
+	LLT		 maxtimeout;	/* Maximum permitted timeout */
 	char		*motd;		/* MotD file to display after login */
 	char		*notify;	/* Files to notify about upon chdir */
-	int		 portmin;	/* Minumum port for passive mode */
-	int		 portmax;	/* Maximum port for passive mode */
+	LLT		 portmin;	/* Minumum port for passive mode */
+	LLT		 portmax;	/* Maximum port for passive mode */
 	LLT		 rateget;	/* Get (RETR) transfer rate throttle */
 	LLT		 rateput;	/* Put (STOR) transfer rate throttle */
-	unsigned int	 timeout;	/* Default timeout */
+	LLT		 timeout;	/* Default timeout */
 	class_ft	 type;		/* Class type */
 	mode_t		 umask;		/* Umask to use */
+	LLT		 mmapsize;	/* mmap window size */
+	LLT		 readsize;	/* data read size */
+	LLT		 writesize;	/* data write size */
+	LLT		 sendbufsize;	/* SO_SNDBUF size */
+	LLT		 sendlowat;	/* SO_SNDLOWAT size */
 };
 
-extern void		ftp_loop(void);
+extern void		ftp_loop(void) __attribute__ ((noreturn));
 extern void		ftp_handle_line(char *);
 
 #ifndef	GLOBAL
@@ -355,8 +353,8 @@
 			} while (0);
 
 #define CURCLASSTYPE	curclass.type == CLASS_GUEST  ? "GUEST"  : \
-		    	curclass.type == CLASS_CHROOT ? "CHROOT" : \
-		    	curclass.type == CLASS_REAL   ? "REAL"   : \
+			curclass.type == CLASS_CHROOT ? "CHROOT" : \
+			curclass.type == CLASS_REAL   ? "REAL"   : \
 			"<unknown>"
 
 #define ISDOTDIR(x)	(x[0] == '.' && x[1] == '\0')

==== //depot/projects/ia64/contrib/lukemftpd/src/ftpcmd.y#3 (text+ko) ====

@@ -1,7 +1,7 @@
-/*	$NetBSD: ftpcmd.y,v 1.66 2001/12/01 10:25:30 lukem Exp $	*/
+/*	$NetBSD: ftpcmd.y,v 1.71 2002/10/12 08:35:17 darrenr Exp $	*/
 
 /*-
- * Copyright (c) 1997-2001 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -77,7 +77,41 @@
  */
 
 %{
-#include "lukemftpd.h"
+#include <sys/cdefs.h>
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)ftpcmd.y	8.3 (Berkeley) 4/6/94";
+#else
+__RCSID("$NetBSD: ftpcmd.y,v 1.71 2002/10/12 08:35:17 darrenr Exp $");
+#endif
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#include <netinet/in.h>
+#include <arpa/ftp.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <pwd.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <time.h>
+#include <tzfile.h>
+#include <unistd.h>
+#include <netdb.h>
+
+#ifdef KERBEROS5
+#include <krb5/krb5.h>
+#endif
 
 #include "extern.h"
 #include "version.h"
@@ -93,7 +127,10 @@
 %}
 
 %union {
-	int	i;
+	struct {
+		off_t	o;
+		int	i;
+	} u;
 	char   *s;
 }
 
@@ -128,10 +165,10 @@
 
 %token	<s> STRING
 %token	<s> ALL
-%token	<i> NUMBER
+%token	<u> NUMBER
 
-%type	<i> check_login octal_number byte_size
-%type	<i> struct_code mode_code type_code form_code decimal_integer
+%type	<u.i> check_login octal_number byte_size
+%type	<u.i> struct_code mode_code type_code form_code decimal_integer
 %type	<s> pathstring pathname password username
 %type	<s> mechanism_name base64data prot_code
 
@@ -259,32 +296,48 @@
 	| LPSV check_login CRLF
 		{
 			if ($2) {
-				if (epsvall)
-					reply(501,
-					    "LPSV disallowed after EPSV ALL");
-				else
-					long_passive("LPSV", PF_UNSPEC);
+				if (CURCLASS_FLAGS_ISSET(passive)) {
+					if (epsvall)
+						reply(501,
+						    "LPSV disallowed after EPSV ALL");
+					else
+						long_passive("LPSV", PF_UNSPEC);
+				} else
+					reply(500, "LPSV mode not available.");
 			}
 		}
 
 	| EPSV check_login SP NUMBER CRLF
 		{
-			if ($2)
-				long_passive("EPSV", epsvproto2af($4));
+			if ($2) {
+				if (CURCLASS_FLAGS_ISSET(passive))
+					long_passive("EPSV",
+					    epsvproto2af($4.i));
+				else
+					reply(500, "EPSV mode not available.");
+			}
 		}
 
 	| EPSV check_login SP ALL CRLF
 		{
 			if ($2) {
-				reply(200, "EPSV ALL command successful.");
-				epsvall++;
+				if (CURCLASS_FLAGS_ISSET(passive)) {
+					reply(200,
+					    "EPSV ALL command successful.");
+					epsvall++;
+				} else
+					reply(500, "EPSV mode not available.");
 			}
 		}
 
 	| EPSV check_login CRLF
 		{
-			if ($2)
-				long_passive("EPSV", PF_UNSPEC);
+			if ($2) {
+				if (CURCLASS_FLAGS_ISSET(passive))
+					long_passive("EPSV", PF_UNSPEC);
+				else
+					reply(500, "EPSV mode not available.");
+			}
 		}
 
 	| TYPE check_login SP type_code CRLF
@@ -517,24 +570,28 @@
 		{
 			if ($4) {
 				reply(200,
-			    "Current IDLE time limit is %d seconds; max %d",
-				    curclass.timeout, curclass.maxtimeout);
+				    "Current IDLE time limit is " LLF
+				    " seconds; max " LLF,
+				    (LLT)curclass.timeout,
+				    (LLT)curclass.maxtimeout);
 			}
 		}
 
 	| SITE SP IDLE check_login SP NUMBER CRLF
 		{
 			if ($4) {
-				if ($6 < 30 || $6 > curclass.maxtimeout) {
+				if ($6.i < 30 || $6.i > curclass.maxtimeout) {
 					reply(501,
-			    "IDLE time limit must be between 30 and %d seconds",
-					    curclass.maxtimeout);
+				"IDLE time limit must be between 30 and "
+					    LLF " seconds",
+					    (LLT)curclass.maxtimeout);
 				} else {
-					curclass.timeout = $6;
+					curclass.timeout = $6.i;
 					(void) alarm(curclass.timeout);
 					reply(200,
-					    "IDLE time limit set to %d seconds",
-					    curclass.timeout);
+					    "IDLE time limit set to "
+					    LLF " seconds",
+					    (LLT)curclass.timeout);
 				}
 			}
 		}
@@ -550,19 +607,17 @@
 
 	| SITE SP RATEGET check_login SP STRING CRLF
 		{
+			char errbuf[100];
 			char *p = $6;
 			LLT rate;
 
 			if ($4) {
-				rate = strsuftoll(p);
-				if (rate == -1)
-					reply(501, "Invalid RATEGET %s", p);
-				else if (curclass.maxrateget &&
-				    rate > curclass.maxrateget)
-					reply(501,
-			"RATEGET " LLF " is larger than maximum RATEGET " LLF,
-					    (LLT)rate,
-					    (LLT)curclass.maxrateget);
+				rate = strsuftollx("RATEGET", p, 0,
+				    curclass.maxrateget
+				    ? curclass.maxrateget
+				    : LLTMAX, errbuf, sizeof(errbuf));
+				if (errbuf[0])
+					reply(501, "%s", errbuf);
 				else {
 					curclass.rateget = rate;
 					reply(200,
@@ -584,19 +639,17 @@
 
 	| SITE SP RATEPUT check_login SP STRING CRLF
 		{
+			char errbuf[100];
 			char *p = $6;
 			LLT rate;
 
 			if ($4) {
-				rate = strsuftoll(p);

>>> TRUNCATED FOR MAIL (1000 lines) <<<

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301060157.h061vZpW094544>