diff --git a/src/plugins/imapsieve/Makefile.am b/src/plugins/imapsieve/Makefile.am index 6a22cd15cc9a882680c0533dc646c4122845d7fb..2f595eb2d16a399c6026fb75c7d6fb29e9b6fc99 100644 --- a/src/plugins/imapsieve/Makefile.am +++ b/src/plugins/imapsieve/Makefile.am @@ -11,6 +11,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib-sieve \ -I$(top_srcdir)/src/lib-sieve/util \ -I$(top_srcdir)/src/lib-sieve/plugins/environment \ + -I$(top_srcdir)/src/lib-managesieve \ $(LIBDOVECOT_IMAP_INCLUDE) \ $(LIBDOVECOT_LDA_INCLUDE) \ $(LIBDOVECOT_INCLUDE) \ @@ -24,7 +25,8 @@ lib95_imap_sieve_plugin_la_SOURCES = \ imap-sieve-storage.c \ imap-sieve-plugin.c lib95_imap_sieve_plugin_la_LIBADD = \ - $(top_builddir)/src/lib-sieve/libdovecot-sieve.la + $(top_builddir)/src/lib-sieve/libdovecot-sieve.la \ + $(top_builddir)/src/lib-managesieve/libdovecot-managesieve.la lib90_sieve_imapsieve_plugin_la_SOURCES = \ ext-imapsieve.c \ diff --git a/src/plugins/imapsieve/imap-sieve-settings.c b/src/plugins/imapsieve/imap-sieve-settings.c index 19ca54042da6f951f94900442f997e5940f9080b..2291cf277f52edd3695a8c33d06270cddbb34efc 100644 --- a/src/plugins/imapsieve/imap-sieve-settings.c +++ b/src/plugins/imapsieve/imap-sieve-settings.c @@ -6,6 +6,7 @@ #include "settings.h" #include "settings-parser.h" +#include "managesieve-url.h" #include "imap-sieve-settings.h" #undef DEF @@ -48,10 +49,14 @@ imap_sieve_settings_check(void *_set, pool_t pool ATTR_UNUSED, const char **error_r) { struct imap_sieve_settings *set = _set; + const char *error; - if (*set->url != '\0' && !str_begins_icase_with(set->url, "sieve:")) { - *error_r = "Invalid URL for imapsieve_url setting: " - "Not a Sieve URL"; + if (*set->url != '\0' && + managesieve_url_parse(set->url, 0, pool_datastack_create(), + NULL, &error) < 0) { + *error_r = t_strdup_printf( + "Invalid URL for imapsieve_url setting: %s", + set->url); return FALSE; } diff --git a/src/plugins/settings/Makefile.am b/src/plugins/settings/Makefile.am index 4f6c810e70a770709846df7a2c9a63a633819cf5..b55bb834e2b71b116a046453a6aab44cd2c40626 100644 --- a/src/plugins/settings/Makefile.am +++ b/src/plugins/settings/Makefile.am @@ -4,6 +4,7 @@ AM_CPPFLAGS = \ $(LIBDOVECOT_INCLUDE) \ -I$(top_srcdir) \ -I$(top_srcdir)/src/lib-sieve \ + -I$(top_srcdir)/src/lib-managesieve \ -DSETTINGS_PLUGIN libpigeonhole_settings_la_LDFLAGS = -module -avoid-version @@ -15,9 +16,11 @@ libpigeonhole_settings_la_SOURCES = \ pigeonhole-settings-dynamic.c \ pigeonhole-settings.c libpigeonhole_settings_la_LIBADD = \ - $(top_builddir)/src/lib-sieve/libdovecot-sieve.la + $(top_builddir)/src/lib-sieve/libdovecot-sieve.la \ + $(top_builddir)/src/lib-managesieve/libdovecot-managesieve.la libpigeonhole_settings_la_DEPENDENCIES = \ - $(top_builddir)/src/lib-sieve/libdovecot-sieve.la + $(top_builddir)/src/lib-sieve/libdovecot-sieve.la \ + $(top_builddir)/src/lib-managesieve/libdovecot-managesieve.la noinst_HEADERS = \ pigeonhole-settings.h diff --git a/src/plugins/settings/settings-get.pl b/src/plugins/settings/settings-get.pl index d8b0fb8a359dcdc9f38d44c6f11f24deab5c52ba..edf7e8aa263e502bb941672fa546a9611c9a6d53 100755 --- a/src/plugins/settings/settings-get.pl +++ b/src/plugins/settings/settings-get.pl @@ -26,6 +26,7 @@ print '#include "message-header-parser.h"'."\n"; print '#include "sieve-common.h"'."\n"; print '#include "sieve-limits.h"'."\n"; print '#include "sieve-address-source.h"'."\n"; +print '#include "managesieve-url.h"'."\n"; print '#include "pigeonhole-settings.h"'."\n"; print '#include <unistd.h>'."\n"; print '#define CONFIG_BINARY'."\n";