Browse code

Set umask; handle unescaped From in mailboxes

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

Nigel Horne authored on 2003/12/06 04:17:03
Showing 3 changed files
... ...
@@ -1,3 +1,15 @@
1
+Fri Dec  5 19:16:08 GMT 2003 (njh)
2
+----------------------------------
3
+  * clamav-milter: Added call to umask to ensure that the local socket
4
+	is not publically writeable. If it is sendmail
5
+	will (correctly!) refuse to start this program
6
+	Thanks for Nicklaus Wicker <n.wicker@cnk-networks.de>
7
+
8
+	Don't sent From as the first line since that means
9
+	clamd will think it is an mbox and not handle
10
+	unescaped From at the start of lines properly
11
+	Thanks to Michael Dankov <misha@btrc.ru>
12
+
1 13
 Fri Dec  5 09:34:44 GMT 2003 (njh)
2 14
 ----------------------------------
3 15
   * libclamav: Use cli_tok instead of strtok - replaced now by cli_strtok
... ...
@@ -164,6 +164,14 @@ Changes
164 164
 		Thanks to Michael Dankov <misha@btrc.ru>.
165 165
 0.65g	2/12/03	Use setsid if setpgrp is not present.
166 166
 		Thanks to Eugene Crosser <crosser@rol.ru>
167
+0.65h	4/12/03	Added call to umask to ensure that the local socket
168
+		is not publically writeable. If it is sendmail
169
+		will (correctly!) refuse to start this program
170
+		Thanks for Nicklaus Wicker <n.wicker@cnk-networks.de>
171
+		Don't sent From as the first line since that means
172
+		clamd will think it is an mbox and not handle
173
+		unescaped From at the start of lines properly
174
+		Thanks to Michael Dankov <misha@btrc.ru>
167 175
 
168 176
 BUG REPORTS
169 177
 
... ...
@@ -167,9 +167,20 @@
167 167
  *			Thanks to Michael Dankov <misha@btrc.ru>.
168 168
  *	0.65g	2/12/03	Use setsid if setpgrp is not present.
169 169
  *			Thanks to Eugene Crosser <crosser@rol.ru>
170
+ *	0.65h	4/12/03	Added call to umask to ensure that the local socket
171
+ *			is not publically writeable. If it is sendmail
172
+ *			will (correctly!) refuse to start this program
173
+ *			Thanks for Nicklaus Wicker <n.wicker@cnk-networks.de>
174
+ *			Don't sent From as the first line since that means
175
+ *			clamd will think it is an mbox and not handle
176
+ *			unescaped From at the start of lines properly
177
+ *			Thanks to Michael Dankov <misha@btrc.ru>
170 178
  *
171 179
  * Change History:
172 180
  * $Log: clamav-milter.c,v $
181
+ * Revision 1.27  2003/12/05 19:14:07  nigelhorne
182
+ * Set umask; handle unescaped From in mailboxes
183
+ *
173 184
  * Revision 1.26  2003/12/02 06:37:26  nigelhorne
174 185
  * Use setsid if setpgrp not present
175 186
  *
... ...
@@ -233,9 +244,9 @@
233 233
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
234 234
  * Added -f flag use MaxThreads if --max-children not set
235 235
  */
236
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.26 2003/12/02 06:37:26 nigelhorne Exp $";
236
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.27 2003/12/05 19:14:07 nigelhorne Exp $";
237 237
 
238
-#define	CM_VERSION	"0.65g"
238
+#define	CM_VERSION	"0.65h"
239 239
 
240 240
 /*#define	CONFDIR	"/usr/local/etc"*/
241 241
 
... ...
@@ -249,9 +260,11 @@ static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.26 2003/12/02 06:37:26 nig
249 249
 
250 250
 #include <stdio.h>
251 251
 #include <sysexits.h>
252
-#ifndef TARGET_OS_FREEBSD
252
+#ifndef HAVE_MALLOC_H
253 253
 #include <malloc.h>
254 254
 #endif
255
+#include <sys/types.h>
256
+#include <sys/stat.h>
255 257
 #include <syslog.h>
256 258
 #include <unistd.h>
257 259
 #include <stdlib.h>
... ...
@@ -664,6 +677,7 @@ main(int argc, char **argv)
664 664
 				cfgfile);
665 665
 			return EX_CONFIG;
666 666
 		}
667
+		umask(022);
667 668
 	} else if((cpt = cfgopt(copt, "TCPSocket")) != NULL) {
668 669
 		/*
669 670
 		 * TCPSocket is in fact a port number not a full socket
... ...
@@ -1176,7 +1190,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv)
1176 1176
 		}
1177 1177
 	}
1178 1178
 
1179
-	clamfi_send(privdata, 0, "From %s\n", argv[0]);
1179
+	clamfi_send(privdata, 0, "Received: by clamav-milter\n");
1180 1180
 	clamfi_send(privdata, 0, "From: %s\n", argv[0]);
1181 1181
 
1182 1182
 	privdata->from = strdup(argv[0]);