From 7dbd9a3913dfa9e751fbe010f19348556d32e2dd Mon Sep 17 00:00:00 2001 From: Tom Kistner Date: Wed, 15 Dec 2004 11:51:08 +0000 Subject: [PATCH] Added basic MIME ACL decoding errorlevels --- src/OS/Makefile-Base | 4 ++-- src/exim_monitor/em_globals.c | 7 ++++++- src/src/globals.c | 4 ++-- src/src/globals.h | 4 ++-- src/src/mime.c | 20 +++++++++++++++++++- src/src/mime.h | 8 +++++++- src/src/spf.c | 4 ++-- 7 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base index 565ed1c42..3990f2ff4 100644 --- a/src/OS/Makefile-Base +++ b/src/OS/Makefile-Base @@ -1,4 +1,4 @@ -# $Cambridge: exim/src/OS/Makefile-Base,v 1.1.2.4 2004/12/10 09:24:38 tom Exp $ +# $Cambridge: exim/src/OS/Makefile-Base,v 1.1.2.5 2004/12/15 11:51:08 tom Exp $ # This file is the basis of the main makefile for Exim and friends. The # makefile at the top level arranges to build the main makefile by calling @@ -320,7 +320,7 @@ exim: pcre/libpcre.a lookups/lookups.a auths/auths.a \ auths/auths.a \ $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \ $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \ - $(PERL_LIBS) $(TLS_LIBS) + $(PERL_LIBS) $(TLS_LIBS) $(LDFLAGS) @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ echo $(STRIP_COMMAND) exim; \ $(STRIP_COMMAND) exim; \ diff --git a/src/exim_monitor/em_globals.c b/src/exim_monitor/em_globals.c index a0b28136d..a8e17f366 100644 --- a/src/exim_monitor/em_globals.c +++ b/src/exim_monitor/em_globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/exim_monitor/em_globals.c,v 1.1.2.1 2004/12/02 09:15:11 tom Exp $ */ +/* $Cambridge: exim/src/exim_monitor/em_globals.c,v 1.1.2.2 2004/12/15 11:51:09 tom Exp $ */ /************************************************* * Exim Monitor * @@ -44,6 +44,11 @@ uschar actioned_message[24]; uschar *action_required; uschar *alternate_config = NULL; +#ifdef EXPERIMENTAL_BRIGHTMAIL +int bmi_run = 0; +uschar *bmi_verdicts = NULL; +#endif + int body_max = 20000; uschar *exim_path = US BIN_DIRECTORY "/exim" diff --git a/src/src/globals.c b/src/src/globals.c index c36f47c4d..87613662c 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.6.2.5 2004/12/10 14:59:08 tom Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.6.2.6 2004/12/15 11:51:09 tom Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -692,7 +692,7 @@ uschar *message_reference = NULL; /* MIME ACL expandables */ #ifdef WITH_CONTENT_SCAN -uschar *mime_anomaly_level = NULL; +int mime_anomaly_level = NULL; uschar *mime_anomaly_text = NULL; uschar *mime_boundary = NULL; uschar *mime_charset = NULL; diff --git a/src/src/globals.h b/src/src/globals.h index 84c95e45b..4860785cb 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.h,v 1.6.2.4 2004/12/10 14:59:08 tom Exp $ */ +/* $Cambridge: exim/src/src/globals.h,v 1.6.2.5 2004/12/15 11:51:09 tom Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -410,7 +410,7 @@ extern uschar *message_reference; /* Reference for error messages */ /* MIME ACL expandables */ #ifdef WITH_CONTENT_SCAN -extern uschar *mime_anomaly_level; +extern int mime_anomaly_level; extern uschar *mime_anomaly_text; extern uschar *mime_boundary; extern uschar *mime_charset; diff --git a/src/src/mime.c b/src/src/mime.c index ac0126d18..e2bdc6ede 100644 --- a/src/src/mime.c +++ b/src/src/mime.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/mime.c,v 1.1.2.3 2004/11/30 15:18:58 tom Exp $ */ +/* $Cambridge: exim/src/src/mime.c,v 1.1.2.4 2004/12/15 11:51:09 tom Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -15,6 +15,19 @@ FILE *mime_stream = NULL; uschar *mime_current_boundary = NULL; +/************************************************* +* set MIME anomaly level + text * +*************************************************/ + +/* Small wrapper to set the two expandables which + give info on detected "problems" in MIME + encodings. Those are defined in mime.h. */ + +void mime_set_anomaly(int level, char *text) { + mime_anomaly_level = level; + mime_anomaly_text = text; +}; + /************************************************* * decode quoted-printable chars * @@ -131,6 +144,7 @@ uschar *mime_parse_line(uschar *buffer, uschar *encoding, int *num_decoded) { while (*(p+offset) != '\0') { /* hit illegal char ? */ if (mime_b64[*(p+offset)] == 128) { + mime_set_anomaly(MIME_ANOMALY_BROKEN_BASE64); offset++; } else { @@ -148,6 +162,7 @@ uschar *mime_parse_line(uschar *buffer, uschar *encoding, int *num_decoded) { /* byte 0 ---------------------- */ if (*(p+1) == 255) { + mime_set_anomaly(MIME_ANOMALY_BROKEN_BASE64); break; } data[(*num_decoded)] = *p; @@ -159,6 +174,7 @@ uschar *mime_parse_line(uschar *buffer, uschar *encoding, int *num_decoded) { p++; /* byte 1 ---------------------- */ if (*(p+1) == 255) { + mime_set_anomaly(MIME_ANOMALY_BROKEN_BASE64); break; } data[(*num_decoded)] = *p; @@ -170,6 +186,7 @@ uschar *mime_parse_line(uschar *buffer, uschar *encoding, int *num_decoded) { p++; /* byte 2 ---------------------- */ if (*(p+1) == 255) { + mime_set_anomaly(MIME_ANOMALY_BROKEN_BASE64); break; } data[(*num_decoded)] = *p; @@ -195,6 +212,7 @@ uschar *mime_parse_line(uschar *buffer, uschar *encoding, int *num_decoded) { if (decode_qp_result == -2) { /* Error from decoder. p is unchanged. */ + mime_set_anomaly(MIME_ANOMALY_BROKEN_QP); data[(*num_decoded)] = '='; (*num_decoded)++; p++; diff --git a/src/src/mime.h b/src/src/mime.h index 8fb948158..436c0eb80 100644 --- a/src/src/mime.h +++ b/src/src/mime.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/mime.h,v 1.1.2.3 2004/11/30 15:18:58 tom Exp $ */ +/* $Cambridge: exim/src/src/mime.h,v 1.1.2.4 2004/12/15 11:51:09 tom Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -56,6 +56,12 @@ static mime_parameter mime_parameter_list[] = { static int mime_parameter_list_size = sizeof(mime_parameter_list)/sizeof(mime_parameter); + +/* MIME Anomaly list */ +#define MIME_ANOMALY_BROKEN_BASE64 2, "Broken BASE64 encoding detected" +#define MIME_ANOMALY_BROKEN_QP 1, "Broken Quoted-Printable encoding detected" + + /* BASE64 decoder matrix */ static unsigned char mime_b64[256]={ /* 0 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, diff --git a/src/src/spf.c b/src/src/spf.c index 7b5edb9b9..5521891e4 100644 --- a/src/src/spf.c +++ b/src/src/spf.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/spf.c,v 1.1.2.1 2004/12/10 09:24:38 tom Exp $ */ +/* $Cambridge: exim/src/src/spf.c,v 1.1.2.2 2004/12/15 11:51:09 tom Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -13,7 +13,7 @@ #include "exim.h" #ifdef EXPERIMENTAL_SPF -#include "spf.h" +/* #include "spf.h" */ SPF_config_t spfcid = NULL; SPF_dns_config_t spfdcid_resolv = NULL; -- 2.30.2