From 8130150b037a0c68386a55c47ffb4573b8d3617e Mon Sep 17 00:00:00 2001 From: hsn <> Date: Sat, 8 Nov 2003 16:35:51 +0000 Subject: [PATCH] beta 16 --- ChangeLog | 8 ++++++-- TODO | 2 +- bsd_src/ls.c | 9 ++++++--- client/util.c | 48 ++++++++++++++++++++++++++--------------------- clients/fgetcmd.c | 9 ++++++--- configure.ac | 2 +- 6 files changed, 47 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index b77ab59..e09d4b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,15 @@ -W.I.P +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 flscmd: do not list file size > 2GB as negative, same for block count fspscan: install it when doing make install fspd: -l logfile switch - removed crash when logfile is in use + fixed crash when logfile is in use. (from betat15) 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 + do not delete partial file on FSP timeout in fgetcmd Version 2.8.1b15 -- 15 Oct 2003 Sven writes manpage for fspscan.1 diff --git a/TODO b/TODO index d5c5446..7c69c8f 100644 --- a/TODO +++ b/TODO @@ -33,6 +33,7 @@ random number generator in server is low random quality on low bits. Client LIBRARY 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. :low: fver and others add support new syntax fsp://host:port/file add sem locking method @@ -45,7 +46,6 @@ do not use global variables CLIENTS ALL: normalize return error codes of all clients write new clients for new commands - fsprencmd fpasswd finfo -fgetcmd deletes partially transfered file on errors? :low: add support for more sane fsplist file format (as used by warez ppl) to fhostcmd diff --git a/bsd_src/ls.c b/bsd_src/ls.c index 99a9b97..bc0430f 100644 --- a/bsd_src/ls.c +++ b/bsd_src/ls.c @@ -187,10 +187,13 @@ static void displaydir PROTO2(LS *, stats, register int, num) printfcn(stats, num); - if (f_recursive) { + if (f_recursive) + { savedpath = endofpath; - for (lp = stats; num--; ++lp) { - if (!(S_ISDIR(lp->lstat.st_mode))) continue; + for (lp = stats; num--; ++lp) + { + if (!(S_ISDIR(lp->lstat.st_mode))) + continue; p = lp->name; if (p[0] == '.' && (!p[1] || (p[1] == '.' && !p[2]))) continue; if (endofpath != path && endofpath[-1] != '/') *endofpath++ = '/'; diff --git a/client/util.c b/client/util.c index 4c759e4..3c283f5 100644 --- a/client/util.c +++ b/client/util.c @@ -530,10 +530,11 @@ int util_stat PROTO2(char *, path, struct stat *, sbuf) RDIRENT **dep; DDLIST *ddp; UBUF *ub; - char *fpath, *ppath, *p1, *pfile; + char *fpath,*fpath2, *ppath, *p1, *pfile; int cached=0; fpath = util_abs_path(path); + fpath2 = strdup(fpath); if(!strcmp(fpath,env_dir)) { ppath = fpath; @@ -542,6 +543,7 @@ int util_stat PROTO2(char *, path, struct stat *, sbuf) util_split_path(fpath,&ppath,&p1,&pfile); *p1='\0'; } + /* printf("ppath `%s` pfile '%s'\n",ppath,pfile); */ /* check if we have ppath cached */ /* printf("Finding `%s` in cache.\n",ppath); */ @@ -555,23 +557,14 @@ int util_stat PROTO2(char *, path, struct stat *, sbuf) } } - free(fpath); - - fpath = util_abs_path(path); - if(!strcmp(fpath,env_dir)) { - ppath = fpath; - pfile = "."; - } else { - util_split_path(fpath,&ppath,&p1,&pfile); - } - /* if(cached) printf("Record found in cache.\n",ppath); */ if(statworks && !cached) { /* send a new FSP_STAT command to server */ - ub = client_interact(CC_STAT,0L, strlen(fpath), - (unsigned char *) fpath+1, 0, 0); - if(ub->cmd == CC_STAT) { + ub = client_interact(CC_STAT,0L, strlen(fpath2), + (unsigned char *) fpath2+1, 0, 0); + if(ub->cmd == CC_STAT) + { sbuf->st_uid = 0; sbuf->st_gid = 0; sbuf->st_atime = sbuf->st_mtime = @@ -587,6 +580,9 @@ int util_stat PROTO2(char *, path, struct stat *, sbuf) sbuf->st_mode = 0666 | S_IFREG; sbuf->st_nlink = 1; } + + free(fpath); + free(fpath2); if(ub->buf[8]==0) { @@ -601,14 +597,22 @@ int util_stat PROTO2(char *, path, struct stat *, sbuf) } } /* CC_STAT */ - if( (drp = util_opendir(ppath)) ) { - for(dep = drp->dep; *dep; dep++) { - if(!strcmp((*dep)->name,pfile)) { - if((*dep)->type & RDTYPE_DIR) sbuf->st_mode = 0777 | S_IFDIR; - else sbuf->st_mode = 0666 | S_IFREG; + if( (drp = util_opendir(ppath)) ) + { + for(dep = drp->dep; *dep; dep++) + { + if(!strcmp((*dep)->name,pfile)) + { + if((*dep)->type == RDTYPE_DIR) + sbuf->st_mode = 0777 | S_IFDIR; + else + sbuf->st_mode = 0666 | S_IFREG; - if((*dep)->type & RDTYPE_DIR) sbuf->st_nlink = 2; - else sbuf->st_nlink = 1; + if((*dep)->type == RDTYPE_DIR) + sbuf->st_nlink = 2; + else + sbuf->st_nlink = 1; + sbuf->st_uid = 0; sbuf->st_gid = 0; sbuf->st_size = BB_READ4((*dep)->bb_size); @@ -616,6 +620,7 @@ int util_stat PROTO2(char *, path, struct stat *, sbuf) sbuf->st_ctime = BB_READ4((*dep)->bb_time); util_closedir(drp); free(fpath); + free(fpath2); return(0); } } @@ -623,6 +628,7 @@ int util_stat PROTO2(char *, path, struct stat *, sbuf) } free(fpath); + free(fpath2); errno = ENOENT; return(-1); } diff --git a/clients/fgetcmd.c b/clients/fgetcmd.c index 8fa038e..e4bca2a 100644 --- a/clients/fgetcmd.c +++ b/clients/fgetcmd.c @@ -112,16 +112,19 @@ PROTO4(char *, path, struct stat *, sbufp, int, mode, int, level) fprintf(stderr,"Cannot create %s\n",name); } - if(fp) { + if(fp) + { if( #ifdef COMMAND_GET util_download #else util_grab_file #endif - (path,fp, start_from) == -1) { + (path,fp, start_from) == -1) + { fclose(fp); - unlink(name); + if(clobbertype==C_TEMPNAME) + unlink(name); } else fclose(fp); } else fprintf(stderr,"Cannot write %s\n",name); diff --git a/configure.ac b/configure.ac index d3595f2..9881be5 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.1b15,hsn@cybermail.net) +AC_INIT(fsp,2.8.1b16,hsn@cybermail.net) AC_CONFIG_SRCDIR(server/main.c) AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE