git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Relax restrictions on which ACLs verify conditions may be used
[exim.git]
/
src
/
src
/
filtertest.c
diff --git
a/src/src/filtertest.c
b/src/src/filtertest.c
index 4c80b6f77b2fcc33ec73c2bd53c6cd7eb967c351..f54cbefb5582e80d950c2f3052ed0958a4a59cd8 100644
(file)
--- a/
src/src/filtertest.c
+++ b/
src/src/filtertest.c
@@
-1,10
+1,8
@@
-/* $Cambridge: exim/src/src/filtertest.c,v 1.3 2005/01/04 10:00:42 ph10 Exp $ */
-
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 200
5
*/
+/* Copyright (c) University of Cambridge 1995 - 200
9
*/
/* See the file NOTICE for conditions of use and distribution. */
/* See the file NOTICE for conditions of use and distribution. */
@@
-22,19
+20,20
@@
we can set up the message_body variables at the same time (in normal use, the
message_body variables are not set up unless needed). The reading code is
written out here rather than having options in read_message_data, in order to
we can set up the message_body variables at the same time (in normal use, the
message_body variables are not set up unless needed). The reading code is
written out here rather than having options in read_message_data, in order to
-keep that function as efficient as possible. Handling message_body_end is
-somewhat more tedious. Pile it all into a circular buffer and sort out at the
-end.
+keep that function as efficient as possible. (Later: this function is now
+global because it is also used by the -bem testing option.) Handling
+message_body_end is somewhat more tedious. Pile it all into a circular buffer
+and sort out at the end.
-Arguments:
+Arguments:
dot_ended TRUE if message already terminated by '.'
Returns: nothing
*/
dot_ended TRUE if message already terminated by '.'
Returns: nothing
*/
-
-
static
void
-read_message_body(dot_ended)
-{
+
+void
+read_message_body(
BOOL
dot_ended)
+{
register int ch;
int body_len, body_end_len, header_size;
uschar *s;
register int ch;
int body_len, body_end_len, header_size;
uschar *s;
@@
-48,7
+47,7
@@
header_size = message_size;
if (!dot_ended && !feof(stdin))
{
if (!dot_ended && !feof(stdin))
{
- if (!dot_ends)
+ if (!
f.
dot_ends)
{
while ((ch = getc(stdin)) != EOF)
{
{
while ((ch = getc(stdin)) != EOF)
{
@@
-113,7
+112,7
@@
if (body_len >= message_body_visible)
int above = message_body_visible - below;
if (above > 0)
{
int above = message_body_visible - below;
if (above > 0)
{
- uschar *temp = store_get(below);
+ uschar *temp = store_get(below
, TRUE
);
memcpy(temp, message_body_end, below);
memmove(message_body_end, s+1, above);
memcpy(message_body_end + above, temp, below);
memcpy(temp, message_body_end, below);
memmove(message_body_end, s+1, above);
memcpy(message_body_end + above, temp, below);
@@
-154,7
+153,7
@@
twice if both system and user filters are being tested.
Argument:
fd an fd containing the filter file
Argument:
fd an fd containing the filter file
- filename the name of the filter file
+ filename the name of the filter file
is_system TRUE if testing is to be as a system filter
dot_ended TRUE if message already terminated by '.'
is_system TRUE if testing is to be as a system filter
dot_ended TRUE if message already terminated by '.'
@@
-179,9
+178,9
@@
if (fstat(fd, &statbuf) != 0)
return FALSE;
}
return FALSE;
}
-filebuf = store_get(statbuf.st_size + 1);
+filebuf = store_get(statbuf.st_size + 1
, is_tainted(filename)
);
rc = read(fd, filebuf, statbuf.st_size);
rc = read(fd, filebuf, statbuf.st_size);
-close(fd);
+
(void)
close(fd);
if (rc != statbuf.st_size)
{
if (rc != statbuf.st_size)
{
@@
-248,7
+247,7
@@
if (filter_type == FILTER_FORWARD)
return TRUE;
}
return TRUE;
}
-/* For a filter, set up the message_body variables and the message size if this
+/* For a filter, set up the message_body variables and the message size if this
is the first time this function has been called. */
if (message_body == NULL) read_message_body(dot_ended);
is the first time this function has been called. */
if (message_body == NULL) read_message_body(dot_ended);
@@
-260,18
+259,18
@@
testing a system filter that is going to be followed by a user filter test. */
if (is_system)
{
if (is_system)
{
- system_filtering = TRUE;
- enable_dollar_recipients = TRUE; /* Permit $recipients in system filter */
+
f.
system_filtering = TRUE;
+
f.
enable_dollar_recipients = TRUE; /* Permit $recipients in system filter */
yield = filter_interpret
(filebuf,
RDO_DEFER|RDO_FAIL|RDO_FILTER|RDO_FREEZE|RDO_REWRITE, &generated, &error);
yield = filter_interpret
(filebuf,
RDO_DEFER|RDO_FAIL|RDO_FILTER|RDO_FREEZE|RDO_REWRITE, &generated, &error);
- enable_dollar_recipients = FALSE;
- system_filtering = FALSE;
+
f.
enable_dollar_recipients = FALSE;
+
f.
system_filtering = FALSE;
}
else
{
yield = (filter_type == FILTER_SIEVE)?
}
else
{
yield = (filter_type == FILTER_SIEVE)?
- sieve_interpret(filebuf, RDO_REWRITE, NULL, &generated, &error)
+ sieve_interpret(filebuf, RDO_REWRITE, NULL,
NULL, NULL, NULL,
&generated, &error)
:
filter_interpret(filebuf, RDO_REWRITE, &generated, &error);
}
:
filter_interpret(filebuf, RDO_REWRITE, &generated, &error);
}