Browse code

Print better message if hostaddr is null

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

Nigel Horne authored on 2004/04/20 17:14:43
Showing 3 changed files
... ...
@@ -1,3 +1,9 @@
1
+Tue Apr 20 09:13:46 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Print a better message if hostaddr is null in
4
+		clamfi_connect()
5
+	Handle "i" macro not being set in sendmail.cf
6
+
1 7
 Mon Apr 19 23:11:48 BST 2004 (njh)
2 8
 ----------------------------------
3 9
   * clamav-milter: Added --from
... ...
@@ -329,6 +329,8 @@ Changes
329 329
 			<Christian.Pelissier@onera.fr>. Store different
330 330
 			day's quarantines in different directories to
331 331
 			make them easier to manage
332
+0.70n	20/4/04	Allow for "i" macro not defined in sendmail.cf
333
+		clamfi_connect: print better message if hostaddr is null
332 334
 
333 335
 BUG REPORTS
334 336
 
... ...
@@ -330,9 +330,14 @@
330 330
  *				<Christian.Pelissier@onera.fr>. Store different
331 331
  *				day's quarantines in different directories to
332 332
  *				make them easier to manage
333
+ *	0.70n	20/4/04	Allow for "i" macro not defined in sendmail.cf
334
+ *			clamfi_connect: print better message if hostaddr is null
333 335
  *
334 336
  * Change History:
335 337
  * $Log: clamav-milter.c,v $
338
+ * Revision 1.78  2004/04/20 08:13:15  nigelhorne
339
+ * Print better message if hostaddr is null
340
+ *
336 341
  * Revision 1.77  2004/04/19 22:11:20  nigelhorne
337 342
  * Many changes
338 343
  *
... ...
@@ -549,9 +554,9 @@
549 549
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
550 550
  * Added -f flag use MaxThreads if --max-children not set
551 551
  */
552
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.77 2004/04/19 22:11:20 nigelhorne Exp $";
552
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.78 2004/04/20 08:13:15 nigelhorne Exp $";
553 553
 
554
-#define	CM_VERSION	"0.70m"
554
+#define	CM_VERSION	"0.70n"
555 555
 
556 556
 /*#define	CONFDIR	"/usr/local/etc"*/
557 557
 
... ...
@@ -1574,7 +1579,9 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
1574 1574
 	}
1575 1575
 	if(hostaddr == NULL) {
1576 1576
 		if(use_syslog)
1577
-			syslog(LOG_ERR, "clamfi_connect: hostaddr is null");
1577
+			syslog(LOG_ERR,
1578
+				"clamfi_connect: hostaddr for '%s' is null",
1579
+				hostname);
1578 1580
 		return cl_error;
1579 1581
 	}
1580 1582
 
... ...
@@ -1758,7 +1765,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv)
1758 1758
 
1759 1759
 	privdata = (struct privdata *)cli_calloc(1, sizeof(struct privdata));
1760 1760
 	if(privdata == NULL)
1761
-		return SMFIS_TEMPFAIL;
1761
+		return cl_error;
1762 1762
 
1763 1763
 	privdata->dataSocket = -1;	/* 0.4 */
1764 1764
 	privdata->cmdSocket = -1;	/* 0.4 */
... ...
@@ -1797,7 +1804,7 @@ clamfi_envrcpt(SMFICTX *ctx, char **argv)
1797 1797
 		privdata->to = cli_realloc(privdata->to, sizeof(char *) * (privdata->numTo + 2));
1798 1798
 
1799 1799
 	if(privdata->to == NULL)
1800
-		return SMFIS_TEMPFAIL;
1800
+		return cl_error;
1801 1801
 
1802 1802
 	privdata->to[privdata->numTo] = strdup(argv[0]);
1803 1803
 	privdata->to[++privdata->numTo] = NULL;
... ...
@@ -1939,10 +1946,13 @@ clamfi_body(SMFICTX *ctx, u_char *bodyp, size_t len)
1939 1939
 	if(streamMaxLength > 0L) {
1940 1940
 		privdata->numBytes += (long)len;
1941 1941
 		if(privdata->numBytes > streamMaxLength) {
1942
-			if(use_syslog)
1942
+			if(use_syslog) {
1943
+				const char *sendmailId = smfi_getsymval(ctx, "i");
1944
+				if(sendmailId == NULL)
1945
+					sendmailId = "Unknown";
1943 1946
 				syslog(LOG_NOTICE, "%s: Message more than StreamMaxLength (%ld) bytes - not scanned\n",
1944
-					smfi_getsymval(ctx, "i"),
1945
-					streamMaxLength);
1947
+					sendmailId, streamMaxLength);
1948
+			}
1946 1949
 			clamfi_cleanup(ctx);	/* not needed, but just to be safe */
1947 1950
 			return SMFIS_ACCEPT;
1948 1951
 		}
... ...
@@ -2049,6 +2059,8 @@ clamfi_eom(SMFICTX *ctx)
2049 2049
 	privdata->cmdSocket = -1;
2050 2050
 
2051 2051
 	sendmailId = smfi_getsymval(ctx, "i");
2052
+	if(sendmailId == NULL)
2053
+		sendmailId = "Unknown";
2052 2054
 
2053 2055
 	if(strstr(mess, "ERROR") != NULL) {
2054 2056
 		if(strstr(mess, "Size exceeded") != NULL) {
... ...
@@ -2110,7 +2122,7 @@ clamfi_eom(SMFICTX *ctx)
2110 2110
 
2111 2111
 		if(err == NULL) {
2112 2112
 			clamfi_cleanup(ctx);
2113
-			return SMFIS_TEMPFAIL;
2113
+			return cl_error;
2114 2114
 		}
2115 2115
 
2116 2116
 		/*