diff --git a/src/lib-sieve/sieve-binary-dumper.c b/src/lib-sieve/sieve-binary-dumper.c index 91ca775a0e92fc9d59bab4097c3fd6b03d66263a..2c64bae7b7d8e988b0b527eb1497e134429026f2 100644 --- a/src/lib-sieve/sieve-binary-dumper.c +++ b/src/lib-sieve/sieve-binary-dumper.c @@ -124,4 +124,7 @@ void sieve_binary_dumper_run } } } + + /* Finish with empty line */ + sieve_binary_dumpf(denv, "\n"); } diff --git a/src/lib-sieve/sieve-code-dumper.c b/src/lib-sieve/sieve-code-dumper.c index e6aa93ee327315e2f1ca33c8e0fccc9ba0325c75..173faa4158d6d717ac2f61a1b08a89c3845f06cf 100644 --- a/src/lib-sieve/sieve-code-dumper.c +++ b/src/lib-sieve/sieve-code-dumper.c @@ -160,7 +160,7 @@ static bool sieve_code_dumper_print_operation opcode_string = sieve_operation_read_string(denv->sbin, &address); if ( opcode_string != NULL ) - sieve_code_dumpf(denv, "Unknown upcode: %s", opcode_string); + sieve_code_dumpf(denv, "Unknown opcode: %s", opcode_string); else sieve_code_dumpf(denv, "Failed to read opcode."); return FALSE; diff --git a/src/lib-sieve/sieve-extensions-private.h b/src/lib-sieve/sieve-extensions-private.h index 2ebc0e9e95a292859fcd30dca80c038103e8e9f6..0131c2ce3eb643d9916216745a71cee9769ceb7f 100644 --- a/src/lib-sieve/sieve-extensions-private.h +++ b/src/lib-sieve/sieve-extensions-private.h @@ -37,10 +37,10 @@ static inline sieve_size_t _sieve_extension_emit_obj if ( reg->count > 1 ) (void) sieve_binary_emit_byte(sbin, obj_code); - + return address; } - + return sieve_binary_emit_byte(sbin, obj_code); } #define sieve_extension_emit_obj(sbin, defreg, obj, reg, ext_id)\ @@ -94,8 +94,10 @@ static inline const char *sieve_extension_read_obj_string unsigned int code = 0; const struct sieve_extension_obj_registry *reg; - if ( (reg=get_reg_func(sbin, obj_code - defreg->count)) == NULL || - reg->count == 0 ) + if ( (reg=get_reg_func(sbin, obj_code - defreg->count)) == NULL ) + return t_strdup_printf("[EXT: %d; NO REGISTRY]", obj_code); + + if ( reg->count == 0 ) return t_strdup_printf("[EXT: %d; NO CODES!]", obj_code); if ( reg->count > 1) diff --git a/src/lib-sieve/sieve-extensions.c b/src/lib-sieve/sieve-extensions.c index 8f7875ae6edd186d7fc5539887790c492eed6f9f..627fd7d90ebb0d37c9af2117978c28b65992ec52 100644 --- a/src/lib-sieve/sieve-extensions.c +++ b/src/lib-sieve/sieve-extensions.c @@ -26,20 +26,18 @@ const struct sieve_extension *sieve_preloaded_extensions[] = { const unsigned int sieve_preloaded_extensions_count = N_ELEMENTS(sieve_preloaded_extensions); -ARRAY_DEFINE(sieve_preloaded_ext_ids, int); - /* Dummy extensions */ static const struct sieve_extension comparator_i_octet_extension = { "comparator-i;octet", - NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, SIEVE_EXT_DEFINE_NO_OPERATIONS, SIEVE_EXT_DEFINE_NO_OPERANDS }; static const struct sieve_extension comparator_i_ascii_casemap_extension = { "comparator-i;ascii-casemap", - NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, SIEVE_EXT_DEFINE_NO_OPERATIONS, SIEVE_EXT_DEFINE_NO_OPERANDS }; @@ -92,44 +90,21 @@ const unsigned int sieve_core_extensions_count = bool sieve_extensions_init(const char *sieve_plugins ATTR_UNUSED) { unsigned int i; - int ext_id; sieve_extensions_init_registry(); - i_array_init(&sieve_preloaded_ext_ids, sieve_core_extensions_count); - /* Pre-load core extensions */ for ( i = 0; i < sieve_core_extensions_count; i++ ) { - ext_id = sieve_extension_register(sieve_core_extensions[i]); - - array_append(&sieve_preloaded_ext_ids, &ext_id, 1); - - if ( sieve_core_extensions[i]->load != NULL && - !sieve_core_extensions[i]->load(ext_id) ) { - i_error("sieve: failed to load '%s' extension support.", - sieve_core_extensions[i]->name); - return FALSE; - } + (void) sieve_extension_register(sieve_core_extensions[i]); } - ext_id = -1; - array_append(&sieve_preloaded_ext_ids, &ext_id, 1); - /* More extensions can be added through plugins */ - /* FIXME */ return TRUE; } -const int *sieve_extensions_get_preloaded_ext_ids(void) -{ - return array_idx(&sieve_preloaded_ext_ids, 0); -} - void sieve_extensions_deinit(void) -{ - array_free(&sieve_preloaded_ext_ids); - +{ sieve_extensions_deinit_registry(); } @@ -163,6 +138,11 @@ int sieve_extension_register(const struct sieve_extension *extension) hash_insert(extension_index, (void *) extension->name, (void *) ereg); + if ( extension->load != NULL && !extension->load(ext_id) ) { + i_error("sieve: failed to load '%s' extension support.", extension->name); + return -1; + } + return ext_id; } diff --git a/src/testsuite/cmd-test-message.c b/src/testsuite/cmd-test-message.c index 25f7e79c576d9628dbc446a7145246d5b0c39be4..b8178407ff1fc7edb0548d2b727b67a3e0bee05d 100644 --- a/src/testsuite/cmd-test-message.c +++ b/src/testsuite/cmd-test-message.c @@ -32,7 +32,7 @@ static bool cmd_test_message_validate static bool cmd_test_message_generate (struct sieve_generator *generator, struct sieve_command_context *ctx); -/* Redirect command +/* Test command * * Syntax * redirect <address: string> @@ -48,7 +48,7 @@ const struct sieve_command cmd_test_message = { NULL }; -/* Redirect operation */ +/* Test operation */ const struct sieve_operation test_message_operation = { "TEST_MESSAGE", @@ -115,7 +115,6 @@ static bool cmd_test_message_operation_execute const struct sieve_runtime_env *renv, sieve_size_t *address) { string_t *message; - int ret = 0; t_push(); @@ -127,7 +126,8 @@ static bool cmd_test_message_operation_execute printf(">> TEST MESSAGE \"%s\"\n", str_c(message)); t_pop(); - return (ret >= 0); + + return TRUE; } diff --git a/src/testsuite/ext-testsuite.c b/src/testsuite/ext-testsuite.c index d4facaf75982cb2233f8c2dce205a46cd2d18564..5e3f717b7ba089d3d704c59f5711569e3f9f1f77 100644 --- a/src/testsuite/ext-testsuite.c +++ b/src/testsuite/ext-testsuite.c @@ -45,7 +45,7 @@ const struct sieve_extension testsuite_extension = { "vnd.dovecot.testsuite", ext_testsuite_load, ext_testsuite_validator_load, - NULL, + NULL, NULL, ext_testsuite_binary_load, NULL, SIEVE_EXT_DEFINE_OPERATION(test_message_operation), diff --git a/src/testsuite/testsuite b/src/testsuite/testsuite index e253c03ac8c4eb8e632e7fd08f03f5fbd2606f19..8839e4a4592d78ab5f1d65331925e8cb2b79c8b7 100755 Binary files a/src/testsuite/testsuite and b/src/testsuite/testsuite differ diff --git a/src/testsuite/testsuite.c b/src/testsuite/testsuite.c index bb7c6184d483383c11ad2d0a8e84afd8ab1a51f2..d2ac044ad5fde5d85a22e5247e5e2a0045615192 100644 --- a/src/testsuite/testsuite.c +++ b/src/testsuite/testsuite.c @@ -65,7 +65,7 @@ static void testsuite_init(void) if ( !sieve_init("") ) i_fatal("Failed to initialize sieve implementation\n"); - sieve_extension_register(&testsuite_extension); + (void) sieve_extension_register(&testsuite_extension); } static void testsuite_deinit(void)