dovecot-2.2-pigeonhole: lib-sieve: include extension: didn't get...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Thu Sep 20 02:22:40 EEST 2012
details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/ead2e76425bf
changeset: 1671:ead2e76425bf
user: Stephan Bosch <stephan at rename-it.nl>
date: Thu Sep 20 01:22:29 2012 +0200
description:
lib-sieve: include extension: didn't get semantics of mixing optional and non-optional includes for the same script quite right.
diffstat:
src/lib-sieve/plugins/include/ext-include-binary.c | 5 ++---
src/lib-sieve/plugins/include/ext-include-common.c | 16 +++++++++++++---
2 files changed, 15 insertions(+), 6 deletions(-)
diffs (63 lines):
diff -r 3d3d8549c834 -r ead2e76425bf src/lib-sieve/plugins/include/ext-include-binary.c
--- a/src/lib-sieve/plugins/include/ext-include-binary.c Thu Sep 20 00:51:09 2012 +0200
+++ b/src/lib-sieve/plugins/include/ext-include-binary.c Thu Sep 20 01:22:29 2012 +0200
@@ -337,12 +337,11 @@
return FALSE;
}
- if ( (flags & EXT_INCLUDE_FLAG_OPTIONAL) == 0 &&
- (flags & EXT_INCLUDE_FLAG_MISSING_AT_UPLOAD) == 0) {
+ if ( (flags & EXT_INCLUDE_FLAG_OPTIONAL) == 0 ) {
/* Not supposed to be missing, recompile */
if ( svinst->debug ) {
sieve_sys_debug(svinst,
- "include: script '%s' contained in binary %s is now missing, "
+ "include: script '%s' included in binary %s is missing, "
"so recompile", str_c(script_name), sieve_binary_path(sbin));
}
sieve_script_unref(&script);
diff -r 3d3d8549c834 -r ead2e76425bf src/lib-sieve/plugins/include/ext-include-common.c
--- a/src/lib-sieve/plugins/include/ext-include-common.c Thu Sep 20 00:51:09 2012 +0200
+++ b/src/lib-sieve/plugins/include/ext-include-common.c Thu Sep 20 01:22:29 2012 +0200
@@ -516,11 +516,19 @@
binctx = ext_include_binary_init(this_ext, sbin, cgenv->ast);
/* Is the script already compiled into the current binary? */
- if ( !ext_include_binary_script_is_included(binctx, script, &included) )
- {
+ if ( ext_include_binary_script_is_included(binctx, script, &included) ) {
+ /* Yes, only update flags */
+ if ( (flags & EXT_INCLUDE_FLAG_OPTIONAL) == 0 )
+ flags &= ~EXT_INCLUDE_FLAG_OPTIONAL;
+ if ( (flags & EXT_INCLUDE_FLAG_ONCE) == 0 ) // for consistency
+ flags &= ~EXT_INCLUDE_FLAG_ONCE;
+
+ } else {
const char *script_name = sieve_script_name(script);
enum sieve_compile_flags cpflags = cgenv->flags;
+ /* No, include new script */
+
/* Check whether include limit is exceeded */
if ( ext_include_binary_script_get_count(binctx) >=
ext_ctx->max_includes ) {
@@ -530,9 +538,10 @@
return -1;
}
- /* No, allocate a new block in the binary and mark the script as included.
+ /* Allocate a new block in the binary and mark the script as included.
*/
if ( !sieve_script_is_open(script) ) {
+ /* Just making an empty entry to mark a missing script */
i_assert((flags & EXT_INCLUDE_FLAG_MISSING_AT_UPLOAD) != 0 ||
(flags & EXT_INCLUDE_FLAG_OPTIONAL) != 0);
included = ext_include_binary_script_include
@@ -542,6 +551,7 @@
} else {
struct sieve_binary_block *inc_block = sieve_binary_block_create(sbin);
+ /* Real include */
included = ext_include_binary_script_include
(binctx, location, flags, script, inc_block);
More information about the dovecot-cvs
mailing list