]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dovecot: Add lib-regex
authorAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 1 Aug 2025 09:17:36 +0000 (12:17 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 29 Aug 2025 08:42:35 +0000 (11:42 +0300)
20 files changed:
configure.ac
src/Makefile.am
src/lib-dcrypt/Makefile.am
src/lib-dict-extra/Makefile.am
src/lib-dict/Makefile.am
src/lib-dns-client/Makefile.am
src/lib-dovecot/Makefile.am
src/lib-fs/Makefile.am
src/lib-http/Makefile.am
src/lib-imap-client/Makefile.am
src/lib-login/Makefile.am
src/lib-master/Makefile.am
src/lib-oauth2/Makefile.am
src/lib-program-client/Makefile.am
src/lib-regex/test-regex.c
src/lib-settings/Makefile.am
src/lib-smtp/Makefile.am
src/lib-ssl-iostream/Makefile.am
src/lib-var-expand-crypt/Makefile.am
src/lib-var-expand/Makefile.am

index c113617f5e7acab0791950a1eb1e8686f3395b53..0f56c3036cc8b22356df7db28fdc49012d3af419 100644 (file)
@@ -595,6 +595,7 @@ LIBDOVECOT_LA_LIBS='\
        $(top_builddir)/src/lib-ssl-iostream/libssl_iostream.la \
        $(top_builddir)/src/lib-dcrypt/libdcrypt.la \
        $(top_builddir)/src/lib-json/libjson.la \
+       $(top_builddir)/src/lib-regex/libdregex.la \
        $(top_builddir)/src/lib-test/libtest.la \
        $(top_builddir)/src/lib/liblib.la'
 # This is used in dovecot-config, which is grepped in dovecot.m4,
@@ -605,7 +606,7 @@ LIBDOVECOT_LUA=''
 
 if test "$want_shared_libs" = "yes"; then
   LIBDOVECOT_DEPS='$(top_builddir)/src/lib-dovecot/libdovecot.la'
-  LIBDOVECOT="$LIBDOVECOT_DEPS \$(MODULE_LIBS)"
+  LIBDOVECOT="$LIBDOVECOT_DEPS \$(MODULE_LIBS) \$(LIBPCRE_LIBS)"
   LIBDOVECOT_STORAGE_DEPS='$(top_builddir)/src/lib-storage/libdovecot-storage.la $(top_builddir)/src/lib-imap-storage/libimap-storage.la'
   LIBDOVECOT_LOGIN='$(top_builddir)/src/login-common/libdovecot-login.la'
   LIBDOVECOT_LDA='$(top_builddir)/src/lib-lda/libdovecot-lda.la'
@@ -614,7 +615,7 @@ if test "$want_shared_libs" = "yes"; then
   fi
 else
   LIBDOVECOT_DEPS="$LIBDOVECOT_LA_LIBS"
-  LIBDOVECOT="$LIBDOVECOT_DEPS \$(MODULE_LIBS)"
+  LIBDOVECOT="$LIBDOVECOT_DEPS \$(MODULE_LIBS) \$(LIBPCRE_LIBS)"
   LIBDOVECOT_STORAGE_DEPS='$(top_builddir)/src/lib-storage/libstorage.la'
   LIBDOVECOT_LOGIN='$(top_builddir)/src/login-common/liblogin.la'
   LIBDOVECOT_LDA='$(top_builddir)/src/lib-lda/liblda.la'
index 85064133ae02d8b124131a3be1261d57675839b6..8fb76b7fcff362e572d402bf2054d7d7458d82fc 100644 (file)
@@ -11,6 +11,7 @@ endif
 LIBDOVECOT_SUBDIRS = \
        lib-test \
        lib \
+       lib-regex \
        lib-var-expand \
        lib-dns \
        lib-settings \
@@ -44,7 +45,6 @@ SUBDIRS = \
        lib-dovecot \
        $(LIB_LDAP) \
        $(LIB_LUA) \
-       lib-regex \
        lib-language \
        lib-imap-client \
        lib-imap-urlauth \
index b3d85b813a17e52b1fc7a55b0b1fb77a50b2fe66..294730a0b4e93221ddcce462fdab30cd148cd9d2 100644 (file)
@@ -56,6 +56,7 @@ check-local:
 
 LIBDOVECOT_TEST_DEPS = \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-ssl-iostream/libssl_iostream.la \
        ../lib-json/libjson.la \
        ../lib-settings/libsettings.la \
index 83b84504ae672740aa656ee238b0d13fea04ff62..e7b783109abcca38b5e73068f89397f86812c27b 100644 (file)
@@ -35,6 +35,7 @@ test_libs = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib/liblib.la
 
 test_dict_fs_SOURCES = test-dict-fs.c
index 74ce3e481f1e08fda1320bf16f2b93e8ba9b3b75..68539db32f6a87a8d13b29c65b444749cbfa1460 100644 (file)
@@ -57,6 +57,7 @@ test_libs = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la
 
index c16b3d8b57ee909d105249fb7cffba9c37a0fcb3..2e882d80ab1538aead152f01c4ddd6569f0ec332 100644 (file)
@@ -27,6 +27,7 @@ test_libs = \
        ../lib-dns/libdns.la  \
        ../lib-test/libtest.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib/liblib.la
 
 test_dns_lookup_SOURCES = test-dns-lookup.c
index b39cf26720366679fd3150bf68f2684fe68d4f1e..d22c9bb0aca14aff231637bd6b5db576a7084d7e 100644 (file)
@@ -5,6 +5,7 @@ libdovecot_la_SOURCES =
 libdovecot_la_LIBADD = \
        $(LIBDOVECOT_LA_LIBS) \
        $(MODULE_LIBS) \
+       $(LIBPCRE_LIBS) \
        $(RELRO_LDFLAGS)
 
 libdovecot_la_DEPENDENCIES = $(LIBDOVECOT_LA_LIBS)
index c663688896c742d8b4906d5354767253168ef7d4..dc129f32bf4d548413bbbc5d3390341691efeeaa 100644 (file)
@@ -54,6 +54,7 @@ test_deps = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la
 
index a492e168895a9cb7d89f5384a7e0a16904a2433a..0d4328b0bf47b293123626f5d341c7447a0dbcc7 100644 (file)
@@ -83,6 +83,7 @@ test_libs = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la \
        $(MODULE_LIBS)
@@ -93,6 +94,7 @@ test_deps = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib/liblib.la
 
 test_http_url_SOURCES = test-http-url.c
index 6c6a84bc6e6797778ca44d51ec4d8421063cd344..0e4b7c6ea411471205de1e70446de3eae3b059fc 100644 (file)
@@ -47,6 +47,7 @@ test_deps = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la
 
index 08a2f30ee11be8c36db39d052f982b130ed00c8e..c12e47d1ead5323911912fb3d76a98b0ac408d76 100644 (file)
@@ -37,6 +37,7 @@ test_libs = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la \
        $(MODULE_LIBS)
@@ -51,6 +52,7 @@ test_deps = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la
 
index f4b22d1484705420afc6aefd4946d9ecd1f44936..fbc748b222dbc62d8d45d59473cca5eeffa0b9b9 100644 (file)
@@ -57,6 +57,7 @@ test_deps = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib-dns-client/libdns-client.la  \
        ../lib-dns/libdns.la \
index 3f5c577e19617d95b820bdf753b82fec02f9837e..f5172198aa3707c367d0ef414c885df2ee3a3557 100644 (file)
@@ -47,6 +47,7 @@ test_libs = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la \
        $(MODULE_LIBS)
@@ -65,6 +66,7 @@ test_deps = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la
 
index b2dd804463450aaeef4fb5c803846c8a20f97b14..c7081b7aa89b7188c1df8daf2e02e96ec5642904 100644 (file)
@@ -40,6 +40,7 @@ test_libs = \
        ../lib-dns/libdns.la \
        ../lib-charset/libcharset.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib/liblib.la \
        $(MODULE_LIBS)
 
index ef2d3bd8cf270bef7b47d24c1db998e9c74c45c5..10b393e409ef8a3faac6092f9dfda134d94d8e02 100644 (file)
@@ -112,6 +112,13 @@ static void test_dregex_match(void)
                MATCH_CASE("^.{2,3}$", "hel"),
                MATCH_CASE("^.+$", "hello"),
                MATCH_CASE_FULL("^.+$", "", NULL, 0, 0),
+               /* Groups */
+               MATCH_CASE(
+                       "the (.*) jumped over a (.*) dog",
+                       "the fox jumped over a lazy dog"
+               ),
+               MATCH_CASE("the (a) of (b)", "the a of b"),
+               MATCH_CASE("the \\(a\\) of \\(b\\)", "the (a) of (b)"),
                /* Alternation and grouping */
                MATCH_CASE("^(hello|world)$", "hello"),
                MATCH_CASE("^(hello|world)$", "world"),
@@ -175,6 +182,14 @@ static void test_dregex_match(void)
                        0,
                        0
                ),
+               {
+                       .pattern = "the (.*) jumps off the (.*)",
+                       .subject = "the cat jumps off the table",
+                       .error = NULL,
+                       .flags = (DREGEX_ICASE|DREGEX_ASCII_ONLY),
+                       .compile_ret = 0,
+                       .match_ret = 1,
+               },
                MATCH_CASE("<(.*)@", "<simple-list@test.invalid>"),
                MATCH_CASE("^\\[(.*)\\] (.*)$", "[acme-users] [fwd]: hello, world"),
                MATCH_CASE_END
index 5154ddf93e0a75110af049e2fb08bb9d8d484d3b..25616a733367750bd67193edae9369fa193c8c3c 100644 (file)
@@ -40,6 +40,7 @@ noinst_PROGRAMS = $(test_programs)
 test_libs = \
        libsettings.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-dns/libdns.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la
index a93bee4d5187e61341153270aca0ffda4e9d1fd3..a281f5bd0cdfe72a45749c35e8cd0ba6308b8894 100644 (file)
@@ -118,6 +118,7 @@ test_libs = \
        ../lib-otp/libotp.la \
        ../lib-json/libjson.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la \
        $(MODULE_LIBS)
@@ -138,6 +139,7 @@ test_deps = \
        ../lib-auth/libauth.la \
        ../lib-json/libjson.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la
 
index 0a25aa8e663d17971828f1cefd190eef504e7a28..b1c680e77ea06b0ffafc6ae9a2d2e6b900294713 100644 (file)
@@ -47,6 +47,7 @@ test_libs = \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la
 
index e56727fc9cf64398f30c43f4421d6f9f3b512906..74bc05a79961d6ad40bd234f3a3024ed1f19cbcf 100644 (file)
@@ -25,6 +25,7 @@ test_libs = \
        $(module_LTLIBRARIES) \
        ../lib-dcrypt/libdcrypt.la \
        ../lib-var-expand/libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-json/libjson.la \
        ../lib-settings/libsettings.la \
        ../lib-dns/libdns.la \
index 68c04c521270734eec0c17a351eb625236b8d42a..172057788e87459aa5d06195b156bb9f838af9fc 100644 (file)
@@ -19,6 +19,7 @@ YACC=/bin/false
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/lib \
        -I$(top_srcdir)/src/lib-test \
+       -I$(top_srcdir)/src/lib-regex \
        -Wno-error=unused-function \
        -DVAR_EXPAND_MODULE_DIR=\"$(moduledir)\"
 
@@ -59,6 +60,7 @@ noinst_PROGRAMS = $(test_programs)
 
 test_libs = \
        libvar_expand.la \
+       ../lib-regex/libdregex.la \
        ../lib-test/libtest.la \
        ../lib/liblib.la \
        $(MODULE_LIBS)