Browse code

BINDTODEVICE fix was broken

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

Nigel Horne authored on 2004/10/10 07:12:56
Showing 3 changed files
... ...
@@ -1,3 +1,10 @@
1
+Sat Oct  9 23:11:35 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Correct fix for systems where BINDTODEVICE is not
4
+				supported
5
+			SESSIONS: If the PORT command to clamd fails, reset the
6
+				link
7
+
1 8
 Sat Oct  9 09:03:21 BST 2004 (njh)
2 9
 ----------------------------------
3 10
   * libclamav/mbox.c:	Only use libcurl if the version is >= 7.11
... ...
@@ -13,7 +20,7 @@ Fri Oct  8 17:53:30 CEST 2004 (tk)
13 13
 Thu Oct  7 16:37:04 BST 2004 (njh)
14 14
 ----------------------------------
15 15
   * clamav-milter:	Requirement for ScanMail removed since that is no
16
-  				longer supported in clamd.conf
16
+				longer supported in clamd.conf
17 17
 
18 18
 Thu Oct  7 12:18:59 BST 2004 (trog)
19 19
 -----------------------------------
... ...
@@ -517,6 +517,8 @@ Changes
517 517
 			once as 'msg.xxxxxx' and once as 'msg.xxxxxx.virusname'
518 518
 0.80i	5/10/04	ScanMail is no longer needed
519 519
 		Improved tracing of the infected machine
520
+0.80j	8/10/04	SESSION: reset the session if the PORT command fails
521
+		Correct --broadcast code if BINDTODEVICE isn't supported
520 522
 
521 523
 INTERNATIONALISATION
522 524
 
... ...
@@ -26,6 +26,9 @@
26 26
  *
27 27
  * Change History:
28 28
  * $Log: clamav-milter.c,v $
29
+ * Revision 1.141  2004/10/09 22:10:08  nigelhorne
30
+ * BINDTODEVICE fix was broken
31
+ *
29 32
  * Revision 1.140  2004/10/07 15:36:43  nigelhorne
30 33
  * Remove scanmail requirement
31 34
  *
... ...
@@ -431,9 +434,9 @@
431 431
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
432 432
  * Added -f flag use MaxThreads if --max-children not set
433 433
  */
434
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.140 2004/10/07 15:36:43 nigelhorne Exp $";
434
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.141 2004/10/09 22:10:08 nigelhorne Exp $";
435 435
 
436
-#define	CM_VERSION	"0.80i"
436
+#define	CM_VERSION	"0.80j"
437 437
 
438 438
 /*#define	CONFDIR	"/usr/local/etc"*/
439 439
 
... ...
@@ -1146,20 +1149,21 @@ main(int argc, char **argv)
1146 1146
 	 * Drop privileges
1147 1147
 	 */
1148 1148
 	if(getuid() == 0) {
1149
-#ifdef	SO_BINDTODEVICE
1150 1149
 		if(iface) {
1150
+#ifdef	SO_BINDTODEVICE
1151 1151
 			struct ifreq ifr;
1152 1152
 
1153 1153
 			memset(&ifr, '\0', sizeof(struct ifreq));
1154 1154
 			strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name) - 1);
1155 1155
 			if(setsockopt(broadcastSock, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) < 0) {
1156 1156
 				perror(iface);
1157
-				return EX_UNAVAILABLE;
1157
+				return EX_CONFIG;
1158 1158
 			}
1159
-		}
1160 1159
 #else
1161
-		fprintf(stderr, _("%s: The iface option to --broadcast is not supported on your operating system\n"), argv[0]);
1160
+			fprintf(stderr, _("%s: The iface option to --broadcast is not supported on your operating system\n"), argv[0]);
1161
+			return EX_CONFIG;
1162 1162
 #endif
1163
+		}
1163 1164
 		if((cpt = cfgopt(copt, "User")) != NULL) {
1164 1165
 			if((user = getpwnam(cpt->strarg)) == NULL) {
1165 1166
 				fprintf(stderr, _("%s: Can't get information about user %s\n"), argv[0], cpt->strarg);
... ...
@@ -3423,6 +3427,11 @@ connect2clamd(struct privdata *privdata)
3423 3423
 			else
3424 3424
 				cli_warnmsg(_("Expected port information from clamd, got '%s'\n"),
3425 3425
 					buf);
3426
+#ifdef	SESSION
3427
+			pthread_mutex_lock(&sstatus_mutex);
3428
+			cmdSocketsStatus[privdata->serverNumber] = CMDSOCKET_DOWN;
3429
+			pthread_mutex_unlock(&sstatus_mutex);
3430
+#endif
3426 3431
 			return 0;
3427 3432
 		}
3428 3433