Browse code

Fix X-VIRUS-STATUS deletion

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1045 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/10/30 03:12:05
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Fri Oct 29 19:11:07 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Fix problem with deleting X-VIRUS-STATUS not setting
4
+				correct libmilter settings
5
+
1 6
 Fri Oct 29 02:19:48 CEST 2004 (tk)
2 7
 ----------------------------------
3 8
   * clamdscan: update manual page and fix return code for "unknown option"
... ...
@@ -535,6 +535,10 @@ Changes
535 535
 		Update version information in the watchdog. There may therefore
536 536
 			be a delay between the server updating and this being
537 537
 			reflected in the headers
538
+0.80m	29/10/04 Mark a session as down if the STREAM command timesout, or
539
+			we can't connect to the returned PORT
540
+		Fix problem with deleting X-VIRUS-STATUS not setting correct
541
+			libmilter settings
538 542
 
539 543
 INTERNATIONALISATION
540 544
 
... ...
@@ -26,6 +26,9 @@
26 26
  *
27 27
  * Change History:
28 28
  * $Log: clamav-milter.c,v $
29
+ * Revision 1.144  2004/10/29 18:09:14  nigelhorne
30
+ * Fix X-VIRUS-STATUS deletion
31
+ *
29 32
  * Revision 1.143  2004/10/27 12:34:21  nigelhorne
30 33
  * Correct version header
31 34
  *
... ...
@@ -440,9 +443,9 @@
440 440
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
441 441
  * Added -f flag use MaxThreads if --max-children not set
442 442
  */
443
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.143 2004/10/27 12:34:21 nigelhorne Exp $";
443
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.144 2004/10/29 18:09:14 nigelhorne Exp $";
444 444
 
445
-#define	CM_VERSION	"0.80l"
445
+#define	CM_VERSION	"0.80m"
446 446
 
447 447
 /*#define	CONFDIR	"/usr/local/etc"*/
448 448
 
... ...
@@ -855,7 +858,7 @@ main(int argc, char **argv)
855 855
 	struct smfiDesc smfilter = {
856 856
 		"ClamAv", /* filter name */
857 857
 		SMFI_VERSION,	/* version code -- leave untouched */
858
-		SMFIF_ADDHDRS,	/* flags - we add headers */
858
+		SMFIF_ADDHDRS|SMFIF_CHGHDRS,	/* flags - we add and deleted headers */
859 859
 		clamfi_connect, /* connection callback */
860 860
 		NULL, /* HELO filter callback */
861 861
 		clamfi_envfrom, /* envelope sender filter callback */
... ...
@@ -1013,7 +1016,6 @@ main(int argc, char **argv)
1013 1013
 				break;
1014 1014
 			case 'A':
1015 1015
 				advisory++;
1016
-				smfilter.xxfi_flags |= SMFIF_CHGHDRS;
1017 1016
 				break;
1018 1017
 			case 'b':	/* bounce worms/viruses */
1019 1018
 				bflag++;
... ...
@@ -1055,7 +1057,7 @@ main(int argc, char **argv)
1055 1055
 				break;
1056 1056
 			case 'n':	/* don't add X-Virus-Scanned */
1057 1057
 				nflag++;
1058
-				smfilter.xxfi_flags &= ~SMFIF_ADDHDRS;
1058
+				smfilter.xxfi_flags &= ~(SMFIF_ADDHDRS|SMFIF_CHGHDRS);
1059 1059
 				break;
1060 1060
 			case 'N':	/* Do we reject mail or silently drop it */
1061 1061
 				rejectmail = 0;
... ...
@@ -2500,6 +2502,11 @@ clamfi_eom(SMFICTX *ctx)
2500 2500
 #ifdef	CL_DEBUG
2501 2501
 		cli_dbgmsg(_("clamfi_eom: read nothing from clamd\n"));
2502 2502
 #endif
2503
+#ifdef	SESSION
2504
+		pthread_mutex_lock(&sstatus_mutex);
2505
+		cmdSocketsStatus[privdata->serverNumber] = CMDSOCKET_DOWN;
2506
+		pthread_mutex_unlock(&sstatus_mutex);
2507
+#endif
2503 2508
 		return cl_error;
2504 2509
 	}
2505 2510
 
... ...
@@ -3503,15 +3510,24 @@ connect2clamd(struct privdata *privdata)
3503 3503
 
3504 3504
 #ifdef	SESSION
3505 3505
 		nbytes = clamd_recv(cmdSockets[privdata->serverNumber], buf, sizeof(buf));
3506
+		if(nbytes < 0) {
3507
+			perror("recv");
3508
+			if(use_syslog)
3509
+				syslog(LOG_ERR, _("recv failed from clamd getting PORT"));
3510
+			pthread_mutex_lock(&sstatus_mutex);
3511
+			cmdSocketsStatus[privdata->serverNumber] = CMDSOCKET_DOWN;
3512
+			pthread_mutex_unlock(&sstatus_mutex);
3513
+			return 0;
3514
+		}
3506 3515
 #else
3507 3516
 		nbytes = clamd_recv(privdata->cmdSocket, buf, sizeof(buf));
3508
-#endif
3509 3517
 		if(nbytes < 0) {
3510 3518
 			perror("recv");
3511 3519
 			if(use_syslog)
3512 3520
 				syslog(LOG_ERR, _("recv failed from clamd getting PORT"));
3513 3521
 			return 0;
3514 3522
 		}
3523
+#endif
3515 3524
 		buf[nbytes] = '\0';
3516 3525
 #ifdef	CL_DEBUG
3517 3526
 		if(debug_level >= 4)
... ...
@@ -3558,6 +3574,11 @@ connect2clamd(struct privdata *privdata)
3558 3558
 #else
3559 3559
 				syslog(LOG_ERR, _("Failed to connect to port %d given by clamd: %s"), p, strerror(errno));
3560 3560
 #endif
3561
+#ifdef	SESSION
3562
+				pthread_mutex_lock(&sstatus_mutex);
3563
+				cmdSocketsStatus[privdata->serverNumber] = CMDSOCKET_DOWN;
3564
+				pthread_mutex_unlock(&sstatus_mutex);
3565
+#endif
3561 3566
 			}
3562 3567
 			return 0;
3563 3568
 		}