Browse code

Only fix old socket when FixStaleSocket is set

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

Nigel Horne authored on 2003/10/06 02:31:56
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sun Oct  5 18:30:40 BST 2003 (njh)
2
+----------------------------------
3
+  * clamav-milter: Used to always remove old UNIX domain sockets, now
4
+  		only does that if FixStaleSocket is set
5
+		
1 6
 Sun Oct  5 14:58:05 BST 2003 (njh)
2 7
 ----------------------------------
3 8
   * clamav-milter: s/atoi(cpt->strarg)/cpt->numarg for MaxThreads
... ...
@@ -129,6 +129,8 @@ Changes
129 129
 0.60j	1/10/03	strerror_r doesn't work on Linux, attempting workaround
130 130
 		Added support for hard-coded list of email addresses
131 131
 		who's e-mail is not scanned
132
+0.60k	5/10/03	Only remove old UNIX domain socket if FixStaleSocket
133
+		is set
132 134
 
133 135
 BUG REPORTS
134 136
 
... ...
@@ -134,9 +134,14 @@
134 134
  *	0.60j	1/10/03	strerror_r doesn't work on Linux, attempting workaround
135 135
  *			Added support for hard-coded list of email addresses
136 136
  *			who's e-mail is not scanned
137
+ *	0.60k	5/10/03	Only remove old UNIX domain socket if FixStaleSocket
138
+ *			is set
137 139
  *
138 140
  * Change History:
139 141
  * $Log: clamav-milter.c,v $
142
+ * Revision 1.12  2003/10/05 17:30:04  nigelhorne
143
+ * Only fix old socket when FixStaleSocket is set
144
+ *
140 145
  * Revision 1.11  2003/10/05 13:57:47  nigelhorne
141 146
  * Fixed handling of MaxThreads
142 147
  *
... ...
@@ -156,9 +161,9 @@
156 156
  * Added -f flag use MaxThreads if --max-children not set
157 157
  *
158 158
  */
159
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.11 2003/10/05 13:57:47 nigelhorne Exp $";
159
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.12 2003/10/05 17:30:04 nigelhorne Exp $";
160 160
 
161
-#define	CM_VERSION	"0.60j"
161
+#define	CM_VERSION	"0.60k"
162 162
 
163 163
 /*#define	CONFDIR	"/usr/local/etc"*/
164 164
 
... ...
@@ -577,15 +582,21 @@ main(int argc, char **argv)
577 577
 		use_syslog = 0;
578 578
 	}
579 579
 
580
-	/*
581
-	 * Get the incoming socket details - the way sendmail talks to us
582
-	 *
583
-	 * TODO: There's a security problem here that'll need fixing
584
-	 */
585
-	if(strncasecmp(port, "unix:", 5) == 0)
586
-		unlink(port + 5);
587
-	else if(strncasecmp(port, "local:", 6) == 0)
588
-		unlink(port + 6);
580
+	if(cfgopt(copt, "FixStaleSocket")) {
581
+		/*
582
+		 * Get the incoming socket details - the way sendmail talks to
583
+		 * us
584
+		 *
585
+		 * TODO: There's a security problem here that'll need fixing
586
+		 */
587
+		if(strncasecmp(port, "unix:", 5) == 0) {
588
+			if(unlink(&port[5]) < 0)
589
+				perror(&port[5]);
590
+		} else if(strncasecmp(port, "local:", 6) == 0) {
591
+			if(unlink(&port[6]) < 0)
592
+				perror(&port[6]);
593
+		}
594
+	}
589 595
 
590 596
 	if(smfi_register(smfilter) == MI_FAILURE) {
591 597
 		fputs("smfi_register failure\n", stderr);