git-svn: trunk@2835
Nigel Horne authored on 2007/02/22 19:57:20... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Thu Feb 22 09:00:31 GMT 2007 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamav-milter/clamav-milter.c: Better recovery when a remote clamd |
|
4 |
+ goes down |
|
5 |
+ |
|
1 | 6 |
Wed Feb 21 20:40:49 GMT 2007 (njh) |
2 | 7 |
---------------------------------- |
3 | 8 |
* libclamav/message.c: Better warning message, bug 311 |
... | ... |
@@ -33,7 +33,7 @@ |
33 | 33 |
*/ |
34 | 34 |
static char const rcsid[] = "$Id: clamav-milter.c,v 1.312 2007/02/12 22:24:21 njh Exp $"; |
35 | 35 |
|
36 |
-#define CM_VERSION "devel-210207" |
|
36 |
+#define CM_VERSION "devel-220207" |
|
37 | 37 |
|
38 | 38 |
#if HAVE_CONFIG_H |
39 | 39 |
#include "clamav-config.h" |
... | ... |
@@ -1555,7 +1555,7 @@ main(int argc, char **argv) |
1555 | 1555 |
clamav_versions = (char **)cli_malloc(sizeof(char *)); |
1556 | 1556 |
if(clamav_versions == NULL) |
1557 | 1557 |
return EX_TEMPFAIL; |
1558 |
- clamav_version = strdup(version); |
|
1558 |
+ clamav_version = cli_strdup(version); |
|
1559 | 1559 |
} |
1560 | 1560 |
} else { |
1561 | 1561 |
unsigned int session; |
... | ... |
@@ -1573,7 +1573,7 @@ main(int argc, char **argv) |
1573 | 1573 |
return EX_TEMPFAIL; |
1574 | 1574 |
|
1575 | 1575 |
for(session = 0; session < max_children; session++) { |
1576 |
- clamav_versions[session] = strdup(version); |
|
1576 |
+ clamav_versions[session] = cli_strdup(version); |
|
1577 | 1577 |
if(clamav_versions[session] == NULL) |
1578 | 1578 |
return EX_TEMPFAIL; |
1579 | 1579 |
} |
... | ... |
@@ -1804,7 +1804,7 @@ main(int argc, char **argv) |
1804 | 1804 |
|
1805 | 1805 |
return EX_CONFIG; |
1806 | 1806 |
} |
1807 |
- p = strdup(pidfile); |
|
1807 |
+ p = cli_strdup(pidfile); |
|
1808 | 1808 |
q = strrchr(p, '/'); |
1809 | 1809 |
*q = '\0'; |
1810 | 1810 |
|
... | ... |
@@ -1874,8 +1874,8 @@ main(int argc, char **argv) |
1874 | 1874 |
#ifdef SESSION |
1875 | 1875 |
pthread_mutex_lock(&version_mutex); |
1876 | 1876 |
#endif |
1877 |
- logg(_("Starting %s"), clamav_version); |
|
1878 |
- logg(_("*Debugging is on")); |
|
1877 |
+ logg(_("Starting %s\n"), clamav_version); |
|
1878 |
+ logg(_("*Debugging is on\n")); |
|
1879 | 1879 |
|
1880 | 1880 |
if(blacklist_time) { |
1881 | 1881 |
mx(); |
... | ... |
@@ -2687,7 +2687,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
2687 | 2687 |
*/ |
2688 | 2688 |
privdata->rejectCode = "550"; |
2689 | 2689 |
|
2690 |
- privdata->from = strdup(mailaddr); |
|
2690 |
+ privdata->from = cli_strdup(mailaddr); |
|
2691 | 2691 |
|
2692 | 2692 |
if(hflag) |
2693 | 2693 |
privdata->headers = header_list_new(); |
... | ... |
@@ -2727,7 +2727,7 @@ clamfi_envrcpt(SMFICTX *ctx, char **argv) |
2727 | 2727 |
if(to == NULL) |
2728 | 2728 |
to = argv[0]; |
2729 | 2729 |
|
2730 |
- privdata->to[privdata->numTo] = strdup(to); |
|
2730 |
+ privdata->to[privdata->numTo] = cli_strdup(to); |
|
2731 | 2731 |
privdata->to[++privdata->numTo] = NULL; |
2732 | 2732 |
|
2733 | 2733 |
return SMFIS_CONTINUE; |
... | ... |
@@ -2759,7 +2759,7 @@ clamfi_header(SMFICTX *ctx, char *headerf, char *headerv) |
2759 | 2759 |
(strstr(headerv, "localhost") != 0)) { |
2760 | 2760 |
if(privdata->received) |
2761 | 2761 |
free(privdata->received); |
2762 |
- privdata->received = strdup(headerv); |
|
2762 |
+ privdata->received = cli_strdup(headerv); |
|
2763 | 2763 |
} |
2764 | 2764 |
|
2765 | 2765 |
if((strcasecmp(headerf, "Message-ID") == 0) && |
... | ... |
@@ -2769,14 +2769,14 @@ clamfi_header(SMFICTX *ctx, char *headerf, char *headerv) |
2769 | 2769 |
if(privdata->subject) |
2770 | 2770 |
free(privdata->subject); |
2771 | 2771 |
if(headerv) |
2772 |
- privdata->subject = strdup(headerv); |
|
2772 |
+ privdata->subject = cli_strdup(headerv); |
|
2773 | 2773 |
} else if(strcasecmp(headerf, "X-Virus-Status") == 0) |
2774 | 2774 |
privdata->statusCount++; |
2775 | 2775 |
else if(strcasecmp(headerf, "Sender") == 0) { |
2776 | 2776 |
if(privdata->sender) |
2777 | 2777 |
free(privdata->sender); |
2778 | 2778 |
if(headerv) |
2779 |
- privdata->sender = strdup(headerv); |
|
2779 |
+ privdata->sender = cli_strdup(headerv); |
|
2780 | 2780 |
} |
2781 | 2781 |
|
2782 | 2782 |
if(!useful_header(headerf)) { |
... | ... |
@@ -2958,7 +2958,7 @@ clamfi_body(SMFICTX *ctx, u_char *bodyp, size_t len) |
2958 | 2958 |
|
2959 | 2959 |
if(sendmailId == NULL) |
2960 | 2960 |
sendmailId = "Unknown"; |
2961 |
- logg(_("%s: Message more than StreamMaxLength (%ld) bytes - not scanned"), |
|
2961 |
+ logg(_("%s: Message more than StreamMaxLength (%ld) bytes - not scanned\n"), |
|
2962 | 2962 |
sendmailId, streamMaxLength); |
2963 | 2963 |
if(!nflag) |
2964 | 2964 |
smfi_addheader(ctx, "X-Virus-Status", _("Not Scanned - StreamMaxLength exceeded")); |
... | ... |
@@ -2966,7 +2966,7 @@ clamfi_body(SMFICTX *ctx, u_char *bodyp, size_t len) |
2966 | 2966 |
return SMFIS_ACCEPT; /* clamfi_close will be called */ |
2967 | 2967 |
} |
2968 | 2968 |
} |
2969 |
- if((size_t)nbytes < len) { |
|
2969 |
+ if(nbytes < (int)len) { |
|
2970 | 2970 |
clamfi_cleanup(ctx); /* not needed, but just to be safe */ |
2971 | 2971 |
return cl_error; |
2972 | 2972 |
} |
... | ... |
@@ -3861,11 +3861,11 @@ clamfi_send(struct privdata *privdata, size_t len, const char *format, ...) |
3861 | 3861 |
|
3862 | 3862 |
perror(privdata->filename); |
3863 | 3863 |
strerror_r(errno, buf, sizeof(buf)); |
3864 |
- logg(_("!write failure (%u bytes) to %s: %s"), |
|
3864 |
+ logg(_("!write failure (%u bytes) to %s: %s\n"), |
|
3865 | 3865 |
len, privdata->filename, buf); |
3866 | 3866 |
#else |
3867 | 3867 |
perror(privdata->filename); |
3868 |
- logg(_("!write failure (%u bytes) to %s: %s"), |
|
3868 |
+ logg(_("!write failure (%u bytes) to %s: %s\n"), |
|
3869 | 3869 |
len, privdata->filename, |
3870 | 3870 |
strerror(errno)); |
3871 | 3871 |
#endif |
... | ... |
@@ -4952,11 +4952,11 @@ watchdog(void *a) |
4952 | 4952 |
*ptr = '\0'; |
4953 | 4953 |
pthread_mutex_lock(&version_mutex); |
4954 | 4954 |
if(clamav_versions[i] == NULL) |
4955 |
- clamav_versions[i] = strdup(buf); |
|
4955 |
+ clamav_versions[i] = cli_strdup(buf); |
|
4956 | 4956 |
else if(strcmp(buf, clamav_versions[i]) != 0) { |
4957 | 4957 |
logg("New version received for server %d: '%s'\n", i, buf); |
4958 | 4958 |
free(clamav_versions[i]); |
4959 |
- clamav_versions[i] = strdup(buf); |
|
4959 |
+ clamav_versions[i] = cli_strdup(buf); |
|
4960 | 4960 |
} |
4961 | 4961 |
pthread_mutex_unlock(&version_mutex); |
4962 | 4962 |
} else { |
... | ... |
@@ -5605,7 +5605,7 @@ isBlacklisted(const char *ip_address) |
5605 | 5605 |
static void |
5606 | 5606 |
mx(void) |
5607 | 5607 |
{ |
5608 |
- const u_char *p, *end; |
|
5608 |
+ u_char *p, *end; |
|
5609 | 5609 |
char name[MAXHOSTNAMELEN + 1]; |
5610 | 5610 |
char buf[BUFSIZ]; |
5611 | 5611 |
union { |
... | ... |
@@ -5700,7 +5700,7 @@ mx(void) |
5700 | 5700 |
static void |
5701 | 5701 |
resolve(const char *host) |
5702 | 5702 |
{ |
5703 |
- const u_char *p, *end; |
|
5703 |
+ u_char *p, *end; |
|
5704 | 5704 |
char buf[BUFSIZ]; |
5705 | 5705 |
union { |
5706 | 5706 |
HEADER h; |
... | ... |
@@ -5816,9 +5816,9 @@ black_hole(const struct privdata *privdata) |
5816 | 5816 |
/* All recipients map to /dev/null */ |
5817 | 5817 |
to = privdata->to; |
5818 | 5818 |
if(*to) |
5819 |
- logg("discarded, since all recipients (e.g. \"%s\") are /dev/null", *to); |
|
5819 |
+ logg("Discarded, since all recipients (e.g. \"%s\") are /dev/null\n", *to); |
|
5820 | 5820 |
else |
5821 |
- logg("discarded, since all recipients are /dev/null"); |
|
5821 |
+ logg("Discarded, since all recipients are /dev/null\n"); |
|
5822 | 5822 |
return SMFIS_DISCARD; |
5823 | 5823 |
} |
5824 | 5824 |
return SMFIS_CONTINUE; |