autogen added

This commit is contained in:
hsn 2004-10-23 13:52:12 +00:00
parent 2e8db79ab1
commit 8390634da0
72 changed files with 1388 additions and 1039 deletions

View File

@ -2,16 +2,28 @@ This is a BETA release, as such it's not guaranteed to work perfectly any
problems let me know, they'll be sorted out in the next Beta release. At the
point at which people stop complaining the non-beta release will be let out.
You can get beta version from CVS on sf.net there are tagged fsp-281-bXX.
You can get beta versions from CVS on sf.net there are tagged fsp-281-bXX.
checkouting HEAD it always best.
FSP Development Battle plan:
============================
* for next 2.8 Stable version (will be called 2.8.2)
2.8.2 - Next Stable version after 10 years or so
- get out this version as soon as possible. 2.8.1b3 and lower are buggy.
- add FSP Rename command
- add FSP Info command
- go out this version as soon as possible. 2.8.1b3 and lower are buggy.
- resolve symlink support problem. This maybe breaks compatibility
with older software versions.
- security: symlink to FILE can escape from FSP root directory.
- fix Sven's Slowaris 8 compile problem
- local bind address FSP_LOCALIP for clients
- bind-ip-address for server
- normalize return error codes of all clients
- server can be run multiple times on the same port, how to check?
on freebsd this works okay. needs re-testing on linux.
- fspd: add special defence against rapid/double fire clients (burst command in fspclient)
* for next point Stable version 2.8.3
- add native symbolic link support
- add FSP change password command
- add FSP command for changing owners
- add FSP command for listing directory owners
@ -33,17 +45,9 @@ release and ultimately into the final release.
-----------------------------------------------------------------------------
This version is fully backwards compatible with 2.7.1 and 2.8.1 both from the
client and the server viewpoints. Bar one thing, the reversed IP problem with
restricted host lists has now been fixed, so if you've deliberately reversed
the IP numbers in that list to get around the bug you should now put them back
in the correct order again.
Another point worth noting is that the next release will go to ANSI-C. If you
have a problem with this then now is the time to let me know. I don't forsee
any portability problems since I would expect that ANSI-C compliant compilers
are available for all platforms by now. This move will aid both maintenance and
any future use of C++ for Application Programming Interfaces.
This version is not quite fully backwards compatible with 2.7.1 and 2.8.1 from
the client and the server viewpoints. See file PROTOCOL for minor changes
in wire-protocol.
If you successfully build this distribution on a machine/OS/compiler
combination which isn't listed in the MACHINES file then please drop me a line

View File

@ -1,5 +1,5 @@
Authors:
Radim Kolar <hsn@cybermail.net> (Current FSP maintainer)
Radim Kolar <hsn@netmag.cz> (Current FSP maintainer)
Andrew Doherty <A.J.Doherty@reading.ac.uk>
Michael Fischbein
Cimarron D. Taylor

442
ChangeLog
View File

@ -1,46 +1,88 @@
Version - not yet released
Added pidfile.[c|h] from FreeBSD and modified it to fit in (hoaxter)
Added pidfile support, config option is 'pidlogname', the option
is required to start fspd, hope that's ok for most people (hoaxter)
Replaced . file information from INSTALL with a hint to man 1 fspd (hoaxter)
Added pidfile support, config option is 'pidlogname' (hoaxter)
Replaced .file information from INSTALL with a hint to man 1 fspd (hoaxter)
PROTOCOL: Added security section, fixed method of computing of checksums fspd: unlink filecache.c from build
conf: commented dangerours settings for win32 platform which can
cause data loss when fspd.conf is reused on win32 without editing.
Defaults are detected at build time.
fspd: allow to run without pidfile set.
added autogen.sh for regenerating of autoconf on FreeBSD which needs
to set some env. variables unless --enable-maintainer-mode do
not works.
do not free pidfile name on failure
changelog reformated: each entry begins with tab/not spaces.
continuation line has 2 chars leading space
removed trailing spaces from all sources and headers
tests: run random test 2000 times by default
random generator switched to simple2. Better results on both
freebsd and linux systems.
added maximum supported packet size to output of CC_VER command
fspd: -b command line switch for bandwidth limiting
PROTOCOL: Added compatibility section to some commands
Default timeout increased from 180 to 360 seconds.
clients: apply delay timeout also when starting transfer
clients: added env. variable FSP_MAXDELAY for fine-tuning resends
DEFAULT_MAXDELAY added to source code
FSP_TIMEOUT is total number of seconds, not retry count.
clients: try to resend packet on less fatal error (network down or so)
remove clients lock files after sending BYE. code merged from fspclient.
threre is an race condition: After client unlinks lock file and other
clients still runs new client will create new lock file which will
not share secret key with other clients. New client can't communicate
with server until other clients terminates.
man: we did not install fsp_env.7 manpage
allow home directory not starting with /
allow uploads only on file border
up/down speed is in B/s, not b/s.
client tracing improved:
H - not enough bytes for header
C - wrong checksum
S - wrong seq. number
T - truncated
R - First resend
I - Idle resend
client: use random starting seq. number - better for avoiding
seq. number clash with another client
fixed compiler warning on BB_READ4(const char *);
Version 2.8.1b19 - 11 Jan 2004
sven has added fspget URL command to setup.sh.
fixed case for mklargefile.py in tests/Makefile.am
added --enable-debug switch to configure for enabling extra
debuging code in client library
debuging code in client library
fsp/fifocache.c changed malloc.h to stdlib.h -> allow compile on
freebsd
freebsd
do not use ${RM} in clients/Makefile.am -> allow compile with bsd make
Version 2.8.1b18 - 25 Nov 24 2003
This is MINIMUM REQUIRED VERSION for applications which are using
javafsp library, only download machine atm. Javafsp library will
be released shortly as separate package.
PROTOCOL updated. Made rules about breaking directory header on
packet boundary more clear. Previous text was from fspd code comment
and was bad.
This is MINIMUM REQUIRED VERSION for applications which are using
javafsp library, only download machine atm. Javafsp library will
be released shortly as separate package.
PROTOCOL updated. Made rules about breaking directory header on
packet boundary more clear. Previous text was from fspd code comment
and was bad.
fixed tests/mklargefile.py
log uploads to wuftpd logfile also
PROTOCOL file updated. Added required commands section.
PROTOCOL file updated. Added recommended delay management section.
default delay in clients adjusted from 1.5 to 1.34 sec as recommended
in PROTOCOL
in PROTOCOL
support for MIN_DELAY, MAX_DELAY and DEFAULT_DELAY in source
path parsing moved to separate file server/path.c
new test tool parsecheck for testing server path parser
reworked parse path: separate error messages for high bit chars,
control chars
control chars
MAJOR BUGFIX: path with trailing / or starting / is now parsed correctly
pathes with dot after slash are now detected at parse level (side
effect of prev. fix, fixed security prob)
effect of prev. fix, fixed security prob)
tests moved from server/ into tests/ directory
removed special test case for root directory in path.c -> use more
general alg. instead. This fixed "/" dir.
general alg. instead. This fixed "/" dir.
parsecheck turned into test suite with hard coded test results
parsecheck added to 'make check'
support for multiple \n in filename - in future there will be
used for symlinks.
used for symlinks.
random generator changed to one recommended by Jiann-Ming Su.
new test program tests/randomcheck.c - tests random number generators.
@ -63,31 +105,31 @@ Version 2.8.1b16 -- 8 Nov 2003
fixed memory leak in client/util.c:get_dir_blk
fixed memory leak in client/util.c:open_dir
fixed error from 2.8.1b15 in util_stat which brokes recursive
directory listings
directory listings
do not delete partial file on FSP timeout in fgetcmd
Version 2.8.1b15 -- 15 Oct 2003
Sven writes manpage for fspscan.1
Sven writes manpage for fspscan.1
junked concept of private directory, now directory has flag
+g - public can get files
+g - public can get files
dir_priv -> dir_get
fprocmd flags changed +p -> -g (incompatible change in protocol)
fgetprocmd works in private directories. There are no more
private.
private.
.FSP_PRIVATE -> .FSP_NO_GET for avoiding user confusion because
i have axed marking directories as private in beta6
i have axed marking directories as private in beta6
fixed off-by-one error in getpro cmd
fsetpro cmd shows command syntax on error
fspd: do not save readme files to disk (avoids truncation them
to 1k)
to 1k)
fspd: fixed reply for makedir command (size of reply block was
not included)
fspd: getdirlisting checks for seek offsets (do not allow send partial
packets of dir listings)
Done item from my 1997 fsp wishlist: check 4 rights before
not included)
fspd: getdirlisting checks for seek offsets (do not allow send partial
packets of dir listings)
Done item from my 1997 fsp wishlist: check 4 rights before
uploading!
fver command can be disabled on server -- protection against FSP
detectors.
detectors.
fspscan: end port -e switch
configure.ac add check for compiler warning options
removed multiple definition of process from bsd_src/find.c and
@ -104,7 +146,7 @@ Version 2.8.1b15 -- 15 Oct 2003
fsp_prof: made `fsp` in `fsp port` optional
fsp_prof: made `fsp` in `fsp directory' optional
fhostcmd has now parser written in flex, should be less brain
damaged and more stable
damaged and more stable
fhostcmd: searching can now match full hostname or alias, not
a subpart of hostname or alias.
fhostcmd: added -? switch
@ -116,33 +158,33 @@ Version 2.8.1b15 -- 15 Oct 2003
do not use echo -e when building fspmerge client
updated manpages for fhostcmd.1 and fsp_prof.5
fspd: really reuse cached directory listings. Forgot to update
mtime after loading and they were loaded for every dirlisting
packet.
client library: do not use CC_STAT when building a directory listing.
fix in beta14 do not fixed the problem when working in non root
directory.
mtime after loading and they were loaded for every dirlisting
packet.
client library: do not use CC_STAT when building a directory listing.
fix in beta14 do not fixed the problem when working in non root
directory.
Version 2.8.1b14 -- 22 Sep 2003
Sven fixed bash shell script
Sven fixed bash shell script
fspd: list files over 4GB as 4GB in directory listings
fspd: do not allow seeking over 2GB when OS is not LFS friendly
fspd: print command names instead of numbers in debug mode
added new program fspscan.c to package. Well known fsp port scanner
made in 1992. Paranoid people calls this program fsp exploit.
made in 1992. Paranoid people calls this program fsp exploit.
added new SGML FSP FAQ made by Sven
fspd: debug messages are printed to stderr
PROTOCOL: added talking about timeouts
fcatcmd: removed debug messages
!!dirlist cache hit ratio is bad - something overwrites that!!
!!only happens when compiled without EFENCE??
fixed by fifocache malloc -> calloc
!!dirlist cache hit ratio is bad - something overwrites that!!
!!only happens when compiled without EFENCE??
fixed by fifocache malloc -> calloc
fspd: return 'is a directory' when trying to download directory
client library: do not use CC_STAT when building a directory listing
PLEASE!!! It is S l o w. Fixed: Performance of flscmd -l is now
back to the normal speed. EnJoy!
client library: do not use CC_STAT when building a directory listing
PLEASE!!! It is S l o w. Fixed: Performance of flscmd -l is now
back to the normal speed. EnJoy!
fstatcmd: print dates in ISO format, avoid tabs in output
fspd: support for long local directory names > 1024 but < 2048
fixed SECURITY prob: stat can stat any file (even out of FSP root!)
fixed SECURITY prob: stat can stat any file (even out of FSP root!)
added support for fstat to both shell scripts
fifocache.c support for memory profiler functions
fifocache.c supports nice memory stats
@ -150,19 +192,19 @@ Version 2.8.1b14 -- 22 Sep 2003
cache stats are dumped to dumpfile also on SIGUSR1
Version 2.8.1b13 -- 10 Sep 2003
fver: reports if timestamping is supported
fver: reports if timestamping is supported
CC_VER: now reports fspd + version + \n
Hanno Hecker help us port shell script from CSH to BASH
large file support activated in configure
example.conf -> fspd.conf
added contrib/mklargefile.c program for creating a large file with
hole
hole
fver -l reports max file size supported and LFS mode
server detects i/o errors when uploading (out of diskspace)
4GB-1 files should work from server p. of view if LFS is on
fspd -F runs in foreground, for broken startup scripts
random port for fspd (-p 65535) important for keeping lamers out of
your warez site.
your warez site.
changed exit codes for server, for easy debuging
manual page for fspd updated - exit codes added
PROTOCOL: added support for timestamping on uploads
@ -170,8 +212,8 @@ Version 2.8.1b13 -- 10 Sep 2003
fspd: -T switch for setting temporary directory for uploads
fput.c: added support for timestamping uploads
fcdcmd supports new permisions also
fput - made timestamping optional -p option
correct stats dumping - now dumpfile is used (really)
fput - made timestamping optional -p option
correct stats dumping - now dumpfile is used (really)
inetd mode now works!
updated INFO document
moved faq, history and protocol to a new doc subdirectory
@ -181,17 +223,17 @@ Version 2.8.1b12 -- 3 Sep 2003
port setting in config file works
manual page for fprocmd updated
fstatcmd now uses remote wildcard expansion like rest of fsp
merged fgetcmd and fgrabcmd commands
merged fgetcmd and fgrabcmd commands
merged patch Geoffrey T. Dairiki. Server records new keyid from client
when serving session timeout.
when serving session timeout.
updated Bash version of CSH setup script, but still do not works
NEW FEATURE: fget/fgrab can now set file timestamps to remote date
When I have first used FSP in 1996 - I wanted this option.
When I have first used FSP in 1996 - I wanted this option.
Cygwin has now different builtin defaults
modified man page for fgetcmd - after 10 years! same goes for
fgrabcmd
default mode of fget/grab changed to unique fnames. Should I
change it to noclober
fgrabcmd
default mode of fget/grab changed to unique fnames. Should I
change it to noclober?
fget/grab has now -h help
Version 2.8.1b11 -- 27 Aug 2003
@ -200,7 +242,7 @@ Version 2.8.1b11 -- 27 Aug 2003
stat type log switch
new command FSP_STAT (not tested)
some code cleanup in client/ and common/ directories, warnings
removed.
removed.
PROTOCOL definition updated (stat and rename commands added)
auto_del.csh script added to server directory (untested)
return only file or directory objects in dir listing and stat command.
@ -208,8 +250,8 @@ Version 2.8.1b11 -- 27 Aug 2003
server has -? and -h options
new command fstatcmd (no manpage yet)
fixed main arg count in merged fsp client
client library now uses a new command FSP_STAT if server supports it
fprocmd without args displays directory name instead of .
client library now uses a new command FSP_STAT if server supports it
fprocmd without args displays directory name instead of .
fprocmd now supports 2.8.1bXX extented access rights
Version 2.8.1b10 -- 21 Jul 2003
@ -217,155 +259,155 @@ Version 2.8.1b10 -- 21 Jul 2003
removed -Wconversion from debug gcc switches
MAJOR BUGFIX: can CD to more than 1 level deep
changes init order in server/main.c so we can see error messages
during server startup
during server startup
Version 2.8.1b9 -- 19 Jul 2003
missing tmpdir switches fspd to read-only mode (really!)
daemonize is on by default
added port to default cnf file for fspd
check for -lefence in configure script
check for sys/syslimits.h - needed for cygwin
default port is 21 in conf.c
FIXED BUG when server root != file system root
Now compiles and runs on cygwin
do not use -1 exit code in server/main.c
server now tries to create tmpdirectory on startup
fspd: allow command line overide even when -f is used
missing tmpdir switches fspd to read-only mode (really!)
daemonize is on by default
added port to default cnf file for fspd
check for -lefence in configure script
check for sys/syslimits.h - needed for cygwin
default port is 21 in conf.c
FIXED BUG when server root != file system root
Now compiles and runs on cygwin
do not use -1 exit code in server/main.c
server now tries to create tmpdirectory on startup
fspd: allow command line overide even when -f is used
Version 2.8.1b8 -- 17 Jul 2003
new cfg switch: setgid
use /dev/random for seeding a random number generator
new cfg switches: umask and serverumask (octal value). Umask
for creating server files
fixed compilation on GCC < 3.0
fixed check for maintainer_mode in server/Makefile.am and
clients/Makefile.am
fhostcmd: check for $SHELL if we have csh-like shell
fhostcmd: options -c or -b to force C or Bourne shell syntax
server tables dump signal changed from alarm -> sigusr1
new cfg switch: dumpname for dumping runtime stats
clean server shutdown on sigint, sigterm
new cfg switch: grabcommand on/off
env. vars removed from individual manual pages and moved to a New
manpage fsp_env 7.
updated PROTOCOL definition of FSP. Fixed some bugs, added method
of packet checksum.
updated example configuration file for server
removed all prints when debug is not on
updated FILES section in fspd manpage
new cfg switch: setgid
use /dev/random for seeding a random number generator
new cfg switches: umask and serverumask (octal value). Umask
for creating server files
fixed compilation on GCC < 3.0
fixed check for maintainer_mode in server/Makefile.am and
clients/Makefile.am
fhostcmd: check for $SHELL if we have csh-like shell
fhostcmd: options -c or -b to force C or Bourne shell syntax
server tables dump signal changed from alarm -> sigusr1
new cfg switch: dumpname for dumping runtime stats
clean server shutdown on sigint, sigterm
new cfg switch: grabcommand on/off
env. vars removed from individual manual pages and moved to a New
manpage fsp_env 7.
updated PROTOCOL definition of FSP. Fixed some bugs, added method
of packet checksum.
updated example configuration file for server
removed all prints when debug is not on
updated FILES section in fspd manpage
Version 2.8.1b7 -- 13 Jul 2003
do not sent zero length blocks if client asks for them
filecache.c nuked
new cfg statement tmpdir for placing files during upload
all server code (except host.c) rewriting complete.
do not sent zero length blocks if client asks for them
filecache.c nuked
new cfg statement tmpdir for placing files during upload
all server code (except host.c) rewriting complete.
Version 2.8.1b6 -- 2 Jul 2003
configuration file was not closed after reading (found by valgrind)
link against Eletric Fence only in maintainer mode
compile server/cachecheck only in maintainer mode
removed long files check and support for code. FSP has maximum path
about 1024; it is no need to check if file can be longer than 14 chars
use config.guess for guessing OS type.
simplified configure.ac
up to date BETA.README
MACHINES file lives again
allow files starting with \ in directory listing
directory content is builded correctly on systems with pragma pack > 1
fixed another bug in generating of directory listing which violates FSP
protocol definiton (but worked in current code anyway)
use extern only in header files
key was not initialised when using shmem locking method
default timeout for clients changed from 4 to 180 sec.
removed option -r from fcatcmd
init socket data in udp io and avoid using sin there (gcc builtin)
server debug option changed from -d to -X
server argument -d directory -> sets root directory
server now runs also without configuration file!
keys generated by server are now 16bit random, not 8bit random
directory_cache nuked - it was uneffective and it has a file
descriptor leak!
new cfg. use_prebuild_dirlists (load/save) content file
new directory memory based cache engine works!
new directory .FSP_CONTENT load/save engine works
clear buffer before generating a directory listing (no information
leak)
fixed buffer overflow (exploitable if file uploads was allowed).
new cfg keyword statcache - size of dirstatcache
new cfg keyword statcache_timeout - (sec)
new cfg keyword use_access_files - boolean
fixed bug when home directory was symlinked to somewhere
removed remote FSP support from PPATH. It was never used in code.
new cfg use_directory_mtime - boolean. For windows set it to NO.
!!! NEW DIRECTORY STATE ENGINE CACHE !!!
new .FSP_PASSWORD access file
new .FSP_OWNER owner file (not yet implemented)
resend of BYE command is also accepted, why not?
no memory leaks in new code. Last leaks are in code which is going
to be rewrited
!!! MAJOR PERFORMANCE SPEEDUP. Need only 1 syscal to serve a
packet (if everything is cached).
do not list special files as directories
added file COPYRIGHT
speedup when loading access files
min delay for clients was increased from 0.5s to 1.5s (packets
was are just thrown out by server for <3sec reply). Performance
tested on our WireLess network. Today only 65% packets loss!
new configuration option homedir_restricted for following symlinks
out of home_directory
if $test in configure changed to x$test
ip range and IP parsing function moved out of host.c to iprange.c
host type must be specified (in config or in owner file)
renamed cfg. bufsize -> packetsize
use packetsize when generatin a directory listing. -> max packet size
management moved from user cfg. to server cfg.
added support for readme files to new dirstat engine
public directory list flag changed from negative to positive
new cfg option permit_passwordless_owners
NEW SECURITY ENGINE implemented
fixed infinite loop in client library if server sends directory
in smaller blocks than expected.
removed buffer overflow in log code (remote exploitable of course)
added new log switch 'readonly'
fixed security hole in grab command
rewrite log in packet processing (more readable)
corrected handling of public rights in private directories
detect if cached directory listings are out of date
configuration file was not closed after reading (found by valgrind)
link against Eletric Fence only in maintainer mode
compile server/cachecheck only in maintainer mode
removed long files check and support for code. FSP has maximum path
about 1024; it is no need to check if file can be longer than 14 chars
use config.guess for guessing OS type.
simplified configure.ac
up to date BETA.README
MACHINES file lives again
allow files starting with \ in directory listing
directory content is builded correctly on systems with pragma pack > 1
fixed another bug in generating of directory listing which violates FSP
protocol definiton (but worked in current code anyway)
use extern only in header files
key was not initialised when using shmem locking method
default timeout for clients changed from 4 to 180 sec.
removed option -r from fcatcmd
init socket data in udp io and avoid using sin there (gcc builtin)
server debug option changed from -d to -X
server argument -d directory -> sets root directory
server now runs also without configuration file!
keys generated by server are now 16bit random, not 8bit random
directory_cache nuked - it was uneffective and it has a file
descriptor leak!
new cfg. use_prebuild_dirlists (load/save) content file
new directory memory based cache engine works!
new directory .FSP_CONTENT load/save engine works
clear buffer before generating a directory listing (no information
leak)
fixed buffer overflow (exploitable if file uploads was allowed).
new cfg keyword statcache - size of dirstatcache
new cfg keyword statcache_timeout - (sec)
new cfg keyword use_access_files - boolean
fixed bug when home directory was symlinked to somewhere
removed remote FSP support from PPATH. It was never used in code.
new cfg use_directory_mtime - boolean. For windows set it to NO.
!!! NEW DIRECTORY STATE ENGINE CACHE !!!
new .FSP_PASSWORD access file
new .FSP_OWNER owner file (not yet implemented)
resend of BYE command is also accepted, why not?
no memory leaks in new code. Last leaks are in code which is going
to be rewrited
!!! MAJOR PERFORMANCE SPEEDUP. Need only 1 syscal to serve a
packet (if everything is cached).
do not list special files as directories
added file COPYRIGHT
speedup when loading access files
min delay for clients was increased from 0.5s to 1.5s (packets
was are just thrown out by server for <3sec reply). Performance
tested on our WireLess network. Today only 65% packets loss!
new configuration option homedir_restricted for following symlinks
out of home_directory
if $test in configure changed to x$test
ip range and IP parsing function moved out of host.c to iprange.c
host type must be specified (in config or in owner file)
renamed cfg. bufsize -> packetsize
use packetsize when generatin a directory listing. -> max packet size
management moved from user cfg. to server cfg.
added support for readme files to new dirstat engine
public directory list flag changed from negative to positive
new cfg option permit_passwordless_owners
NEW SECURITY ENGINE implemented
fixed infinite loop in client library if server sends directory
in smaller blocks than expected.
removed buffer overflow in log code (remote exploitable of course)
added new log switch 'readonly'
fixed security hole in grab command
rewrite log in packet processing (more readable)
corrected handling of public rights in private directories
detect if cached directory listings are out of date
Version 2.8.1b5 -- 25 June 2003
configure.ac upgaded to autoconf 2.57 and cleaned
added missing include headers to source code
vms code nuked from rest of headers
prefix is now used when finding configuration file
check for max. number of open files and adjust open handle cache
removed long file limit hack for FAT/VMS filesystems. Nonstandard and
unsecure.
removed include/version.h - use autoconf instead
added -V server option (display version)
do not use dircache as upload cache. Uploads now works even without
dircache
turn off cachedir when it do not exists
better init of random number generator. It should be really random.
fixed use of prebuild directory content and dircache
turn of logging if no log file is set
clean cache directory on startup
merged security patch from Debian package fsp_2.81.b3-4, i have
fixed this problem in 2.8.1b4; but Debian code looks better.
removed non standard NEED_ from configure.ac, use HAVE_
fver displays locking method and used config. files.
give lockf locking method priority over flock method
fgetcmd and fgrabcmd now understands -c continue download
fixed check for in.fspd
we have called check_required_vars twice
display copyright in fspd -V
INFO document updated, fixed spelling errors, added section
FSP today
added -t option for fspd; specifes timeout for inetd mode (or
when debug is on for normal more also)
configure.ac upgaded to autoconf 2.57 and cleaned
added missing include headers to source code
vms code nuked from rest of headers
prefix is now used when finding configuration file
check for max. number of open files and adjust open handle cache
removed long file limit hack for FAT/VMS filesystems. Nonstandard and
unsecure.
removed include/version.h - use autoconf instead
added -V server option (display version)
do not use dircache as upload cache. Uploads now works even without
dircache
turn off cachedir when it do not exists
better init of random number generator. It should be really random.
fixed use of prebuild directory content and dircache
turn off logging if no log file is set
clean cache directory on startup
merged security patch from Debian package fsp_2.81.b3-4, i have
fixed this problem in 2.8.1b4; but Debian code looks better.
removed non standard NEED_ from configure.ac, use HAVE_
fver displays locking method and used config. files.
give lockf locking method priority over flock method
fgetcmd and fgrabcmd now understands -c continue download
fixed check for in.fspd
we have called check_required_vars twice
display copyright in fspd -V
INFO document updated, fixed spelling errors, added section
FSP today
added -t option for fspd; specifes timeout for inetd mode (or
when debug is on for normal more also)
Version 2.8.1b4 -- 30 March, 2001
-------------------------------------------------------------------------
New maintainer: Radim Kolar hsn/at/cybermail.net now maintains FSP codebase.
New maintainer: Radim Kolar hsn/at/netmag.cz now maintains FSP codebase.
-------------------------------------------------------------------------
1) Eliminated a lot of warnings when compiling with -Wall.
2) Moved to autoconf 2.12. Replaced old m4 macros with Autoconf's.
@ -381,11 +423,11 @@ New maintainer: Radim Kolar hsn/at/cybermail.net now maintains FSP codebase.
8) Server has now configurable timeouts, maximal packetsize,
directory and file handles caches.
9) REMOVED VMS part vms/ and vms_src/. Is was out of date.
10) Removed file MACHINES. It was out of date. After my changes in
autoconf, it may not compile on non-Linux systems.
11) Implemented a check for reliable signals in the configure script.
12) Return type of signal handler is detected in configure script.
13) ANSI prototypes are now used, if host compiler supports them.
14) When server is running in read-only mode, server send this
information to clients, instead generic "Permission denied".
15) Access checking and uploading was fixed. Now works.
10) Removed file MACHINES. It was out of date. After my changes in
autoconf, it may not compile on non-Linux systems.
11) Implemented a check for reliable signals in the configure script.
12) Return type of signal handler is detected in configure script.
13) ANSI prototypes are now used, if host compiler supports them.
14) When server is running in read-only mode, server send this
information to clients, instead generic "Permission denied".
15) Access checking and uploading was fixed. Now works.

72
INFO
View File

@ -9,35 +9,69 @@
and FSP software was not maintained...
FSP today
Written by Radim Kolar
FSP uses UDP datagrams and it is reliable even when there is high
number of packet loss. It is usable on WiFi network with 60% packet
loss.
Protocol related
Unlike TCP, FSP has a fast restart when line comes up.
FSP uses UDP datagrams and it is reliable even when there is
high number of packet loss. It is usable on WiFi network with
60% packet loss.
FSP server do not sends any data out unless is asked for. This
solves problem with transfering duplicate data when using
TCP protocol on overloaded lines. About 30% are dupes, thrown
out by client.
FSP can very quickly addapt to changing line condition. This
is excelent for wireless packet networks. FSP needs about 6
RTT to retune itself after receiving condition goes worse.
And unlike TCP based protocols, FSP has a fast restart when
line improves - It do not needs any RTT; FSP goes immediatly
to maximum possible speed.
UDP ports are not often port scanned today. Nobody notice that
you are running a server.
Maximum FSP speed is by design lower than maximum speed of TCP
based protocols because it has only 1 packet in the network.
TCP protocol has about 3 packets. Design of FSP protocol
makes impossible to send more than 1 packet into network.
This is nice method for bandwidth protection.
FSP uses UDP which is unnoticed by many firewalls. FSP server
runs on 21 port by default, if you move it to port 53 (dns)
even strictly configured firewall can be worked around.
FSP server do not sends any data out unless is asked for. This
solves problem with transfering duplicate data when using TCP
protocol on overloaded lines. About 30% are dupes, thrown out
by client. Note: TCP stacks from BSD family has this dupe
ratio much lower.
You want to run anonymous archive and want to keep lamers out.
Embedded devices
You want to share something without ruining your valueable bandwidth.
FSP protocol is very easy to implement; client core has about
one page of C code. It is ideal for embedded devices for
file-transfer tasks, like firmware downloading. Because of its
simplicity, there is a little chance to writing buggy
implementation.
You have overloaded archive site.
FSP is also good for remote booting. It is simplier than TFTP
and supports directory listings.
You do want to share large data files (movies, ISO images) on
slow (or you do not want to waste valuable bandwidth) lines.
Ideal for sharing files on modem lines.
FSP protocol can be used as wire-protocol even without using
any layer 2 stuff. It operates in degraded mode with extra
features disabled.
Internet operation
UDP ports are not often port scanned today, only one exception
is scanning for Windows/Samba file sharing service. Nobody
will notice that you are running a fsp server.
FSP uses UDP which is unnoticed by many firewalls. FSP server
runs on 21 port by default, if you move it to port 53 (dns)
even strictly configured firewall can be worked around.
You want to run anonymous archive and want to keep lamers out.
You want to share something without ruining your valueable
bandwidth.
You have overloaded archive site.
You do want to share large data files (movies, ISO images) on
slow (or you do not want to waste valuable bandwidth) lines.
Ideal for sharing files on modem lines.
FSP daemon is a very light server.

View File

@ -3,7 +3,7 @@ successfully compiled out of the box using configure script. If you get it to
compile on an architecture/compiler combination other than one listed here,
PLEASE SEND ME DETAILS of the fsp version, the type of machine, the OS, the
compiler used and C library used; As well as what changes (if any) were needed
to for a clean compile. My email address is hsn/at/cybermail.net. Thanks
to for a clean compile. My email address is hsn/at/sendmail.cz. Thanks
for your cooperation.
FSP Version CPU OS Compiler C library
@ -14,4 +14,5 @@ FSP Version CPU OS Compiler C library
2.8.1 Beta 14 i386 Debian/testing-unstable
2.8.1 Beta 14 i386 RedHat 7.3
2.8.1 Beta 14 i386 Conectiva Linux 9
2.8.1 Beta 19 i386 FreeBSD 5.x gcc-3.3
2.8.1 Beta 19 i386 FreeBSD 5.2 gcc-3.3
2.8.1 Beta 19 i386 FreeBSD 5.3 gcc-3.4

24
TODO
View File

@ -6,31 +6,36 @@ show loosers online (finfo command) and server statz
rename command
password change command
TESTING NEEDED:
TESTSUITE NEEDED:
Write a simple FSP protocol testing tool
Write a test suite using testing tool
test for remote buffer overflows
Test new command rename /when implemented/
Test if >2GB files but <4GB works correctly with and without --disable-largefile
Test new command rename /when implemented/
SECURITY BUGS:
symlink to FILE can escape from FSP root directory. OLD known problem.
PROTOCOL-RELATED BUGS:
none known
PORTING
Sven's Slowaris 8 compile problem
not builds on freebsd 4 and non intel platforms?
NEEDS IMPROVMENT:
Client LIBRARY
:high:
local bind address FSP_LOCALIP
remove stale lock files if not needed, port code from fspclient.
FSP_TIMEOUT should be total number of seconds, not delay between retrys.
we should retune retry algoritm for better support lines with higher
packed loss.
add more detailed stats from retry alg.
:low:
fver and others add support new syntax fsp://host:port/file
add sem locking method, possible?
flscmd does stat before directory listing, why?
:long-term goals:
:better to write a new code instead fixing old crap
=convert to multi threaded=
make setup from env a separate function
@ -42,17 +47,21 @@ write new clients for new commands - fsprencmd fpasswd finfo
:low:
add support for more sane fsplist file format (as used by warez
ppl) to fhostcmd
it looks like
#FSP Sites list
genie.lut.ac.uk 21 genie / # small UK site
clients do not freeing memory allocated from glob()
FUTURE FEATURES FOR SERVER:
:high:
:high: required for 2.8.2 final
can be run multiple times on the same port, how to check?
Currently looks fine on bsd.
write RENAME FSP command
bind-ip-address for server (and client via FSP_LOCAL_IP)
report number of clients connected, size of hostable in new command
CC_INFO command
special defence against rapid/double fire clients (burst command in fspclient)
common log format - replace custom fspd log
:midle:may not be in 2.8.2
Native Supports for symbolic links (needed for mirroring Debian)
@ -73,7 +82,7 @@ PERFORMANCE:
host hashtable shrinking sometimes
stat cache pro FSP_STAT a ostatni
background time() alarm() caller
Current performance 1925648b/s
Current performance 1925648B/s
MAN:
update FAQ - urgent!!
@ -96,3 +105,4 @@ LARGEFILES64 how to turn them on:
Cygwin: #define __LARGE64_FILES fopen64,ftello64,fseeko64 _off64_t
glibc 2.3: #define _LARGEFILE64_SOURCE off64_t
native: _FILE_OFFSETS_BITS = 32 / 64 then use off_t
FreeBSD: in 5.X always enabled, in 4.X not supported.

32
autogen.sh Executable file
View File

@ -0,0 +1,32 @@
#! /bin/sh -e
# This scripts rebuilds configure files using autoconf tools.
# Supports both FreeBSD and Linux installations. No copyrights
# script is public domain.
#
# I am not big fan of autotools stuff, but other solutions
# like scons are worse (harder to maintain).
#
# Radim Kolar
#
# TODO: add linux support (sven?)
# add detection of automake19 and use it instead of
# automake18
#
rm -f configure configure.lineno config.log config.status
rm -f aclocal.m4
#rm -fr autom4te.cache
rm -f Makefile "Makefile.in"
echo "Generating configure and friends..."
if [ `uname -s` = 'FreeBSD' ]; then
echo "* FreeBSD detected"
echo "* Using autoconf 2.59 + automake 1.8"
#Use autoconf 2.59 + automake 1.8 pair
ACLOCAL=aclocal18; export ACLOCAL
AUTOMAKE=automake18; export AUTOMAKE
AUTOHEADER=autoheader259; export AUTOHEADER
AUTOCONF=autoconf259; export AUTOCONF
autoreconf259 -v
fi
echo "Now running configure $@"
./configure $@
echo "done."

View File

@ -1,4 +1,5 @@
/*********************************************************************\
* Copyright (c) 2004 by Radim Kolar *
* Copyright (c) 1991 by Wen-King Su (wen-king@vlsi.cs.caltech.edu) *
* *
* You may copy or modify this file in any manner you wish, provided *
@ -26,7 +27,9 @@ static unsigned short key;
int client_trace = 0;
int client_intr_state = 0;
unsigned long target_delay = DEFAULT_DELAY; /* expected max delay */
unsigned long target_delay = DEFAULT_DELAY; /* expected max delay from server on good connection */
unsigned long target_maxdelay = DEFAULT_MAXDELAY; /* max resend timer */
unsigned long busy_delay = DEFAULT_DELAY; /* busy retransmit timer */
unsigned long idle_delay = DEFAULT_DELAY; /* idle retransmit timer */
unsigned long udp_sent_time;
@ -41,8 +44,10 @@ UBUF *client_interact PROTO6(unsigned char, cmd, unsigned long, pos,
unsigned char *s, *t, *d, seq0, seq1;
unsigned u, n, sum, mlen, rlen;
fd_set mask;
int retval, bytes, retry_send, retry_recv;
int retval, retry_send, retry_recv;
socklen_t bytes;
unsigned long w_delay;
unsigned long total_delay;
FD_ZERO(&mask);
sbuf.cmd = cmd;
@ -55,6 +60,8 @@ UBUF *client_interact PROTO6(unsigned char, cmd, unsigned long, pos,
BB_WRITE4(sbuf.bb_pos,pos);
client_intr_state = 1;
total_delay = 0;
w_delay = 0;
for(u = l1, d = (unsigned char *) sbuf.buf; u--; *d++ = *p1++);
for(u = l2; u--; *d++ = *p2++);
@ -63,6 +70,7 @@ UBUF *client_interact PROTO6(unsigned char, cmd, unsigned long, pos,
key = client_get_key();
for(retry_send = 0; ; retry_send++) {
total_delay += w_delay;
BB_WRITE2(sbuf.bb_key,key);
sbuf.bb_seq[0] = seq0 = (myseq >> 8) & 0xff;
sbuf.bb_seq[1] = seq1 = (myseq & 0xfc) | (retry_send & 0x0003);
@ -84,12 +92,13 @@ UBUF *client_interact PROTO6(unsigned char, cmd, unsigned long, pos,
default:
#ifdef CLIENT_TIMEOUT
if (!pos && retry_send >= env_timeout ) {
if (total_delay/1000 >= env_timeout ) {
fprintf(stderr, "\rRemote server not responding.\n");
exit(1);
}
#endif
if(idle_delay < 3*60*1000) idle_delay = idle_delay * 3 / 2;
idle_delay = idle_delay * 3 / 2;
if (idle_delay > target_maxdelay) idle_delay = target_maxdelay;
w_delay = idle_delay;
if(client_trace) write(2,"I",1);
break;
@ -97,39 +106,69 @@ UBUF *client_interact PROTO6(unsigned char, cmd, unsigned long, pos,
if(sendto(myfd,(const char*)&sbuf,mlen,0,(struct sockaddr *)&server_addr,
sizeof(server_addr)) == -1) {
perror("sendto");
exit(1);
switch(errno) {
case ENOBUFS:
case EHOSTUNREACH:
case ECONNREFUSED:
case EHOSTDOWN:
case ENETDOWN:
case EPIPE:
/* try to resend packet */
continue;
default:
perror("sendto");
exit(1);
}
}
udp_sent_time = time((time_t *) 0);
FD_SET(myfd,&mask);
for(retry_recv = 0; ; retry_recv++) {
if(retry_recv && client_trace) write(2,"E",1);
retval = _x_select(&mask, w_delay);
if((retval == -1) && (errno == EINTR)) continue;
if(retval == 1) { /* an incoming message is waiting */
bytes = sizeof(from);
if((bytes = recvfrom(myfd,(char*)&rbuf,sizeof(rbuf),0,
(struct sockaddr *)&from, &bytes)) < UBUF_HSIZE)
{
/* too enough bytes for header */
if (client_trace) write(2,"H",1);
continue;
}
rlen = BB_READ2(rbuf.bb_len);
if( (rlen+UBUF_HSIZE) > bytes)
{
/* truncated. */
if (client_trace) write(2,"T",1);
continue;
}
s = (unsigned char *) &rbuf;
d = s + bytes;
u = rbuf.sum; rbuf.sum = 0;
for(t = s, sum = 0; t < d; sum += *t++);
sum = (sum + (sum >> 8)) & 0xff;
if(sum != u) continue; /* wrong check sum */
rlen = BB_READ2(rbuf.bb_len);
if(sum != u)
{
/* wrong check sum */
if (client_trace) write(2,"C",1);
continue;
}
if( (rbuf.bb_seq[0] ^ seq0) ||
((rbuf.bb_seq[1] ^ seq1)&0xfc)) continue; /* wrong seq # */
if((int) (rlen+UBUF_HSIZE) > bytes) continue; /* truncated. */
((rbuf.bb_seq[1] ^ seq1)&0xfc))
{
/* wrong seq # */
if (client_trace) write(2,"S",1);
continue;
}
myseq = (myseq + 0x0004) & 0xfffc; /* seq for next request */
key = BB_READ2(rbuf.bb_key); /* key for next request */
client_set_key(key);
if(rbuf.cmd != CC_BYE)
client_set_key(key);
if(client_intr_state == 2) {
if(!key_persists) client_done();
@ -162,6 +201,7 @@ static RETSIGTYPE client_intr PROTO1(int, signum)
void init_client PROTO3(const char *, host, unsigned short, port, unsigned short, myport)
{
busy_delay = idle_delay = target_delay;
myseq = random();
if((myfd = _x_udp(&myport)) == -1) {
perror("socket open");
@ -181,6 +221,6 @@ int client_done PROTO0((void))
{
(void) client_interact(CC_BYE, 0L, 0, (unsigned char *)NULLP, 0,
(unsigned char *)NULLP);
client_destroy_key();
return(0);
}

View File

@ -19,7 +19,7 @@
static char key_string[sizeof(KEY_PREFIX)+32];
static char code_str[] =
"0123456789:_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
"0123456789:_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static void make_key_string PROTO2(unsigned long, server_addr,
unsigned long, server_port)
@ -102,6 +102,11 @@ void client_init_key PROTO3(unsigned long, server_addr,
umask(omask);
}
void client_destroy_key(void)
{
(void)close(lock_fd);
unlink(key_string);
}
#endif
/********************************************************************/
/******* For those systems that has lockf function call *************/
@ -163,6 +168,11 @@ void client_init_key PROTO3(unsigned long, server_addr,
umask(omask);
}
void client_destroy_key(void)
{
(void)close(lock_fd);
unlink(key_string);
}
#endif
/********************************************************************/
/******* For those systems that has SysV shared memory + lockf ******/
@ -178,6 +188,7 @@ void client_init_key PROTO3(unsigned long, server_addr,
int key_persists = 0;
static unsigned short *share_key;
static unsigned int lock_fd;
static int lock_shm;
unsigned short client_get_key PROTO0((void))
{
@ -203,7 +214,6 @@ void client_init_key PROTO3(unsigned long, server_addr,
{
unsigned long omask;
key_t lock_key;
int lock_shm;
make_key_string(server_addr,server_port);
@ -226,6 +236,21 @@ void client_init_key PROTO3(unsigned long, server_addr,
*share_key = key;
}
void client_destroy_key(void)
{
(void)close(lock_fd);
if (shmdt((char *)share_key) < 0)
{
perror("shmdt");
exit(1);
}
if (shmctl(lock_shm,IPC_RMID,NULL) < 0)
{
perror("shmctl");
exit(1);
}
unlink(key_string);
}
#endif
/********************************************************************/
/******* For those who does not want to use locking *****************/
@ -252,4 +277,11 @@ void client_init_key PROTO3(unsigned long, server_addr,
okey = key;
}
void client_destroy_key(void)
{
return;
}
#endif
/********************************************************************/
/********************************************************************/
/********************************************************************/

View File

@ -22,7 +22,7 @@ const char *env_myport;
const char *env_host;
const char *env_port;
const char *env_local_dir;
int env_timeout;
unsigned int env_timeout;
unsigned short client_buf_len;
unsigned short client_net_len;
@ -260,7 +260,7 @@ static int util_download_main PROTO5(char *, path, char *, fpath, FILE *, fp,
downloaded = pos - started_from;
if(client_trace)
{
fprintf(stderr,"\r%luk : %s [%ldb/s] \n", 1+(pos>>10), path, downloaded/t);
fprintf(stderr,"\r%luk : %s [%ldB/s] \n", 1+(pos>>10), path, downloaded/t);
fflush(stderr);
}
@ -414,7 +414,7 @@ int util_upload PROTO3(char *, path, FILE *, fp, time_t , stamp)
if(t == 0) t = 1;
if(client_trace)
{
fprintf(stderr,"\r%luk : %s [%ldb/s] \n", 1+(pos>>10), path, pos/t);
fprintf(stderr,"\r%luk : %s [%ldB/s] \n", 1+(pos>>10), path, pos/t);
fflush(stderr);
}
free(fpath);
@ -450,9 +450,13 @@ static void util_get_env PROTO0((void))
if(target_delay < MIN_DELAY) target_delay = MIN_DELAY;
if(target_delay > MAX_DELAY) target_delay = MAX_DELAY;
if( (p = getenv("FSP_MAXDELAY")) ) target_maxdelay = atol(p);
if(target_maxdelay < target_delay) target_maxdelay = target_delay;
if(target_maxdelay > MAX_DELAY) target_maxdelay = MAX_DELAY;
if(!(env_local_dir = getenv("FSP_LOCAL_DIR"))) env_local_dir=".";
if(!(p = getenv("FSP_TIMEOUT"))) env_timeout = 180;
if(!(p = getenv("FSP_TIMEOUT"))) env_timeout = DEFAULT_TIMEOUT;
else env_timeout = atol(p);
}

View File

@ -64,6 +64,13 @@ int main PROTO2(int, argc, char **, argv)
printf(" (max %d bytes/sec)\n", tput);
} else
printf("\tRemote server throughput control is DISABLED.\n");
/* check for optional max. packet size block */
if(++v2 < ub->buf+len+len2)
{
tput=0;
tput = BB_READ2(v2);
printf("\tMax. packet size supported by server is %d bytes.\n",tput);
}
}
else
printf("\tRemote server do not send extended info.\n");

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a working configure script.
dnl tested with autoconf 2.57
AC_INIT(fsp,2.8.1b19,hsn@netmag.cz)
AC_INIT(fsp,2.8.1b20,hsn@netmag.cz)
AC_CONFIG_SRCDIR(server/main.c)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE

View File

@ -1,8 +1,7 @@
File Service Protocol version 2
specification
FILE SERVICE PROTOCOL VERSION 2
Document version 0.9
Last updated 18 Nov 2003
Document version 0.10
Last updated 18 Oct 2004
Also known as
File Slurping Protocol,
@ -34,10 +33,31 @@ Data formats used in this document
Numbers starting with 0x are in hexadecimal (base 16) notation.
Transport
FSP uses UDP datagrams as transport medium. Minimum UDP packet size (not
including size of UDP, IP and link layer headers) is 12 bytes, maximum UDP
packet size is 1024+12 bytes.
Security
Design
FSP protocol was not designed to transfer secret data. It was designed as
alternative protocol for providing lightweight access to collection of public
files. FSP has the same user level of security as the anonymous FTP file
server. FSP has better network level security, because it was designed
to ressist various denial-of-service attacks. FSP protocol v3 will be
designed to be fully secure. FSP3 will not be backward compatible with
FSP2.
Passwords
Recently, password support was added to protocol, because just
too many people wants it and there were hacked version of FSP with
password support floating around. Passwords are transmited in clear
text over network which makes them a weak protection for determined
intruder.
FSP Packet format:
HEADER - size = Fixed size 12 bytes. Always present.
DATA - size = defined in header (DATA_LENGTH)
@ -57,9 +77,15 @@ HEADER FORMAT (12 bytes)
MESSAGE_CHECKSUM
Entire packet (HEADER + DATA + XTRA DATA) is checksumed. When computing a
checksum use zero in place of MESSAGE_CHECKSUM header field. Checksums are
computed as follows:
checksum use zero in place of MESSAGE_CHECKSUM header field.
Due to some unknown reason, method of computing checksums is different in each
direction. For packets travelling from server to client initial checksum
value is zero, otherwise it is HEADER + DATA + XTRA DATA size.
Checksums in server->client direction are computed as follows:
/* assume that we have already zeroed checksum in packet */
unsigned int sum,checksum;
for(t = packet_start, sum = 0; t < packet_end; sum += *t++);
checksum= sum + (sum >> 8);
@ -126,15 +152,21 @@ FSP File servers MUST supports following commands:
bit 2 set - reverse lookup required
bit 3 set - server is in private mode
bit 4 set - thruput control
if bit 4 is set thruput info follows
long - max_thruput allowed (in bytes/sec)
word - max. packet size supported by server
Compatibility
Max. packet size supported is reported only by fspd 2.8.1 b20
or newer.
CC_ERR 0x40 - error response from server
If you want to get a error from server, send
any unknown client command (for example CC_ERR).
CC_ERRs are normally sent only by server on
errors.
errors conditions.
request (not used)
file position: not used
@ -268,15 +300,21 @@ RDIRENT.HEADER types:
data: ASCIIZ directory readme
xtra data: extra protection data (format follows)
Protection bits:
0 - caller owns the directory
1 - files can be deleted from this dir
2 - files can be added to this dir
3 - new subdirectories can be created
4 - files are NOT readable by non-owners
5 - directory contain an readme file
6 - directory can be listed
7 - files can be renamed in this directory
Protection bits:
0 - caller owns the directory
1 - files can be deleted from this dir
2 - files can be added to this dir
3 - new subdirectories can be created
4 - files are NOT readable by non-owners
5 - directory contain an readme file
6 - directory can be listed
7 - files can be renamed in this directory
Compatibility
Versions older than 2.8.1b6 do not uses bits 6 and 7. This
causes that directory can be listable even it do not have
6th bit set.
CC_SET_PRO 0x48 - set directory protection
@ -298,6 +336,10 @@ Protection bits:
reply
same as CC_GET_PRO
Compatibility
FSP versions older than 2.8.1 beta15 used p flag instead
g flag. +p = -g
CC_MAKE_DIR 0x49 - create a directory
request
@ -319,6 +361,10 @@ Protection bits:
optional data: not used
xtra data: not used
You should send this packet when you are done with
talking to server. This causes that server will
accept next packet from your IP with any key.
Commands starting from FSP version 2.4 ( released March 27, 1992 )
CC_GRAB_FILE 0x4B - atomic get+delete a file
@ -349,13 +395,19 @@ Commands starting from FSP 2.8.1 Beta 11
data format is the same as in directory listing with exception
that there is no file name appended. If file do not exists or
there is other problem (no access rights) return type of file is
0. CC_ERR message is NOT returned in this case.
0.
struct STAT {
long time;
long size;
byte type;
}
struct STAT {
long time;
long size;
byte type;
}
Compatibility
CC_ERR message is NEVER returned as reply to CC_STAT command
by server supporting CC_STAT command. If you have got CC_ERR reply,
you are talking to old server, which do not supports this
command.
CC_RENAME 0x4E - rename file or directory
request
@ -380,6 +432,7 @@ Reserved commands:
CC_LIMIT 0x80 - commands > 0x7F will have extended
header. No such extensions or commands
which uses that are known today.
which uses that are known today. This
header will be used in protocol version 3.
CC_TEST 0x81 - reserved for testing of new header

View File

@ -42,12 +42,13 @@ use_access_files yes
permit_passwordless_owners off
# The 'tmpdir' command controls where the server stores temporary files
# during upload or grab.
# during upload or grab. You must have it or server will support
# read operations only. This can be absolute or relative path to home
# dir. Server will try to create it.
#
tmpdir /tmp/fsp
# The 'pidlogname command controls where we write the fspd pid
# This command is required!
# The 'pidlogname command controls where we write the fspd pid.
pidlogname /var/run/fspd.pid
# The 'grabcommand' can turn grab command on or off.
@ -64,12 +65,12 @@ vercommand on
# readme .README
# The 'dircache' command controls how much directories listings gets cached.
dircache 50
dircache 100
# 'use_prebuild_dirlists' allows to load/save prebuilded directories
# listing from filesystem. It is a good idea to allow that.
# Win32: Set to NO
use_prebuild_dirlists yes
# Do not use on Win32 system.
#use_prebuild_dirlists yes
# The 'statcache' command controls how many directories are placed into
# stat cache. Cache contains last modified time and access rights.
@ -82,8 +83,8 @@ statcache_timeout 15
# 'use_directory_mtime'. If your filesystem changes mtime when directory
# is updated, set it to YES. If set to NO, directory will be rechecked
# after statcache_timeout and dircache entry invalidated.
# Win32: Set to NO
use_directory_mtime yes
# Do not use on Win32 system.
#use_directory_mtime yes
# The 'filecache' command controls maximal number of open files by server.
# After this limit will be reached, server will close last recently used files.
@ -229,11 +230,12 @@ xferlog ../logs/xferlog
# pass after new packet with the old KEY from client will be accepted
# FSP protocol definition says that must be at least 3 secs, but you
# can set this to shorter time and allow faster error recovery. It is
# higly recommended to keep 3 seconds.
# higly recommended to keep it at least 3 seconds.
# retry 3
# The "timeout" command specifies how much time must pass after new
# packet with wrong KEY number is accepted. FSP definition sets this
# to 60 seconds.
# to 60 seconds. You can set it to lower value for faster clients
# recovery (about 20 sec is fine).
# timeout 60

View File

@ -3,7 +3,7 @@
/* lib.c */
extern int client_trace;
extern unsigned long udp_sent_time,target_delay;
extern unsigned long udp_sent_time,target_delay,target_maxdelay;
UBUF *client_interact PROTO0((unsigned char, unsigned long, unsigned int,
unsigned const char *, unsigned int,
unsigned const char *));
@ -14,12 +14,13 @@ int client_done PROTO0((void));
extern int key_persists;
unsigned short client_get_key PROTO0((void));
void client_set_key PROTO0((unsigned short));
void client_destroy_key PROTO0((void));
void client_init_key PROTO0((unsigned long, unsigned long,
unsigned short));
/* util.c */
extern const char *env_dir,*env_passwd,*env_local_dir,*env_port,*env_myport,*env_host;
extern int env_timeout;
extern unsigned int env_timeout;
extern unsigned short client_buf_len,client_net_len;
char *util_abs_path PROTO0((const char *));
char *util_getwd PROTO0((char *));

View File

@ -169,6 +169,8 @@ typedef struct RDIRENT { unsigned char bb_time[4];
#define MIN_DELAY 1000L
#define DEFAULT_DELAY 1340L
#define DEFAULT_MAXDELAY 60000L
#define MAX_DELAY 300000L
#define DEFAULT_TIMEOUT 360
#endif /* _FSP_COMMON_DEF_H_ */

View File

@ -24,7 +24,7 @@
* Following setting is a minimum recommended size. *
****************************************************************************/
#define DEFAULT_DIRLISTCACHE_SIZE 32
#define DEFAULT_DIRLISTCACHE_SIZE 50
/****************************************************************************
* DEFAULT_DIRSTATCACHE_SIZE should be set to contain the number of dirs *
@ -33,7 +33,7 @@
* expensive than listing a directory, so if can be a lower number.
*/
#define DEFAULT_DIRSTATCACHE_SIZE 20
#define DEFAULT_DIRSTATCACHE_SIZE 30
/* THCCOUNT is the number of seconds used to compute average throughput.
* 10 seconds seems to be a good value

View File

@ -77,7 +77,7 @@
#ifdef WORD_TYPE_4
/* there is an integer type of size 4 */
#define BB_READ4(V) ntohl(*(WORD_TYPE_4 *)(V))
#define BB_READ4(V) ntohl(*(const WORD_TYPE_4 *)(V))
#define BB_WRITE4(V,A) *(WORD_TYPE_4 *)(V) = htonl(A)
#else
/* there is no integer type of size 4 */

View File

@ -2,6 +2,7 @@
man_MANS= fcat.1 fcatcmd.1 fcd.1 fcdcmd.1 fdu.1 fducmd.1 ffind.1 ffindcmd.1 \
fget.1 fgetcmd.1 fgrab.1 fgrabcmd.1 fhost.1 fhostcmd.1 fls.1 \
flscmd.1 fmkdir.1 fpro.1 fprocmd.1 fput.1 frm.1 frmcmd.1 frmdir.1 \
frmdircmd.1 fsp_prof.5 fspd.1 fver.1 fstatcmd.1 fspscan.1
frmdircmd.1 fsp_prof.5 fspd.1 fver.1 fstatcmd.1 fspscan.1 \
fsp_env.7
EXTRA_DIST=$(man_MANS)

View File

@ -42,11 +42,15 @@ so that network speed has an indicator. This variable has no effect when the
standard output is a terminal.
.TP
.B FSP_TIMEOUT
If this variable is set, it contains the timeout value. The default value is 180.
If this variable is set, it contains the timeout value in seconds.
The default value is 360.
No function if program was compiled without timeout code.
.TP
.B FSP_DELAY
Minimum wait time before resending packet in milliseconds.
.TP
.B FSP_MAXDELAY
Maximum wait time before resending packet in milliseconds.
.TP
.B FSP_LOCAL_DIR
Where to look for local files. Default is current directory.

View File

@ -1,8 +1,8 @@
.TH FSPD 1 "29 Sep 2003" FSP
.TH FSPD 1 "18 Oct 2004" FSP
.SH NAME
fspd, in.fspd \- File Service Protocol (FSP) server
.SH SYNOPSIS
.B fspd [-f configfile] [-p port] [-i] [-v|-V] [-t timeout] [-X] [-d directory] [-F ] [-T temporary directory] [-l logfile] [-P pidlogname]
.B fspd [-f configfile] [-p port] [-i] [-v|-V] [-t timeout] [-X] [-d directory] [-F ] [-T temporary directory] [-l logfile] [-P pidlogname] [-b bandwidth]
.SH DESCRIPTION
.B fspd
is the server for an anonymous-ftp style archive called FSP. The main
@ -69,8 +69,14 @@ Write log output to file.
.PD 0
.TP 20
.B -P pidlogname
Write pid to the given file name. This Option is required, if it's
not given in your fspd.conf or on command line fspd will fail to start.
Write pid to the given file name.
.PD 0
.TP 20
.B -b bandwidth
Enable bandwidth limiting. Limit output to
.I bandwidth
bytes per second.
.LP
.SH FILES
@ -163,6 +169,12 @@ Server dumps stats to file specified as dumpfile in configuration.
This file must be writeable by server or server must have rights
to create it.
.TP
.B SIGINT | SIGTERM
Server performs cleaup and exits. All connected clients will be
disconnected. Because FSP is stateless protocol, if you start
server later, than can continue without breakage.
.SH EXIT CODES
.B 1
configuration or command line invocation error.

View File

@ -1,4 +1,4 @@
.TH FVER 1 "8 December 1991" FSP
.TH FVER 1 "Oct 2004" FSP
.SH NAME
fver \- displays the version number string of the FSP database
.SH SYNOPSIS
@ -8,7 +8,7 @@ fver \- displays the version number string of the FSP database
.LP
Without arguments,
.B fver
displays the version string of the FSP database.
displays the version string of the FSP server.
Otherwise, the version string of the client utilities is displayed.
.SH ENVIRONMENT
.LP

View File

@ -2,7 +2,7 @@
bin_PROGRAMS=fspd
fspd_SOURCES=file.c host.c main.c conf.c filecache.c server.c fifocache.c \
fspd_SOURCES=file.c host.c main.c conf.c server.c fifocache.c \
log.c iprange.c acl.c path.c random.c pidfile.c
fspd_CFLAGS=-DSYSCONFDIR="\"@sysconfdir@\"" $(AM_CFLAGS)
fspd_LDADD=-L../common -lcommon

View File

@ -289,5 +289,6 @@ void destroy_configuration PROTO0((void))
if(iptab) free_ip_table(iptab);
readme_file = home_dir = logname = tmp_dir = dumpname = NULL;
iptab = pidlogname = NULL;
iptab = NULL;
pidlogname = NULL;
}

View File

@ -779,8 +779,8 @@ const char *server_up_load PROTO5(char *, data, unsigned int, len, unsigned long
tmp=tname;
cache_f=f_cache_find(fpcache,&tmp);
if(! cache_f ) {
/* file not found in cache */
FPCACHE newfile;
/* file not found in cache? */
if (pos) {
fp = fopen(tname, "r+b");
} else {
@ -790,12 +790,31 @@ const char *server_up_load PROTO5(char *, data, unsigned int, len, unsigned long
if(!fp) return("Cannot open temporary file");
/* check for symlinks or other junk */
if(lstat(tname,&sf) || !S_ISREG(sf.st_mode))
{
fclose(fp);
unlink(tname);
remove(tname);
return("Temporary file is NOT a regular file");
}
/* test if we do not create hole in file which is caused that
client continues upload across server crash, which causes
some data loss due to libc stdio write caching */
/* server do not cleans temporary directory on startup - so
uploads across restart should work */
if(pos > sf.st_size || pos < sf.st_size - UBUF_SPACE)
{
fclose(fp);
unlink(tname);
return("Non continuous upload detected. Restart upload please.");
}
/* seek to starting position */
if(fseeko(fp, pos, SEEK_SET))
{
fclose(fp);
unlink(tname);
return("Seeking in file failed");
}
/* protect temporary file */
chmod(tname,S_IRUSR|S_IWUSR);
/* add it to the file-cache */
@ -804,13 +823,33 @@ const char *server_up_load PROTO5(char *, data, unsigned int, len, unsigned long
newfile.fp=fp;
tmp=strdup(tname);
f_cache_put(fpcache,&tmp,&newfile);
} else
} else {
/* get file pointer from cache */
fp=cache_f->fp;
}
/* check for uploading on non-tail of file */
sf.st_size= ftello(fp);
if(pos > sf.st_size || pos < sf.st_size - UBUF_SPACE)
{
f_cache_delete_entry(fpcache,cache_f);
unlink(tname);
if( pos == 0)
{
/* we can retry */
return server_up_load (data,len,pos,inet_num,port_num);
}
return("Non continuous upload detected. Restart upload please.");
}
/*
if(fseeko(fp, pos, SEEK_SET))
return("Seeking in file failed");
*/
if(len!=fwrite(data, 1, len, fp))
{
f_cache_delete_entry(fpcache,cache_f);
return("Writing to file failed");
}
return(NULLP);
}

View File

@ -24,7 +24,7 @@ static void display_version PROTO0((void))
{
printf(
"File Service Protocol Daemon - FSP "PACKAGE_VERSION"\n"
"Copyright (c) 1991-1996 by A. J. Doherty, 2001-2003 by Radim Kolar.\n"
"Copyright (c) 1991-1996 by A. J. Doherty, 2001-2004 by Radim Kolar.\n"
"All of the FSP code is free software with revised BSD license.\n"
"Portions copyright by BSD, Wen-King Su, Philip G. Richards, Michael Meskes.\n"
#ifdef __GNUC__
@ -37,7 +37,7 @@ static void display_version PROTO0((void))
static void arg_err PROTO0((void))
{
fputs("Usage: fspd [-f configfile] [-d directory] [-v|-V] [-i] [-F] [-p port] [-X] [-t timeout] [-T temporary directory] [-l logfile] [-P pidlogname]\n", stderr);
fputs("Usage: fspd [-f configfile] [-d directory] [-v|-V] [-i] [-F] [-p port] [-X] [-t timeout] [-T temporary directory] [-l logfile] [-P pidlogname] [-b bytes/sec]\n", stderr);
}
static void check_required_vars PROTO0((void))
@ -45,7 +45,7 @@ static void check_required_vars PROTO0((void))
double rnd;
if(!inetd_mode && udp_port==0) {
fprintf(stderr, "No port set. Exiting. (Use 65535 for random port)\n");
fprintf(stderr, "Error: No port set. (Use 65535 for random port)\n");
exit(1);
}
if(udp_port == 65535)
@ -55,17 +55,21 @@ static void check_required_vars PROTO0((void))
udp_port=rnd*(65535-1024)+1024;
}
if(!home_dir) {
fprintf(stderr, "No home directory set.\n");
fprintf(stderr, "Error: No home directory set.\n");
exit(1);
}
#if 0
if(*home_dir != '/') {
fprintf(stderr,"home directory [%s] does not start with a /.\n", home_dir);
fprintf(stderr,"Error: home directory [%s] does not start with a /.\n", home_dir);
exit(1);
}
#endif
#if 0
if(!pidlogname) {
fprintf(stderr, "No pidlogname set in your fspd.conf.\n");
exit(1);
}
#endif
if(!readme_file) {
readme_file = strdup(".README");
}
@ -108,7 +112,7 @@ int main PROTO2(int, argc, char **, argv)
if(strlen(argv[0])>=7)
inetd_mode = !strcasecmp(&argv[0][strlen(argv[0])-7],"in.fspd");
while( (opt=getopt(argc,argv,"h?Xd:f:vVip:t:FT:l:P:"))!=EOF)
while( (opt=getopt(argc,argv,"h?Xd:f:vVip:t:FT:l:P:b:"))!=EOF)
{
switch(opt)
{
@ -143,6 +147,9 @@ int main PROTO2(int, argc, char **, argv)
case 'p':
udp_port = atoi (optarg);
break;
case 'b':
maxthcallowed = atoi (optarg);
break;
case 't':
inetd_timeout = 1000L * atoi (optarg);
break;
@ -171,7 +178,7 @@ int main PROTO2(int, argc, char **, argv)
{
opt=_x_udp(&udp_port);
if(opt == -1) {
perror("socket open");
perror("Error: socket open");
exit(2);
}
if(dbug) {
@ -236,6 +243,17 @@ int main PROTO2(int, argc, char **, argv)
}
}
/* With pidfile we have currently 2 problems:
1) creating pidfile after we have droped root rights. We can not
write to root only directories like /var/run
2) If we create pidfile early before setuid() we can't write
new pid to it after we setuid()+fork()
*/
if (pidfile(pidlogname)) {
fprintf(stderr,"Error: can not write pidfile - exiting.\n");
exit(1);/* cannot write pid file - exit */
}
init_htab();
/* we can enable table dumping from there */
signal(SIGINT,server_interrupt);
@ -274,8 +292,10 @@ int main PROTO2(int, argc, char **, argv)
pid_t forkpid;
forkpid = fork();
if (forkpid == 0) { /* child prozess */
if (pidfile(pidlogname))
if (pidfile(pidlogname)) {
pidfile_cleanup(pidlogname); /* try cleanup */
exit(1);/* cannot write pid file - exit */
}
} else if (forkpid > 0) { /* father prozess */
_exit(0);
}

View File

@ -5,6 +5,8 @@
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Modified by Sven Hoaxter and Radim Kolar for FSP project.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -45,19 +47,18 @@
static pid_t pidfile_pid;
int pidfile(char *pidfile_path)
int pidfile(const char *pidfile_path)
{
FILE *f;
int save_errno;
pid_t pid;
if (pidfile_path == NULL)
return (-1);
return (0);
if ((f = fopen(pidfile_path, "w")) == NULL) {
save_errno = errno;
free(pidfile_path);
pidfile_path = NULL;
(void) unlink(pidfile_path);
errno = save_errno;
return (-1);
}
@ -66,8 +67,6 @@ int pidfile(char *pidfile_path)
if (fprintf(f, "%ld\n", (long)pid) <= 0 || fclose(f) != 0) {
save_errno = errno;
(void) unlink(pidfile_path);
free(pidfile_path);
pidfile_path = NULL;
errno = save_errno;
return (-1);
}
@ -77,7 +76,9 @@ int pidfile(char *pidfile_path)
}
void pidfile_cleanup(char *pidfile_path)
void pidfile_cleanup(const char *pidfile_path)
{
if (pidfile_path) {
(void) unlink(pidfile_path);
}
}

View File

@ -1,2 +1,2 @@
int pidfile(char *);
void pidfile_cleanup(char *);
int pidfile(const char *);
void pidfile_cleanup(const char *);

View File

@ -7,6 +7,13 @@
****************************************************************************/
/* get high bits from random result - better */
unsigned short gen_next_key PROTO0((void))
{
return (random() >> 15);
}
#if 0
/* The following algorithm is recommended by Numerical Recipies. */
/* Best, but needs floating point division. */
unsigned short gen_next_key PROTO0 ((void))
@ -14,8 +21,9 @@ unsigned short gen_next_key PROTO0 ((void))
unsigned short ulRandom = ((float)(0xffff)*rand()/(RAND_MAX+1.0f));
return(ulRandom);
}
#if 0
#endif
#if 0
/* FSP original */
unsigned short gen_next_key PROTO0((void))
{
unsigned long k;

View File

@ -259,13 +259,13 @@ int server_loop PROTO2(int, fd, time_t, timeout)
else {
if(hp->last_key == rkey) {
if(cur_time < hp->last_acc + retry_timeout) {
if(dbug) fprintf(stderr,"Ignoring too early retry request (rtime=%ld,timeout=%d).\n",cur_time-hp->last_acc,(int)retry_timeout);
if(dbug) fprintf(stderr,"Ignoring too early retry request (rtime=%ld,timeout=%d).\n",(long)cur_time-hp->last_acc,(int)retry_timeout);
continue;
}
old = 1;
} else {
if(cur_time < hp->last_acc + session_timeout ) {
if(dbug) fprintf(stderr,"Request with bad key (rtime=%ld,timeout=%d).\n",cur_time-hp->last_acc, (int)session_timeout);
if(dbug) fprintf(stderr,"Request with bad key (rtime=%ld,timeout=%d).\n",(long)cur_time-hp->last_acc, (int)session_timeout);
continue;
}
hp->active = 0;
@ -416,6 +416,7 @@ void send_file PROTO5(struct sockaddr_in *, from, UBUF *, ub, FILE *, fp,
static void server_show_version PROTO2(struct sockaddr_in *, from, UBUF *, ub)
{
char buf[UBUF_SPACE], verflags = 0;
unsigned int xtra = VER_BYTES;
strcpy(buf, "fspd " PACKAGE_VERSION);
strcat(buf, "\n");
@ -427,20 +428,18 @@ static void server_show_version PROTO2(struct sockaddr_in *, from, UBUF *, ub)
if (maxthcallowed) verflags |= VER_THRUPUT;
strcpy(ub->buf, buf);
BB_WRITE4(ub->bb_pos,VER_BYTES);
ub->buf[strlen(ub->buf)] = '\0';
ub->buf[strlen(ub->buf)+1] = verflags;
/* add optional thruput data */
if(maxthcallowed) {
BB_WRITE4(ub->bb_pos,VER_BYTES+4);
ub->buf[strlen(ub->buf)+2] = (char)((maxthcallowed & 0xff000000)>>24);
ub->buf[strlen(ub->buf)+3] = (char)((maxthcallowed & 0x00ff0000)>>16);
ub->buf[strlen(ub->buf)+4] = (char)((maxthcallowed & 0x0000ff00)>>8);
ub->buf[strlen(ub->buf)+5] = (char)(maxthcallowed & 0x000000ff);
server_reply(from, ub, strlen(ub->buf)+1, VER_BYTES+4);
} else {
server_reply(from, ub, strlen(ub->buf)+1, VER_BYTES);
BB_WRITE4(ub->buf+strlen(ub->buf)+2,maxthcallowed);
xtra+=4;
}
/* Add packetsize - 2.8.1 b20 extension */
BB_WRITE2(ub->buf+strlen(ub->buf)+xtra+1,packetsize);
xtra+=2;
BB_WRITE4(ub->bb_pos,xtra);
server_reply(from, ub, strlen(ub->buf)+1, xtra);
}
/****************************************************************************

View File

@ -7,7 +7,7 @@
static int bitcount[16];
static int rounds;
static int result;
#define MAX_WORST_ALLOWED 0.2f
#define MAX_WORST_ALLOWED 0.1f
/* FSP classic algo */
static unsigned short classic PROTO0((void))
@ -84,7 +84,7 @@ static void print_bitcount(void)
int main(int argc,const char *argv[])
{
rounds=200;
rounds=2000;
if(argc>1)
{
rounds=atoi(argv[1]);