Commit Graph

36 Commits

Author SHA1 Message Date
Sebastian Huber
995610e145 ftpd: Go back to the root directory 2013-02-13 14:19:50 +01:00
Sebastian Huber
1b937c6994 ftpd: Check the root and current directory change
Only continue the session if the root and current directory change was
successful, otherwise the FTP server may access restricted file system
areas.
2013-01-30 17:08:04 +01:00
Sebastian Huber
55a36b724c ftpd: Add SIZE command 2012-11-21 16:38:34 +01:00
Sebastian Huber
4da3fef455 ftpd: Set current directory after session close
The chroot() is an implicit chdir("/").  Set the current directory to
"/" after session close.  This helps to avoid references to mounted file
systems in dynamic media.
2012-05-29 16:18:44 +02:00
Joel Sherrill
9b4422a251 Remove All CVS Id Strings Possible Using a Script
Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines
  next to each other after Id string line removed.
+ remove entire comment blocks which only exited to
  contain CVS Ids
+ If the processing left a blank line at the top of
  a file, it was removed.
2012-05-11 08:44:13 -05:00
Joel Sherrill
796bb3f51c PR 1998/networking - Move ftpd root initialization
From: Xiangfu <xiangfu@sharism.cc>
Signed-off-by: Xiangfu <xiangfu@sharism.cc>
2012-02-02 13:33:09 -06:00
Ralf Corsepius
438a893051 2011-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
* ftpd/ftpd.c: Make split_command static.
2011-12-08 05:36:27 +00:00
Sebastian Huber
09647b7e20 2011-10-26 Sebastian Huber <sebastian.huber@embedded-brains.de>
* ftpd/ftpd.h, ftpd/ftpd.c: Moved buffer and stack size constants into
	header file.
2011-10-26 10:32:09 +00:00
Sebastian Huber
eef45d18c3 2011-10-26 Sebastian Huber <sebastian.huber@embedded-brains.de>
* ftpd/ftpd.c: Increased data buffer size to 4096 bytes.  Use
	RTEMS_MINIMUM_STACK_SIZE plus the data buffer size for worker thread
	stack size.
2011-10-26 10:20:54 +00:00
Joel Sherrill
64adc13c86 2011-07-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* ftpd/ftpd.c, libcsupport/src/geteuid.c, libcsupport/src/getgroups.c,
	libcsupport/src/getpgrp.c, libcsupport/src/getpid.c,
	libcsupport/src/getppid.c, libcsupport/src/setpgid.c,
	libcsupport/src/setsid.c, libcsupport/src/utsname.c,
	libmisc/stackchk/check.c, posix/include/rtems/posix/mqueue.h,
	posix/inline/rtems/posix/cond.inl,
	posix/inline/rtems/posix/mqueue.inl,
	posix/inline/rtems/posix/mutex.inl,
	posix/inline/rtems/posix/pthread.inl,
	posix/inline/rtems/posix/semaphore.inl,
	posix/inline/rtems/posix/timer.inl, posix/src/alarm.c,
	posix/src/barrierattrdestroy.c, posix/src/barrierattrgetpshared.c,
	posix/src/barrierattrinit.c, posix/src/barrierattrsetpshared.c,
	posix/src/cleanuppop.c, posix/src/cleanuppush.c,
	posix/src/clockgetcpuclockid.c, posix/src/clockgetenableattr.c,
	posix/src/clockgetres.c, posix/src/clockgettime.c,
	posix/src/clocksetenableattr.c, posix/src/clocksettime.c,
	posix/src/cond.c, posix/src/condattrdestroy.c,
	posix/src/condattrgetpshared.c, posix/src/condattrinit.c,
	posix/src/condattrsetpshared.c, posix/src/condbroadcast.c,
	posix/src/conddefaultattributes.c, posix/src/conddestroy.c,
	posix/src/condinit.c, posix/src/condsignal.c,
	posix/src/condsignalsupp.c, posix/src/condtimedwait.c,
	posix/src/condwait.c, posix/src/condwaitsupp.c,
	posix/src/keygetspecific.c, posix/src/keyrundestructors.c,
	posix/src/keysetspecific.c, posix/src/mprotect.c, posix/src/mqueue.c,
	posix/src/mqueuecreatesupp.c, posix/src/mqueuedeletesupp.c,
	posix/src/mqueuegetattr.c, posix/src/mqueuenotify.c,
	posix/src/mqueuereceive.c, posix/src/mqueuesend.c,
	posix/src/mqueuesendsupp.c, posix/src/mqueuesetattr.c,
	posix/src/mqueuetimedreceive.c, posix/src/mqueuetimedsend.c,
	posix/src/mqueuetranslatereturncode.c, posix/src/mqueueunlink.c,
	posix/src/mutex.c, posix/src/mutexattrdestroy.c,
	posix/src/mutexattrgetprioceiling.c,
	posix/src/mutexattrgetprotocol.c, posix/src/mutexattrgetpshared.c,
	posix/src/mutexattrinit.c, posix/src/mutexattrsetprioceiling.c,
	posix/src/mutexattrsetprotocol.c, posix/src/mutexattrsetpshared.c,
	posix/src/mutexdestroy.c, posix/src/mutexgetprioceiling.c,
	posix/src/mutexinit.c, posix/src/mutexlock.c,
	posix/src/mutexlocksupp.c, posix/src/mutexsetprioceiling.c,
	posix/src/mutextimedlock.c, posix/src/mutextrylock.c,
	posix/src/mutexunlock.c, posix/src/nanosleep.c, posix/src/psignal.c,
	posix/src/psignalchecksignal.c,
	posix/src/psignalclearprocesssignals.c,
	posix/src/psignalclearsignals.c,
	posix/src/psignalsetprocesssignals.c,
	posix/src/psignalunblockthread.c, posix/src/pthreadinitthreads.c,
	posix/src/rwlockattrdestroy.c, posix/src/rwlockattrgetpshared.c,
	posix/src/rwlockattrinit.c, posix/src/rwlockattrsetpshared.c,
	posix/src/semaphore.c, posix/src/semaphoredeletesupp.c,
	posix/src/semaphorenametoid.c, posix/src/semaphorewaitsupp.c,
	posix/src/semclose.c, posix/src/semdestroy.c,
	posix/src/semgetvalue.c, posix/src/seminit.c, posix/src/semopen.c,
	posix/src/sempost.c, posix/src/semtimedwait.c,
	posix/src/semtrywait.c, posix/src/semunlink.c, posix/src/semwait.c,
	posix/src/sysconf.c, posix/src/testcancel.c, posix/src/ualarm.c,
	rtems/src/clockgetuptime.c, rtems/src/clockset.c,
	rtems/src/clocksetnsecshandler.c, rtems/src/clocktick.c,
	rtems/src/clocktodtoseconds.c, rtems/src/clocktodvalidate.c,
	rtems/src/dpmem.c, rtems/src/dpmemcreate.c, rtems/src/dpmemdelete.c,
	rtems/src/dpmemexternal2internal.c, rtems/src/dpmemident.c,
	rtems/src/dpmeminternal2external.c, rtems/src/event.c,
	rtems/src/eventmp.c, rtems/src/eventreceive.c,
	rtems/src/eventseize.c, rtems/src/eventsend.c,
	rtems/src/eventsurrender.c, rtems/src/eventtimeout.c, rtems/src/mp.c,
	rtems/src/msg.c, rtems/src/msgmp.c, rtems/src/msgqallocate.c,
	rtems/src/msgqbroadcast.c, rtems/src/msgqcreate.c,
	rtems/src/msgqdelete.c, rtems/src/msgqflush.c,
	rtems/src/msgqgetnumberpending.c, rtems/src/msgqident.c,
	rtems/src/msgqreceive.c, rtems/src/msgqtranslatereturncode.c,
	rtems/src/msgqurgent.c, rtems/src/part.c, rtems/src/partcreate.c,
	rtems/src/partdelete.c, rtems/src/partgetbuffer.c,
	rtems/src/partident.c, rtems/src/partmp.c,
	rtems/src/partreturnbuffer.c, rtems/src/ratemon.c,
	rtems/src/ratemoncancel.c, rtems/src/ratemoncreate.c,
	rtems/src/ratemondelete.c, rtems/src/ratemongetstatistics.c,
	rtems/src/ratemongetstatus.c, rtems/src/ratemonident.c,
	rtems/src/ratemonperiod.c, rtems/src/ratemonresetstatistics.c,
	rtems/src/ratemontimeout.c, rtems/src/region.c,
	rtems/src/regioncreate.c, rtems/src/regiondelete.c,
	rtems/src/regionextend.c, rtems/src/regiongetfreeinfo.c,
	rtems/src/regiongetinfo.c, rtems/src/regiongetsegment.c,
	rtems/src/regiongetsegmentsize.c, rtems/src/regionident.c,
	rtems/src/regionmp.c, rtems/src/regionprocessqueue.c,
	rtems/src/regionresizesegment.c, rtems/src/regionreturnsegment.c,
	rtems/src/rtemsobjectgetclassicname.c, rtems/src/rtemstimer.c,
	rtems/src/sem.c, rtems/src/semcreate.c, rtems/src/semdelete.c,
	rtems/src/semflush.c, rtems/src/semident.c, rtems/src/semmp.c,
	rtems/src/semobtain.c, rtems/src/semrelease.c,
	rtems/src/semtranslatereturncode.c, rtems/src/signal.c,
	rtems/src/signalcatch.c, rtems/src/signalmp.c,
	rtems/src/signalsend.c, rtems/src/taskcreate.c,
	rtems/src/taskdelete.c, rtems/src/taskgetnote.c,
	rtems/src/taskident.c, rtems/src/taskinitusers.c,
	rtems/src/taskissuspended.c, rtems/src/taskmp.c,
	rtems/src/taskrestart.c, rtems/src/taskresume.c, rtems/src/tasks.c,
	rtems/src/tasksetnote.c, rtems/src/tasksetpriority.c,
	rtems/src/taskstart.c, rtems/src/tasksuspend.c,
	rtems/src/taskwakeafter.c, rtems/src/taskwakewhen.c,
	rtems/src/timercancel.c, rtems/src/timercreate.c,
	rtems/src/timerdelete.c, rtems/src/timerfireafter.c,
	rtems/src/timerfirewhen.c, rtems/src/timergetinfo.c,
	rtems/src/timerident.c, rtems/src/timerreset.c,
	rtems/src/timerserverfireafter.c, rtems/src/timerserverfirewhen.c,
	sapi/src/debug.c, sapi/src/extension.c, sapi/src/posixapi.c,
	sapi/src/rtemsapi.c, score/src/apiext.c, score/src/chain.c,
	score/src/corebarrier.c, score/src/corebarrierrelease.c,
	score/src/corebarrierwait.c, score/src/coremsgbroadcast.c,
	score/src/coremsgclose.c, score/src/coremsgflush.c,
	score/src/coremsgflushsupp.c, score/src/coremsgflushwait.c,
	score/src/coremsginsert.c, score/src/coremsgseize.c,
	score/src/coremsgsubmit.c, score/src/coremutex.c,
	score/src/coremutexflush.c, score/src/coremutexseize.c,
	score/src/corerwlock.c, score/src/corerwlockobtainread.c,
	score/src/corerwlockobtainwrite.c, score/src/corerwlockrelease.c,
	score/src/coresem.c, score/src/coresemflush.c,
	score/src/coresemsurrender.c, score/src/corespinlock.c,
	score/src/corespinlockrelease.c, score/src/corespinlockwait.c,
	score/src/coretod.c, score/src/coretodset.c,
	score/src/coretodtickle.c, score/src/heap.c, score/src/interr.c,
	score/src/mpci.c, score/src/objectallocate.c,
	score/src/objectextendinformation.c, score/src/objectfree.c,
	score/src/objectget.c, score/src/objectgetisr.c,
	score/src/objectgetnext.c, score/src/objectgetnoprotection.c,
	score/src/objectinitializeinformation.c, score/src/objectmp.c,
	score/src/objectnametoid.c, score/src/objectnametoidstring.c,
	score/src/objectshrinkinformation.c, score/src/rbtree.c,
	score/src/threaddelayended.c, score/src/threadhandler.c,
	score/src/threadinitialize.c, score/src/threadloadenv.c,
	score/src/threadmp.c, score/src/threadq.c,
	score/src/threadqdequeue.c, score/src/threadqdequeuefifo.c,
	score/src/threadqdequeuepriority.c, score/src/threadqenqueue.c,
	score/src/threadqenqueuefifo.c, score/src/threadqenqueuepriority.c,
	score/src/threadqextract.c, score/src/threadqextractfifo.c,
	score/src/threadqextractpriority.c,
	score/src/threadqextractwithproxy.c, score/src/threadqfirst.c,
	score/src/threadqfirstfifo.c, score/src/threadqfirstpriority.c,
	score/src/threadqflush.c, score/src/threadqrequeue.c,
	score/src/threadstackallocate.c, score/src/threadstartmultitasking.c,
	score/src/watchdog.c, score/src/watchdogadjust.c,
	score/src/watchdoginsert.c, score/src/watchdogremove.c,
	score/src/watchdogtickle.c: Remove /*PAGE markers which were
	interpreted by a long dead print script.
2011-07-24 23:55:15 +00:00
Sebastian Huber
86933ce00d 2011-06-24 Arnout Vandecappelle <arnout@mind.be>
Sebastien Bourdeauducq <sebastien@milkymist.org>

	PR 1724/cpukit
	* ftpd/ftpd.h, ftpd/ftpd.c: Added USER/PASS authentication.
2011-06-24 10:00:36 +00:00
Sebastian Huber
1343dfa314 2011-06-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR 1811/networking
	* ftpd/ftpd.c: Fixed reply format.
2011-06-07 09:08:37 +00:00
Joel Sherrill
ff49ffe396 2011-04-04 Sebastien Bourdeauducq <sebastien.bourdeauducq@gmail.com>
PR 1722/networking
	* ftpd/ftpd.c: FTPD fails to parse correctly FTP commands relating to
	filenames with spaces in them.
2011-04-04 17:08:34 +00:00
Sebastian Huber
e7fd0524d2 2010-05-07 Arnout Vandecappelle <arnout@mind.be>
PR 1511/networking
	* ftpd/ftpd.c: Abort RETR for directories.
2010-05-07 09:07:17 +00:00
Joel Sherrill
bab5c5fac0 2010-03-12 Joel Sherrill <joel.sherrill@oarcorp.com>
* ftpd/ftpd.c, httpd/asp.c, httpd/ejparse.c, httpd/emfdb.c,
	httpd/misc.c, httpd/um.c, httpd/webs.c, httpd/websuemf.c,
	libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_format.c,
	libfs/src/dosfs/msdos_misc.c, libfs/src/nfsclient/src/nfs.c,
	libmisc/capture/capture-cli.c, libmisc/monitor/mon-network.c,
	libmisc/shell/hexdump-odsyntax.c, libmisc/shell/main_ifconfig.c,
	libmisc/shell/shell.c, libmisc/shell/shell_makeargs.c,
	libmisc/uuid/parse.c, libnetworking/libc/gethostbydns.c,
	libnetworking/libc/gethostbyht.c, libnetworking/libc/gethostnamadr.c,
	libnetworking/libc/getnetnamadr.c, libnetworking/libc/inet_addr.c,
	libnetworking/libc/inet_network.c, libnetworking/libc/res_debug.c,
	libnetworking/libc/res_init.c, libnetworking/libc/res_query.c,
	libnetworking/rtems/rtems_mii_ioctl.c,
	score/src/objectgetnameasstring.c: Readdress use of ctype methods per
	recommendation from D.J. Delorie on the newlib mailing list. We
	should pass an unsigned char into these methods.
2010-03-12 16:26:16 +00:00
Joel Sherrill
391b4dda25 2010-03-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* ftpd/ftpd.c, httpd/uemf.c, httpd/um.c, httpd/webs.c,
	httpd/websuemf.c, libblock/src/diskdevs.c,
	libmisc/capture/capture-cli.c, libmisc/monitor/mon-network.c,
	libmisc/shell/hexdump-odsyntax.c, libmisc/shell/main_ifconfig.c,
	libmisc/uuid/parse.c, libnetworking/lib/ftpfs.c,
	libnetworking/libc/gethostbyht.c, libnetworking/libc/getnetnamadr.c,
	libnetworking/libc/inet_network.c,
	libnetworking/rtems/rtems_mii_ioctl.c,
	score/src/objectgetnameasstring.c: Fix warnings for ctype methods.
2010-03-11 19:12:30 +00:00
Ralf Corsepius
dc936a46ca Change SIX_MONTHS to time_t. 2009-02-05 05:19:16 +00:00
Ralf Corsepius
031deada15 Add __attribute__((unused)) to unused function args. 2009-01-02 13:04:13 +00:00
Ralf Corsepius
e95065d2c0 Fix prototype. 2008-08-29 14:25:04 +00:00
Ralf Corsepius
3316af8af2 2008-08-21 Ralf Corsépius <ralf.corsepius@rtems.org>
* ftpd/ftpd.c: Don't use annonymous unions.
2008-08-21 04:57:22 +00:00
Ralf Corsepius
03e3a3ac3e Fix broken prototype. 2008-08-01 05:03:23 +00:00
Ralf Corsepius
5bc8a75e39 Add prototypes. 2008-07-29 11:46:19 +00:00
Joel Sherrill
d030c4e72d 2007-08-28 Joel Sherrill <joel.sherrill@OARcorp.com>
PR 1256/networking
	* ftpd/ftpd.c: Fix unaligned access.
2007-08-28 14:06:29 +00:00
Ralf Corsepius
2add4525d0 2007-05-08 Ralf Corsépius <ralf.corsepius@rtems.org>
* ftpd/ftpd.c: Add HAVE_CONFIG_H magic.
2007-05-08 15:31:55 +00:00
Joel Sherrill
a009d94459 2006-08-30 Joel Sherrill <joel@OARcorp.com>
* ftpd/ftpd.c, libcsupport/include/sys/ioccom.h,
	libcsupport/src/ioctl.c, libnetworking/kern/uipc_mbuf.c,
	libnetworking/libc/inet_addr.c, libnetworking/net/ethernet.h,
	libnetworking/net/if.c, libnetworking/net/if_ethersubr.c,
	libnetworking/net/if_ppp.c, libnetworking/net/if_pppvar.h,
	libnetworking/net/if_var.h, libnetworking/net/ppp_tty.c,
	libnetworking/netinet/in_cksum.c, libnetworking/nfs/bootp_subr.c,
	libnetworking/rtems/rtems_bsdnet_internal.h,
	libnetworking/sys/mbuf.h, pppd/md4.c, pppd/pppd.h: Remove warnings
	due to improper use of int which shows up on 16 bit targets. Added
	ioctl_command_t since IOCTL command argument does not reliably fit
	into 16 bits.
2006-08-31 01:10:02 +00:00
Ralf Corsepius
ea78ecadc9 socklen_t. 2005-05-10 08:56:46 +00:00
Ralf Corsepius
5146462f04 2004-10-21 Ralf Corsepius <ralf_corsepius@rtems.org>
* libnetworking/rtems_servers/ftpd.c: Use POSIX fixed size types.
2004-10-21 13:42:53 +00:00
Joel Sherrill
19ed3cf43b 2002-09-07 Joel Sherrill <joel@OARcorp.com>
* pppd/ipcp.c, rtems_servers/ftpd.c: Add include files to resolve
	warnings.
2002-09-07 23:07:58 +00:00
Ralf Corsepius
2129ac821d 2002-08-14 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* rtems_servers/ftpd.c: Remove unused variable buf.
	* pppd/md5.c: #include <string.h> to make gcc31 happy.
	* rtems_telnetd/telnetd.c: #include <string.h> to make gcc31 happy.
	* rtems_webserver/webmain.c: Remove unused variable dir, cp.
2002-08-14 10:44:49 +00:00
Joel Sherrill
a8c3326863 2001-04-20 Jake Janovetz <janovetz@uiuc.edu>
* rtems_servers/ftpd.c: Correct argument so hooks work again.
2001-04-20 19:17:08 +00:00
Joel Sherrill
07fbfcedf0 2001-01-31 Sergei Organov <osv@javad.ru>
* rtems_servers/ftp.d: Following changes:
	  - Hacks with current dir and root dir removed in favor of new libio
	    support for task-local current and root directories.
	  - Bug in `close_data_socket()' introduced by previous change fixed.
	  - `command_pasv()' changed to set timeout on socket we are listening
	    on and code fixed to don't close socket twice on error.
	  - `serr()' changed to clear `errno'.
	  - `data_socket()' changed to clear `errno' before `bind()'.
	  - `session()' changed to clear `errno' before processing session.
	  - `close_data_socket()' fixed to close both active and passive sockets
	  - Initialize info->data_socket to -1 in `daemon()'
	  - Initialize `fname' to empty string  in `exec_command()'
2001-03-05 23:01:43 +00:00
Joel Sherrill
38371dbebb 2001-01-24 Sergei Organov <osv@javad.ru>
* rtems_servers/ftpd.c, rtems_servers/ftpd.h: Major enhancements
	as listed below:
	  - Timeouts on sockets implemented. 'idle' field added to
	    configuration. No timeout by default to keep backward compatibility.
	    Note: SITE IDLE command not implemented yet.
	  - Basic global access control implemented. 'access' field added to
	    configuration. No access limitations by default to keep backward
	    compatibility.
	  - Anchor data socket for active mode (using self IP and port 20.)
	  - Fixed default data port support (still not tested).
	  - Don't allow IP address different from originating host in
	    PORT command to improve security.
	  - Fixed bug in MDTM command.
	  - Check for correctness of parsing of argument in command_port().
	  - Fixed squeeze_path() to don't allow names like 'NAME/smth' where
	    'NAME' is not a directory.
	  - Command parsing a little bit improved: command names are now
	    converted to upper-case to be more compatible with RFC (command
	    names are not case-sensitive.)
	  - Reformat comments so that they have RTEMS look-and-feel.
	  - Fixed DELE, SITE CHMOD, RMD, MKD broken by previous changes
	  - True ASCII mode implemented (doesn't work for hooks and /dev/null)
	  - Passive mode implemented, PASV command added.
	  - Default port for data connection could be used (untested, can't find
	    ftp client that doesn't send PORT command)
	  - SYST reply changed to UNIX, as former RTEMS isn't registered name.
	  - Reply codes reviewed and fixed.
2001-01-24 19:20:24 +00:00
Joel Sherrill
3f777d0edf 2001-01-12 Sergei Organov <osv@javad.ru>
* rtems_servers/ftpd.c, rtems_servers/ftpd.h: Major enhancements
	as listed below:
	    - use pool of pre-created threads to handle sessions instead of
  	      creating/deleting threads on the fly
	    - LIST output is now similar to what "/bin/ls -al" would output,
	      thus FTP clients such Netscape are happy with it.
	    - LIST NAME now works (both for files and directories)
	    - added support for NLST, CDUP, and MDTM FTP commands to make
	      more FTP clients happy
	    - keep track of CWD for every session separately
	    - ability to specify root directory name for FTPD in configuration
	      table. FTPD will then create illusion for FTP clients that this
	      is actually root directory.
	    - ignore options sent in commands, thus LIST -al FILE works and
	      doesn't try to list "-al" directory.
	    - buffers are allocated on stack instead of heap where possible to
	      eliminate malloc/free calls (avoid possible heap fragmentation
	      troubles).
	    - drop using of task notepad to pass parameters - use function
	      arguments instead
	    - use snprintf() instead of sprintf() as the latter is unsafe
	    - use of PF_INET in socket() instead of AF_INET

	    Here are ftp clients I've tried new FTPD with (all of them
	    running on Debian GNU/Linux 2.2):

	         Lftp 2.1.10
	         NcFTP 2.4.3
	         Netscape 4.75
	         ftp
	         mc 4.5.49
2001-01-12 13:51:56 +00:00
Joel Sherrill
df49c60c96 Merged from 4.5.0-beta3a 2000-06-12 15:00:15 +00:00
Joel Sherrill
85e24a3237 Patch from Emmanuel Rauget (raguet@crf.canon.fr) to add a htons on the
sin_port.
1999-04-02 14:39:19 +00:00
Joel Sherrill
6d0e13c3bd Added ftpd server from Jake Janovetz <janovetz@tempest.ece.uiuc.edu>. 1999-03-16 01:51:53 +00:00