repo sync

This commit is contained in:
hsn 2004-12-17 09:52:20 +00:00
parent 7fe08f7019
commit 0d3a35dd94
28 changed files with 548 additions and 234 deletions

View File

@ -15,12 +15,10 @@ FSP Protocol wire changes:
with older software versions. with older software versions.
- security: symlink to FILE can escape from FSP root directory, this will - security: symlink to FILE can escape from FSP root directory, this will
be fixed as part of symlink support. be fixed as part of symlink support.
- add FSP change password command (??) - add FSP change password command (do we really need this ??)
Code fixups: Code fixups:
- fix Sven's compiling problems on various unixes - fix Sven's compiling problems on various unixes
- normalize return error codes of all clients - 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) - fspd: add special defence against rapid/double fire clients (burst command in fspclient)
* for next point Stable version 2.8.3 * for next point Stable version 2.8.3

View File

@ -1,4 +1,4 @@
Version NEXT Version 2.8.1b22 - 17 Dec 2004
fixed sf bug 1060594: fspd: owner can't rename files fixed sf bug 1060594: fspd: owner can't rename files
fixed sf bug 1060558: fpro 'l' sets 'm' flag instead (dairiki) fixed sf bug 1060558: fpro 'l' sets 'm' flag instead (dairiki)
fixed sf bug 1060558: fpro 'l' flag was not correctly saved fixed sf bug 1060558: fpro 'l' flag was not correctly saved
@ -23,7 +23,36 @@ Version NEXT
directory from environment is used instead directory from environment is used instead
fput: use request position for sizing of extra (timestamp) data. fput: use request position for sizing of extra (timestamp) data.
use new upload cancel feature on user abort/kill. use new upload cancel feature on user abort/kill.
fspd: default inetd timeout increased to 5 minutes. fspd: default inetd timeout increased to 5 minutes.
udpio: Do not set reuse flag when binding socket
nicer help from configure --help
!! configure option --disable-timeout for disabling timeout code
in client util. This will switch clients into classic FSP
infinite retry mode.
some shell portability fixes in configure.ac shell tests
cleaned outdated information from INSTALL file
fcdcmd: do not print password to standard output. really
support cd into password protected root directory
!! Protocol Wire definiton of rename command has changed
PROTOCOL: CC_RENAME updated
fmvcmd,fspd: now supports this new definition.
fmvcmd: do not sent bye packet to server on bad command line arguments
client locking subsystem: do not report errors on deleting shm segment
!! shmem+semop client-side locking method added. This should solve all
problems with shmem+lockf locks.
autogen.sh updated for FreeBSD-5 + automake 1.9
lamerguide: added section on upload area setup.
sgml faq: added inetd fspd install
sgml faq: client commands updated, added more fspd info
fspd: default dirlistcache increased to 100
fspd: default fp cache increased to 20 and moved into server_conf.h
fget/grab cmd: better -h help
fput: add help on -p option
fmv alias added to both setup.c?sh scripts
fspd: logging of RENAME command fixed
fspd.conf: logging of stat and rename added to comments.
FILES: file somewhat updated
sgml fsp faq released as version 0.1, first public version
Version 2.8.1b21 - 1 Nov 2004 Version 2.8.1b21 - 1 Nov 2004
check for errors while copying files in fspd. check for errors while copying files in fspd.

37
FILES
View File

@ -7,22 +7,29 @@ Complete content of the FSP package:
INSTALL Installation instructions for FSP INSTALL Installation instructions for FSP
PROTOCOL FSP protocol definition PROTOCOL FSP protocol definition
MACHINES Where FSP compiles out of box MACHINES Where FSP compiles out of box
faq.html FSP FAQ
Makefile.in input file for building makefile from configure script. Makefile.in input file for building makefile from configure script.
Makefile.am file for generating Makefile.in Makefile.am file for generating Makefile.in
aclocal.m4 Automake macros aclocal.m4 Automake macros
install-sh A shell script for installation. install-sh A shell script for installation.
setup CSH script for initializing FSP (Unix). setup.csh CSH script for initializing FSP (Unix).
setup.sh SH script for initializing FSP (Unix).
config.status GNU autoconf that will be regenerated every time configure config.status GNU autoconf that will be regenerated every time configure
is run. It is used to regenerate the same configuration as is run. It is used to regenerate the same configuration as
before. before.
config.guess Guess your operation system for configuration
configure SH script generated by GNU autoconf from configure.in used configure SH script generated by GNU autoconf from configure.in used
to test certain parameters of the operating system in order to test certain parameters of the operating system in order
to enable compilation with the minimum of human to enable compilation with the minimum of human
intervention. intervention.
configure.ac Input script to autoconf used to generate configure. configure.ac Input script to autoconf used to generate configure.
fspd.conf An example fspd.conf file suitable for copying and editing. fspd.conf An example fspd.conf file suitable for copying and editing.
doc/ Aditional FSP documentation
faq.html OLD FSP FAQ
HISTORY OLD FSP Changelog
PROTOCOL FSP v2 protocol definition
fsp-faq.sgml New SGML FSP FAQ
bsd_src/ Directory containing additional sources derived from bsd_src/ Directory containing additional sources derived from
those in public archive on uunet.uu.net. Most sources those in public archive on uunet.uu.net. Most sources
are modified to deal with FSP or some architectures. are modified to deal with FSP or some architectures.
@ -53,7 +60,7 @@ Complete content of the FSP package:
ffindcmdc file globbing on argv based on directory information ffindcmdc file globbing on argv based on directory information
fgetcmd.c gotten from the server or because the modify the fgetcmd.c gotten from the server or because the modify the
fgrabcmd.c environment variables (fcdcmd and fhostcmd) fgrabcmd.c environment variables (fcdcmd and fhostcmd)
fhostcmd.c fhostcmd.c
flscmd.c flscmd.c
fmkdir.c fmkdir.c
fprocmd.c fprocmd.c
@ -61,6 +68,10 @@ Complete content of the FSP package:
frmcmd.c frmcmd.c
frmdircmd.c frmdircmd.c
fver.c fver.c
fstatcmd.c
fmvcmd.c
fspprof.l lex rules for generating fsp_prof parser
fprintpro.c display protections flags in human readable form
merge.c This file is used to call the other client programs merge.c This file is used to call the other client programs
when program merging option is used. Rather than when program merging option is used. Rather than
compiling into individual client utility programs, compiling into individual client utility programs,
@ -73,6 +84,8 @@ Complete content of the FSP package:
common/ Directory containing code used in both server and clients common/ Directory containing code used in both server and clients
Makefile.in input file for building makefile from configure script. Makefile.in input file for building makefile from configure script.
strdup.c Unix strdup function. strdup.c Unix strdup function.
random.c Unix random function.
getsl.c gets with length limit
udp_io.c Lowest level routines that deal with the unix inet udp_io.c Lowest level routines that deal with the unix inet
sockets. Some changes might be needed to get it sockets. Some changes might be needed to get it
running with other network implementations. running with other network implementations.
@ -128,12 +141,26 @@ Complete content of the FSP package:
fspd.1 fspd.1
fver.1 fver.1
fsp_prof.5 fsp_prof.5
fsp_env.7
server/ Files needed to compile the FSPD server server/ Files needed to compile the FSPD server
Makefile Unix Makefile for compiling the server. Makefile Unix Makefile for compiling the server.
acl.c ACL loading, saving, testing
conf.c fspd configuration file reading routines. conf.c fspd configuration file reading routines.
fifocache.c Simple FIFO - style cache
file.c Server routines for file i/o. file.c Server routines for file i/o.
filecache.c fp-caching routines. filecache.c fp-caching routines.
host.c Server routines for maintaining client database. host.c Server routines for maintaining client database.
lib.c Server routines for inet socket i/o. info.c Generation of INFO block
iprange.c Range checks for IPv4
log.c Loging stuff
main.c Server main routine and dispatch loop. main.c Server main routine and dispatch loop.
path.c Path parser
pidfile.c Pidfile writing
random.c Next KEY generator
server.c FSP Packet serving
contrib/ User contributed files
rotate.py 90deg. rotation of input text
fspscan.c FSP site scanner
auto_del.csh Remove outdated files from FSP home

44
INSTALL
View File

@ -1,18 +1,18 @@
Compilation:
The first step in running this fine software (:) is to get it to The first step in running this fine software (:) is to get it to
compile. Every effort on my part will be made to make this code compile. Every effort on my part will be made to make this code
compile and run on any reasonable system. The information in this compile and run on any reasonable system. The information in this
file CURRENTLY pertains only to Unix and Cygwin users. file CURRENTLY pertains only to Unix and Cygwin users.
Configuration:
The first step is to run the configure script provided in this The first step is to run the configure script provided in this
directory. This will generate a good makefile and a file called directory. This will generate a good makefile and a file called
tweak.h in the include directory. These files are vital for the config.h in the include directory. These files are vital for the
compilation of the system. compilation of the system.
You must also edit the files include/client_conf.h and configure can take several optional switches. Most important
include server_conf.h as they contain parameters which must switch is --disable-timeout. This option switches fsp clients
still at this point be manually set by the person compiling into classic infinite retry mode which is preferred by people
the code. with very flaky networks.
>> By default, the configure script will set up the Makefile >> By default, the configure script will set up the Makefile
>> to install the code in /usr/local/bin and the man pages under >> to install the code in /usr/local/bin and the man pages under
@ -21,6 +21,7 @@ Compilation:
>> machine, I install the files under /usr/jt/bin and /usr/jt/man. >> machine, I install the files under /usr/jt/bin and /usr/jt/man.
>> To do this, I type configure --prefix=/usr/jt >> To do this, I type configure --prefix=/usr/jt
Compilation:
At this point, you should just be able to type 'make' At this point, you should just be able to type 'make'
and then 'make install'. This will compile and (if and then 'make install'. This will compile and (if
you do an install) install the clients in the directory specified you do an install) install the clients in the directory specified
@ -72,20 +73,13 @@ Client utilities:
all data will be transferred. all data will be transferred.
Server Administration: Server Administration:
The only things you need for setting up a FSP server is a work
directory for the service the FSP server itself (fspd) and
an fspd.conf file in the place you specified in include/server_conf.h.
To create an fspd.conf file, copy the example.conf file
provided to the correct place and edit to suit your tastes.
fspd can run independently or it can be run under inetd. When fspd can run independently or it can be run under inetd. When
running independently, fspd waits for messages through a UDP running independently, fspd waits for messages through a UDP
socket whoes port number is defined in the fspd.conf file. socket whoes port number is defined in the fspd.conf file.
When runing under inetd, fspd is invoked as in.fspd. Inetd will When runing under inetd, fspd is invoked as in.fspd. Inetd will
spawn fspd when a message arrives for the FSP socket. The fspd spawn fspd when a message arrives for the FSP socket. The fspd
process will take over and stick around to wait on additional process will take over and stick around to wait on additional
messages. After 2 minutes pass with no messages, fspd will exit messages. After 5 minutes pass with no messages, fspd will exit
and return control to inted. and return control to inted.
Sample setup for inetd operation: Sample setup for inetd operation:
@ -96,7 +90,7 @@ Server Administration:
In /etc/inetd.conf file: In /etc/inetd.conf file:
fsp dgram udp wait ftp /usr/etc/fspd in.fspd fsp dgram udp wait ftp /usr/local/bin/fspd in.fspd
In this sample, the same port number for ftp is used for the In this sample, the same port number for ftp is used for the
fsp socket. There will not be a conflict because ftp uses fsp socket. There will not be a conflict because ftp uses
@ -107,31 +101,11 @@ Server Administration:
the fspd.conf file. Please read the comments in the fspd.conf the fspd.conf file. Please read the comments in the fspd.conf
file for details. file for details.
FSPD provides directory security through a series of . files created
in the directories serviced by fspd. These files are invisible to
the clients, and can (mostly) be changed via the fprocmd client
utility (or by the server administrator manually). The only file
that can not be changed in this manner is the ownership of a
directory. The files and their meanings are:
.OWN.XXXXXXXX specifies that the machine whose IP number is
encoded as XXXXXXXX owns the directory. The owner
of a directory automatically has all other rights to
a directory and is the only one that can change the
other protections. It is created when a directory
is initially created in the archive via fmkdir.
Information about all other directory security . files is
maintained in 'man 1 fspd'.
Clients do not get to read the directory information directly. Clients do not get to read the directory information directly.
Instead, fspd maintains a directory listing for each directory Instead, fspd maintains a directory listing for each directory
in a cache file. If the directory is writable by fspd, or if a in a cache file. If the directory is writable by fspd, or if a
writable file in it is prepared beforehand, fspd will store the writable file in it is prepared beforehand, fspd will store the
directory information in .FSP_CONTENT file in that directory. directory information in .FSP_CONTENT file in that directory.
Otherwise, it will store the information in a pair of files (with
hashed names) in a special directory specified in the fspd.conf
file. The latter allows read-only directories to be exported.
When a client requests information for a directory, the cache When a client requests information for a directory, the cache
file is created if it doesn't exist, and it is rebuilt if it is file is created if it doesn't exist, and it is rebuilt if it is

25
TODO
View File

@ -1,4 +1,4 @@
FSP SUITE TO DO LIST BY RADIM KOLAR FSP SUITE TO DO LIST BY RADIM KOLAR
/* maintained by hsn -at- netmag * cz */ /* maintained by hsn -at- netmag * cz */
Radim Kolar's personal wishlist from 1997 Radim Kolar's personal wishlist from 1997
@ -34,20 +34,22 @@ we should retune retry algoritm for better support lines with higher
add more detailed stats from retry alg. add more detailed stats from retry alg.
:low: :low:
fver and others add support new syntax fsp://host:port/file fver and others add support new syntax fsp://host:port/file
add sem locking method, possible?
flscmd should not to do stat before directory listing. flscmd should not to do stat before directory listing.
directory listing should not need to get 0 sized block. Needs total code directory listing should not need to get 0 sized block. Needs total code
rewrite. rewrite.
better support for persistent keys - do not send cc_bye ? this should
be probably configurable
:long-term goals: :long-term goals:
drop this library and use libfsp instead drop this library and use libfsp instead
LOCKING
better support for persistent keys - do not send cc_bye ? this should
be probably configurable
CLIENTS CLIENTS
:high: :high:
normalize return error codes of all clients normalize return error codes of all clients
write new clients for new commands - fpasswd finfo write new clients for new commands - fpasswd finfo
:low: :low:
add support for more sane fsplist file format (as used by warez add support for more sane fsplist file format (as used by warez
ppl) to fhostcmd ppl) to fhostcmd
@ -59,10 +61,6 @@ clients do not freeing memory allocated from glob()
FUTURE FEATURES FOR SERVER: FUTURE FEATURES FOR SERVER:
:high: required for 2.8.2 final :high: required for 2.8.2 final
can be run multiple times on the same port, how to check?
drop reuse flag from socket bind?
Currently looks fine with flag on bsd. Fails on lin-suck.
report number of clients connected, size of hostable in new command report number of clients connected, size of hostable in new command
CC_INFO command CC_INFO command
special defence against rapid/double fire clients (burst command in fspclient) special defence against rapid/double fire clients (burst command in fspclient)
@ -73,8 +71,6 @@ new LSTAT COMMAND
write FSP_CHANGE_PASSWORD command write FSP_CHANGE_PASSWORD command
improve RENAME FSP command improve RENAME FSP command
* cross directory renames are unsuported for now * cross directory renames are unsuported for now
* server can send error reply even to denied per directory clients
- minor security flaw
:low:this will sure go after 2.8.2: :low:this will sure go after 2.8.2:
hashed passwords. Do we really needs them? hashed passwords. Do we really needs them?
@ -86,7 +82,8 @@ ipv6 socket support
privileged Hosts, excluded from Byte transfer Limit (hard to do) privileged Hosts, excluded from Byte transfer Limit (hard to do)
new toy new toy
FSP Proxy repeater - look at old code. FSP Proxy repeater - take a look at old code, but we have NAT and fspproxy
today.
PERFORMANCE: PERFORMANCE:
host hashtable shrinking sometimes host hashtable shrinking sometimes
@ -96,8 +93,8 @@ background time() alarm() caller
Current performance 1925648B/s Current performance 1925648B/s
MAN: MAN:
finish sgml FAQ
separate manpage for 7 fsp (protocol definition) == write FSP RFC separate manpage for 7 fsp (protocol definition) == write FSP RFC
manual page for fmvcmd.1
libraries and support for FSP protocol libraries and support for FSP protocol
====================================== ======================================
@ -109,8 +106,8 @@ FSP plugin for Netscape/MSIE.
Not possible to write protocol plugins with Netscape 3 SDK Not possible to write protocol plugins with Netscape 3 SDK
we have fsproxy now. we have fsproxy now.
FSP backend for APT FSP backend for APT
Transfer HTTP over fsp transport Experimental transfer HTTP over fsp transport
FSP support to lftp,wget,curl,gftp FSP support in major ftp programs: lftp,wget,curl,gftp
AVFS plugin http://sourceforge.net/projects/avf AVFS plugin http://sourceforge.net/projects/avf
LARGEFILES64 how to turn them on: LARGEFILES64 how to turn them on:

View File

@ -31,7 +31,10 @@ if [ `uname -s` = 'FreeBSD' ]; then
AUTOHEADER=autoheader259; export AUTOHEADER AUTOHEADER=autoheader259; export AUTOHEADER
AUTOCONF=autoconf259; export AUTOCONF AUTOCONF=autoconf259; export AUTOCONF
export LDFLAGS=-L/usr/local/lib export LDFLAGS=-L/usr/local/lib
autoreconf259 -iv $ACLOCAL -I /usr/local/share/aclocal
$AUTOMAKE -a
$AUTOCONF
#autoreconf259 -iv -I /usr/local/share/aclocal
else else
echo "Using your default auto* tools" echo "Using your default auto* tools"
#this should work with recent autotools #this should work with recent autotools

View File

@ -11,6 +11,7 @@
#ifdef STDC_HEADERS #ifdef STDC_HEADERS
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include <time.h>
#include "client_def.h" #include "client_def.h"
#include "c_extern.h" #include "c_extern.h"
#include "my-string.h" #include "my-string.h"
@ -233,7 +234,6 @@ void client_init_key (unsigned long server_addr,
perror("shmat"); perror("shmat");
exit(1); exit(1);
} }
*share_key = key;
} }
void client_destroy_key(void) void client_destroy_key(void)
@ -242,13 +242,8 @@ void client_destroy_key(void)
if (shmdt((char *)share_key) < 0) if (shmdt((char *)share_key) < 0)
{ {
perror("shmdt"); perror("shmdt");
exit(1);
}
if (shmctl(lock_shm,IPC_RMID,NULL) < 0)
{
perror("shmctl");
exit(1);
} }
shmctl(lock_shm,IPC_RMID,NULL);
unlink(key_string); unlink(key_string);
} }
#endif #endif
@ -283,5 +278,144 @@ void client_destroy_key(void)
} }
#endif #endif
/********************************************************************/ /********************************************************************/
/******* For those systems that has SysV shared memory + semop ******/
/********************************************************************/
#ifdef USE_SHAREMEM_AND_SEMOP
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
int key_persists = 0;
static unsigned short *share_key;
static int lock_shm;
static int lock_sem;
unsigned short client_get_key (void)
{
struct sembuf sem;
sem.sem_num = 0;
sem.sem_op = -1;
sem.sem_flg = SEM_UNDO;
if(semop(lock_sem,&sem,1) == -1 )
{
perror("semop");
exit(1);
}
return(*share_key);
}
void client_set_key (unsigned short key)
{
struct sembuf sem;
sem.sem_num = 0;
sem.sem_op = 1;
sem.sem_flg = SEM_UNDO;
*share_key = key;
if(semop(lock_sem,&sem,1) == -1) {
perror("semop");
exit(1);
}
}
void client_init_key (unsigned long server_addr,
unsigned long server_port,
unsigned short key)
{
unsigned long omask;
key_t lock_key;
int fd;
union semun sun;
struct sembuf sem;
make_key_string(server_addr,server_port);
omask = umask(0);
fd = open(key_string,O_RDWR|O_CREAT,0666);
umask(omask);
close(fd);
if((lock_key = ftok(key_string,238)) == -1) {
perror("ftok");
exit(1);
}
if((lock_shm = shmget(lock_key,sizeof(short),IPC_CREAT|0666)) == -1) {
perror("shmget");
exit(1);
}
if(!(share_key = (unsigned short *) shmat(lock_shm,(char*)0,0))) {
perror("shmat");
exit(1);
}
if((lock_sem = semget(lock_key,0,0)) == -1) {
/* create a new semaphore and init it */
if((lock_sem = semget(lock_key,2,IPC_CREAT|0666)) == -1) {
perror("semget");
}
/* we need to init this semaphore */
sun.val=1;
if(semctl(lock_sem,0,SETVAL,sun) == -1)
{
perror("semctl setval");
exit(1);
}
*share_key = key;
}
/* increase in use counter */
sem.sem_num = 1;
sem.sem_op = 1;
sem.sem_flg = SEM_UNDO;
if(semop(lock_sem,&sem,1) == -1) {
perror("semop");
exit(1);
}
/*
fd=semctl(lock_sem,0,GETVAL);
printf("sem value: %d\n",fd);
fd=semctl(lock_sem,0,GETNCNT);
printf("sem ncnt: %d\n",fd);
*/
}
void client_destroy_key(void)
{
int rc;
if (shmdt((char *)share_key) < 0)
{
perror("shmdt");
exit(1);
}
/* check if we are only one process holding lock */
rc = semctl(lock_sem,1,GETVAL);
if (rc == -1)
{
perror("semctl");
exit(1);
}
if (rc == 1)
{
/*
printf("destroying shmem()+sem()\n");
*/
/* safe to destroy */
if (
(semctl(lock_sem,0,IPC_RMID) < 0) ||
(shmctl(lock_shm,IPC_RMID,NULL) < 0) ||
(unlink(key_string) < 0) )
rc++;/* ignore cleanup errors */
}
}
#endif
/********************************************************************/
/********************************************************************/ /********************************************************************/
/********************************************************************/ /********************************************************************/

View File

@ -21,7 +21,7 @@
#include "merge.h" #include "merge.h"
#include "printpro.h" #include "printpro.h"
static int f_cd (const char * p) static int f_cd (char * p)
{ {
UBUF *ub; UBUF *ub;
@ -32,6 +32,7 @@ static int f_cd (const char * p)
fprintf(stderr, "ERR: %s\n",ub->buf); fprintf(stderr, "ERR: %s\n",ub->buf);
return(0); return(0);
} else { } else {
util_junk_password(p);
fprintf(stderr, "directory %s\nmode: ",p); fprintf(stderr, "directory %s\nmode: ",p);
print_pro(ub,stderr); print_pro(ub,stderr);
return(1); return(1);
@ -45,8 +46,9 @@ int main (int argc, char ** argv)
env_client(); env_client();
if(argc == 1) { if(argc == 1) {
f_cd("/"); np=util_abs_path("/");
puts("/"); f_cd(np);
puts(np);
} else { } else {
if(!(av = glob(argv[1]))) { if(!(av = glob(argv[1]))) {
av = av2; av = av2;
@ -56,7 +58,6 @@ int main (int argc, char ** argv)
np = util_abs_path(*av); np = util_abs_path(*av);
if(f_cd(np)) if(f_cd(np))
{ {
util_junk_password(np);
puts(np); puts(np);
} }
else { else {

View File

@ -186,7 +186,15 @@ static void usage (void)
#else #else
printf("fgrabcmd"); printf("fgrabcmd");
#endif #endif
printf(" -[<f|o>|u|t|n|<a|c>] -r -p -h -?\n"); printf(" [options] [filename] ...\n");
printf("Options:\n");
printf("-f,-o\toverwrite existing files\n");
printf("-u\tuse unique names\n");
printf("-t\tdownload into temporary file\n");
printf("-n\tnever overwrite existing files\n");
printf("-a,-c\tappend to files\n");
printf("-p\tpreserve timestamp of remote files\n");
printf("-r\trecursively get directories\n");
} }
/* Parse options /* Parse options

View File

@ -37,15 +37,15 @@ static int append_to_buf(const char *what,size_t len)
static void rename_file (const char *fname,const char *target) static void rename_file (const char *fname,const char *target)
{ {
char *fpath; char *fpath;
unsigned int l;
UBUF *reply; UBUF *reply;
unsigned int srclen,dstlen;
/* reset buffer */ /* reset buffer */
n=0; n=0;
/* append source file */ /* append source file */
fpath = util_abs_path(fname); fpath = util_abs_path(fname);
l=strlen(fpath)+1; srclen=strlen(fpath)+1;
if(append_to_buf(fpath,l)) if(append_to_buf(fpath,srclen))
{ {
printf("path too long: %s.\n",fpath); printf("path too long: %s.\n",fpath);
free(fpath); free(fpath);
@ -54,8 +54,8 @@ static void rename_file (const char *fname,const char *target)
free(fpath); free(fpath);
/* add dest */ /* add dest */
fpath=util_abs_path(target); fpath=util_abs_path(target);
l=strlen(fpath)+1; dstlen=strlen(fpath)+1;
if(append_to_buf(fpath,l)) if(append_to_buf(fpath,dstlen))
{ {
printf("path too long: %s.\n",fpath); printf("path too long: %s.\n",fpath);
free(fpath); free(fpath);
@ -63,7 +63,7 @@ static void rename_file (const char *fname,const char *target)
} }
/* send our nicely crafted junk to the server */ /* send our nicely crafted junk to the server */
reply=client_interact (CC_RENAME,0,n,buf,0,NULL); reply=client_interact (CC_RENAME,dstlen,srclen,buf,dstlen,buf+srclen);
if(reply->cmd==CC_ERR) if(reply->cmd==CC_ERR)
{ {
@ -92,8 +92,11 @@ int main (int argc, char ** argv)
rename_file(*av++,argv[argc-1]); rename_file(*av++,argv[argc-1]);
} }
} }
else else
{
fprintf(stderr,"%s source target\n", argv[0]); fprintf(stderr,"%s source target\n", argv[0]);
exit(1);
}
client_done(); client_done();

View File

@ -26,7 +26,8 @@ static int optletter;
static void usage (void) static void usage (void)
{ {
printf("fput"); printf("fput");
printf(" [-p | [ -h | -? ] ] file ...\n"); printf(" [-p | -h | -? ] file ...\n");
printf("-p\tPreserve file modification time\n");
} }
static int put_file (char * path) static int put_file (char * path)

View File

@ -93,6 +93,8 @@ int main (int argc, char ** argv)
printf("LOCKF"); printf("LOCKF");
#elif defined(NOLOCKING) #elif defined(NOLOCKING)
printf("None"); printf("None");
#elif defined(USE_SHAREMEM_AND_SEMOP)
printf("SHAREMEM_AND_SEMOP");
#else #else
#error "We do not have any locking method defined!" #error "We do not have any locking method defined!"
#endif #endif

View File

@ -45,7 +45,10 @@ int _x_udp (const char * bindaddress, unsigned short * port)
if(f == -1) return(-1); if(f == -1) return(-1);
if(setsockopt(f,SOL_SOCKET,SO_REUSEADDR,(char *)&zz,sizeof(zz)) < 0 || if(
#ifdef REUSE_SOCKET
setsockopt(f,SOL_SOCKET,SO_REUSEADDR,(char *)&zz,sizeof(zz)) < 0 ||
#endif
bind(f,(struct sockaddr *) &me,len) < 0 || bind(f,(struct sockaddr *) &me,len) < 0 ||
getsockname(f,(struct sockaddr *)&myadr,&len) < 0) { getsockname(f,(struct sockaddr *)&myadr,&len) < 0) {
SAVE_ERRNO(((void) close(f))); SAVE_ERRNO(((void) close(f)));

View File

@ -31,11 +31,19 @@ AC_MSG_CHECKING([if building for Cygwin])
case $host_os in case $host_os in
*cygwin* ) AC_DEFINE(OS_CYGWIN,1,[Define if you are building for cygwin]) AC_MSG_RESULT(yes);; *cygwin* ) AC_DEFINE(OS_CYGWIN,1,[Define if you are building for cygwin]) AC_MSG_RESULT(yes);;
* ) AC_MSG_RESULT(no);; * ) AC_MSG_RESULT(no);;
esac esac
AC_MSG_CHECKING([if we are building lamer pack]) AC_MSG_CHECKING([if we are building lamer pack])
AC_ARG_ENABLE(lamerpack,[Build for lamers],AC_DEFINE(LAMERPACK,1,[Define if you want to build for lamer disabled ppl]) AC_MSG_RESULT(YES),AC_MSG_RESULT(NO)) AC_ARG_ENABLE(lamerpack,AS_HELP_STRING([--enable-lamerpack],[Build fspd tuned for lamers (default no)]),AC_DEFINE(LAMERPACK,1,[Define if you want to build for lamer disabled ppl]) AC_MSG_RESULT(YES),AC_MSG_RESULT(NO))
AC_MSG_CHECKING([if enable extra debug code]) AC_MSG_CHECKING([if enabling of extra debug code is requested])
AC_ARG_ENABLE(debug,[Enable client library debuging],AC_DEFINE(DEBUG,1,[Define if you want more debug messages]) AC_MSG_RESULT(YES),AC_MSG_RESULT(NO)) AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug],[Enable client library debuging output (default no)]),AC_DEFINE(DEBUG,1,[Define if you want more debug messages]) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
AC_MSG_CHECKING([If client commands can time out])
AC_ARG_ENABLE(timeout,AS_HELP_STRING([--disable-timeout],[Disable timeouts in client commands (default enabled)]),,enable_timeout=yes)
if test "x${enable_timeout}" = xyes; then
AC_DEFINE(CLIENT_TIMEOUT,1,[Define if you want client commands timeout])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_PROG_RANLIB AC_PROG_RANLIB
AM_PROG_LEX AM_PROG_LEX
AC_PROG_LN_S AC_PROG_LN_S
@ -43,7 +51,7 @@ AC_PROG_CC
dnl If we're using gcc, enable some warnings dnl If we're using gcc, enable some warnings
AC_CACHE_CHECK(for additional compiler options, ac_cv_prog_gcc_flags, [ AC_CACHE_CHECK(for additional compiler options, ac_cv_prog_gcc_flags, [
ac_cv_prog_gcc_flags="" ac_cv_prog_gcc_flags=""
if test "$GCC" = yes if test "x$GCC" = xyes
then then
echo "void dummy(void);" >configure-dummy.c echo "void dummy(void);" >configure-dummy.c
echo "void dummy(void) {}" >>configure-dummy.c echo "void dummy(void) {}" >>configure-dummy.c
@ -79,7 +87,6 @@ AC_C_CONST
AC_C_VOLATILE AC_C_VOLATILE
AC_PROG_CPP AC_PROG_CPP
AC_ISC_POSIX AC_ISC_POSIX
AC_SYS_LARGEFILE
if test "${enable_maintainer_mode+set}" = set; then if test "${enable_maintainer_mode+set}" = set; then
CFLAGS="-g3 $ac_cv_prog_gcc_flags" CFLAGS="-g3 $ac_cv_prog_gcc_flags"
AC_CHECK_LIB(efence,EF_Abort) AC_CHECK_LIB(efence,EF_Abort)
@ -94,15 +101,16 @@ AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(void) AC_CHECK_SIZEOF(void)
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO AC_FUNC_FSEEKO
AC_CHECK_SIZEOF(off_t) AC_CHECK_SIZEOF(off_t)
if test $ac_cv_sizeof_off_t -ge 8 -a "$ac_cv_func_fseeko" = yes; then if test $ac_cv_sizeof_off_t -ge 8 -a "x$ac_cv_func_fseeko" = xyes; then
AC_DEFINE(NATIVE_LARGEFILES,1,[Define if we have 64bit off_t and fseeko]) AC_DEFINE(NATIVE_LARGEFILES,1,[Define if we have 64bit off_t and fseeko])
AC_MSG_NOTICE([Native large file support enabled]) AC_MSG_NOTICE([Native large file support enabled])
else else
AC_MSG_NOTICE([No native 64 bit files support, fallback to fopen64]) AC_MSG_NOTICE([No native 64 bit files support, fallback to fopen64])
AC_CHECK_FUNC(fopen64) AC_CHECK_FUNC(fopen64)
if test "$ac_cv_func_fopen64" = yes -a "$enable_largefile" = yes; then if test "x$ac_cv_func_fopen64" = xyes -a "x$enable_largefile" = xyes; then
AC_MSG_ERROR([You have fopen64 but no native LFS support. This configuration is not currently supported. Report compiler version, os version and library version to Radim Kolar. Thank you for your cooperation.]) AC_MSG_ERROR([You have fopen64 but no native LFS support. This configuration is not currently supported. Report compiler version, os version and library version to Radim Kolar. Thank you for your cooperation.])
fi fi
fi fi
@ -114,7 +122,7 @@ AC_CHECK_TYPE(nlink_t, ,AC_DEFINE(nlink_t, int,[declare nlink_t as int if not fo
AC_CHECK_TYPE(rlim_t, ,AC_DEFINE(rlim_t, [unsigned int],[declare rlim_t as unsigned int if not found in <sys/resource.h>]),[#include <sys/resource.h>]) AC_CHECK_TYPE(rlim_t, ,AC_DEFINE(rlim_t, [unsigned int],[declare rlim_t as unsigned int if not found in <sys/resource.h>]),[#include <sys/resource.h>])
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_FUNC_CLOSEDIR_VOID AC_FUNC_CLOSEDIR_VOID
AC_CHECK_FUNCS(random strdup bcopy flock lockf getrlimit fork setsid) AC_CHECK_FUNCS(random strdup bcopy flock lockf getrlimit fork setsid semop nanosleep)
AC_CACHE_CHECK(for working shmget ,fsp_cv_func_shmget, AC_CACHE_CHECK(for working shmget ,fsp_cv_func_shmget,
[LOCKPATH="conftestlock" [LOCKPATH="conftestlock"
AC_TRY_RUN([ AC_TRY_RUN([

View File

@ -19,7 +19,7 @@
### # # ### L8mer guide to FSP ### # # ### L8mer guide to FSP
### ## ## ### ### ## ## ###
### ### # ### LQ Version ### ### # ### LQ Version
##### # ###### ##### Oct 2004 ##### # ###### ##### Dec 2004
Why you need it Why you need it
@ -31,16 +31,18 @@ Why you need it
- 100% attack resistant - 100% attack resistant
- net adminz do not like it - net adminz do not like it
- lamerz can not handle it - lamerz can not handle it
- bandwidth friendly
STuFF firSt! STuFF firSt!
you neeeed to get a p-file called cygwin1.dll. lamerz at www.cygwin.com you neeeed to get a p-file called cygwin1.dll. lamerz at www.cygwin.com
have some. Grab a copy, man. Copy it to your winlost sistema32 dyr. have some. Grab a copy, man. Copy it to your winlost sistema32 dyr.
Have it? Right. Have it? Right! You are ready now.
------------------------ sharing -------------------
Now rock! FSP server rocks!
There is a p-file fspd.exe. This is for stuff sharing. Server. You know. There is a p-file fspd.exe. This is for stuff sharing. Server. You know.
Right. Running this is easy: Right. Running this is easy:
@ -50,12 +52,32 @@ fspd.exe -d c:\your\stuff\to\share -p 53
this number is important. Recommended numbers for stealth this number is important. Recommended numbers for stealth
operation are: 53, 2090, 137-139, 13, 80, 443 operation are: 53, 2090, 137-139, 13, 80, 443
You can be catched more easily with bad number, so chooze wisely. Rememmber, You can be catched more easily with bad number, so chooze wisely. Remember,
some numbers like 2221, 21, 2000, 2001 are used only by Elite! some numbers like 2221, 21, 2000, 2001 are used only by Elite!
do not try it at home; bad thingz can hepen. you know. police will certainly do not try it at home; bad thingz can hepen. you know. police will certainly
take a visit. Lamers can detect you more easily on this ports, so be take a visit. Lamers can detect you more easily on this ports, so be
wise a little. Remember: You are c000l. wise a little. Remember: You are c000l.
Upload area
You want uploads from users. Of course. You need to setup an upload
area. This is easy.
In your FSP homedir create subdirectory upload and and create file named
".FSP_OK_ADD" there. Content of this file dosnot matter. Copy your favourite
music into it if you want. Do something nice.
Last point is to add upload directory to server invocation arguments:
fspd.exe -d c:\your\stuff\to\share -p 53 -T c:\your\stuff\to\share\upload
that's all.
Wait! If you want to stop users from downloading files from your upload area,
simply create ".FSP_NO_GET" file here.
------------------------- leeching ------------------
Get more stuff! Get more stuff!
Of course that you want to have the latest stuff, isn't it? Of course that you want to have the latest stuff, isn't it?
@ -96,7 +118,7 @@ much better guide - hq version. Try to offer something.
192.168.45.21 108 192.168.45.21 108
10.20.30.40 5060 10.20.30.40 5060
never try to flood fsp server, this does not work, elite will lauch never try to flood fsp server, this does not work, elite will laugh
at you and cut your accez down. remember, you ar elite, not a kiddie! at you and cut your accez down. remember, you ar elite, not a kiddie!
-----**************------*******************----------************--- -----**************------*******************----------************---
@ -107,10 +129,9 @@ for HQ version of this guide send
number 550694 number 550694
Features included: Features included:
list of hq quality sitez list of 5 hq quality sitez
how to setup upload facility
how to search for new sitez how to search for new sitez
special seek tool special fsp sites seek tool
and 3 secret bonuzez and 3 secret bonuzez
!We Do NOT sEnDZ hQ guiDe to LAmeRZ! Prove yourself first. !We Do NOT sEnDZ hQ guiDe to LAmeRZ! Prove yourself first.

View File

@ -1,8 +1,8 @@
FILE SERVICE PROTOCOL VERSION 2 FILE SERVICE PROTOCOL VERSION 2
FSP v2 FSP v2
Document version 0.15 Document version 0.16
Last updated 2 Dec 2004 Last updated 15 Dec 2004
Also known as Also known as
File Slurping Protocol, File Slurping Protocol,
@ -496,10 +496,9 @@ Commands starting from FSP 2.8.1 Beta 11
CC_RENAME 0x4E - rename file or directory CC_RENAME 0x4E - rename file or directory
request request
file position: not used file position: size of extra data
data: ASCIIZ source file or directory data: ASCIIZ source file or directory
ASCIIZ destination file or directory xtra data: ASCIIZ destination file or directory
xtra data: not used
Note: It is possible to do cross-directory rename. In this Note: It is possible to do cross-directory rename. In this
case you must have rights to DELETE in source directory and case you must have rights to DELETE in source directory and

View File

@ -9,27 +9,28 @@
<firstname>Sven</firstname> <firstname>Sven</firstname>
<othername>"Hoaxter"</othername> <othername>"Hoaxter"</othername>
<surname>Hoexter</surname> <surname>Hoexter</surname>
<affiliation>
<address><email>sven@du-gehoerst-mir.de-nospam</email></address>
</affiliation>
</author> </author>
<author> <author>
<firstname>Radim</firstname> <firstname>Radim</firstname>
<othername>"HSN"</othername> <othername>"HSN"</othername>
<surname>Kolar</surname> <surname>Kolar</surname>
<affiliation> <affiliation>
<address><email>hsn@sendmail.cz.nospam</email></address> <address><email>hsn@no.spam.sendmail.cz</email></address>
</affiliation> </affiliation>
</author> </author>
<copyright> <copyright>
<year>2003-2004</year> <year>2003-2004</year>
<holder>Authors</holder> <holder>Authors</holder>
</copyright> </copyright>
<!-- I'll call it 0.1 later
<revhistory> <revhistory>
<revision> <revision>
<revnumber>0.1</revnumber> <revnumber>0.1</revnumber>
<date>2003.09.10</date> <date>2004.12.17</date>
</revision> </revision>
</revhistory> </revhistory>
-->
<!-- starting with some general stuff --> <!-- starting with some general stuff -->
<abstract> <abstract>
<para> <para>
@ -58,15 +59,15 @@
FSP stands for &fsp;. In general FSP is what anonymous ftp should be: a reliable and bandwidth friendly FSP stands for &fsp;. In general FSP is what anonymous ftp should be: a reliable and bandwidth friendly
way to access publicly available data. way to access publicly available data.
<para> <para>
FSP is a UDP based protocol for transferring files around. It has FSP is a lightweight UDP based protocol for transferring files around.
many benefits over FTP, mainly for running It has many benefits over FTP, mainly for running
anonymous archives. FSP protocol is valuable in all kinds of anonymous archives. FSP protocol is valuable in all kinds of
environments because it is one of the only TCP/IP protocols that is not environments because it is one of the only TCP/IP protocols that is not
aggressive about bandwidth, while still being sufficiently fault tolerant. aggressive about bandwidth, while still being sufficiently fault tolerant.
</para> </para>
</sect2> </sect2>
<sect2 id="fsp-project"> <sect2 id="fsp-project">
<title>FSP Project</title> <title>FSP Project</title>
<para> <para>
FSP is (and always has been) open source project with MIT/X11 source FSP is (and always has been) open source project with MIT/X11 source
code license. See <xref linkend="licence"> for more details. code license. See <xref linkend="licence"> for more details.
@ -103,6 +104,9 @@
which solves problems with aborted and timed out transfer. Because which solves problems with aborted and timed out transfer. Because
FSP is stateless protocol, it can survive even server reboot without FSP is stateless protocol, it can survive even server reboot without
interruption. interruption.
<para>
More information about FSP use can be found
in <ulink url="http://cvs.sourceforge.net/viewcvs.py/fsp/fsp/INFO?view=auto">INFO document</ulink>.
</para> </para>
</sect2> </sect2>
<sect2 id="comparison"> <sect2 id="comparison">
@ -140,6 +144,7 @@
<para> <para>
HTTP: widely supported by servers, clients and proxies. HTTP: widely supported by servers, clients and proxies.
De-facto standard protocol for accessing information today. De-facto standard protocol for accessing information today.
HTTP is also primary protocol used for file distribution today.
<para> <para>
FSP: Can provide directory listings, which are not supported FSP: Can provide directory listings, which are not supported
by standard HTTP/1.1 protocol. You need to have configured by standard HTTP/1.1 protocol. You need to have configured
@ -151,21 +156,25 @@
<para> <para>
FTP: widely supported by servers and clients, more difficult FTP: widely supported by servers and clients, more difficult
to proxy than HTTP, uses 2 TCP connections, can provide directory to proxy than HTTP, uses 2 TCP connections, can provide directory
listings in site-specific format, more heavy service than HTTP. listings in site-specific format, server side is more heavy service
than HTTP. FTP is being replaced by HTTP today.
<para> <para>
FSP: do not needs to make any connection, very lightweight service, FSP: do not needs to make any connection, server side is very
directory listings are standardized by protocol. lightweight service,
directory listings are standardized by protocol and very quick,
no problems with NAT.
</sect3> </sect3>
<sect3 id="comparetftp"> <sect3 id="comparetftp">
<title>FSP vs. tftp</title> <title>FSP vs. tftp</title>
<para> <para>
tftp is UDP (but TCP version also exists) used mainly tftp is simple UDP (but TCP version also exists) protocol used mainly
for loading boot and flash ROM images from network. for loading boot and flash ROM images from network. Standard
tftp uses 512 bytes long packets.
<para> <para>
TFTP: more widely used, standardized, most network cards TFTP: more widely used, standardized in RFC, most network cards
can boot image via TFTP. can boot image via TFTP.
<para> <para>
FSP: about 1.5-times faster because of bigger packet size, FSP: about 1.5-times faster because of 1k packet size,
supports directory listings, supports directory listings,
can query file date and size, can query file date and size,
can provide random access to file and supports opening can provide random access to file and supports opening
@ -186,12 +195,14 @@
files from your archive. It also helps people during spikes periods files from your archive. It also helps people during spikes periods
when archive is very busy. when archive is very busy.
<para> <para>
There are also some people which likes slower FSP downloads, because There are also some people which likes slower FSP downloads better,
it saves their bandwidth for interactive tasks. because
it saves their bandwidth for interactive tasks. This is often prefered
way of downloading large files, like CD-ROM images.
<para> <para>
It is not true that UDP based protocols are unsecure. &fsp; provides It is not true that UDP based protocols are unsecure. &fsp; provides
the same security level as anonymous FTP and is much more resistant the same security level as anonymous FTP and is much more resistant
against denial of service attack. It is nearly impossible to overload against denial of service attacks. It is nearly impossible to overload
fsp server by flooding. On other side, TCP-based protocols are very fsp server by flooding. On other side, TCP-based protocols are very
simple to SYN flood. simple to SYN flood.
<sect2 id="wherecanifind"> <sect2 id="wherecanifind">
@ -324,18 +335,22 @@
version 2.7.1 was released. It was quite popular at that time, version 2.7.1 was released. It was quite popular at that time,
mainly because it was superior way for transferring warez around mainly because it was superior way for transferring warez around
when compared with FTP. Because of this, FSP protocol got a bad when compared with FTP. Because of this, FSP protocol got a bad
name and suffers from it even today. I see that FSP warez era name "Underground file sharing protocol" and suffers from it even today.
I see that FSP warez era
as practical demonstration how can FSP perform nicely on as practical demonstration how can FSP perform nicely on
overloaded sites and lines. overloaded sites and lines.
<para> <para>
After that then was some work on After that then was some maintenance work on FSP in 1995 which ends
FSP in 1995 and which ends with now famous FSP version 2.8.1b3 with famous last official beta FSP version 2.8.1b3
in March 1996. This version is used on some in March 1996, which was coded by original FSP developers team.
servers today because Debian Woody has it, but 2.7.1 is still This version is used on some servers today because Debian Woody has it.
used on some forgotten machines in universities. It has also
known security issues (fspd follows all symlinks), but at this <para>
time there were viewed as feature, not a bug. Last official stable FSP version was 2.7.1. This is still
used on some forgotten machines in universities today. It has also
known security issue (fspd follows all symlinks), but at this
time this was viewed as feature, not a bug.
<para> <para>
Radim Kolar released 2.8.1b4 in 2001, which was just some bugfixed Radim Kolar released 2.8.1b4 in 2001, which was just some bugfixed
@ -343,6 +358,7 @@
Active working on FSP again starts on 25 June 2003 when Version Active working on FSP again starts on 25 June 2003 when Version
2.8.1b5 goes out. Major parts of FSP server code was rewrited 2.8.1b5 goes out. Major parts of FSP server code was rewrited
for higher performance and many old bugs in FSP code fixed. for higher performance and many old bugs in FSP code fixed.
Some bugs gets fixed after more than 10 years.
<para> <para>
In the past various people worked on the &fsp;, see In the past various people worked on the &fsp;, see
@ -354,7 +370,7 @@
<para> <para>
Radim Kolar started to work on the &fsp; again in June 2003. Since Radim Kolar started to work on the &fsp; again in June 2003. Since
that time he's maintaining the source distribution. You can reach him that time he's maintaining the source distribution. You can reach him
on the mailinglists or via e-mail <email>hsn@sendmail.cz-nospam</email>. on the mailinglists or via e-mail <email>hsn@no.spam.sendmail.cz</email>.
</para> </para>
<para> <para>
Since September 2003 Sven Hoexter is working on parts of the documentation. Since September 2003 Sven Hoexter is working on parts of the documentation.
@ -414,33 +430,59 @@
<sect1 id="serverside"> <sect1 id="serverside">
<title>How to set up your FSP server</title> <title>How to set up your FSP server</title>
<para> <para>
FIXME Setting FSP server is a easy task. Majority of people runs FSP
Information about the fspd server in read only mode. In this mode fspd needs to know
Maybe I should start a second document describing all the only home directory and port number. Both can be supplied by command
possible configuration options in the fspd? line arguments to fspd.
Raw overview for this section: <para>
- install fspd -> see prior section If you need additional features, such as
- basic infos on fspd.conf logging, you will need to know <xref linkend="fspd.conf">
- info about init scripts </para>
- info about the several .FSP_ files <sect2 id="installserver">
</para> <title>How to install fsp server</title>
<para>
See <xref linkend="installation"> first.
<para>
Server can be installed as inetd service or standalone. I prefer
inetd installation, because modification of system startup
scripts is not needed.
<para>
Server can operate even without user supplied configuration file
fspd.conf. Basic setup can be easily done by command line arguments.
</sect2>
<sect2 id="installfspdquick">
<title>How to quickly install fsp server</title>
<para>
Add following line to your /etc/inetd.conf
<programlisting>
ftp dgram udp wait ftp /usr/local/bin/fspd in.fspd -d /home/ftp
</programlisting>
This easy setup will run fsp server on standard port 21, home directory set to /home/ftp and effective user set to ftp. If you do not have configured
temporary directory in fspd.conf, fsp server will run in read-only
mode.
<sect2 id="fspd.conf"> <sect2 id="fspd.conf">
<title>How to setup a basic fspd.conf</title> <title>How to setup a basic fspd.conf</title>
<para> <para>
FIXME Example config file for fsp server is called fspd.conf and can be
found in distribution. This file needs to be installed as
/usr/local/etc/fspd.conf or you can specify alternate location
by -f command line switch passed to fspd.
<para>
Configuration file itself is commented. Read comments inside.
</para> </para>
</sect2> </sect2>
<sect2 id="initscript"> <sect2 id="initscript">
<title>How can I start the fspd automagicly on reboot?</title> <title>How can I start the fspd automagicly on reboot?</title>
<para> <para>
FIXME FIXME.
Use init scripts ;) Use init scripts ;) or run it from inetd.
</para> </para>
</sect2> </sect2>
<sect2 id="restrictions"> <sect2 id="restrictions">
<title>How to setup restrictions on directories?</title> <title>How to setup restrictions on directories?</title>
<para> <para>
FIXME FIXME.
See manual page fspd(1).
</para> </para>
</sect2> </sect2>
</sect1> </sect1>
@ -450,15 +492,29 @@
<sect1 id="clientside"> <sect1 id="clientside">
<title>How to use the fsp client tools</title> <title>How to use the fsp client tools</title>
<para> <para>
FIXME For accessing FSP server, you need to use programs which supports
Explain client tools and those f*cking shell script wrappers *hrhr* FSP v2 protocol. There are several programs available today.
Check the X based fsp tools, maybe they'll compile ... </para>
</para>
<sect2 id="fsptoolchain"> <sect2 id="fsptoolchain">
<title>The fsp tool collection</title> <title>The fsp tool collection</title>
<para> <para>
FIXME Classic command line interfacing with FSP server is via client
Information about all the f* commands utilities found in basic distribution. Because FSP protocol
do not uses connections, there is no central command line interpreter
like found in ftp, because it is not needed. Information about
current remote server address and remote working directory is kept
in several environment variables. See manual page fsp_env for more
info.
<para>
Fsp client commands are started from normal shell interpreter. Because
most commands does remote globing which can not be done by your
local shell, you will need to turn globing in your shell off or
use one of prepared shell aliases. In distribution you will find
setup.sh and setup.csh shell scripts. These scripts must be
sourced (not executed) by your current shell.
<para>
Fsp commands names follows unix standard with f prepended. For
example: fcd, fpwd, fls. Files are transfered by fget/fput commands.
</para> </para>
</sect2> </sect2>
<sect2 id="fspclient"> <sect2 id="fspclient">
@ -554,7 +610,7 @@
<para> <para>
For bigger performance enhancement we need to use at least 2KB, For bigger performance enhancement we need to use at least 2KB,
but packets of that size must be fragmented on most network and fragmenting increases possibility of packet loss. We will not increase packet size but packets of that size must be fragmented on most network and fragmenting increases possibility of packet loss. We will not increase packet size
in FSP v2, but we are willing to do some experiments in FSP v3. in FSP v2 codebase, but we are willing to do some experiments in FSP v3.
</sect1> </sect1>
</article> </article>
<!-- vim: set expandtab: --> <!-- vim: set expandtab: -->

View File

@ -124,7 +124,8 @@ logfile ../logs/logfile
# The log command takes the following options # The log command takes the following options
# 'none' or any of 'all', '(!)errors', '(!)version', '(!)getdir', # 'none' or any of 'all', '(!)errors', '(!)version', '(!)getdir',
# '(!)getfile', '(!)upload', '(!)install', '(!)delfile', '(!)deldir', # '(!)getfile', '(!)upload', '(!)install', '(!)delfile', '(!)deldir',
# '(!)setpro', '(!)getpro', '(!)makedir', '(!)grabfile',(!)readonly. # '(!)setpro', '(!)getpro', '(!)makedir', '(!)grabfile',(!)readonly,
# '(!)stat', '(!)rename'.
# logging of 'all' will include logging of errors. # logging of 'all' will include logging of errors.
# for example: # for example:
# log all !errors -- will log all commands sent, but no error messages. # log all !errors -- will log all commands sent, but no error messages.

View File

@ -2,4 +2,4 @@
noinst_HEADERS=bsd_extern.h c_extern.h client_conf.h client_def.h co_extern.h \ noinst_HEADERS=bsd_extern.h c_extern.h client_conf.h client_def.h co_extern.h \
common_def.h find.h ls.h my-string.h s_extern.h server_conf.h \ common_def.h find.h ls.h my-string.h s_extern.h server_conf.h \
server_def.h tweak.h server_def.h tweak.h fspinfo.h

View File

@ -15,12 +15,10 @@
#define FSPPROF ".fsp_prof" #define FSPPROF ".fsp_prof"
/**************************************************************************** /****************************************************************************
* Define the following if you want the client programs to time out and * * Define the CLIENT_TIMEOUT if you want the client programs to time out
* abort after a certain period (period is settable via an environment * * and abort after a certain period. Period is settable via an environment
* variable. See the INFO, client man pages, and ChangeLog files for * * variable FSP_TIMEOUT. See the fsp_env(7) for details
* details *
****************************************************************************/ ****************************************************************************/
#define CLIENT_TIMEOUT 1
/**************************************************************************** /****************************************************************************
* Define the following if you want fhostcmd to attempt to perform name * * Define the following if you want fhostcmd to attempt to perform name *
@ -39,18 +37,22 @@
/* find the best locking method, defines one of USE_SHAREMEM_AND_LOCKF, /* find the best locking method, defines one of USE_SHAREMEM_AND_LOCKF,
* USE_FLOCK,USE_LOCKF,NOLOCKING 1 */ * USE_FLOCK,USE_LOCKF,NOLOCKING 1 */
#if defined(HAVE_SHMEM) && defined(HAVE_LOCKF) #if defined(HAVE_SHMEM) && defined(HAVE_SEMOP)
#define USE_SHAREMEM_AND_LOCKF 1 #define USE_SHAREMEM_AND_SEMOP 1
#else #else
#ifdef HAVE_LOCKF #if defined(HAVE_SHMEM) && defined(HAVE_LOCKF)
#define USE_LOCKF 1 #define USE_SHAREMEM_AND_LOCKF 1
#else #else
#ifdef HAVE_FLOCK #ifdef HAVE_LOCKF
#define USE_FLOCK 1 #define USE_LOCKF 1
#else #else
#define NOLOCKING #ifdef HAVE_FLOCK
#endif #define USE_FLOCK 1
#endif #else
#endif #define NOLOCKING
#endif
#endif
#endif
#endif /* locking story */
#endif /* _FSP_CLIENT_CONF_H_ */ #endif /* _FSP_CLIENT_CONF_H_ */

View File

@ -25,6 +25,7 @@ void destroy_configuration (void);
int init_caches (void); int init_caches (void);
void shutdown_caches (void); void shutdown_caches (void);
void stat_caches (FILE *fp); void stat_caches (FILE *fp);
void init_home_dir (void);
const char *validate_path (char *, unsigned, PPATH *,DIRINFO **, int); const char *validate_path (char *, unsigned, PPATH *,DIRINFO **, int);
const char *server_get_dir (DIRLISTING **,const DIRINFO *); const char *server_get_dir (DIRLISTING **,const DIRINFO *);
const char *server_del_file (PPATH *, DIRINFO *); const char *server_del_file (PPATH *, DIRINFO *);
@ -43,8 +44,7 @@ const char *server_grab_file (FILE **, unsigned long,
unsigned short); unsigned short);
const char *server_grab_done (unsigned long, unsigned short); const char *server_grab_done (unsigned long, unsigned short);
const char *server_stat (UBUF * buf); const char *server_stat (UBUF * buf);
const char *server_rename (char *,unsigned int,unsigned long); const char *server_rename (PPATH *src,PPATH *dest,DIRINFO *sdir, DIRINFO *tdir);
void init_home_dir (void);
/* filecache.c, open filehandles cache */ /* filecache.c, open filehandles cache */

View File

@ -18,23 +18,32 @@
#endif #endif
/**************************************************************************** /****************************************************************************
* DEFAULT_DIRLISTCACHE_SIZE should be set to contain the number of * * DEFAULT_DIRLISTCACHE_SIZE should be set to contain the number of
* listings you want to held in memory cache. Dirlisting needs a lot of * * listings you want to held in memory cache.
* syscalls, so it should be set to some higher number. * * Dirlisting building needs a lot of syscalls, so it should be set to
* Following setting is a minimum recommended size. * * some higher number.
* Following setting is a minimum recommended size.
****************************************************************************/ ****************************************************************************/
#define DEFAULT_DIRLISTCACHE_SIZE 50 #define DEFAULT_DIRLISTCACHE_SIZE 100
/**************************************************************************** /****************************************************************************
* DEFAULT_DIRSTATCACHE_SIZE should be set to contain the number of dirs * * DEFAULT_DIRSTATCACHE_SIZE should be set to contain the number of dirs *
* you want to held in dirstat memory cache. This cache avoids calling stat * * you want to held in dirstat memory cache. This cache avoids calling stat *
* on directory and loading access perms. This operation is far less * on directory and loading access perms. This operation is far less
* expensive than listing a directory, so if can be a lower number. * expensive than listing a directory, so if can be a lower number.
*/ ***************************************************************************/
#define DEFAULT_DIRSTATCACHE_SIZE 30 #define DEFAULT_DIRSTATCACHE_SIZE 30
/****************************************************************************
* Set this value to the maximum number of open files you wish your system *
* to keep around at any given time. The smaller this number is, the more *
* likely the server is to be opening and closing files, but the less file *
* descriptors need to be taken up by the server itself. *
****************************************************************************/
#define DEFAULT_FPCACHE_SIZE 20
/* THCCOUNT is the number of seconds used to compute average throughput. /* THCCOUNT is the number of seconds used to compute average throughput.
* 10 seconds seems to be a good value * 10 seconds seems to be a good value
*/ */

View File

@ -1,4 +1,4 @@
.TH FVER 1 "Oct 2004" FSP .TH FVER 1 "Dec 2004" FSP
.SH NAME .SH NAME
fver \- displays the version number string of the FSP database fver \- displays the version number string of the FSP database
.SH SYNOPSIS .SH SYNOPSIS
@ -8,8 +8,9 @@ fver \- displays the version number string of the FSP database
.LP .LP
Without arguments, Without arguments,
.B fver .B fver
displays the version string of the FSP server. displays the version string of the remote FSP server.
Otherwise, the version string of the client utilities is displayed. Otherwise, the version string of the client utilities and
compile time options are displayed.
.SH ENVIRONMENT .SH ENVIRONMENT
.LP .LP
See fsp_env(7) for list of used environment variables. See fsp_env(7) for list of used environment variables.

View File

@ -64,16 +64,7 @@ unsigned int dir_cache_limit = DEFAULT_DIRLISTCACHE_SIZE;
unsigned int stat_cache_limit = DEFAULT_DIRSTATCACHE_SIZE; unsigned int stat_cache_limit = DEFAULT_DIRSTATCACHE_SIZE;
mode_t upload_umask = 0033; mode_t upload_umask = 0033;
mode_t system_umask = 0077; mode_t system_umask = 0077;
unsigned int fp_cache_limit= DEFAULT_FPCACHE_SIZE;
/****************************************************************************
* Set this value to the maximum number of open files you wish your system *
* to keep around at any given time. The smaller this number is, the more *
* likely the server is to be opening and closing files, but the less file *
* descriptors need to be taken up by the server itself *
* Five seems to work reasonably well on my system *
****************************************************************************/
unsigned int fp_cache_limit=10;
static void log_set (int flag, int neg) static void log_set (int flag, int neg)
{ {
@ -98,7 +89,6 @@ static int get_boolean (const char *q)
fprintf(stderr,"Bogus boolean value '%s'. Exiting.\n",q); fprintf(stderr,"Bogus boolean value '%s'. Exiting.\n",q);
exit(1); exit(1);
return -1;
} }
static void read_configuration (const char * name) static void read_configuration (const char * name)

View File

@ -1066,32 +1066,15 @@ const char *server_stat (UBUF * ubuf )
} }
/* rename FILE/directory object */ /* rename FILE/directory object */
const char *server_rename (char * ub, unsigned int l1, unsigned long inet) const char *server_rename (PPATH *src,PPATH *dest,DIRINFO *sdir, DIRINFO *tdir)
{ {
struct stat sb; struct stat sb;
int issrcdir, istargetdir; int issrcdir, istargetdir;
unsigned n; unsigned n;
PPATH src,dest;
const char *pe; const char *pe;
DIRINFO *sdir,*tdir;
/* compute size of 1st component */
for(n=0;n<l1;n++)
if(ub[n] == '\0')
break;
n++;
/* parse suplied request data */
pe=parse_path(ub, n, &src );
if(pe)
return pe;
pe=parse_path(ub+n,l1- n, &dest );
if(pe)
return pe;
/* explore type of source object */ /* explore type of source object */
if(FSP_STAT(src.fullp,&sb)) return("can't find source file or directory"); if(FSP_STAT(src->fullp,&sb)) return("can't find source file or directory");
if(S_ISDIR(sb.st_mode)) if(S_ISDIR(sb.st_mode))
issrcdir=1; issrcdir=1;
else else
@ -1099,17 +1082,9 @@ const char *server_rename (char * ub, unsigned int l1, unsigned long inet)
issrcdir=0; issrcdir=0;
else else
return ("Refusing to operate on special files"); return ("Refusing to operate on special files");
/* validate source object */
/* we must turn \0 back into \n in password field */
if(src.passwd)
{
ub[n-strlen(src.passwd)-2]='\n';
}
pe=validate_path(ub,n,&src,&sdir,0);
if(pe) return pe;
/* --- explore Target --- */ /* --- explore Target --- */
if(FSP_STAT(dest.fullp,&sb)) if(FSP_STAT(dest->fullp,&sb))
istargetdir=-1; /* non - existent! */ istargetdir=-1; /* non - existent! */
else else
if(S_ISDIR(sb.st_mode)) if(S_ISDIR(sb.st_mode))
@ -1120,20 +1095,13 @@ const char *server_rename (char * ub, unsigned int l1, unsigned long inet)
else else
return ("Refusing to operate on special files"); return ("Refusing to operate on special files");
/* validate target */
if(istargetdir==1)
pe=validate_path(ub+n,l1 - n,&dest,&tdir,1);
else
pe=validate_path(ub+n,l1 - n,&dest,&tdir,0);
if(pe) return pe;
/* --=== now check ACL and do it ===-- */ /* --=== now check ACL and do it ===-- */
/* Cross - directory rename? */ /* Cross - directory rename? */
if (sdir == tdir) if (sdir == tdir)
{ {
/* no, do simple rename */ /* no, do simple rename */
/* not needed checked at upper level
pe=require_access_rights( sdir,DIR_RENAME,inet,src.passwd); pe=require_access_rights( sdir,DIR_RENAME,inet,src.passwd);
if(pe[0]!='N' && pe[0]!='O') if(pe[0]!='N' && pe[0]!='O')
return ("Permission denied"); return ("Permission denied");
@ -1141,8 +1109,9 @@ const char *server_rename (char * ub, unsigned int l1, unsigned long inet)
pe=require_access_rights( sdir,DIR_DEL,inet,src.passwd); pe=require_access_rights( sdir,DIR_DEL,inet,src.passwd);
if(pe[0]!='N' && pe[0]!='O') if(pe[0]!='N' && pe[0]!='O')
return ("No permission for overwriting files"); return ("No permission for overwriting files");
*/
/* now go to the action */ /* now go to the action */
if (rename(src.fullp,dest.fullp)) if (rename(src->fullp,dest->fullp))
return ("Rename failed"); return ("Rename failed");
/* update dir listing */ /* update dir listing */
sdir->lastcheck=cur_time; sdir->lastcheck=cur_time;

View File

@ -49,7 +49,7 @@ do { if((logging & (FLAG)) && !old) { \
#define ACTIONLOG2(FLAG,X) \ #define ACTIONLOG2(FLAG,X) \
do { if((logging & (FLAG)) && !old) { \ do { if((logging & (FLAG)) && !old) { \
fsplogs(); \ fsplogs(); \
fsploga("%s %-8s /%.*s %s %s", inetstr, (X), l1, s1, s1+l1); \ fsploga("%s %-8s /%.*s /%.*s", inetstr, (X), l1, s1, l2, s2); \
} } while (0) } } while (0)
#define ACTIONINFO(FLAG,F) \ #define ACTIONINFO(FLAG,F) \
@ -102,6 +102,8 @@ static const char * print_command(unsigned char cmd)
return "BYE"; return "BYE";
case CC_VERSION: case CC_VERSION:
return "VER"; return "VER";
case CC_INFO:
return "INFO";
case CC_ERR: case CC_ERR:
return "ERR"; return "ERR";
case CC_GET_DIR: case CC_GET_DIR:
@ -875,15 +877,88 @@ static void server_process_packet (unsigned bytes, UBUF * ub, int old,
} }
if(!old) if(!old)
{ {
DIRINFO *srcdir;
PPATH srcpath;
int istargetdir;
struct stat sb;
ACTIONLOG2(L_RENAME,"RENAME"); ACTIONLOG2(L_RENAME,"RENAME");
if ( (pe = server_rename(ub->buf,l1,inet_num)) )
/* validate source file */
pe = validate_path(s1,l1,&pp,&di,0);
if (pe)
{ {
ACTIONLOG1(L_RENAME|L_ERR,"RENAME"); ACTIONLOG2(L_ERR|L_RENAME,"RENAME");
ACTIONFAILED(L_ERR|L_RENAME,pe);
send_error(from, ub, pe) ;
return;
}
CHECK_ACCESS_RIGHTS(DIR_RENAME,L_RENAME);
srcdir=di;
srcpath=pp;
/* validate target */
pe = NULL;
/* check if target path is zero terminated */
if(s2[l2-1])
pe = ("Target path is not zero terminated");
else
{
if(FSP_STAT(s2,&sb))
istargetdir=-1; /* non - existent! */
else
if(S_ISDIR(sb.st_mode))
istargetdir=1;
else
if(S_ISREG(sb.st_mode))
istargetdir=0;
else
pe = ("Refusing to operate on special files");
}
if (!pe)
{
if (istargetdir == 1)
pe = validate_path(s2,l2,&pp,&di,1);
else
pe = validate_path(s2,l2,&pp,&di,0);
}
if (pe)
{
ACTIONLOG2(L_ERR|L_RENAME,"RENAME");
ACTIONFAILED(L_ERR|L_RENAME,pe);
send_error(from, ub, pe) ;
return;
}
/* check ACL in target directory */
if (istargetdir == 0)
{
/* we need delete right in the target directory */
pe = require_access_rights(di,DIR_DEL,inet_num,pp.passwd);
if(pe[0]!='N' && pe[0]!='O')
pe=("No permission for overwriting files");
else
pe=NULL;
}
/* execute rename */
if (!pe)
pe = server_rename(&srcpath,&pp,srcdir,di);
if ( pe )
{
ACTIONLOG2(L_RENAME|L_ERR,"RENAME");
ACTIONFAILED(L_RENAME|L_ERR,pe); ACTIONFAILED(L_RENAME|L_ERR,pe);
send_error(from, ub, pe); send_error(from, ub, pe);
return; return;
} }
} }
/* clear position field */
memset(ub->bb_pos,0,4);
server_reply(from,ub,0,0); server_reply(from,ub,0,0);
ACTIONOK(L_RENAME); ACTIONOK(L_RENAME);
return; return;

View File

@ -22,4 +22,5 @@ alias fpro \(set noglob\; exec fprocmd \!\*\)
alias fpwd echo \$FSP_DIR on \$FSP_HOST port \$FSP_PORT alias fpwd echo \$FSP_DIR on \$FSP_HOST port \$FSP_PORT
alias frm \(set noglob\; exec frmcmd \!\*\) alias frm \(set noglob\; exec frmcmd \!\*\)
alias frmdir \(set noglob\; exec frmdircmd \!\*\) alias frmdir \(set noglob\; exec frmdircmd \!\*\)
alias fmv \(set noglob\; exec fmvcmd \!\*\)
alias ftouch "touch \!:1;fput \!:1;rm \!:1" alias ftouch "touch \!:1;fput \!:1;rm \!:1"

View File

@ -52,6 +52,8 @@ alias frmdir='set -f;_frmdir'
ftouch() { touch "$1"; fput "$1"; rm "$1" ;} ftouch() { touch "$1"; fput "$1"; rm "$1" ;}
_fcd() { export FSP_DIR=$(fcdcmd "$@"); set +f;} _fcd() { export FSP_DIR=$(fcdcmd "$@"); set +f;}
alias fcd='set -f;_fcd' alias fcd='set -f;_fcd'
_fmv() { fmvcmd "$@"; set +f;}
alias fmv='set -f;_fmv'
####something like wget emulation#### ####something like wget emulation####
_fspget() { _fspget() {