Browse code

Fix FreeBSD

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

Nigel Horne authored on 2004/02/18 19:06:51
Showing 2 changed files
... ...
@@ -226,6 +226,8 @@ Changes
226 226
 		Handle machines that don't have in_port_t
227 227
 0.67	16/2/04	Upissued to 0.67
228 228
 0.67a	16/2/04	Added clamfi_free
229
+0.67b	17/2/04	Removed compilation warning - now compiles on FreeBSD5.2
230
+		Don't allow --force to overwride TCPwrappers
229 231
 
230 232
 BUG REPORTS
231 233
 
... ...
@@ -229,9 +229,14 @@
229 229
  *			Handle machines that don't have in_port_t
230 230
  *	0.67	16/2/04	Upissued to 0.67
231 231
  *	0.67a	16/2/04	Added clamfi_free
232
+ *	0.67b	17/2/04	Removed compilation warning - now compiles on FreeBSD5.2
233
+ *			Don't allow --force to overwride TCPwrappers
232 234
  *
233 235
  * Change History:
234 236
  * $Log: clamav-milter.c,v $
237
+ * Revision 1.48  2004/02/18 10:06:51  nigelhorne
238
+ * Fix FreeBSD
239
+ *
235 240
  * Revision 1.47  2004/02/16 11:55:24  nigelhorne
236 241
  * Added clamfi_free which helps with the tidying up
237 242
  *
... ...
@@ -358,9 +363,9 @@
358 358
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
359 359
  * Added -f flag use MaxThreads if --max-children not set
360 360
  */
361
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.47 2004/02/16 11:55:24 nigelhorne Exp $";
361
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.48 2004/02/18 10:06:51 nigelhorne Exp $";
362 362
 
363
-#define	CM_VERSION	"0.67a"
363
+#define	CM_VERSION	"0.67b"
364 364
 
365 365
 /*#define	CONFDIR	"/usr/local/etc"*/
366 366
 
... ...
@@ -380,7 +385,7 @@ static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.47 2004/02/16 11:55:24 nig
380 380
 
381 381
 #include <stdio.h>
382 382
 #include <sysexits.h>
383
-#ifndef HAVE_MALLOC_H
383
+#ifdef HAVE_MALLOC_H
384 384
 #include <malloc.h>
385 385
 #endif
386 386
 #include <sys/types.h>
... ...
@@ -1282,7 +1287,7 @@ static sfsistat
1282 1282
 clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1283 1283
 {
1284 1284
 	char buf[INET_ADDRSTRLEN];	/* IPv4 only */
1285
-	const char *remoteIP;
1285
+	char *remoteIP;
1286 1286
 
1287 1287
 	if(hostname == NULL) {
1288 1288
 		if(use_syslog)
... ...
@@ -1295,7 +1300,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1295 1295
 		return cl_error;
1296 1296
 	}
1297 1297
 
1298
-	remoteIP = inet_ntop(AF_INET, &((struct sockaddr_in *)(hostaddr))->sin_addr, buf, sizeof(buf));
1298
+	remoteIP = (char *)inet_ntop(AF_INET, &((struct sockaddr_in *)(hostaddr))->sin_addr, buf, sizeof(buf));
1299 1299
 
1300 1300
 	if(remoteIP == NULL) {
1301 1301
 		if(use_syslog)
... ...
@@ -1311,6 +1316,20 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1311 1311
 	}
1312 1312
 #endif
1313 1313
 
1314
+#ifdef	WITH_TCPWRAP
1315
+	/*
1316
+	 * Support /etc/hosts.allow and /etc/hosts.deny
1317
+	 */
1318
+	if(!hosts_ctl("clamav-milter", hostname, remoteIP, STRING_UNKNOWN)) {
1319
+		if(use_syslog)
1320
+			syslog(LOG_WARNING,
1321
+				"Access to clamav-milter denied for %s[%s]",
1322
+				hostname,
1323
+				remoteIP);
1324
+		return SMFIS_TEMPFAIL;
1325
+	}
1326
+#endif
1327
+
1314 1328
 	if(fflag)
1315 1329
 		/*
1316 1330
 		 * Patch from "Richard G. Roberto" <rgr@dedlegend.com>
... ...
@@ -1368,19 +1387,6 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1368 1368
 		}
1369 1369
 	}
1370 1370
 
1371
-#ifdef	WITH_TCPWRAP
1372
-	/*
1373
-	 * Support /etc/hosts.allow and /etc/hosts.deny
1374
-	 */
1375
-	if(!hosts_ctl("clamav-milter", hostname, remoteIP, STRING_UNKNOWN)) {
1376
-		if(use_syslog)
1377
-			syslog(LOG_WARNING,
1378
-				"Access to clamav-milter denied for %s[%s]",
1379
-				hostname,
1380
-				remoteIP);
1381
-		return SMFIS_TEMPFAIL;
1382
-	}
1383
-#endif
1384 1371
 	return SMFIS_CONTINUE;
1385 1372
 }
1386 1373