History log of /src/libexec/ftpd/cmds.c |
Revision | | Date | Author | Comments |
1.35 |
| 17-Jan-2016 |
christos | PR/50665: David Binderman: move "dir" to the outer scope so it stays alive when the pointer is used later.
|
1.34 |
| 10-Aug-2015 |
shm | Fix directory stream leaks
|
1.33 |
| 03-Jul-2013 |
christos | check that stat succeeded before testing the guts of struct stat (Manime Villard)
|
1.32 |
| 28-Jun-2013 |
joerg | Fix violations of the sequence point rule.
|
1.31 |
| 19-Jun-2012 |
dholland | branches: 1.31.2; Pass WARNS=5
|
1.30 |
| 15-Mar-2009 |
lukem | branches: 1.30.6; Fix WARNS=4 issues (const & sign mismatches, etc) Ensure various ftpd.conf values can't exceed their underlying types.
|
1.29 |
| 02-Mar-2009 |
lukem | Use LLF (et al) instead of "%lld" (et al).
|
1.28 |
| 29-Dec-2008 |
christos | branches: 1.28.2; fix for 64 bit time_t and dev_t
|
1.27 |
| 13-Sep-2008 |
lukem | Crank copyright dates
|
1.26 |
| 09-Jun-2008 |
lukem | Don't use non-standard "u_<foo>" types. Strip trailing whitespace (as well as ':'s) off PAM password prompts. Improve some debug logging related to PAM.
|
1.25 |
| 28-Apr-2008 |
martin | branches: 1.25.2; Remove clause 3 and 4 from TNF licenses
|
1.24 |
| 01-Feb-2006 |
christos | branches: 1.24.18; debug -> ftpd_debug xstrdup -> ftpd_strdup
|
1.23 |
| 09-Aug-2004 |
lukem | 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'.
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.
|
1.22 |
| 07-Aug-2003 |
agc | branches: 1.22.2; Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22284, verified by myself.
|
1.21 |
| 24-Feb-2003 |
erh | Fix uninitialized variable in mlsname()
|
1.20 |
| 08-Jan-2003 |
manu | ftpd was unable to service the pwd request once you entered a directory without search permission. This confused some ftp clients.
We fix this problem by maitaining a cached path when getcwd() does not work. The symbolic links and ../ are resolved in the cached path, and it is finnally checked for accuracy by comparing ./ and the cached path with stat (device and inode comparison). If the comparison fails, pwd fails as it did before, and if the comparison succeeds, the cached path is displayed.
If paths are too long, we should just compare ./ with a truncated path and fail, thus making pwd displaying an error as it did before.
|
1.19 |
| 25-Oct-2002 |
itojun | Turns out that our implementation of STAT wasn't RFC 959 compliant. This version is now RFC 959 compliant, using a patch adapted from one sent in by david.leonard@eecs.uq.edu.au
openbsd libexec/ftpd/ftpd.c revision 1.69.
(see RFC959 page 36)
|
1.18 |
| 12-Oct-2002 |
darrenr | * enclose unknown command strings inside a pair of 's to clearly mark the text as being the 'whole' part received. * change a HELP reply from 214 to 504 when there is an error looking for help on a command.
|
1.17 |
| 11-Oct-2002 |
darrenr | "Command not implemented." is 502, not 501 (RFC959, 4.2.1)
|
1.16 |
| 13-Feb-2002 |
lukem | branches: 1.16.2; Fixes for mlsd/mlst standards conformance issues (noted by Robert Elz): - mlst shouldn't return cdir or pdir for type, only dir - mlst should always provide a full path name - mlsd should provide a full path name for the cdir entry. (providing a full path name for the pdir entry is optional, and i punted on that).
|
1.15 |
| 01-Feb-2002 |
lukem | fix previous, and ensure that closedataconn() is only called after dataconn() and with a non-NULL file pointer. active transfers now work correctly again, passive transfers work, and the data stream is only closed after a PASV or EPSV if a successful connection was initiated with dataconn().
|
1.14 |
| 17-Jan-2002 |
itojun | reject SIZE request for ascii file if it exceeds 10k.
|
1.13 |
| 25-Apr-2001 |
lukem | crank copyrights of files changed this year remove superfluous byte_count update in send_file_list crank version
|
1.12 |
| 09-Jan-2001 |
itojun | ensure replydirname() do not truncate the names. From: Paul Janzen <pjanzen@foatdi.harvard.edu>
|
1.11 |
| 09-Jan-2001 |
itojun | make sure we do not return stray " at the end of stirng, like bla"\0. From: "William C. Allen" <allenwc@home.com>
|
1.10 |
| 18-Dec-2000 |
lukem | Features:
* Add ftpd.conf(5) directive `advertise'; change the address that is advertised to the client for PASV transfers. this may be useful in certain firewall/NAT environments.
Feature requested in [bin/9606] by Scott Presnell.
* Add -X option; syslog wu-ftpd style xferlog messages, prefixed with `xferlog: '. An example line from syslog (wrapped): Dec 16 18:50:24 odysseus ftpd[571]: xferlog: Sat Dec 16 18:50:24 2000 2 localhost 3747328 /pub/WLW2K601.EXE b _ o a lukem@ FTP 0 * c
These messages can be converted to a wu-ftpd style xferlog file suitable for parsing with third-party tools with something like: grep 'xferlog: ' /var/log/xferlog | \ sed -e 's/^.*xferlog: //' >wuxferlog
The format is the same as the wu-ftpd xferlog entries (with the leading syslog stuff), but different from the wu-ftpd syslogged xferlog entries because the latter is not as easy to convert into the standard xferlog file format.
The choice to only syslog the xferlog messages rather than append to a /var/log/xferlog file was made because the latter doesn't work to well in the situation where the logfile is rotated and compressed and a long-running ftpd still has a file-descriptor to the now nonexistant xferlog file, and the log message will then get lost.
Feature requested in [bin/11651] by Hubert Feyrer.
Fixes:
* In ftpd(8), clarify the -a and -c options.
* More clarifications in ftpd.conf(5).
* Ensure that all ftpd.conf commands set a parameter back to sane defaults if an argument of `none' or bad settings are given.
* Support the `chroot' directive for `REAL' users too (for consistency).
* For `GUEST' users, store the supplied password in pw->pw_passwd for use later in the xferlog.
* If show_chdir_messages() is given a code of -1, flush the cache of visited directories. Invoke show_chdir_messages(-1) in end_login().
* Only syslog session stats if logging is requested.
* Rename logcmd() -> logxfer(), and dolog() -> logremotehost().
* Use cprintf() instead of fprintf() where appropriate.
* Minor KNF, and make a couple of functions static that were declared static.
|
1.9 |
| 04-Dec-2000 |
itojun | in replydirname(), avoid one-byte overrun. From: Kristian Vlaardingerbroek <kris@obit.nl> (to bugs@openbsd)
|
1.8 |
| 16-Nov-2000 |
lukem | - new ftpd.conf directives: maxfilesize set the maximum size of uploaded files sanenames if set, only permit uploaded filenames that contain characters from the set "-+,._A-Za-z0-9" and that don't start with `.'
- new/changed command line options: -e emailaddr define email address for %E (see below) -P dataport use dataport as the dataport (instead of ctrlport-1) -q use pid files to count users [default] -Q don't use pid files to count users -u write entries to utmp -U don't write entries to utmp [default] -w write entries to wtmp [default] -W don't write entries to wtmp
NOTE: -U used to mean `write utmp entries'. Its meaning has changed so that it's orthogonal with -q/-Q and -w/-W. This isn't considered a major problem, because using -U isn't going to enable something you don't want, but will disable something you did want (which is safer).
- new display file escape sequences: %E email address %s literal `s' if the previous %M or %N wasn't ``1''. %S literal `S' if the previous %M or %N wasn't ``1''.
- expand the description of building ~ftp/incoming to cover the appropriate ftpd.conf(5) directives (which are defaults, but it pays to explicitly explain them)
- replace strsuftoi() with strsuftoll(), which returns a long long if supported, otherwise a long
- rework the way that check_modify and check_upload are done in the yacc parser; they're merged into a common check_write() function which is called explicitly
- merge all ftpclass `flag variables' into a single bitfield-based flag element
- move various common bits of parse_conf() into a couple of macros
- clean up some comments
|
1.7 |
| 15-Nov-2000 |
lukem | changes to improve portability: * replace union sockunion {} with struct sockinet {}, and modify the code accordingly. this is possibly more portable, as it doesn't rely upon the structure alignment within the union for our own stuff. uses local su_len unless HAVE_SOCKADDR_SA_LEN is defined (set ifdef BSD4_4) (XXX: haven't tested the ipv6 stuff) * always use getaddrinfo() and getnameinfo() instead of maintaining two code paths. (lukemftpd will provide replacements for these on older systems) * use lockf() instead of open(.., O_EXLOCK) to lock the pid file * minor KNF * clean up long long support: create helper #defines and use as appropriate: #define NO_LONG_LONG ! NO_LONG_LONG ------- ------------ -------------- LLF "%ld" "%lld" LLFP(x) "%" x "ld" "%" x "lld" LLT long long long ULLF "%lu" "%llu" ULLFP(x) "%" x "lu" "%" x "llu" ULLT unsigned long unsigned long long STRTOLL(x,y,z) strtol(x,y,z) strtoll(x,y,z)
|
1.6 |
| 10-Jul-2000 |
lukem | base64_encode(): separate out the special case for the last 2 bytes, and be a bit safer with signed chars. per discussion with kre.
|
1.5 |
| 09-Jul-2000 |
lukem | - base64_encode(): fix garbled output due to fencepost error. output now appears to match that of 'mimencode' (from metamail). problem noted by kre@munnari.oz.au. - fact_unique(): encode a combined dev_t+ino_t chunk rather than separate bits
|
1.4 |
| 19-Jun-2000 |
lukem | branches: 1.4.2; 1.4.4; rewrite method of traversing facttab[]; use size of list to terminate not NULL terminated entry (since we need to know the size of other reasons...)
|
1.3 |
| 19-Jun-2000 |
lukem | various fixes suggested by Robert Elz: * implement closedataconn() and use appropriately (including in mlsd()) * only put leading space in front of MLST output (not MLSD output) * MLSD: only output pdir and cdir entries when the type fact is requested. * change error code for giving MLSD a non-directory from 550 to 501 * remove MLSx Type fact support for UNIX.* for now; it's not standardised yet. * do a check_login when MLSD and MLST are given no args * detect & complain about null facts in OPTS MLST * cache getgroups() at login instead of calling each time in fact_perm()
other mods: * implement cprintf(); as per fprintf() but increments total_bytes{,_out} * implement CPUTC(); as per putc() but increments total_bytes{,_out} * implement base64_encode() * fact_unique() display base64 encoding of dev_t and ino_t rather than hex output; should scale if size of those changes * change reply() so that a negative code acts as the initial line in a reply, code == 0 prefixes the line with 4 spaces, and code > 0 works as before. deprecate lreply(code, ) and lreply(0, ) in favour of reply(-code, ) and reply(0, ) respectively. * use cprintf() and CPUTC() appropriately (often instead of printf(), lreply(-2, ) or lreply(-1, ). now we actually account for the data sent by MLST and MLSD. * remove DEBUG support for sending MLSD output to control connection instead of data connection (my ftp client now supports MLSD :-)
|
1.2 |
| 16-Jun-2000 |
explorer | include <krb5/krb5.h> before including extern.h, so krb5_context is defined
|
1.1 |
| 14-Jun-2000 |
lukem | major overhaul (just before netbsd 1.5 :-):
* implement draft-ietf-ftpext-mlst-10 commands, especially MLST and MLSD. we already supported SIZE and MDTM. add the appropriate FEAT output lines.
* migrate a lot of the command code from ftpcmd.y and ftpd.c to cmds.c
* make dataconn(), feat(), lookup(), opts() and sizecmd() public
* modify struct tab so that it has a `flags' instead of `implemented' element, and remove the `hasopts' element. If flags == 1, the command is implemented. if flags == 2, the command is implemented and takes options
* add macros ISDOTDIR(x) (is x ".") and ISDOTDOTDIR(x) (is x "..")
* modify lreply() so that lreply(-2, ...) just outputs the given info without a prefix or trailing \r\n. this saves doing b = printf(); total_* += b;
* enhance statcmd(). still needs work in the LPRT status stuff.
* crank version
|
1.4.4.2 |
| 22-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.4.4.1 |
| 19-Jun-2000 |
minoura | file cmds.c was added on branch minoura-xpg4dl on 2000-06-22 15:58:15 +0000
|
1.4.2.5 |
| 26-Aug-2004 |
jmc | Pullup rev 1.13-1.18,1.20-1.23 (requested by he in ticket #158)
Update to NetBSD ftpd 20040809. Fixes SA#2004-009.
|
1.4.2.4 |
| 25-Oct-2002 |
itojun | libexec/ftpd/cmds.c 1.19
Correct RFC959 compliance in quoting lines starting with digits (page 36).
(itojun)
|
1.4.2.3 |
| 29-Mar-2001 |
lukem | sync ftpd to -current with the following revisions (for lukem/christos): Makefile 1.43-1.44 cmds.c 1.7-1.8, 1.10-1.12 conf.c 1.35-1.40 extern.h 1.32-1.38 ftpcmd.y 1.53-1.59 ftpd.8 1.58-1.63 ftpd.c 1.102-1.104, 1.106-1.122 ftpd.conf.5 1.12-1.15 ftpusers.5 1.8 logwtmp.c 1.16 popen.c 1.23-1.25 version.h 1.28
a quick summary of user-visible changes; - fix glob DoS by using GLOB_LIMIT - add ftpd.conf directives `advertise', `maxfilesize', `sanenames' - add flags: -P dataport, -X - wuftpd style log entries, -q/-Q - (en|dis)able pidfiles, -u/-U - (en|dis)able utmp, -w/-W - (en|dis)able wtmp
|
1.4.2.2 |
| 13-Dec-2000 |
he | Pull up revision 1.9 (requested by itojun): Fix a one-byte buffer overrun.
|
1.4.2.1 |
| 13-Jul-2000 |
thorpej | Pull up revs. 1.4-1.6 (lukem): fixes some issues with the correct generation of unique facts in the output of MLSx.
|
1.16.2.3 |
| 31-Aug-2004 |
jmc | Pullup rev 1.17-1.18,1.21-1.23 (requested by he in ticket #1739)
Update to NetBSD ftpd 20040809. Fixes SA#2004-009.
|
1.16.2.2 |
| 11-Jan-2003 |
jmc | Pull up revisions 1.19-1.20 (requested by manu in ticket #1064) ftpd was unable to service the pwd request once you entered a directory without search permission. This confused some ftp clients.
We fix this problem by maitaining a cached path when getcwd() does not work. The symbolic links and ../ are resolved in the cached path, and it is finnally checked for accuracy by comparing ./ and the cached path with stat (device and inode comparison). If the comparison fails, pwd fails as it did before, and if the comparison succeeds, the cached path is displayed.
If paths are too long, we should just compare ./ with a truncated path and fail, thus making pwd displaying an error as it did before.
|
1.16.2.1 |
| 01-Nov-2002 |
tron | Pull up revision 1.19 (requested by itojun in ticket #942): Turns out that our implementation of STAT wasn't RFC 959 compliant. This version is now RFC 959 compliant, using a patch adapted from one sent in by david.leonard@eecs.uq.edu.au openbsd libexec/ftpd/ftpd.c revision 1.69. (see RFC959 page 36)
|
1.22.2.1 |
| 13-Aug-2004 |
jmc | Pullup rev 1.23 (requested by lukem in ticket #757)
* 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'. * 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.
|
1.24.18.2 |
| 17-Jun-2008 |
yamt | sync with head.
|
1.24.18.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.25.2.2 |
| 24-Sep-2008 |
wrstuden | Merge in changes between wrstuden-revivesa-base-2 and wrstuden-revivesa-base-3.
|
1.25.2.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.28.2.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
|
1.30.6.2 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.30.6.1 |
| 30-Oct-2012 |
yamt | sync with head
|
1.31.2.1 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|