[exim-cvs] sieve dynamic module

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Exim Git Commits Mailing List
Data:  
Para: exim-cvs
Asunto: [exim-cvs] sieve dynamic module
Gitweb: https://git.exim.org/exim.git/commitdiff/834dae55650eb31b893242b9d50b477f5a339bf5
Commit:     834dae55650eb31b893242b9d50b477f5a339bf5
Parent:     3f96c3e750eb4e4dc63f53d783106aa5cf2498cb
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Sep 10 12:32:03 2024 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Sep 10 12:34:23 2024 +0100


    sieve dynamic module
---
 doc/doc-txt/NewStuff                               |  6 ++-
 src/OS/Makefile-Base                               |  3 +-
 src/scripts/Configure-Makefile                     |  2 +-
 src/scripts/MakeLinks                              |  3 +-
 src/src/EDITME                                     | 11 ++++
 src/src/config.h.defaults                          |  2 +
 src/src/drtables.c                                 |  6 +++
 src/src/exim.c                                     | 13 ++++-
 src/src/exim.h                                     |  3 ++
 src/src/filtertest.c                               | 18 +++++--
 src/src/functions.h                                |  2 -
 src/src/globals.h                                  |  1 -
 src/src/miscmods/Makefile                          | 21 ++++----
 src/src/{sieve.c => miscmods/sieve_filter.c}       | 62 +++++++++++++++-------
 src/src/miscmods/sieve_filter_api.h                | 15 ++++++
 src/src/rda.c                                      | 13 ++++-
 test/aux-fixed/{0427.message => 4160.message}      |  0
 test/aux-fixed/{0427.message2 => 4160.message2}    |  0
 test/aux-fixed/{0427.message3 => 4160.message3}    |  0
 .../{0506.sieve-filter => 4162.sieve-filter}       |  0
 test/aux-fixed/{0950.sieve => 4163.sieve}          |  0
 test/confs/{0427 => 4160}                          |  2 +-
 test/confs/{0428 => 4161}                          |  2 +-
 test/confs/4162                                    | 32 +++++++++++
 test/confs/{0950 => 4163}                          |  2 +-
 test/log/0506                                      |  5 +-
 test/log/{0428 => 4161}                            |  0
 test/log/{0506 => 4162}                            |  5 +-
 test/log/{0950 => 4163}                            |  0
 test/mail/{0428.CALLER => 4161.CALLER}             |  0
 test/mail/{0428.inbox.JUNK => 4161.inbox.JUNK}     |  0
 .../{0428.inbox.changed => 4161.inbox.changed}     |  0
 test/mail/{0428.redirected => 4161.redirected}     |  0
 test/mail/{0428.someone => 4161.someone}           |  0
 test/mail/{0428.userx => 4161.userx}               |  0
 test/mail/{0428.userx-extra => 4161.userx-extra}   |  0
 .../{0428.userx-sawsuffix => 4161.userx-sawsuffix} |  0
 test/mail/{0428.userx13 => 4161.userx13}           |  0
 test/mail/{0428.userx14 => 4161.userx14}           |  0
 test/mail/{0428.userx9 => 4161.userx9}             |  0
 test/mail/{0950.CALLER => 4163.CALLER}             |  0
 test/mail/{0950.myfolder => 4163.myfolder}         |  0
 test/scripts/0000-Basic/0506                       | 10 ++--
 .../{0000-Basic/0427 => 4160-sieve-filter/4160}    |  0
 .../{0000-Basic/0428 => 4160-sieve-filter/4161}    |  0
 test/scripts/4160-sieve-filter/4162                | 10 ++++
 .../{0000-Basic/0950 => 4160-sieve-filter/4163}    |  0
 test/scripts/4160-sieve-filter/REQUIRES            |  1 +
 test/stdout/{0427 => 4160}                         |  0
 test/stdout/{0950 => 4163}                         |  0
 50 files changed, 188 insertions(+), 62 deletions(-)


diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff
index 01326b488..bca7d6f87 100644
--- a/doc/doc-txt/NewStuff
+++ b/doc/doc-txt/NewStuff
@@ -14,8 +14,10 @@ Version 4.98

3. Events smtp:fail:protocol and smtp:fail:syntax

- 4. JSON and LDAP lookup support, PAM, RADIUS, perl, SPF, DKIM, DMARC and ARC
-    support, all the router and authenticator drivers, and all the transport
+ 4. Support for Sieve filters can be omitted at build time
+
+ 5. JSON and LDAP lookup support, Sieve, PAM, RADIUS, perl, SPF, DKIM, DMARC and
+    ARC support, all the router and authenticator drivers, and all the transport
     drivers except smtp, can now be built as loadable modules


 Version 4.98
diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base
index d8df29672..7793e5da2 100644
--- a/src/OS/Makefile-Base
+++ b/src/OS/Makefile-Base
@@ -518,7 +518,7 @@ OBJ_EXIM = acl.o base64.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
         header.o host.o host_address.o ip.o log.o lss.o match.o md5.o moan.o \
         os.o parse.o priv.o proxy.o queue.o \
         rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o regex_cache.o \
-        route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
+        route.o search.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
         std-crypto.o store.o string.o tls.o tod.o transport.o tree.o verify.o \
         xtextencode.o environment.o macro.o \
         $(OBJ_LOOKUPS) $(OBJ_ROUTERS) $(OBJ_AUTHS) \
@@ -866,7 +866,6 @@ regex_cache.o:   $(HDRS) regex_cache.c
 rfc2047.o:       $(HDRS) rfc2047.c
 route.o:         $(HDRS) route.c
 search.o:        $(HDRS) search.c
-sieve.o:         $(HDRS) sieve.c
 smtp_in.o:       $(HDRS) smtp_in.c
 smtp_out.o:      $(HDRS) smtp_out.c
 spool_in.o:      $(HDRS) spool_in.c
diff --git a/src/scripts/Configure-Makefile b/src/scripts/Configure-Makefile
index df6323f3b..fd5afaf10 100755
--- a/src/scripts/Configure-Makefile
+++ b/src/scripts/Configure-Makefile
@@ -315,7 +315,7 @@ done <<-END
  routers    ROUTER    ACCEPT DNSLOOKUP IPLITERAL IPLOOKUP MANUALROUTE QUERYPROGRAM REDIRECT
  transports TRANSPORT    APPENDFILE AUTOREPLY LMTP PIPE QUEUEFILE SMTP
  auths        AUTH    CRAM_MD5 CYRUS_SASL DOVECOT EXTERNAL GSASL HEIMDAL_GSSAPI PLAINTEXT SPA TLS
- miscmods   SUPPORT    ARC _DKIM DMARC PAM PERL RADIUS SPF
+ miscmods   SUPPORT    ARC _DKIM DMARC PAM PERL RADIUS _SIEVE_FILTER SPF
 END


 # See if there is a definition of EXIM_PERL in what we have built so far.
diff --git a/src/scripts/MakeLinks b/src/scripts/MakeLinks
index d7441ef0d..6327bc819 100755
--- a/src/scripts/MakeLinks
+++ b/src/scripts/MakeLinks
@@ -105,6 +105,7 @@ for f in dummy.c \
     pam.c pam_api.h \
     perl.c perl_api.h \
     radius.c radius_api.h \
+    sieve_filter.c sieve_filter_api.h \
     spf.c spf.h spf_api.h
 do
   ln -s ../../src/$d/$f `basename $f`
@@ -136,7 +137,7 @@ for f in blob.h dbfunctions.h exim.h functions.h globals.h \
   globals.c hash.c header.c host.c host_address.c ip.c log.c lss.c match.c md5.c moan.c \
   parse.c priv.c proxy.c queue.c rda.c readconf.c receive.c retry.c rewrite.c \
   regex_cache.c rfc2047.c route.c search.c setenv.c environment.c \
-  sieve.c smtp_in.c smtp_out.c spool_in.c spool_out.c std-crypto.c store.c \
+  smtp_in.c smtp_out.c spool_in.c spool_out.c std-crypto.c store.c \
   string.c tls.c tlscert-gnu.c tlscert-openssl.c tls-cipher-stdname.c \
   tls-gnu.c tls-openssl.c \
   tod.c transport.c tree.c verify.c version.c xtextencode.c \
diff --git a/src/src/EDITME b/src/src/EDITME
index 757e94746..85effd13f 100644
--- a/src/src/EDITME
+++ b/src/src/EDITME
@@ -551,6 +551,17 @@ SUPPORT_DANE=yes
 # EXIM_MONITOR=eximon.bin



+#------------------------------------------------------------------------------
+# Compiling with support for Sieve filters is the default. To disable this
+# uncomment the line below.
+
+# DISABLE_SIEVE_FILTER=yes
+
+# Alternatively, to build the support as a dynamically-loaded module uncomment
+# this line.
+
+# SUPPORT_SIEVE_FILTER=2
+
#------------------------------------------------------------------------------
# Compiling Exim with content scanning support: If you want to compile Exim
# with support for message body content scanning, set WITH_CONTENT_SCAN to
diff --git a/src/src/config.h.defaults b/src/src/config.h.defaults
index e6ded1e8f..404ac0c1c 100644
--- a/src/src/config.h.defaults
+++ b/src/src/config.h.defaults
@@ -57,6 +57,7 @@ Do not put spaces between # and the 'define'.
#define DISABLE_PIPE_CONNECT
#define DISABLE_PRDR
#define DISABLE_QUEUE_RAMP
+#define DISABLE_SIEVE_FILTER
#define DISABLE_TLS
#define DISABLE_TLS_RESUME
#define DISABLE_WELLKNOWN
@@ -171,6 +172,7 @@ Do not put spaces between # and the 'define'.
#define SUPPORT_ARC
#define SUPPORT_DKIM
#define SUPPORT_PERL
+#define SUPPORT_SIEVE_FILTER
#define SUPPORT_RADIUS

#define SYSLOG_LOG_PID
diff --git a/src/src/drtables.c b/src/src/drtables.c
index 8bde47666..49d3ae129 100644
--- a/src/src/drtables.c
+++ b/src/src/drtables.c
@@ -762,6 +762,9 @@ extern misc_module_info pam_module_info;
#if defined(EXIM_PERL) && (!defined(SUPPORT_PERL) || SUPPORT_PERL!=2)
extern misc_module_info perl_module_info;
#endif
+#if !defined(DISABLE_SIEVE_FILTER) && (!defined(SUPPORT_SIEVE_FILTER) || SUPPORT_SIEVE_FILTER!=2)
+extern misc_module_info sieve_filter_module_info;
+#endif

void
init_misc_mod_list(void)
@@ -792,6 +795,9 @@ onetime = TRUE;
#if defined(EXIM_PERL) && (!defined(SUPPORT_PERL) || SUPPORT_PERL!=2)
misc_mod_add(&perl_module_info);
#endif
+#if !defined(DISABLE_SIEVE_FILTER) && (!defined(SUPPORT_SIEVE_FILTER) || SUPPORT_SIEVE_FILTER!=2)
+ misc_mod_add(&sieve_filter_module_info);
+#endif
}


diff --git a/src/src/exim.c b/src/src/exim.c
index 3d1b7f1d9..274187cfc 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -1221,6 +1221,9 @@ g = string_cat(g, US"Support for:");
 #ifdef WITH_CONTENT_SCAN
   g = string_cat(g, US" Content_Scanning");
 #endif
+#ifndef DISABLE_SIEVE_FILTER
+  g = string_cat(g, US" Sieve_filter");
+#endif
 #ifdef SUPPORT_CRYPTEQ
   g = string_cat(g, US" crypteq");
 #endif
@@ -1475,8 +1478,14 @@ switch(request)
 );
     return;
   case CMDINFO_SIEVE:
-    for (const uschar ** pp = exim_sieve_extension_list; *pp; ++pp)
-      fprintf(stream, "%s\n", *pp);
+    {
+    const misc_module_info * mi;
+    typedef void (*fn_t)(FILE *);
+    if ((mi = misc_mod_find(US"sieve_filter", NULL)))
+      (((fn_t *) mi->functions)[SIEVE_EXTENSIONS]) (stream);
+    else
+      fprintf(stream, "Sieve filtering not available\n");
+    }
     return;
   case CMDINFO_DSCP:
     dscp_list_to_stream(stream);
diff --git a/src/src/exim.h b/src/src/exim.h
index 771c00df8..bae5ec390 100644
--- a/src/src/exim.h
+++ b/src/src/exim.h
@@ -567,6 +567,9 @@ config.h, mytypes.h, and store.h, so we don't need to mention them explicitly.
 #ifdef EXIM_PERL
 # include "miscmods/perl_api.h"
 #endif
+#ifndef DISABLE_SIEVE
+# include "miscmods/sieve_filter_api.h"
+#endif


 /* The following stuff must follow the inclusion of config.h because it
 requires various things that are set therein. */
diff --git a/src/src/filtertest.c b/src/src/filtertest.c
index a58fe5e82..eb5f5e54b 100644
--- a/src/src/filtertest.c
+++ b/src/src/filtertest.c
@@ -270,12 +270,22 @@ if (is_system)
   f.enable_dollar_recipients = FALSE;
   f.system_filtering = FALSE;
   }
-else
+else if (filter_type == FILTER_SIEVE)
   {
-  yield = filter_type == FILTER_SIEVE
-    ? sieve_interpret(filebuf, RDO_REWRITE, NULL, &generated, &error)
-    : filter_interpret(filebuf, RDO_REWRITE, &generated, &error);
+  const misc_module_info * mi;
+  uschar * errstr = NULL;
+  typedef int (*fn_t)(const uschar *, int, const sieve_block *,
+               address_item **, uschar **);
+  if (!(mi = misc_mod_find(US"sieve_filter", &errstr)))
+    {
+    printf("exim: Sieve filtering not available: %s\n", errstr ? errstr : US"?");
+    return FALSE;
+    }
+  yield = (((fn_t *) mi->functions)[SIEVE_INTERPRET])
+                    (filebuf, RDO_REWRITE, NULL, &generated, &error);
   }
+else
+  yield = filter_interpret(filebuf, RDO_REWRITE, &generated, &error);


 return yield != FF_ERROR;
 }
diff --git a/src/src/functions.h b/src/src/functions.h
index 9b645a85f..60b07d2d7 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -481,8 +481,6 @@ extern void    set_process_info(const char *, ...) PRINTF_FUNCTION(1,2);
 extern void    sha1_end(hctx *, const uschar *, int, uschar *);
 extern void    sha1_mid(hctx *, const uschar *);
 extern void    sha1_start(hctx *);
-extern int     sieve_interpret(const uschar *, int, const sieve_block *,
-         address_item **, uschar **);
 extern void    sigalrm_handler(int);
 extern void    single_queue_run(qrunner *, const uschar *, const uschar *);
 extern int     smtp_boundsock(smtp_connect_args *);
diff --git a/src/src/globals.h b/src/src/globals.h
index a172d9abc..e9be97cd8 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -586,7 +586,6 @@ extern const uschar *event_name;       /* event classification */
 extern gid_t   exim_gid;               /* To be used with exim_uid */
 extern BOOL    exim_gid_set;           /* TRUE if exim_gid set */
 extern uschar *exim_path;              /* Path to exec exim */
-extern const uschar *exim_sieve_extension_list[]; /* list of sieve extensions */
 extern uid_t   exim_uid;               /* Non-root uid for exim */
 extern BOOL    exim_uid_set;           /* TRUE if exim_uid set */
 extern int     expand_level;           /* Nesting depth; indent for debug */
diff --git a/src/src/miscmods/Makefile b/src/src/miscmods/Makefile
index c1489d6e8..3c255dbb6 100644
--- a/src/src/miscmods/Makefile
+++ b/src/src/miscmods/Makefile
@@ -31,16 +31,17 @@ miscmods.a:    $(OBJ)


 # Note that the sources from pdkim/ are linked into the build.../miscmods/ dir
 # by scripts/Makelinks.
-arc.o    arc.so:        $(HDRS) pdkim.h arc.c
-dkim.o  dkim.so:    $(HDRS) dkim.h dkim.c dkim_transport.c \
-            crypt_ver.h pdkim.h pdkim_hash.h pdkim.c \
-            signing.h signing.c
-dmarc.o dmarc.so:    $(HDRS) pdkim.h dmarc.h dmarc.c
-dummy.o:        dummy.c
-pam.o   pam.so:        $(HDRS) pam.c
-perl.o perl.so:         $(HDRS) perl.c
-radius.o radius.so:    $(HDRS) radius.c
-spf.o   spf.so:        $(HDRS) spf.h spf.c
+arc.o    arc.so:            $(HDRS) pdkim.h arc.c
+dkim.o  dkim.so:        $(HDRS) dkim.h dkim.c dkim_transport.c \
+                crypt_ver.h pdkim.h pdkim_hash.h pdkim.c \
+                signing.h signing.c
+dmarc.o dmarc.so:        $(HDRS) pdkim.h dmarc.h dmarc.c
+dummy.o:            dummy.c
+pam.o   pam.so:            $(HDRS) pam.c
+perl.o perl.so:             $(HDRS) perl.c
+radius.o radius.so:        $(HDRS) radius.c
+sieve_filter.o sieve_filter.so:    $(HDRS) sieve_filter.c
+spf.o   spf.so:            $(HDRS) spf.h spf.c


 dkim.o:
     @echo "$(CC) dkim.c dkim_transport.c pdkim.c signing.c"
diff --git a/src/src/sieve.c b/src/src/miscmods/sieve_filter.c
similarity index 98%
rename from src/src/sieve.c
rename to src/src/miscmods/sieve_filter.c
index dbe64cffa..56f20bfd5 100644
--- a/src/src/sieve.c
+++ b/src/src/miscmods/sieve_filter.c
@@ -3,11 +3,11 @@
 *************************************************/


/*
- * Copyright (c) The Exim Maintainers 2016 - 2023
- * Copyright (c) Michael Haardt 2003 - 2015
- * See the file NOTICE for conditions of use and distribution.
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
+Copyright (c) The Exim Maintainers 2016 - 2024
+Copyright (c) Michael Haardt 2003 - 2015
+See the file NOTICE for conditions of use and distribution.
+SPDX-License-Identifier: GPL-2.0-or-later
+*/

/* This code was contributed by Michael Haardt. */

@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>

-#include "exim.h"
+#include "../exim.h"

#if HAVE_ICONV
# include <iconv.h>
@@ -113,7 +113,7 @@ that callers don't get surprised.

List *MUST* end with a NULL. Which at least makes ifdef-vs-comma easier. */

-const uschar *exim_sieve_extension_list[] = {
+static const uschar *exim_sieve_extension_list[] = {
   CUS"comparator-i;ascii-numeric",
   CUS"copy",
 #ifdef ENCODED_CHARACTER
@@ -283,7 +283,7 @@ Returns
  -1           syntax error
 */


-int
+static int
check_mail_address(struct Sieve * filter, const gstring * address)
{
int start, end, domain;
@@ -1883,20 +1883,11 @@ static int
parse_matchtype(struct Sieve *filter, enum MatchType *m)
{
if (parse_identifier(filter, CUS ":is") == 1)
-{
- *m = MATCH_IS;
- return 1;
-}
+ { *m = MATCH_IS; return 1; }
else if (parse_identifier(filter, CUS ":contains") == 1)
-{
- *m = MATCH_CONTAINS;
- return 1;
-}
+ { *m = MATCH_CONTAINS; return 1; }
else if (parse_identifier(filter, CUS ":matches") == 1)
-{
- *m = MATCH_MATCHES;
- return 1;
-}
+ { *m = MATCH_MATCHES; return 1; }
else return 0;
}

@@ -3615,3 +3606,34 @@ expand_level--;
 DEBUG(D_route) debug_printf_indent("Sieve: end of processing\n");
 return r;
 }
+
+
+/* Module API: print list of supported sieve extensions to given stream */
+static void
+sieve_extensions(FILE * fp)
+{
+for (const uschar ** pp = exim_sieve_extension_list; *pp; ++pp)
+  fprintf(fp, "%s\n", *pp);
+}
+
+
+/******************************************************************************/
+/* Module API */
+
+static void * sieve_functions[] = {
+  [SIEVE_INTERPRET] =    sieve_interpret,
+  [SIEVE_EXTENSIONS] =    sieve_extensions,
+};
+
+misc_module_info sieve_filter_module_info =
+{
+  .name =        US"sieve_filter",
+# ifdef DYNLOOKUP
+  .dyn_magic =        MISC_MODULE_MAGIC,
+# endif
+
+  .functions =        sieve_functions,
+  .functions_count =    nelem(sieve_functions),
+};
+
+/* End of sieve_filter.c */
diff --git a/src/src/miscmods/sieve_filter_api.h b/src/src/miscmods/sieve_filter_api.h
new file mode 100644
index 000000000..42294c5ae
--- /dev/null
+++ b/src/src/miscmods/sieve_filter_api.h
@@ -0,0 +1,15 @@
+/*************************************************
+*     Exim - an Internet mail transport agent    *
+*************************************************/
+
+/* Copyright (c) The Exim Maintainers 2024 */
+/* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/* API definitions for the sieve_filter module */
+
+
+/* Function table entry numbers */
+
+#define    SIEVE_INTERPRET        0
+#define SIEVE_EXTENSIONS    1
diff --git a/src/src/rda.c b/src/src/rda.c
index 8289ab084..3e3a0cf83 100644
--- a/src/src/rda.c
+++ b/src/src/rda.c
@@ -388,16 +388,27 @@ if (*filtertype != FILTER_FORWARD)
       *error = US"Exim filtering not enabled";
       return FF_ERROR;
       }
+/*XXX*/
     frc = filter_interpret(data, options, generated, error);
     }
   else
     {
+    const misc_module_info * mi;
+    typedef int (*fn_t)(const uschar *, int, const sieve_block *,
+               address_item **, uschar **);
+
     if (options & RDO_SIEVE_FILTER)
       {
       *error = US"Sieve filtering not enabled";
       return FF_ERROR;
       }
-    frc = sieve_interpret(data, options, sieve, generated, error);
+    if (!(mi = misc_mod_find(US"sieve_filter", NULL)))
+      {
+      *error = US"Sieve filtering not available";
+      return FF_ERROR;
+      }
+    frc = (((fn_t *) mi->functions)[SIEVE_INTERPRET])
+                      (data, options, sieve, generated, error);
     }


expand_forbid = old_expand_forbid;
diff --git a/test/aux-fixed/0427.message b/test/aux-fixed/4160.message
similarity index 100%
rename from test/aux-fixed/0427.message
rename to test/aux-fixed/4160.message
diff --git a/test/aux-fixed/0427.message2 b/test/aux-fixed/4160.message2
similarity index 100%
rename from test/aux-fixed/0427.message2
rename to test/aux-fixed/4160.message2
diff --git a/test/aux-fixed/0427.message3 b/test/aux-fixed/4160.message3
similarity index 100%
rename from test/aux-fixed/0427.message3
rename to test/aux-fixed/4160.message3
diff --git a/test/aux-fixed/0506.sieve-filter b/test/aux-fixed/4162.sieve-filter
similarity index 100%
rename from test/aux-fixed/0506.sieve-filter
rename to test/aux-fixed/4162.sieve-filter
diff --git a/test/aux-fixed/0950.sieve b/test/aux-fixed/4163.sieve
similarity index 100%
rename from test/aux-fixed/0950.sieve
rename to test/aux-fixed/4163.sieve
diff --git a/test/confs/0427 b/test/confs/4160
similarity index 87%
rename from test/confs/0427
rename to test/confs/4160
index cdbc8ae3e..019476a48 100644
--- a/test/confs/0427
+++ b/test/confs/4160
@@ -1,4 +1,4 @@
-# Exim test configuration 0427
+# Exim test configuration 4160

.include DIR/aux-var/std_conf_prefix

diff --git a/test/confs/0428 b/test/confs/4161
similarity index 99%
rename from test/confs/0428
rename to test/confs/4161
index 0f6614bcf..f24502a83 100644
--- a/test/confs/0428
+++ b/test/confs/4161
@@ -1,4 +1,4 @@
-# Exim test configuration 0428
+# Exim test configuration 4161

.include DIR/aux-var/std_conf_prefix

diff --git a/test/confs/4162 b/test/confs/4162
new file mode 100644
index 000000000..76045b7ca
--- /dev/null
+++ b/test/confs/4162
@@ -0,0 +1,32 @@
+# Exim test configuration 4162
+
+ALLOW=allow_filter
+FORBID=
+
+.include DIR/aux-var/std_conf_prefix
+
+primary_hostname = myhost.test.ex
+
+# ----- Main settings -----
+
+log_selector = +queue_time_overall
+
+# ----- Routers -----
+
+begin routers
+
+r1:
+  driver = redirect
+  user = EXIMUSER
+  ALLOW
+  FORBID
+  file = ${lookup {TESTNUM.$local_part} dsearch,ret=full {DIR/aux-fixed} {$value}fail}
+
+
+# ----- Retry -----
+
+begin retry
+
+* *    F,1d,1h
+
+# End
diff --git a/test/confs/0950 b/test/confs/4163
similarity index 96%
rename from test/confs/0950
rename to test/confs/4163
index f75e2c4d4..3b4f6df79 100644
--- a/test/confs/0950
+++ b/test/confs/4163
@@ -1,4 +1,4 @@
-# Exim test configuration 0950
+# Exim test configuration 4163


SERVER=

diff --git a/test/log/0506 b/test/log/0506
index db961727b..1e94ac0f8 100644
--- a/test/log/0506
+++ b/test/log/0506
@@ -1,13 +1,10 @@
1999-03-02 09:44:33 10HmaX-000000005vi-0000 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaX-000000005vi-0000 => discarded <exim-filter@???> R=r1
-1999-03-02 09:44:33 10HmaX-000000005vi-0000 => discarded <sieve-filter@???> R=r1
1999-03-02 09:44:33 10HmaX-000000005vi-0000 Completed QT=qqs
1999-03-02 09:44:33 10HmaY-000000005vi-0000 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaY-000000005vi-0000 => discarded <exim-filter@???> R=r1
-1999-03-02 09:44:33 10HmaY-000000005vi-0000 == sieve-filter@??? R=r1 defer (-17): error in filter file: Sieve filtering not enabled
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 Completed QT=qqs
1999-03-02 09:44:33 10HmaZ-000000005vi-0000 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaZ-000000005vi-0000 == exim-filter@??? R=r1 defer (-17): error in filter file: Exim filtering not enabled
-1999-03-02 09:44:33 10HmaZ-000000005vi-0000 => discarded <sieve-filter@???> R=r1
1999-03-02 09:44:33 10HmbA-000000005vi-0000 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmbA-000000005vi-0000 == exim-filter@??? R=r1 defer (-17): error in filter file: filtering not enabled
-1999-03-02 09:44:33 10HmbA-000000005vi-0000 == sieve-filter@??? R=r1 defer (-17): error in filter file: filtering not enabled
diff --git a/test/log/0428 b/test/log/4161
similarity index 100%
rename from test/log/0428
rename to test/log/4161
diff --git a/test/log/0506 b/test/log/4162
similarity index 66%
copy from test/log/0506
copy to test/log/4162
index db961727b..5d11b2a8d 100644
--- a/test/log/0506
+++ b/test/log/4162
@@ -1,13 +1,10 @@
1999-03-02 09:44:33 10HmaX-000000005vi-0000 <= CALLER@??? U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmaX-000000005vi-0000 => discarded <exim-filter@???> R=r1
1999-03-02 09:44:33 10HmaX-000000005vi-0000 => discarded <sieve-filter@???> R=r1
1999-03-02 09:44:33 10HmaX-000000005vi-0000 Completed QT=qqs
1999-03-02 09:44:33 10HmaY-000000005vi-0000 <= CALLER@??? U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmaY-000000005vi-0000 => discarded <exim-filter@???> R=r1
1999-03-02 09:44:33 10HmaY-000000005vi-0000 == sieve-filter@??? R=r1 defer (-17): error in filter file: Sieve filtering not enabled
1999-03-02 09:44:33 10HmaZ-000000005vi-0000 <= CALLER@??? U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmaZ-000000005vi-0000 == exim-filter@??? R=r1 defer (-17): error in filter file: Exim filtering not enabled
1999-03-02 09:44:33 10HmaZ-000000005vi-0000 => discarded <sieve-filter@???> R=r1
+1999-03-02 09:44:33 10HmaZ-000000005vi-0000 Completed QT=qqs
1999-03-02 09:44:33 10HmbA-000000005vi-0000 <= CALLER@??? U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmbA-000000005vi-0000 == exim-filter@??? R=r1 defer (-17): error in filter file: filtering not enabled
1999-03-02 09:44:33 10HmbA-000000005vi-0000 == sieve-filter@??? R=r1 defer (-17): error in filter file: filtering not enabled
diff --git a/test/log/0950 b/test/log/4163
similarity index 100%
rename from test/log/0950
rename to test/log/4163
diff --git a/test/mail/0428.CALLER b/test/mail/4161.CALLER
similarity index 100%
rename from test/mail/0428.CALLER
rename to test/mail/4161.CALLER
diff --git a/test/mail/0428.inbox.JUNK b/test/mail/4161.inbox.JUNK
similarity index 100%
rename from test/mail/0428.inbox.JUNK
rename to test/mail/4161.inbox.JUNK
diff --git a/test/mail/0428.inbox.changed b/test/mail/4161.inbox.changed
similarity index 100%
rename from test/mail/0428.inbox.changed
rename to test/mail/4161.inbox.changed
diff --git a/test/mail/0428.redirected b/test/mail/4161.redirected
similarity index 100%
rename from test/mail/0428.redirected
rename to test/mail/4161.redirected
diff --git a/test/mail/0428.someone b/test/mail/4161.someone
similarity index 100%
rename from test/mail/0428.someone
rename to test/mail/4161.someone
diff --git a/test/mail/0428.userx b/test/mail/4161.userx
similarity index 100%
rename from test/mail/0428.userx
rename to test/mail/4161.userx
diff --git a/test/mail/0428.userx-extra b/test/mail/4161.userx-extra
similarity index 100%
rename from test/mail/0428.userx-extra
rename to test/mail/4161.userx-extra
diff --git a/test/mail/0428.userx-sawsuffix b/test/mail/4161.userx-sawsuffix
similarity index 100%
rename from test/mail/0428.userx-sawsuffix
rename to test/mail/4161.userx-sawsuffix
diff --git a/test/mail/0428.userx13 b/test/mail/4161.userx13
similarity index 100%
rename from test/mail/0428.userx13
rename to test/mail/4161.userx13
diff --git a/test/mail/0428.userx14 b/test/mail/4161.userx14
similarity index 100%
rename from test/mail/0428.userx14
rename to test/mail/4161.userx14
diff --git a/test/mail/0428.userx9 b/test/mail/4161.userx9
similarity index 100%
rename from test/mail/0428.userx9
rename to test/mail/4161.userx9
diff --git a/test/mail/0950.CALLER b/test/mail/4163.CALLER
similarity index 100%
rename from test/mail/0950.CALLER
rename to test/mail/4163.CALLER
diff --git a/test/mail/0950.myfolder b/test/mail/4163.myfolder
similarity index 100%
rename from test/mail/0950.myfolder
rename to test/mail/4163.myfolder
diff --git a/test/scripts/0000-Basic/0506 b/test/scripts/0000-Basic/0506
index ed1d7bdff..4f388bb8c 100644
--- a/test/scripts/0000-Basic/0506
+++ b/test/scripts/0000-Basic/0506
@@ -1,10 +1,10 @@
-# forbid_sieve_filter and forbid_exim_filter
-exim -odi sieve-filter@??? exim-filter@???
+# forbid_exim_filter
+exim -odi exim-filter@???
****
-exim -DFORBID=forbid_sieve_filter -odi sieve-filter@??? exim-filter@???
+exim -DFORBID=forbid_sieve_filter -odi exim-filter@???
****
-exim -DFORBID=forbid_exim_filter -odi sieve-filter@??? exim-filter@???
+exim -DFORBID=forbid_exim_filter -odi exim-filter@???
****
-exim -DALLOW= -odi sieve-filter@??? exim-filter@???
+exim -DALLOW= -odi exim-filter@???
****
no_msglog_check
diff --git a/test/scripts/0000-Basic/0427 b/test/scripts/4160-sieve-filter/4160
similarity index 100%
rename from test/scripts/0000-Basic/0427
rename to test/scripts/4160-sieve-filter/4160
diff --git a/test/scripts/0000-Basic/0428 b/test/scripts/4160-sieve-filter/4161
similarity index 100%
rename from test/scripts/0000-Basic/0428
rename to test/scripts/4160-sieve-filter/4161
diff --git a/test/scripts/4160-sieve-filter/4162 b/test/scripts/4160-sieve-filter/4162
new file mode 100644
index 000000000..156a73ba4
--- /dev/null
+++ b/test/scripts/4160-sieve-filter/4162
@@ -0,0 +1,10 @@
+# forbid_sieve_filter
+exim -odi sieve-filter@???
+****
+exim -DFORBID=forbid_sieve_filter -odi sieve-filter@???
+****
+exim -DFORBID=forbid_exim_filter -odi sieve-filter@???
+****
+exim -DALLOW= -odi sieve-filter@???
+****
+no_msglog_check
diff --git a/test/scripts/0000-Basic/0950 b/test/scripts/4160-sieve-filter/4163
similarity index 100%
rename from test/scripts/0000-Basic/0950
rename to test/scripts/4160-sieve-filter/4163
diff --git a/test/scripts/4160-sieve-filter/REQUIRES b/test/scripts/4160-sieve-filter/REQUIRES
new file mode 100644
index 000000000..dd2bec191
--- /dev/null
+++ b/test/scripts/4160-sieve-filter/REQUIRES
@@ -0,0 +1 @@
+support Sieve_filter
diff --git a/test/stdout/0427 b/test/stdout/4160
similarity index 100%
rename from test/stdout/0427
rename to test/stdout/4160
diff --git a/test/stdout/0950 b/test/stdout/4163
similarity index 100%
rename from test/stdout/0950
rename to test/stdout/4163

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/