git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@944 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/09/28 23:47:16... | ... |
@@ -1,3 +1,9 @@ |
1 |
+Tue Sep 28 15:46:18 BST 2004 (njh) |
|
2 |
+--------------------------------- |
|
3 |
+ * contrib/clamavmon: No longer multithreaded |
|
4 |
+ * clamav-milter: Added support for operating systems without |
|
5 |
+ SO_BINDTODEVICE |
|
6 |
+ |
|
1 | 7 |
Tue Sep 28 10:57:13 BST 2004 (njh) |
2 | 8 |
---------------------------------- |
3 | 9 |
* contrib/clamavmon: Added monitor of clamd status |
... | ... |
@@ -505,6 +505,10 @@ Changes |
505 | 505 |
honour HAVE_IN_ADDR_T |
506 | 506 |
Added --broadcast option |
507 | 507 |
0.80c 27/9/04 Added iface option to --broadcast |
508 |
+0.80d 28/9/04 Notify clamavmon when a clamd is down, and when clamav-milter |
|
509 |
+ stops/starts |
|
510 |
+ Error gracefully if the iface option is set to --broadcast on |
|
511 |
+ an operating system that doesn't support it |
|
508 | 512 |
|
509 | 513 |
INTERNATIONALISATION |
510 | 514 |
|
... | ... |
@@ -26,6 +26,9 @@ |
26 | 26 |
* |
27 | 27 |
* Change History: |
28 | 28 |
* $Log: clamav-milter.c,v $ |
29 |
+ * Revision 1.135 2004/09/28 14:44:35 nigelhorne |
|
30 |
+ * Handle operating systems that don't support SO_BINDTODEVICE |
|
31 |
+ * |
|
29 | 32 |
* Revision 1.134 2004/09/27 17:08:31 nigelhorne |
30 | 33 |
* Add iface option to --broadcast |
31 | 34 |
* |
... | ... |
@@ -413,9 +416,9 @@ |
413 | 413 |
* Revision 1.6 2003/09/28 16:37:23 nigelhorne |
414 | 414 |
* Added -f flag use MaxThreads if --max-children not set |
415 | 415 |
*/ |
416 |
-static char const rcsid[] = "$Id: clamav-milter.c,v 1.134 2004/09/27 17:08:31 nigelhorne Exp $"; |
|
416 |
+static char const rcsid[] = "$Id: clamav-milter.c,v 1.135 2004/09/28 14:44:35 nigelhorne Exp $"; |
|
417 | 417 |
|
418 |
-#define CM_VERSION "0.80c" |
|
418 |
+#define CM_VERSION "0.80d" |
|
419 | 419 |
|
420 | 420 |
/*#define CONFDIR "/usr/local/etc"*/ |
421 | 421 |
|
... | ... |
@@ -554,7 +557,7 @@ typedef struct header_list_struct *header_list_t; |
554 | 554 |
* TODO: read this table in from a file (clamd.conf?) |
555 | 555 |
*/ |
556 | 556 |
#define PACKADDR(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) |
557 |
-#define MAKEMASK(bits) (0xffffffff << (bits)) |
|
557 |
+#define MAKEMASK(bits) ((uint32_t)(0xffffffff << (bits))) |
|
558 | 558 |
|
559 | 559 |
static const struct cidr_net { |
560 | 560 |
uint32_t base; |
... | ... |
@@ -1123,6 +1126,7 @@ main(int argc, char **argv) |
1123 | 1123 |
* Drop privileges |
1124 | 1124 |
*/ |
1125 | 1125 |
if(getuid() == 0) { |
1126 |
+#ifdef SO_BINDTODEVICE |
|
1126 | 1127 |
if(iface) { |
1127 | 1128 |
struct ifreq ifr; |
1128 | 1129 |
|
... | ... |
@@ -1133,6 +1137,9 @@ main(int argc, char **argv) |
1133 | 1133 |
return EX_UNAVAILABLE; |
1134 | 1134 |
} |
1135 | 1135 |
} |
1136 |
+#else |
|
1137 |
+ fprintf(stderr, _("%s: The iface option to --broadcast is not supported on your operating system\n"), argv[0]); |
|
1138 |
+#endif |
|
1136 | 1139 |
if((cpt = cfgopt(copt, "User")) != NULL) { |
1137 | 1140 |
if((user = getpwnam(cpt->strarg)) == NULL) { |
1138 | 1141 |
fprintf(stderr, _("%s: Can't get information about user %s\n"), argv[0], cpt->strarg); |
... | ... |
@@ -1471,6 +1478,7 @@ main(int argc, char **argv) |
1471 | 1471 |
argv[0]); |
1472 | 1472 |
use_syslog = 0; |
1473 | 1473 |
} |
1474 |
+ broadcast(_("Starting clamav-milter")); |
|
1474 | 1475 |
|
1475 | 1476 |
if(pidfile) { |
1476 | 1477 |
/* save the PID */ |
... | ... |
@@ -1562,6 +1570,8 @@ createSession(int session) |
1562 | 1562 |
cli_warnmsg(_("Check clamd server %s - it may be down\n"), hostname); |
1563 | 1563 |
free(hostname); |
1564 | 1564 |
|
1565 |
+ broadcast(_("Check clamd server - it may be down\n")); |
|
1566 |
+ |
|
1565 | 1567 |
cmdSocketsStatus[session] = CMDSOCKET_DOWN; |
1566 | 1568 |
} |
1567 | 1569 |
cli_dbgmsg("cmdSockets[%d] = %d\n", session, cmdSockets[session]); |
... | ... |
@@ -1796,6 +1806,7 @@ findServer(void) |
1796 | 1796 |
hostname); |
1797 | 1797 |
close(sock); |
1798 | 1798 |
free(hostname); |
1799 |
+ broadcast(_("Check clamd server - it may be down\n")); |
|
1799 | 1800 |
socks[i] = -1; |
1800 | 1801 |
continue; |
1801 | 1802 |
} |
... | ... |
@@ -2747,8 +2758,7 @@ clamfi_eom(SMFICTX *ctx) |
2747 | 2747 |
|
2748 | 2748 |
snprintf(reject, sizeof(reject) - 1, _("%s detected by ClamAV - http://www.clamav.net"), virusname); |
2749 | 2749 |
smfi_setreply(ctx, (char *)privdata->rejectCode, "5.7.1", reject); |
2750 |
- if(broadcastSock >= 0) |
|
2751 |
- broadcast(mess); |
|
2750 |
+ broadcast(mess); |
|
2752 | 2751 |
} |
2753 | 2752 |
clamfi_cleanup(ctx); |
2754 | 2753 |
|
... | ... |
@@ -4015,7 +4025,7 @@ quit(void) |
4015 | 4015 |
quitting++; |
4016 | 4016 |
|
4017 | 4017 |
if(use_syslog) |
4018 |
- syslog(LOG_INFO, _("Stopping: %s"), clamav_version); |
|
4018 |
+ syslog(LOG_INFO, _("Stopping %s"), clamav_version); |
|
4019 | 4019 |
|
4020 | 4020 |
pthread_mutex_lock(&sstatus_mutex); |
4021 | 4021 |
for(i = 0; i < max_children; i++) { |
... | ... |
@@ -4046,6 +4056,7 @@ quit(void) |
4046 | 4046 |
if(use_syslog) |
4047 | 4047 |
syslog(LOG_INFO, _("Stopping %s"), clamav_version); |
4048 | 4048 |
#endif |
4049 |
+ broadcast(_("Stopping clamav-milter")); |
|
4049 | 4050 |
} |
4050 | 4051 |
|
4051 | 4052 |
static void |
... | ... |
@@ -4053,6 +4064,9 @@ broadcast(const char *mess) |
4053 | 4053 |
{ |
4054 | 4054 |
struct sockaddr_in s; |
4055 | 4055 |
|
4056 |
+ if(broadcastSock < 0) |
|
4057 |
+ return; |
|
4058 |
+ |
|
4056 | 4059 |
memset(&s, '\0', sizeof(struct sockaddr_in)); |
4057 | 4060 |
s.sin_family = AF_INET; |
4058 | 4061 |
s.sin_port = (in_port_t)htons(tcpSocket); |