diff -ruN configuration-file/pure-config.pl.in.orig configuration-file/pure-config.pl.in --- configuration-file/pure-config.pl.in.orig 2009-04-30 00:51:06.000000000 -0500 +++ configuration-file/pure-config.pl.in 2009-06-02 10:54:38.000000000 -0500 @@ -43,6 +43,7 @@ KeepAllFiles => "-K", CreateHomeDir => "-j", NoRename => "-G", + NoAtomicFile => "-7", CustomerProof => "-Z", NoTruncate => "-0", ); diff -ruN src/ftpd.c.orig src/ftpd.c --- src/ftpd.c.orig 2009-04-30 00:51:04.000000000 -0500 +++ src/ftpd.c 2009-06-02 08:24:18.000000000 -0500 @@ -3731,9 +3731,11 @@ void delete_atomic_file(void) { const char *atomic_file; - + if ( no_atomic_file == 1 ) { + return; + } if ((atomic_file = get_atomic_file(NULL)) == NULL || - *atomic_file == 0) { + *atomic_file == 0) { return; } (void) unlink(atomic_file); @@ -3757,7 +3759,9 @@ /* ftruncate+unlink is overkill, but it reduces possible races */ (void) ftruncate(f, (off_t) 0); (void) close(f); - unlink(atomic_file); + if (no_atomic_file != 1) { + unlink(atomic_file); + } ret = -1; } else { (void) close(f); @@ -3859,16 +3863,27 @@ goto end; } if (restartat > (off_t) 0 || (autorename == 0 && no_truncate == 0)) { - if (rename(name, atomic_file) != 0 && errno != ENOENT) { - error(553, MSG_RENAME_FAILURE); - atomic_file = NULL; - goto end; - } - } - if ((f = open(atomic_file, O_CREAT | O_WRONLY, + if (no_atomic_file != 1) { + if (rename(name, atomic_file) != 0 && errno != ENOENT) { + error(553, MSG_RENAME_FAILURE); + atomic_file = NULL; + goto end; + } + } + } + if (no_atomic_file == 1) { + atomic_file = NULL; + if ((f = open(name, O_CREAT | O_WRONLY, (mode_t) 0777 & ~u_mask)) == -1) { - error(553, MSG_OPEN_FAILURE2); - goto end; + error(553, MSG_OPEN_FAILURE2); + goto end; + } + } else { + if ((f = open(atomic_file, O_CREAT | O_WRONLY, + (mode_t) 0777 & ~u_mask)) == -1) { + error(553, MSG_OPEN_FAILURE2); + goto end; + } } if (fstat(f, &st) < 0) { (void) close(f); @@ -4079,7 +4094,7 @@ #endif closedata(); error(450, MSG_WRITE_FAILED); - if (guest != 0) { + if (guest != 0 && no_atomic_file != 1) { unlinkret = unlink(atomic_file); atomic_file = NULL; } @@ -4128,19 +4143,21 @@ if (quota_exceeded == 0) #endif { - if (autorename != 0 && restartat == (off_t) 0) { - if (tryautorename(atomic_file, name) != 0) { - error(553, MSG_RENAME_FAILURE); - } else { - atomic_file = NULL; - } - } else { - if (rename(atomic_file, name) != 0) { - error(553, MSG_RENAME_FAILURE); - } else { - atomic_file = NULL; - } - } + if (no_atomic_file != 1) { + if (autorename != 0 && restartat == (off_t) 0) { + if (tryautorename(atomic_file, name) != 0) { + error(553, MSG_RENAME_FAILURE); + } else { + atomic_file = NULL; + } + } else { + if (rename(atomic_file, name) != 0) { + error(553, MSG_RENAME_FAILURE); + } else { + atomic_file = NULL; + } + } + } displayrate(MSG_UPLOADED, filesize - restartat, started, name, 1); } @@ -4150,7 +4167,7 @@ #endif ALLOCA_FREE(buf); restartat = (off_t) 0; - if (atomic_file != NULL) { + if (atomic_file != NULL && no_atomic_file != 1) { if (rename(atomic_file, name) != 0) { error(553, MSG_RENAME_FAILURE); unlink(atomic_file); @@ -5268,6 +5285,10 @@ no_ipv4 = 1; break; } + case '7': { + no_atomic_file = 1; + break; + } #ifdef WITH_RFC2640 case '8': { if ((charset_fs = strdup(optarg)) == NULL) { diff -ruN src/ftpd_p.h.orig src/ftpd_p.h --- src/ftpd_p.h.orig 2009-04-30 00:51:04.000000000 -0500 +++ src/ftpd_p.h 2009-06-02 09:07:18.000000000 -0500 @@ -60,7 +60,7 @@ }; static const char *GETOPT_OPTIONS = - "0146" + "01467" #ifdef WITH_RFC2640 "8:9:" #endif diff -ruN src/globals.h.orig src/globals.h --- src/globals.h.orig 2009-04-30 00:51:04.000000000 -0500 +++ src/globals.h 2009-06-02 08:44:35.000000000 -0500 @@ -15,6 +15,8 @@ GLOBAL0(signed char anon_only); /* allows only anonymous connections */ GLOBAL0(struct sockaddr_storage *trustedip); /* IP address accepting non-anonymous connections */ GLOBAL0(volatile signed char logging); +GLOBAL0(signed char no_atomic_file); /* Disable upload to atomic file maps to -7 option */ + #ifdef THROTTLING GLOBAL0(unsigned long throttling_delay); GLOBAL0(unsigned long throttling_bandwidth_ul); @@ -118,6 +120,8 @@ GLOBAL0(char *scoreboardfile); #endif +GLOBAL0(signed char no_atomic_file); + #if defined(WITH_UPLOAD_SCRIPT) GLOBAL0(signed char do_upload_script); GLOBAL(int upload_pipe_fd, -1);