Up to [cvs.NetBSD.org] / othersrc / libexec / tnftpd / src
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
merge from NetBSD-20130321 to NetBSD-20190129
Import NetBSD ftpd as at 20190129 Notable changes: - Fix violations of the sequence point rule. - Add volatile for gcc 5. - Check that stat and fstat succeed. - Support blacklistd(8) hooks. - Clear utmpx struct before writing it to wtmpx files. - Fix directory stream leaks. - Use explicit_memset(3) instead of memset(3) to clear password. - Fix scope of variable. PR misc/50665. - Ensure that closing socket exists. CID 603440. - Add -f option to ftpd to stay in foreground with -D. PR bin/53221. - Update version to "NetBSD-ftpd 20180428".
reimport; this time after munging the RCSIDs...
Use tnftpd.h if available.
Import NetBSD-ftpd from 20080504. Changes include:
* Reorganize USE_PAM so that the PAM conversation has a chance to
display a custom message in the 331 reply to USER.
* Remove clause 3 and 4 from TNF licenses
* Switch from lockf() to (more portable) fcntl() locking
* Rename HAVE_SOCKADDR_SA_LEN to HAVE_STRUCT_SOCKADDR_SA_LEN.
* Use defined(HAVE_foo) instead of just testing HAVE_foo.
* Replace references from draft-ietf-ftpext-mlst-NN to RFC 3659.
* Explicitly note the unsupported requests from RFC 2228.
* Improvements from FreeBSD:
- Document `ftp-chroot' from login.conf(5).
- Document that SIZE is prevented for files > 10240 bytes via ASCII transfers.
* Add -n option to display addresses in logs.
* Rename cred_t to ftpd_cred_t; the former causes a nameclash on Solaris.
* Expand documentation on numeric argument suffix parsing, and convert
to IEC 60027-2 prefixes for 2^n multiples ("KiB" instead of "KB", etc.)
Import NetBSD-ftpd 20060923: * Rename debug -> ftpd_debug, xstrdup -> ftpd_strdup * Fix comment about DEFAULT_UMASK. Pointed out in private mail by Tetsuya Isaki and Dmitry Sivachenko. * Add recvbufsize configuration option. This allows for setting the passive socket's SO_RCVBUF. Option works similarly to the current sendbufsize configuration option. * Change how recveive_data() works. When reading data from the socket for passive transfers to the server, receive_data() now works very similar to send_data_with_read(). Reads from the network are now done using either the filesystem block size or the configuration option readsize chunks. * Add hidesymlinks configuration option. This adds a -L to all ls command arguments so that the file or directory the link references is listed rather than the link itself. This was inspired by IRIX ftpd's -S option. * Change _PATH_FOO to _NAME_FOO where FOO is not a path. * Reorder some declarations so that parsers generated by bison can compile. Fix from Michael Richardson. * Implement option "-D", for running ftpd in standalone mode (daemon). ftpd will listen on the default FTP port for incoming connections and fork a child for each connection. This is lower overhead than starting ftpd from inetd(8) and thus might be useful on busy servers to reduce load. Inspired by FreeBSD. * Change (mostly) int to socklen_t. GCC 4 doesn't like that int and socklen_t are different signness. * Remove unreachable code (res could never be NULL here). Fixes Coverity CID 712. * Set file to NULL after calling fclose(). Fixes Coverity CID 2669. * Make sure that "su" is initialized before dereferencing it. Fixes Coverity CID 1075. * Fix some typos. * NLST should return 450 instead of 550 upon error, per RFC 959. * logxfer(): don't use the same buffer to store the results of two separate concurrent realpath(3)s, otherwise we'll log the wrong information for a rename. Noted by Dmitry Sivachenko in private mail. * s/getpwnam/sgetpwnam/ Found by John Nemeth. * Add PAM and LOGIN_CAP support. Mostly from FreeBSD. If pam is defined, then we don't fall back to other authentications even if PAM fails due to a system error (e.g. configuration problem). * Fix inverted test for expired passwords. * Cleanup utmp and utmpx support. - make them symmetric - add a function to open the wtmp file explicitly very early in the game * Apply patch from PR bin/33261 sent by FUKAOMI Naoki: "ftpd does not update wtmpx".
Sync to NetBSD-ftpd 20091107: * Fix WARNS=4 issues (const & sign mismatches, etc) * Ensure various ftpd.conf values can't exceed their underlying types. * Fix for 64 bit time_t and dev_t * Rename internal getline() function to get_line() so it does conflict with the getline(3) libc function. * Log both the hostname and numeric address. * Improve man page mdoc formatting
Sync to NetBSD ftpd 20041201: * Don't write trash in ut_ss; either initialize it to 0, or put in the proper information. * Add (unsigned char) cast to ctype functions * Don't allow accounts with age expired passwords to login. Any account that is required to change their password will not be allowed FTP access. Inspired by similar functionality in other FTP daemons.
Sync to NetBSD ftpd 2004-08-09. Fixes from (or inspired by) OpenBSD: * Fix yacc parser error recovery so that setjmp(3)/longjmp(3) is unnecessary. * Fix SIGURG handler to set an urgflag that's later tested, rather than abusing setjmp(3)/longjmp(3). * Use "volatile sig_atomic_t" as the type of variables modified by sig handlers. * Use sigaction(3) instead of signal(3) to set the signal handlers. * Only set the main SIGALRM handler once. If we need to change it, cache the old handler and restore appropriately... * Remove a bunch of signal races by improving the signal handlers. * Fix memory leak with 'ESPV ALL'. * Correctly clamp illegal "SITE CHMOD" mode values. * Fix minor memory leak with fromname. My stuff: * Clean up the debug message in reply(); use vsnprintf(3) instead of vsyslog(3). * Rework parsing of OOB commands to _not_ use the yacc parser, since the latter isn't reentrant and the hacks to work around that are ugly. We now examine urgflag at appropriate locations and call handleoobcmd() if it's set. Since the only OOB commands we currently implement are ABOR and STAT, this isn't an issue. (I also can't find the reference in RFC2228 where MIC, CONF & ENC are OOB-only commands. Go figure.) I could clean up the is_oob stuff some more, but the remaining stuff in ftpcmd.y is harmless and it's unnecessary churn right this moment.
Sync to NetBSD ftpd 20031210. Notable changes:
* Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22284
* Add ftpd_loginx() and ftpd_logwtmpx() and use them to hold wtmpx file
open while a session. Close bin/21692 by bqt@Krille.Update.UU.SE.
* Fix typos accidentally introduced in rev 1.70 as part of the large
number support. (NetBSD yacc didn't barf on these, although Solaris
and HP/UX's did...)
* Don't declare "yylex()" static; AFAICT it shouldn't be, and it causes
build problems with the output of some versions of yacc.
* Use sysconf(_SC_LOGIN_NAME_MAX) to determine the length of login
names, rather than assuming LOGIN_NAME_MAX. Based on patch from
Garrett Wollman via David O'Brien (both at FreeBSD.org)
* netbsd.org->NetBSD.org
* Move Jason Downs's code from a 4-clause to a 3-clause licence by
removing the advertising clause. Diffs provided in PR 22410 by Joel
Baker, confirmed to the board by Jason Downs.
With additional thanks to Jason Thorpe.
ftpd from 20030223
NetBSD's libexec/ftpd from 20021026
Initial revision