git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1165 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/12/08 04:26:37... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Tue Dec 7 19:25:06 GMT 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamav-milter: Ensure that the daily quarantine directory is created |
|
4 |
+ |
|
1 | 5 |
Tue Dec 7 02:48:08 CET 2004 (tk) |
2 | 6 |
--------------------------------- |
3 | 7 |
* clamd: added support for file descriptor passing (patch by Richard Lyons |
... | ... |
@@ -583,6 +583,7 @@ Changes |
583 | 583 |
name if --quiet is given |
584 | 584 |
Fix compilation error if is SESSION not defined. |
585 | 585 |
Quarantine files could lose the date from the path |
586 |
+0.80aa 7/12/04: Daily quarantine directories were not always being created |
|
586 | 587 |
|
587 | 588 |
INTERNATIONALISATION |
588 | 589 |
|
... | ... |
@@ -26,6 +26,9 @@ |
26 | 26 |
* |
27 | 27 |
* Change History: |
28 | 28 |
* $Log: clamav-milter.c,v $ |
29 |
+ * Revision 1.161 2004/12/07 19:23:48 nigelhorne |
|
30 |
+ * Ensure that the qurantine daily directory is created |
|
31 |
+ * |
|
29 | 32 |
* Revision 1.160 2004/12/06 22:31:13 nigelhorne |
30 | 33 |
* Keep date in quarantine directory path |
31 | 34 |
* |
... | ... |
@@ -491,9 +494,9 @@ |
491 | 491 |
* Revision 1.6 2003/09/28 16:37:23 nigelhorne |
492 | 492 |
* Added -f flag use MaxThreads if --max-children not set |
493 | 493 |
*/ |
494 |
-static char const rcsid[] = "$Id: clamav-milter.c,v 1.160 2004/12/06 22:31:13 nigelhorne Exp $"; |
|
494 |
+static char const rcsid[] = "$Id: clamav-milter.c,v 1.161 2004/12/07 19:23:48 nigelhorne Exp $"; |
|
495 | 495 |
|
496 |
-#define CM_VERSION "0.80z" |
|
496 |
+#define CM_VERSION "0.80aa" |
|
497 | 497 |
|
498 | 498 |
/*#define CONFDIR "/usr/local/etc"*/ |
499 | 499 |
|
... | ... |
@@ -4162,6 +4165,13 @@ qfile(struct privdata *privdata, const char *sendmailId, const char *virusname) |
4162 | 4162 |
YY = tm->tm_year - 100; |
4163 | 4163 |
DD = tm->tm_mday; |
4164 | 4164 |
|
4165 |
+ sprintf(newname, "%s/%02d%02d%02d", quarantine_dir, YY, MM, DD); |
|
4166 |
+ if((mkdir(newname, 0700) < 0) && (errno != EEXIST)) { |
|
4167 |
+ perror(newname); |
|
4168 |
+ if(use_syslog) |
|
4169 |
+ syslog(LOG_ERR, _("mkdir %s failed"), newname); |
|
4170 |
+ return -1; |
|
4171 |
+ } |
|
4165 | 4172 |
sprintf(newname, "%s/%02d%02d%02d/%s.%s", |
4166 | 4173 |
quarantine_dir, YY, MM, DD, sendmailId, virusname); |
4167 | 4174 |
|
... | ... |
@@ -4187,6 +4197,16 @@ qfile(struct privdata *privdata, const char *sendmailId, const char *virusname) |
4187 | 4187 |
* FIXME: handle cross file linking failure meaning that we'd have |
4188 | 4188 |
* to copy |
4189 | 4189 |
*/ |
4190 |
+#ifdef C_LINUX |
|
4191 |
+ if(rename(privdata->filename, newname) < 0) { |
|
4192 |
+ perror(newname); |
|
4193 |
+ if(use_syslog) |
|
4194 |
+ syslog(LOG_WARNING, _("Can't rename %1$s to %2$s"), |
|
4195 |
+ privdata->filename, newname); |
|
4196 |
+ free(newname); |
|
4197 |
+ return -1; |
|
4198 |
+ } |
|
4199 |
+#else |
|
4190 | 4200 |
if(link(privdata->filename, newname) < 0) { |
4191 | 4201 |
perror(newname); |
4192 | 4202 |
if(use_syslog) |
... | ... |
@@ -4196,6 +4216,7 @@ qfile(struct privdata *privdata, const char *sendmailId, const char *virusname) |
4196 | 4196 |
return -1; |
4197 | 4197 |
} |
4198 | 4198 |
unlink(privdata->filename); |
4199 |
+#endif |
|
4199 | 4200 |
free(privdata->filename); |
4200 | 4201 |
privdata->filename = newname; |
4201 | 4202 |
|