From 488c23e93210350bc5cc163884864f1b02db7cd9 Mon Sep 17 00:00:00 2001 From: hsn <> Date: Mon, 17 Nov 2003 18:24:50 +0000 Subject: [PATCH] beta 17 --- BETA.README | 2 +- ChangeLog | 7 +++++++ MACHINES | 4 ++++ TODO | 3 +-- configure.ac | 2 +- fspd.conf | 4 ++++ include/s_extern.h | 4 +++- server/conf.c | 5 +++++ server/log.c | 22 ++++++++++++++++++++++ server/main.c | 15 +++++++++++++++ server/server.c | 1 + 11 files changed, 64 insertions(+), 5 deletions(-) diff --git a/BETA.README b/BETA.README index 0b8d08c..0792647 100644 --- a/BETA.README +++ b/BETA.README @@ -6,11 +6,11 @@ FSP Development Battle plan: ============================ * for next 2.8 Stable version (will be called 2.8.2) - add FSP Rename command -- add FSP change password command - add FSP info command - go out this version as soon as possible. 2.8.1b3 and lower are buggy. * 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 diff --git a/ChangeLog b/ChangeLog index e4b1f79..6c7d9de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ +Version 2.8.1b17 -- 17 Nov 2003 Allow filenames with spaces inside check for fork() and setsid() in configure.ac + wu-ftpd compatible `xferlog` -- usernames are not supported, all + transfers are logged as anonymous + flex output is included in the distribution archive, you do not + need flex to build fsp + MACHINES file updated + Version 2.8.1b16 -- 8 Nov 2003 This version fixes 2 major bugs in beta 15 release. fspd: update mtime for directory listing after .FSP_CONTENT write diff --git a/MACHINES b/MACHINES index 81a0a58..cd4cb7a 100644 --- a/MACHINES +++ b/MACHINES @@ -10,3 +10,7 @@ FSP Version CPU OS Compiler C library -------------------------------------------------------------------------- 2.8.1 Beta 5 i386 Linux 2.4 GCC-3.2 GLIBC 2.3.1 2.8.1 Beta 10 i386 Linux 2.4 GCC-2.95 GLIBC 2.3.1 +2.8.1 Beta 14 i386 Debian/woody +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 diff --git a/TODO b/TODO index ef96dc9..5ef91ea 100644 --- a/TODO +++ b/TODO @@ -59,12 +59,11 @@ 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 -write FSP_CHANGE_PASSWORD command -new transfer log wuftpd file format new common log format :midle:may not be in 2.8.2 Native Supports for symbolic links (needed for mirroring Debian) +write FSP_CHANGE_PASSWORD command :low:this will sure go after 2.8.2: FSP_GET/SET OWNERS like file transfer diff --git a/configure.ac b/configure.ac index 1e83d4c..a933afa 100644 --- a/configure.ac +++ b/configure.ac @@ -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.1b16+cvs,hsn@cybermail.net) +AC_INIT(fsp,2.8.1b17,hsn@cybermail.net) AC_CONFIG_SRCDIR(server/main.c) AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE diff --git a/fspd.conf b/fspd.conf index 63877a2..c89577a 100644 --- a/fspd.conf +++ b/fspd.conf @@ -117,6 +117,10 @@ logfile ../logs/logfile # log all !readonly +#The 'xferlog' command tells server where to use wuftpd compatible +#transfer log file. +xferlog ../logs/xferlog + # The 'thruput' command is used to specify the maximum average # number of bytes per second that the server will transmit. Use # 'thruput off' to specify no through put control. A negative value or diff --git a/include/s_extern.h b/include/s_extern.h index e01b0db..f54d85d 100644 --- a/include/s_extern.h +++ b/include/s_extern.h @@ -12,7 +12,7 @@ extern gid_t run_gid; extern unsigned int maxthcallowed; extern unsigned short udp_port,packetsize; extern time_t retry_timeout,session_timeout,stat_cache_timeout; -extern char *logname,*readme_file,*dumpname; +extern char *logname,*tlogname,*readme_file,*dumpname; extern char *home_dir; extern unsigned int dir_cache_limit, stat_cache_limit,fp_cache_limit; extern char *tmp_dir; @@ -78,6 +78,7 @@ const char * require_access_rights PROTO4(const DIRINFO *,di,unsigned char,right /* log.c */ extern int logfd; +extern int tlogfd; void fsplogf PROTO0((void)); void fsplogs PROTO0((void)); #ifdef __STDC__ @@ -85,5 +86,6 @@ void fsploga(const char *fmt, ...); #else void fsploga(va_alist); #endif +void xferlog(char direction, const char *filename,unsigned long filesize,const char *hostname); #endif /* _FSP_S_EXTERN_H_ */ diff --git a/server/conf.c b/server/conf.c index 964185e..1472a82 100644 --- a/server/conf.c +++ b/server/conf.c @@ -51,6 +51,7 @@ time_t retry_timeout = 3; time_t session_timeout = 60; time_t stat_cache_timeout = 25; char *logname = NULL; +char *tlogname = NULL; char *dumpname = NULL; char *home_dir = NULL; char *tmp_dir = NULL; @@ -139,6 +140,9 @@ static void read_configuration PROTO1(const char *, name) } else if(strcasecmp(p, "logfile") == 0) { if(logname) free(logname); logname = strdup(q); + } else if(strcasecmp(p, "xferlog") == 0) { + if(tlogname) free(tlogname); + tlogname = strdup(q); } else if(strcasecmp(p, "dumpfile") == 0) { if(dumpname) free(dumpname); dumpname = strdup(q); @@ -274,6 +278,7 @@ void destroy_configuration PROTO0((void)) if(readme_file) free(readme_file); if(home_dir) free(home_dir); if(logname) free(logname); + if(tlogname) free(tlogname); if(tmp_dir) free(tmp_dir); if(dumpname) free(dumpname); if(iptab) free_ip_table(iptab); diff --git a/server/log.c b/server/log.c index 5c9c5d8..2f103e2 100644 --- a/server/log.c +++ b/server/log.c @@ -15,6 +15,7 @@ #include int logfd = -1; /* logfile file descriptor */ +int tlogfd = -1; /* transfer log file descriptor */ /**************************************************************************** * A slightly better logging function.. It now takes a format string and * @@ -63,3 +64,24 @@ void fsplogf PROTO0((void)) write(logfd, logbuf, logpos); logpos = 0; } + +/* wu ftpd xferlog subsystem */ +static char tlogbuf[LOGBUFFER]; /* buffer for log message */ + +void xferlog(char direction, const char *filename,unsigned long filesize,const char *hostname) +{ + size_t pos=0,timelen; + char *timestr; + + if(!tlogname) return; /* xfer logging is not enabled */ + + /* current-time */ + timestr = (char *)ctime(&cur_time); + timelen = strlen(timestr) - 1; /* strip the CR */ + timestr[timelen] = '\0'; + strcpy(tlogbuf, timestr); + pos = timelen; + /* transfer-time, remote-host, file-size, file-name, ... */ + pos+=sprintf(tlogbuf+pos," 1 %s %lu %s b * %c a fsp fsp 0 * c\n",hostname,filesize,filename,direction); + write(tlogfd, tlogbuf, pos); +} diff --git a/server/main.c b/server/main.c index e428215..d2b6a0a 100644 --- a/server/main.c +++ b/server/main.c @@ -212,6 +212,21 @@ int main PROTO2(int, argc, char **, argv) } } + if(tlogname) + { + if (dbug) + fprintf(stderr,"logging transfers to %s\n",tlogname); + + /* test to see if logfile can be written */ + if((tlogfd=open(tlogname, O_WRONLY | O_APPEND | O_CREAT, 0640)) < 0) + { + if(! inetd_mode ) + fprintf(stderr, "Error opening transferfile: %s, transfer logging disabled.\n",tlogname); + free(tlogname); + tlogname=NULL; /* no logging */ + } + } + init_htab(); /* we can enable table dumping from there */ signal(SIGINT,server_interrupt); diff --git a/server/server.c b/server/server.c index d1a14f5..f28748f 100644 --- a/server/server.c +++ b/server/server.c @@ -582,6 +582,7 @@ static void server_process_packet PROTO5(unsigned, bytes, UBUF *, ub, int, old, if (!pos) { FSP_STAT(pp.fullp,&sd); /* log filesizes */ ACTIONINFO(L_GETFILE,(" (%d)",sd.st_size)); + xferlog('o',pp.fullp,sd.st_size,inetstr); } send_file(from,ub,fp,l2,s2); if (!pos) ACTIONOK(L_GETFILE);