diff options
| author | lukem <lukem@NetBSD.org> | 2002-11-29 14:39:59 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 2002-11-29 14:39:59 +0000 |
| commit | ee2d1afbb481bd19a36e4262c87c81d1ce64d32f (patch) | |
| tree | 62fadae6175bde5bfaf299fffefb945683534737 /libexec | |
| parent | 6df30bca4fed413206c88bc3967359bb686a28bf (diff) | |
- convert to using libc's strsuftoll(3)
- use LLT (aka 'long long type') for all numeric class parameters
- improve description of various ftpd.conf(5) options
- statcmd(): print out: mmapsize readsize writesize sendbufsize sendlowat
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/ftpd/conf.c | 259 | ||||
| -rw-r--r-- | libexec/ftpd/extern.h | 21 | ||||
| -rw-r--r-- | libexec/ftpd/ftpcmd.y | 60 | ||||
| -rw-r--r-- | libexec/ftpd/ftpd.c | 55 | ||||
| -rw-r--r-- | libexec/ftpd/ftpd.conf.5 | 131 | ||||
| -rw-r--r-- | libexec/ftpd/logutmp.c | 2 | ||||
| -rw-r--r-- | libexec/ftpd/version.h | 4 |
7 files changed, 236 insertions, 296 deletions
diff --git a/libexec/ftpd/conf.c b/libexec/ftpd/conf.c index 997aa64c861..a76ee7ac10f 100644 --- a/libexec/ftpd/conf.c +++ b/libexec/ftpd/conf.c @@ -1,4 +1,4 @@ -/* $NetBSD: conf.c,v 1.50 2002/11/16 03:10:34 itojun Exp $ */ +/* $NetBSD: conf.c,v 1.51 2002/11/29 14:39:59 lukem Exp $ */ /*- * Copyright (c) 1997-2001 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: conf.c,v 1.50 2002/11/16 03:10:34 itojun Exp $"); +__RCSID("$NetBSD: conf.c,v 1.51 2002/11/29 14:39:59 lukem Exp $"); #endif /* not lint */ #include <sys/types.h> @@ -146,11 +146,10 @@ parse_conf(const char *findclass) 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 long timeout; struct ftpconv *conv, *cnext; init_curclass(); @@ -169,7 +168,7 @@ parse_conf(const char *findclass) 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; @@ -193,35 +192,36 @@ parse_conf(const char *findclass) 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(x) \ - do { \ - if (! (none || EMPTYSTR(arg))) { \ - llval = strsuftoll(arg); \ - if (llval == -1) { \ - syslog(LOG_WARNING, \ - "%s line %d: invalid " #x " %s", \ - infile, (int)line, arg); \ - } else \ - curclass.x = llval; \ - } \ +#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) { @@ -359,78 +359,40 @@ parse_conf(const char *findclass) CONF_STRING(homedir); } else if (strcasecmp(word, "limit") == 0) { - long limit; - curclass.limit = DEFAULT_LIMIT; REASSIGN(curclass.limitfile, NULL); - if (none || EMPTYSTR(arg)) - continue; - errno = 0; - endp = NULL; - limit = strtol(arg, &endp, 10); - if (errno || *arg == '\0' || *endp != '\0' || - limit < 0 || limit > INT_MAX) { - syslog(LOG_WARNING, - "%s line %d: invalid limit %s", - infile, (int)line, arg); - continue; - } - curclass.limit = (int)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; - CONF_LL(maxfilesize); + CONF_LL(maxfilesize, arg, -1, LLTMAX); } else if (strcasecmp(word, "maxtimeout") == 0) { curclass.maxtimeout = DEFAULT_MAXTIMEOUT; - if (none || EMPTYSTR(arg)) - continue; - errno = 0; - endp = NULL; - timeout = strtoul(arg, &endp, 10); - if (errno || *arg == '\0' || *endp != '\0' || - timeout > UINT_MAX) { - syslog(LOG_WARNING, - "%s line %d: invalid maxtimeout %s", - infile, (int)line, arg); - continue; - } - if (timeout < 30) { - syslog(LOG_WARNING, - "%s line %d: maxtimeout %ld < 30 seconds", - infile, (int)line, timeout); - continue; - } - if (timeout < curclass.timeout) { - syslog(LOG_WARNING, - "%s line %d: maxtimeout %ld < timeout (%d)", - infile, (int)line, timeout, - curclass.timeout); - continue; - } - curclass.maxtimeout = (unsigned int)timeout; + CONF_LL(maxtimeout, arg, + MIN(30, curclass.timeout), LLTMAX); } else if (strcasecmp(word, "mmapsize") == 0) { curclass.mmapsize = 0; - CONF_LL(mmapsize); + CONF_LL(mmapsize, arg, 0, LLTMAX); } else if (strcasecmp(word, "readsize") == 0) { curclass.readsize = 0; - CONF_LL(readsize); + CONF_LL(readsize, arg, 0, LLTMAX); } else if (strcasecmp(word, "writesize") == 0) { curclass.writesize = 0; - CONF_LL(writesize); + CONF_LL(writesize, arg, 0, LLTMAX); } else if (strcasecmp(word, "sendbufsize") == 0) { curclass.sendbufsize = 0; - CONF_LL(sendbufsize); + CONF_LL(sendbufsize, arg, 0, LLTMAX); } else if (strcasecmp(word, "sendlowat") == 0) { curclass.sendlowat = 0; - CONF_LL(sendlowat); + CONF_LL(sendlowat, arg, 0, LLTMAX); } else if (strcasecmp(word, "modify") == 0) { CONF_FLAG(modify); @@ -446,40 +408,29 @@ parse_conf(const char *findclass) } else if (strcasecmp(word, "portrange") == 0) { long minport, maxport; - char *min, *max; 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; } - errno = 0; - endp = NULL; - minport = strtol(min, &endp, 10); - if (errno || *min == '\0' || *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; } - errno = 0; - endp = NULL; - maxport = strtol(max, &endp, 10); - if (errno || *min == '\0' || *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) { @@ -495,66 +446,21 @@ parse_conf(const char *findclass) 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; - errno = 0; - endp = NULL; - timeout = strtoul(arg, &endp, 10); - if (errno || *arg == '\0' || *endp != '\0' || - timeout > UINT_MAX) { - syslog(LOG_WARNING, - "%s line %d: invalid timeout %s", - infile, (int)line, arg); - continue; - } - if (timeout < 30) { - syslog(LOG_WARNING, - "%s line %d: timeout %ld < 30 seconds", - infile, (int)line, timeout); - continue; - } - if (timeout > curclass.maxtimeout) { - syslog(LOG_WARNING, - "%s line %d: timeout %ld > maxtimeout (%d)", - infile, (int)line, timeout, - curclass.maxtimeout); - continue; - } - curclass.timeout = (unsigned int)timeout; + CONF_LL(timeout, arg, 30, curclass.maxtimeout); } else if (strcasecmp(word, "template") == 0) { if (none) @@ -590,6 +496,8 @@ parse_conf(const char *findclass) infile, (int)line, word); continue; } + nextline: + ; } REASSIGN(template, NULL); fclose(f); @@ -743,8 +651,8 @@ display_file(const char *file, int code) cprintf(stdout, "unlimited"); lastnum = 0; } else { - cprintf(stdout, "%d", - curclass.limit); + cprintf(stdout, LLF, + (LLT)curclass.limit); lastnum = curclass.limit; } break; @@ -965,51 +873,6 @@ do_conversion(const char *fname) } /* - * 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 diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h index 6ece28ab9bf..db00e1ab3b3 100644 --- a/libexec/ftpd/extern.h +++ b/libexec/ftpd/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.44 2002/05/30 00:24:47 enami Exp $ */ +/* $NetBSD: extern.h,v 1.45 2002/11/29 14:39:59 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -108,6 +108,8 @@ # 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 # define LLF "%lld" # define LLFP(x) "%" x "lld" @@ -116,6 +118,8 @@ # define ULLFP(x) "%" x "llu" # define ULLT unsigned long long # define STRTOLL(x,y,z) strtoll(x,y,z) +# define LLTMIN LLONG_MIN +# define LLTMAX LLONG_MAX #endif #define FTP_BUFLEN 512 @@ -176,7 +180,6 @@ void statcmd(void); 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 *); @@ -261,19 +264,19 @@ struct ftpclass { 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 */ @@ -350,8 +353,8 @@ extern struct tab cmdtab[]; } 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') diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index bb5018a9bdd..e0427e6c6b6 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -1,4 +1,4 @@ -/* $NetBSD: ftpcmd.y,v 1.71 2002/10/12 08:35:17 darrenr Exp $ */ +/* $NetBSD: ftpcmd.y,v 1.72 2002/11/29 14:39:59 lukem Exp $ */ /*- * Copyright (c) 1997-2002 The NetBSD Foundation, Inc. @@ -83,7 +83,7 @@ #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 $"); +__RCSID("$NetBSD: ftpcmd.y,v 1.72 2002/11/29 14:39:59 lukem Exp $"); #endif #endif /* not lint */ @@ -570,8 +570,10 @@ cmd { 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); } } @@ -580,14 +582,16 @@ cmd if ($4) { 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.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); } } } @@ -603,19 +607,17 @@ cmd | 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, @@ -637,19 +639,17 @@ cmd | SITE SP RATEPUT check_login SP STRING CRLF { + char errbuf[100]; char *p = $6; LLT rate; if ($4) { - rate = strsuftoll(p); - if (rate == -1) - reply(501, "Invalid RATEPUT %s", p); - else if (curclass.maxrateput && - rate > curclass.maxrateput) - reply(501, - "RATEPUT " LLF " is larger than maximum RATEPUT " LLF, - (LLT)rate, - (LLT)curclass.maxrateput); + rate = strsuftollx("RATEPUT", p, 0, + curclass.maxrateput + ? curclass.maxrateput + : LLTMAX, errbuf, sizeof(errbuf)); + if (errbuf[0]) + reply(501, "%s", errbuf); else { curclass.rateput = rate; reply(200, @@ -1454,11 +1454,11 @@ toolong(int signo) { reply(421, - "Timeout (%d seconds): closing control connection.", - curclass.timeout); + "Timeout (" LLF " seconds): closing control connection.", + (LLT)curclass.timeout); if (logging) - syslog(LOG_INFO, "User %s timed out after %d seconds", - (pw ? pw->pw_name : "unknown"), curclass.timeout); + syslog(LOG_INFO, "User %s timed out after " LLF " seconds", + (pw ? pw->pw_name : "unknown"), (LLT)curclass.timeout); dologout(1); } diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index d12b598c688..78624e82da5 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $NetBSD: ftpd.c,v 1.146 2002/11/16 03:10:34 itojun Exp $ */ +/* $NetBSD: ftpd.c,v 1.147 2002/11/29 14:40:00 lukem Exp $ */ /* * Copyright (c) 1997-2001 The NetBSD Foundation, Inc. @@ -109,7 +109,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: ftpd.c,v 1.146 2002/11/16 03:10:34 itojun Exp $"); +__RCSID("$NetBSD: ftpd.c,v 1.147 2002/11/29 14:40:00 lukem Exp $"); #endif #endif /* not lint */ @@ -800,7 +800,7 @@ checkuser(const char *fname, const char *name, int def, int nofile, line = 0; for (; (buf = fparseln(fd, &len, &line, NULL, FPARSELN_UNESCCOMM | - FPARSELN_UNESCCONT | FPARSELN_UNESCESC)) != NULL; + FPARSELN_UNESCCONT | FPARSELN_UNESCESC)) != NULL; free(buf), buf = NULL) { word = perm = class = NULL; p = buf; @@ -1108,11 +1108,13 @@ pass(const char *passwd) (void)display_file(conffilename(curclass.limitfile), 530); reply(530, - "User %s access denied, connection limit of %d reached.", - pw->pw_name, curclass.limit); + "User %s access denied, connection limit of " LLF + " reached.", + pw->pw_name, (LLT)curclass.limit); syslog(LOG_NOTICE, - "Maximum connection limit of %d for class %s reached, login refused for %s", - curclass.limit, curclass.classname, pw->pw_name); + "Maximum connection limit of " LLF + " for class %s reached, login refused for %s", + (LLT)curclass.limit, curclass.classname, pw->pw_name); goto bad; } @@ -2096,7 +2098,7 @@ statcmd(void) { struct sockinet *su = NULL; static char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; - u_char *a, *p; + u_char *a, *p; int ispassive, af; off_t otbi, otbo, otb; @@ -2137,7 +2139,7 @@ statcmd(void) strunames[stru], modenames[mode]); ispassive = 0; if (data != -1) { - reply(0, "Data connection open"); + reply(0, "Data connection open"); su = NULL; } else if (pdata != -1) { reply(0, "in Passive mode"); @@ -2261,13 +2263,14 @@ statcmd(void) reply(0, "Display file: %s", curclass.display); if (! EMPTYSTR(curclass.notify)) reply(0, "Notify fileglob: %s", curclass.notify); - reply(0, "Idle timeout: %d, maximum timeout: %d", - curclass.timeout, curclass.maxtimeout); + reply(0, "Idle timeout: " LLF ", maximum timeout: " LLF, + (LLT)curclass.timeout, (LLT)curclass.maxtimeout); reply(0, "Current connections: %d", connections); if (curclass.limit == -1) reply(0, "Maximum connections: unlimited"); else - reply(0, "Maximum connections: %d", curclass.limit); + reply(0, "Maximum connections: " LLF, + (LLT)curclass.limit); if (curclass.limitfile) reply(0, "Connection limit exceeded message file: %s", conffilename(curclass.limitfile)); @@ -2304,8 +2307,8 @@ statcmd(void) reply(0, "PASV advertise address: %s", bp); } if (curclass.portmin && curclass.portmax) - reply(0, "PASV port range: %d - %d", - curclass.portmin, curclass.portmax); + reply(0, "PASV port range: " LLF " - " LLF, + (LLT)curclass.portmin, (LLT)curclass.portmax); if (curclass.rateget) reply(0, "Rate get limit: " LLF " bytes/sec", (LLT)curclass.rateget); @@ -2316,6 +2319,28 @@ statcmd(void) (LLT)curclass.rateput); else reply(0, "Rate put limit: disabled"); + if (curclass.mmapsize) + reply(0, "Mmap size: " LLF, (LLT)curclass.mmapsize); + else + reply(0, "Mmap size: disabled"); + if (curclass.readsize) + reply(0, "Read size: " LLF, (LLT)curclass.readsize); + else + reply(0, "Read size: default"); + if (curclass.writesize) + reply(0, "Write size: " LLF, (LLT)curclass.writesize); + else + reply(0, "Write size: default"); + if (curclass.sendbufsize) + reply(0, "Send buffer size: " LLF, + (LLT)curclass.sendbufsize); + else + reply(0, "Send buffer size: default"); + if (curclass.sendlowat) + reply(0, "Send low water mark: " LLF, + (LLT)curclass.sendlowat); + else + reply(0, "Send low water mark: default"); reply(0, "Umask: %.04o", curclass.umask); for (cp = curclass.conversions; cp != NULL; cp=cp->next) { if (cp->suffix == NULL || cp->types == NULL || @@ -3034,7 +3059,7 @@ conffilename(const char *s) * if elapsed != NULL, append "in xxx.yyy seconds" * if error != NULL, append ": " + error * - * if doxferlog != 0, bytes != -1, and command is "get", "put", + * if doxferlog != 0, bytes != -1, and command is "get", "put", * or "append", syslog a wu-ftpd style xferlog entry */ void diff --git a/libexec/ftpd/ftpd.conf.5 b/libexec/ftpd/ftpd.conf.5 index 3b900932f5b..187745bbdcf 100644 --- a/libexec/ftpd/ftpd.conf.5 +++ b/libexec/ftpd/ftpd.conf.5 @@ -1,4 +1,4 @@ -.\" $NetBSD: ftpd.conf.5,v 1.23 2002/10/02 11:10:38 wiz Exp $ +.\" $NetBSD: ftpd.conf.5,v 1.24 2002/11/29 14:40:00 lukem Exp $ .\" .\" Copyright (c) 1997-2001 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -34,7 +34,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 5, 2001 +.Dd November 30, 2002 .Dt FTPD.CONF 5 .Os .Sh NAME @@ -121,8 +121,8 @@ directive is set for the class. .Pp Each configuration line may be one of: .Bl -tag -width 4n -.It Sy advertise Ar class Ar host -.It Sy advertize Ar class Ar host +.It Sy advertise Ar class Op Ar host +.It Sy advertize Ar class Op Ar host Set the address to advertise in the response to the .Sy PASV and @@ -137,7 +137,9 @@ If .Ar class is .Dq none -or no argument is given, disable this. +or +.Ar host +not is specified, disable this. .It Sy checkportcmd Ar class Op Sy off Check the .Sy PORT @@ -160,11 +162,11 @@ is .Dq none or .Sy off -is given, disable this feature, otherwise enable it. +is specified, disable this feature, otherwise enable it. .It Sy chroot Ar class Op Sy pathformat If .Ar pathformat -is not given or +is not specified or .Ar class is .Dq none , @@ -199,7 +201,7 @@ The user's home directory. .It Sy GUEST If .Fl a Ar anondir -is given, use +is specified, use .Ar anondir , otherwise the home directory of the .Sq ftp @@ -285,11 +287,11 @@ is .Dq none or .Sy off -is given, disable this feature, otherwise enable it. +is specified, disable this feature, otherwise enable it. .It Sy display Ar class Op Ar file If .Ar file -is not given or +is not specified or .Ar class is .Dq none , @@ -305,7 +307,7 @@ for more information. .It Sy homedir Ar class Op Sy pathformat If .Ar pathformat -is not given or +is not specified or .Ar class is .Dq none , @@ -331,18 +333,18 @@ and .Sy CHROOT users. .It Xo Sy limit Ar class -.Ar count Op Ar file +.Op Ar count Op Ar file .Xc Limit the maximum number of concurrent connections for .Ar class to .Ar count , with -.Sq 0 +.Sq -1 meaning unlimited connections. If the limit is exceeded and .Ar file -is given, display its contents to the user. +is specified, display its contents to the user. If .Ar class is @@ -356,15 +358,20 @@ is a relative path, it will be searched for in .Pa /etc (which can be overridden with .Fl c Ar confdir ) . -.It Sy maxfilesize Ar class Ar size +.It Sy maxfilesize Ar class Op Ar size Set the maximum size of an uploaded file to -.Ar size . +.Ar size , +with +.Sq -1 +meaning unlimited connections. If .Ar class is .Dq none -or no argument is given, disable this. -.It Sy maxtimeout Ar class Ar time +or +.Ar size +is not specified, disable this. +.It Sy maxtimeout Ar class Op Ar time Set the maximum timeout period that a client may request, defaulting to two hours. This cannot be less than 30 seconds, or the value for @@ -375,8 +382,8 @@ is .Dq none or .Ar time -is not specified, set to default of 2 hours. -.It Sy mmapsize Ar class Ar size +is not specified, use the default. +.It Sy mmapsize Ar class Op Ar size Set the size of the sliding window to map a file using .Xr mmap 2 . If zero, @@ -388,6 +395,13 @@ The default is zero. An optional suffix may be provided as per .Sy rateget . This option affects only binary transfers. +If +.Ar class +is +.Dq none +or +.Ar size +is not specified, use the default. .It Sy modify Ar class Op Sy off If .Ar class @@ -395,7 +409,7 @@ is .Dq none or .Sy off -is given, disable the following commands: +is specified, disable the following commands: .Sy CHMOD , .Sy DELE , .Sy MKD , @@ -407,7 +421,7 @@ Otherwise, enable them. .It Sy motd Ar class Op Ar file If .Ar file -is not given or +is not specified or .Ar class is .Dq none , @@ -429,7 +443,7 @@ is a relative path, it will be searched for in .It Sy notify Ar class Op Ar fileglob If .Ar fileglob -is not given or +is not specified or .Ar class is .Dq none , @@ -444,14 +458,16 @@ is .Dq none or .Sy off -is given, prevent passive +is specified, prevent passive .Sy ( PASV , .Sy LPSV , and .Sy EPSV ) connections. Otherwise, enable them. -.It Sy portrange Ar class Ar min Ar max +.It Sy portrange Ar class Oo +.Ar min Ar max +.Oc Set the range of port number which will be used for the passive data port. .Ar max must be greater than @@ -463,7 +479,7 @@ If .Ar class is .Dq none -or no arguments are given, disable this. +or no arguments are specified, disable this. .It Sy private Ar class Op Sy off If .Ar class @@ -471,11 +487,11 @@ is .Dq none or .Sy off -is given, do not display class information in the output of the +is specified, do not display class information in the output of the .Sy STAT command. Otherwise, display the information. -.It Sy rateget Ar class Ar rate +.It Sy rateget Ar class Op Ar rate Set the maximum get .Pq Sy RETR transfer rate throttle for @@ -490,7 +506,9 @@ If .Ar class is .Dq none -or no arguments are given, disable this. +or +.Ar rate +is not specified, disable this. .Pp An optional suffix may be provided, which changes the interpretation of .Ar rate @@ -508,7 +526,7 @@ Giga; multiply the argument by 1073741824 .It t Tera; multiply the argument by 1099511627776 .El -.It Sy rateput Ar class Ar rate +.It Sy rateput Ar class Op Ar rate Set the maximum put .Pq Sy STOR transfer rate throttle for @@ -522,8 +540,10 @@ If .Ar class is .Dq none -or no arguments are given, disable this. -.It Sy readsize Ar class Ar size +or +.Ar rate +is not specified, disable this. +.It Sy readsize Ar class Op Ar size Set the size of the read buffer to .Xr read 2 a file. @@ -531,6 +551,13 @@ The default is the file system block size. An optional suffix may be provided as per .Sy rateget . This option affects only binary transfers. +If +.Ar class +is +.Dq none +or +.Ar size +is not specified, use the default. .It Sy sanenames Ar class Op Sy off If .Ar class @@ -538,24 +565,38 @@ is .Dq none or .Sy off -is given, allow uploaded file names to contain any characters valid for a +is specified, allow uploaded file names to contain any characters valid for a file name. Otherwise, only permit file names which don't start with a .Sq \&. and only comprise of characters from the set .Dq [-+,._A-Za-z0-9] . -.It Sy sendbufsize Ar class Ar size +.It Sy sendbufsize Ar class Op Ar size Set the size of the socket send buffer. An optional suffix may be provided as per .Sy rateget . The default is zero and the system default value will be used. This option affects only binary transfers. -.It Sy sendlowat Ar class Ar size +If +.Ar class +is +.Dq none +or +.Ar size +is not specified, use the default. +.It Sy sendlowat Ar class Op Ar size Set the low water mark of socket send buffer. An optional suffix may be provided as per .Sy rateget . The default is zero and system default value will be used. This option affects only for binary transfer. +If +.Ar class +is +.Dq none +or +.Ar size +is not specified, use the default. .It Sy template Ar class Op Ar refclass Define .Ar refclass @@ -573,9 +614,9 @@ duplication. There can be only one template defined at a time. If .Ar refclass -is not given, disable the template for +is not specified, disable the template for .Ar class . -.It Sy timeout Ar class Ar time +.It Sy timeout Ar class Op Ar time Set the inactivity timeout period. (the default is fifteen minutes). This cannot be less than 30 seconds, or greater than the value for @@ -586,8 +627,8 @@ is .Dq none or .Ar time -is not specified, set to the default of 15 minutes. -.It Sy umask Ar class Ar umaskval +is not specified, use the default. +.It Sy umask Ar class Op Ar umaskval Set the umask to .Ar umaskval . If @@ -605,7 +646,7 @@ is .Dq none or .Sy off -is given, disable the following commands: +is specified, disable the following commands: .Sy APPE , .Sy STOR , and @@ -619,7 +660,7 @@ as well as the modify commands: and .Sy UMASK . Otherwise, enable them. -.It Sy writesize Ar class Ar size +.It Sy writesize Ar class Op Ar size Limit the number of bytes to .Xr write 2 at a time. @@ -631,6 +672,13 @@ will be written at a time. An optional suffix may be provided as per .Sy rateget . This option affects only binary transfers. +If +.Ar class +is +.Dq none +or +.Ar size +is not specified, use the default. .El .Sh DEFAULTS The following defaults are used: @@ -663,6 +711,7 @@ A sample file. .El .Sh SEE ALSO +.Xr strsuftoll 3 , .Xr ftpchroot 5 , .Xr ftpusers 5 , .Xr ftpd 8 diff --git a/libexec/ftpd/logutmp.c b/libexec/ftpd/logutmp.c index ec17287f24d..cdd05bc7895 100644 --- a/libexec/ftpd/logutmp.c +++ b/libexec/ftpd/logutmp.c @@ -69,7 +69,7 @@ login(const UTMP *ut) } if ((topslot < 0) || ((fd < 0) && (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) < 0)) - return; + return; /* * Now find a slot that's not in use... diff --git a/libexec/ftpd/version.h b/libexec/ftpd/version.h index 856fb5959ad..9bcc632b8ea 100644 --- a/libexec/ftpd/version.h +++ b/libexec/ftpd/version.h @@ -1,4 +1,4 @@ -/* $NetBSD: version.h,v 1.48 2002/10/26 04:19:56 lukem Exp $ */ +/* $NetBSD: version.h,v 1.49 2002/11/29 14:40:00 lukem Exp $ */ /*- * Copyright (c) 1999-2002 The NetBSD Foundation, Inc. * All rights reserved. @@ -36,5 +36,5 @@ */ #ifndef FTPD_VERSION -#define FTPD_VERSION "NetBSD-ftpd 20021025" +#define FTPD_VERSION "NetBSD-ftpd 20021130" #endif |
