From 5495b36ac7d0a5898692170980c3fed17815587d Mon Sep 17 00:00:00 2001 From: hsn <> Date: Mon, 29 Nov 2004 17:17:01 +0000 Subject: [PATCH] added null install feature --- ChangeLog | 2 ++ configure.ac | 2 +- doc/PROTOCOL | 9 +++++++-- server/file.c | 12 ++++++++++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb7ecf7..1083237 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ added BUGS and HISTORY sections to fspscan.1 manual page Lamerpack: disable most of command line options in fspd and print simpler help message. + server_install: zero length filename cancels upload in progress + this change is needed for upcoming fsplib. version 2.8.1b21 - 1 Nov 2004 check for errors while copying files in fspd. diff --git a/configure.ac b/configure.ac index 3a8ceb6..d775105 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,7 @@ case $host_os in * ) AC_MSG_RESULT(no);; esac 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_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_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_PROG_RANLIB diff --git a/doc/PROTOCOL b/doc/PROTOCOL index 6456679..b417143 100644 --- a/doc/PROTOCOL +++ b/doc/PROTOCOL @@ -1,8 +1,8 @@ FILE SERVICE PROTOCOL VERSION 2 FSP v2 - Document version 0.13 - Last updated 1 Nov 2004 + Document version 0.14 + Last updated 29 Nov 2004 Also known as File Slurping Protocol, @@ -326,6 +326,11 @@ RDIRENT.HEADER types: data: not used xtra data: not used + To cancel upload in progress without installing any + file send CC_INSTALL command with zero length (only 00 + terminator) filename. This removes temporary data + created by upload. + CC_DEL_FILE 0x45 - delete a file request diff --git a/server/file.c b/server/file.c index f42b102..29f247f 100644 --- a/server/file.c +++ b/server/file.c @@ -891,14 +891,22 @@ const char *server_install (PPATH * pp, unsigned long inet_num, if (dbug) fprintf(stderr,"server_install: tname: %s, pp->fullp: %s\n",tname, pp->fullp); - + /* zero length filename */ + if( pp->f_len + pp->d_len == 0 ) + { + if (dbug) + fprintf(stderr,"server_install: zero length name. aborting upload.\n"); + unlink(tname); + return (NULLP); + } + if(fexist(pp->fullp) && ( (di->protection & DIR_DEL) || acc[0]=='O' ) ) { unlink(tname); if(dbug) - fprintf(stderr,"File %s already exists, but there is no user is not directory owner and public can't delete files.\n",pp->fullp); + fprintf(stderr,"File %s already exists, but user is not directory owner and public can't delete files.\n",pp->fullp); return("no permission for replacing that file. Not an owner."); }