*** empty log message ***

This commit is contained in:
hsn 2004-10-26 16:24:37 +00:00
parent 7f3727c324
commit f8849e658f
18 changed files with 109 additions and 32 deletions

View File

@ -16,14 +16,14 @@ FSP Development Battle plan:
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
- retune alg. for links with high packet loss
- hard coded access list, do not load it from filesystem
- add FSP change password command
- add FSP command for changing owners
- add FSP command for listing directory owners

View File

@ -45,6 +45,15 @@ Version - not yet released
client: use random starting seq. number - better for avoiding
seq. number clash with another client
fixed compiler warning on BB_READ4(const char *);
PROTOCOL: Added more information about directory blocks
Add pidfile.h to distribution
default FSP_DIR to / if not set
improved Sven's fsp-faq.sgml
Added local bind port support for server
added FSP_LOCALIP env variable for clients
--enable-lamerpack == build specialy tuned fspd for lamers
lamerz guide added
text rotate tool added
Version 2.8.1b19 - 11 Jan 2004
sven has added fspget URL command to setup.sh.

View File

@ -15,4 +15,4 @@ FSP Version CPU OS Compiler C library
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.2 gcc-3.3
2.8.1 Beta 19 i386 FreeBSD 5.3 gcc-3.4
2.8.1 Beta 20 i386 FreeBSD 5.3 gcc-3.4

6
TODO
View File

@ -17,7 +17,9 @@ SECURITY BUGS:
symlink to FILE can escape from FSP root directory. OLD known problem.
PROTOCOL-RELATED BUGS:
none known
it is not clear how to generate directory items with type skip. append
\0 name to them or not? All known clients stops reading the directory
when sees skip item in block.
PORTING
Sven's Slowaris 8 compile problem
@ -27,7 +29,6 @@ NEEDS IMPROVMENT:
Client LIBRARY
:high:
local bind address FSP_LOCALIP
we should retune retry algoritm for better support lines with higher
packed loss.
add more detailed stats from retry alg.
@ -58,7 +59,6 @@ FUTURE FEATURES FOR SERVER:
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)

View File

@ -203,7 +203,7 @@ void init_client PROTO3(const char *, host, unsigned short, port, unsigned short
busy_delay = idle_delay = target_delay;
myseq = random();
if((myfd = _x_udp(&myport)) == -1) {
if((myfd = _x_udp(env_listen_on,&myport)) == -1) {
perror("socket open");
exit(1);
}

View File

@ -22,6 +22,7 @@ const char *env_myport;
const char *env_host;
const char *env_port;
const char *env_local_dir;
const char *env_listen_on;
unsigned int env_timeout;
unsigned short client_buf_len;
unsigned short client_net_len;
@ -434,10 +435,11 @@ static void util_get_env PROTO0((void))
exit(1);
}
if(!(env_dir = getenv("FSP_DIR"))) {
fputs("No FSP_DIR specified.\n",stderr);
exit(1);
env_dir = "/";
env_dir_malloced = 0;
}
if(!(env_myport = getenv("FSP_LOCALPORT"))) env_myport = "0";
if(!(env_listen_on = getenv("FSP_LOCALIP"))) env_listen_on = NULL;
if(!(env_passwd = getenv("FSP_PASSWORD"))) env_passwd = "\0";
client_trace = !!getenv("FSP_TRACE");
if( (p = getenv("FSP_BUF_SIZE")) ) client_buf_len = atoi(p);

View File

@ -26,7 +26,7 @@
#include <netdb.h>
#include <netinet/in.h>
int _x_udp PROTO1(unsigned short *, port)
int _x_udp PROTO2(const char *, bindaddress, unsigned short *, port)
{
int f;
socklen_t len;
@ -34,14 +34,16 @@ int _x_udp PROTO1(unsigned short *, port)
struct sockaddr_in myadr;
int zz=1;
if(bindaddress == NULL || _x_adr (bindaddress, *port,&me ) != 0) {
memset(&me,0,sizeof(me));
me.sin_port = htons(*port);
me.sin_family = AF_INET;
};
len=sizeof(me);
f=socket(AF_INET,SOCK_DGRAM,0);
if((f=socket(AF_INET,SOCK_DGRAM,0)) == -1) return(-1);
if(f == -1) return(-1);
if(setsockopt(f,SOL_SOCKET,SO_REUSEADDR,(char *)&zz,sizeof(zz)) < 0 ||
bind(f,(struct sockaddr *) &me,len) < 0 ||
@ -67,8 +69,9 @@ int _x_adr PROTO3(const char *, host, int, port, struct sockaddr_in *, his)
}
/* if((his->sin_addr.s_addr = inet_addr(host)) != -1) */
if(inet_aton(host,&his->sin_addr))
if(inet_aton(host,&his->sin_addr)) {
his->sin_family = AF_INET;
}
else
if( (H = gethostbyname(host))) {
for(s = (char *)H->h_addr, d = (char *)&his->sin_addr, i = H->h_length;

View File

@ -80,6 +80,8 @@ AC_CHECK_LIB(efence,EF_Abort)
fi
AC_MSG_CHECKING([if enable extra debug code])
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_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 disbled ppl]) AC_MSG_RESULT(YES),AC_MSG_RESULT(NO))
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h sys/syslimits.h errno.h)
AC_CHECK_HEADERS(string.h memory.h strings.h unistd.h sys/resource.h utime.h)

View File

@ -11,11 +11,15 @@
#
port 21
# Server can listen only on particular network interface
#listenaddress 192.168.1.2
# The 'packetsize' sets maximal data size which will send FSPD in one packet.
# FSP definition allows up to 1024 bytes of data (default value) and it is a
# recommended to use this value unless there is a reason to use a smaller one.
# If your fsp site eats too much bandwidth try smaller value. !!! If you
# change this value you must delete all .FSP_CONTENT files !!!
# If your fsp site eats too much bandwidth try smaller value.
# !!! If you change this value you must delete all prebuilded directory
# listings == .FSP_CONTENT files !!!
# packetsize 768
# The 'conf' command allows a global file to read local files so that
@ -34,6 +38,8 @@ homedir_restricted yes
# 'use_access_files' if server should check for special .FSP files
# in directory and set access rights acording to that.
# In most installation, yes is right. Use `no` if people can uload
# files starting with .FSP into fsp server homedir.
use_access_files yes
# 'permit_passwordless_owners' If server allow directory owners without
@ -78,7 +84,7 @@ statcache 30
# The 'statcache_timeout' command controls how long statcache entries are
# valid before directory gets re-examined by stat()
statcache_timeout 15
statcache_timeout 20
# 'use_directory_mtime'. If your filesystem changes mtime when directory
# is updated, set it to YES. If set to NO, directory will be rechecked
@ -89,7 +95,7 @@ statcache_timeout 15
# The 'filecache' command controls maximal number of open files by server.
# After this limit will be reached, server will close last recently used files.
# This do not prevent any number clients from downloading, but file for each
# request must be opened first. Setting this lower open/close overhead.
# request must be opened first. Setting this lowers open/close overhead.
filecache 30
# The 'dumpfile' command tells the server where to log stats on SIGUSR1
@ -123,7 +129,7 @@ logfile ../logs/logfile
log all !readonly
#The 'xferlog' command tells server where to use wuftpd compatible
#transfer log file.
#transfer log file. Thos logs currectly do not support partial transfers.
xferlog ../logs/xferlog
# The 'thruput' command is used to specify the maximum average

View File

@ -19,7 +19,7 @@ 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 const char *env_dir,*env_passwd,*env_local_dir,*env_port,*env_myport,*env_host,*env_listen_on;
extern unsigned int env_timeout;
extern unsigned short client_buf_len,client_net_len;
char *util_abs_path PROTO0((const char *));

View File

@ -15,7 +15,7 @@ long random PROTO0((void));
#endif
/* udp_io.c */
int _x_udp PROTO0((unsigned short *));
int _x_udp PROTO0((const char *, unsigned short *));
int _x_adr PROTO0((const char *, int, struct sockaddr_in *));
int _x_select PROTO0((fd_set *, long));

View File

@ -14,6 +14,7 @@ extern unsigned short udp_port,packetsize;
extern time_t retry_timeout,session_timeout,stat_cache_timeout;
extern char *logname,*tlogname,*readme_file,*dumpname;
extern char *home_dir,*pidlogname;
extern char *listen_on;
extern unsigned int dir_cache_limit, stat_cache_limit,fp_cache_limit;
extern char *tmp_dir;
extern mode_t upload_umask, system_umask;

View File

@ -1,4 +1,4 @@
.TH "FSP ENVIRONMENT" 7 "Jul 2003" FSP "FSP Environment Variables"
.TH "FSP ENVIRONMENT" 7 "Oct 2004" FSP "FSP Environment Variables"
.SH NAME
Environment variables used by FSP Clients programs
.SH SYNOPSIS
@ -8,10 +8,16 @@ setenv VARIABLE value | export VARIABLE=value
The following variables are used for access FSP servers:
.TP
.B FSP_HOST
The name or internet number of the machine with the FSP server.
The name or internet number of the machine with the FSP server. Required.
.TP
.B FSP_PORT
The port number of the UDP socket used by the FSP server.
The port number of the UDP socket used by the FSP server. Required.
.TP
.B FSP_LOCALIP
Local Address of UDP socket used by FSP client utilities. This
IP address must be one of your local IP addresses. If not used,
TCP protocol stack sets the default. This variable is mainly
used for multi-homed hosts.
.TP
.B FSP_LOCALPORT
The port number of the UDP socket used by FSP client utilities.
@ -32,7 +38,7 @@ packets from server.
.TP
.B FSP_DIR
The current working directory of the client in the FSP server.
The root of the database is /.
The server's root is /.
.TP
.B FSP_TRACE
If this variable is set to any value, program

View File

@ -7,4 +7,4 @@ fspd_SOURCES=file.c host.c main.c conf.c server.c fifocache.c \
fspd_CFLAGS=-DSYSCONFDIR="\"@sysconfdir@\"" $(AM_CFLAGS)
fspd_LDADD=-L../common -lcommon
noinst_HEADERS=fifocache.h
noinst_HEADERS=fifocache.h pidfile.h

View File

@ -56,6 +56,7 @@ char *pidlogname = NULL;
char *dumpname = NULL;
char *home_dir = NULL;
char *tmp_dir = NULL;
char *listen_on = NULL;
int homedir_restricted = 1;
int permit_passwordless_owners = 0;
char *readme_file = NULL;
@ -132,6 +133,9 @@ static void read_configuration PROTO1(const char *, name)
} else if(strcasecmp(p, "readme") == 0) {
if(readme_file) free(readme_file);
readme_file = strdup(q);
} else if(strcasecmp(p, "ListenAddress") == 0) {
if(listen_on) free(listen_on);
listen_on = strdup(q);
} else if(strcasecmp(p, "homedir") == 0) {
if(home_dir) free(home_dir);
home_dir = strdup(q);
@ -264,6 +268,9 @@ static void read_configuration PROTO1(const char *, name)
void load_configuration PROTO1(const char *,config_file)
{
#ifdef LAMERPACK
return;
#endif
if(config_file == NULL) return;
/* destroy_configuration(); */
@ -287,8 +294,10 @@ void destroy_configuration PROTO0((void))
if(tmp_dir) free(tmp_dir);
if(dumpname) free(dumpname);
if(iptab) free_ip_table(iptab);
if(listen_on) free(listen_on);
readme_file = home_dir = logname = tmp_dir = dumpname = NULL;
iptab = NULL;
pidlogname = NULL;
listen_on = NULL;
}

View File

@ -213,6 +213,9 @@ void stat_caches PROTO1(FILE *,fp)
/* should init all types of caches in future */
void shutdown_caches PROTO0((void))
{
#ifdef LAMERPACK
fclose(stderr);
#endif
fprintf(stderr,"DIRLISTCACHE ");
f_cache_stats(dirlistcache,stderr);
f_cache_clear(dirlistcache);
@ -1108,9 +1111,13 @@ void init_home_dir PROTO0((void))
chdir(home_dir);
}
#ifndef LAMERPACK
if(dbug) {
#endif
fprintf(stderr,"home on %s\n",home_dir);
if(tmp_dir)
fprintf(stderr,"tmpdir on %s\n",tmp_dir);
#ifndef LAMERPACK
}
#endif
}

View File

@ -23,12 +23,17 @@ static const char *config_file = CONF_FILE ;
static void display_version PROTO0((void))
{
printf(
#ifndef LAMERPACK
"File Service Protocol Daemon - FSP "PACKAGE_VERSION"\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__
"Compiled "__DATE__" by GCC "__VERSION__"\n"
#endif
#else
"FSP server "PACKAGE_VERSION"\n"
"For lamerZ by Elite!\n"
#endif
);
}
@ -44,9 +49,20 @@ static void check_required_vars PROTO0((void))
{
double rnd;
#ifdef LAMERPACK
inetd_mode = 0;
daemonize = 0;
dbug = 0;
dir_cache_limit = 500;
#endif
if(!inetd_mode && udp_port==0) {
#ifdef LAMERPACK
udp_port = 53;
#else
fprintf(stderr, "Error: No port set. (Use 65535 for random port)\n");
exit(1);
#endif
}
if(udp_port == 65535)
{
@ -55,8 +71,12 @@ static void check_required_vars PROTO0((void))
udp_port=rnd*(65535-1024)+1024;
}
if(!home_dir) {
#ifdef LAMERPACK
home_dir = strdup("/");
#else
fprintf(stderr, "Error: No home directory set.\n");
exit(1);
#endif
}
#if 0
if(*home_dir != '/') {
@ -82,8 +102,10 @@ static void check_required_vars PROTO0((void))
dbug = 0;
if(!tmp_dir && !read_only)
{
#ifndef LAMERPACK
if(!inetd_mode)
fprintf(stderr,"Warning: no tmpdir set, switching to readonly mode.\n");
#endif
read_only = 1;
}
}
@ -176,7 +198,7 @@ int main PROTO2(int, argc, char **, argv)
if(!inetd_mode)
{
opt=_x_udp(&udp_port);
opt=_x_udp(listen_on,&udp_port);
if(opt == -1) {
perror("Error: socket open");
exit(2);
@ -185,6 +207,10 @@ int main PROTO2(int, argc, char **, argv)
display_version();
fprintf(stderr,"listening on port %d\n",udp_port);
}
#ifdef LAMERPACK
display_version();
fprintf(stderr,"rocking on port %d\n",udp_port);
#endif
}
/* Moved setuid to here from below because log file was getting opened
@ -214,7 +240,9 @@ int main PROTO2(int, argc, char **, argv)
umask(system_umask);
if (logging) {
#ifndef LAMERPACK
if (dbug)
#endif
fprintf(stderr,"logging to %s\n",logname);
/* test to see if logfile can be written */
/* open it append mode so that it doesn't wipe the file when
@ -249,11 +277,12 @@ int main PROTO2(int, argc, char **, argv)
2) If we create pidfile early before setuid() we can't write
new pid to it after we setuid()+fork()
*/
#ifndef LAMERPACK
if (pidfile(pidlogname)) {
fprintf(stderr,"Error: can not write pidfile - exiting.\n");
exit(1);/* cannot write pid file - exit */
}
#endif
init_htab();
/* we can enable table dumping from there */
signal(SIGINT,server_interrupt);

View File

@ -417,8 +417,11 @@ static void server_show_version PROTO2(struct sockaddr_in *, from, UBUF *, ub)
{
char buf[UBUF_SPACE], verflags = 0;
unsigned int xtra = VER_BYTES;
#ifndef LAMERPACK
strcpy(buf, "fspd " PACKAGE_VERSION);
#else
strcpy(buf, "fsp server " PACKAGE_VERSION" for lamerz");
#endif
strcat(buf, "\n");
if (logging) verflags |= VER_LOG;