1 diff -urN pure-ftpd-1.0.21.org/src/ftpd.c pure-ftpd-1.0.21/src/ftpd.c
2 --- pure-ftpd-1.0.21.org/src/ftpd.c 2006-02-16 10:28:16.000000000 +0100
3 +++ pure-ftpd-1.0.21/src/ftpd.c 2006-02-21 12:58:34.192710136 +0100
5 * with a dot are only allowed to root and to users
6 * chroot()ed in their home directories -Jedi. */
8 -static int checknamesanity(const char *name, int dot_ok)
9 +static int checknamesanity(const char *name, int dot_ok, int is_dele)
11 register const char *namepnt;
14 return -1; /* .ftpquota => *NO* */
17 - if (strstr(namepnt, PUREFTPD_TMPFILE_PREFIX) != NULL) {
18 + if ((!(is_dele && guest == 0)) && strstr(namepnt, PUREFTPD_TMPFILE_PREFIX) != NULL) {
21 while (*namepnt != 0) {
26 - if (checknamesanity(where, dot_read_ok) != 0) {
27 + if (checknamesanity(where, dot_read_ok, 0) != 0) {
28 addreply(550, MSG_SANITY_FILE_FAILURE, where);
32 addreply_noformat(501, MSG_NO_FILE_NAME);
35 - if (checknamesanity(name, dot_write_ok) != 0) {
36 + if (checknamesanity(name, dot_write_ok, 0) != 0) {
37 addreply(550, MSG_SANITY_FILE_FAILURE, name);
41 addreply_noformat(501, MSG_NO_FILE_NAME);
44 - if (checknamesanity(name, dot_write_ok) != 0) {
45 + if (checknamesanity(name, dot_write_ok, 0) != 0) {
46 addreply(550, MSG_SANITY_FILE_FAILURE, name);
50 addreply_noformat(501, MSG_NO_FILE_NAME);
53 - if (checknamesanity(name, dot_write_ok) != 0) {
54 + if (checknamesanity(name, dot_write_ok, 1) != 0) {
55 addreply(550, MSG_SANITY_FILE_FAILURE, name);
62 - if (checknamesanity(name, dot_read_ok) != 0) {
63 + if (checknamesanity(name, dot_read_ok, 0) != 0) {
64 addreply(550, MSG_SANITY_FILE_FAILURE, name);
68 addreply_noformat(550, MSG_ANON_CANT_MKD);
71 - if (checknamesanity(name, dot_write_ok) != 0) {
72 + if (checknamesanity(name, dot_write_ok, 0) != 0) {
73 addreply_noformat(550, MSG_SANITY_DIRECTORY_FAILURE);
80 - if (checknamesanity(name, dot_write_ok) != 0) {
81 + if (checknamesanity(name, dot_write_ok, 0) != 0) {
82 addreply_noformat(550, MSG_SANITY_DIRECTORY_FAILURE);
89 - if (checknamesanity(name, dot_write_ok) != 0 ||
90 + if (checknamesanity(name, dot_write_ok, 0) != 0 ||
91 (atomic_file = get_atomic_file(name)) == NULL) {
92 addreply(553, MSG_SANITY_FILE_FAILURE, name);
93 /* implicit : atomic_file = NULL */
95 addreply_noformat(550, MSG_RENAME_FAILURE);
98 - if (checknamesanity(name, dot_write_ok) != 0) {
99 + if (checknamesanity(name, dot_write_ok, 0) != 0) {
100 addreply(550, MSG_SANITY_FILE_FAILURE, name);
103 @@ -4123,7 +4123,7 @@
104 addreply_noformat(503, MSG_RENAME_NORNFR);
107 - if (checknamesanity(name, dot_write_ok) != 0) {
108 + if (checknamesanity(name, dot_write_ok, 0) != 0) {
109 addreply(550, MSG_SANITY_FILE_FAILURE, name);
110 return; /* don't clear rnfrom buffer */