Skip to content
Snippets Groups Projects
Commit 30c80502 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Updated README and a few minor cosmetic changes to the code.

parent d2ea3b30
No related branches found
No related tags found
No related merge requests found
......@@ -5,37 +5,47 @@ This package is currently not built for installation. To test the sieve
engine it is currently only useful to execute the binaries in the
src/sieve-bin/ directory:
sievec <sieve-file>:
sievec <sieve-file>
Compiles the script and produces various dumps of intermittent compilation
results. This already works pretty good for all supported features.
sieve_test <sieve-file>:
sieve_test <sieve-file>
Reads mail message from standard input and executes the sieve script to
produce a verdict. Currently only prints an execution dump with the
instructions encountered during execution.
In the directory ./sieve various example are test scripts are bundled.
In the directory ./sieve various example scripts are bundled.
FEATURES
Features
--------
* Well-structured 3-stage compiler; uses dovecot framework and avoids using
lex/yucc.
lex/yucc. Parser doesn't bail on first error, but tries to find more.
* Highly extendable with new sieve capabilities. This keeps the possibility
of plugins in mind. Should provide the necessary infrastructure for at least
all currently known (proposed) extensions.
of plugins in mind. Should eventually provide the necessary infrastructure for
at least all currently known (proposed) extensions.
What works:
* Scripts can be parsed.
* Scripts can be parsed, the grammar is fully supported.
* Script validation (contextual analysis) works almost completely.
* Script code generation works for most core commands with exception
of match-related arguments. Comparators already work somewhat though
* Interpreter runs and dumps core commands and tests. It is not possible
to specify alternative addr-parts or match-types yet though
DESIGN
of match-type arguments. Comparators and address-part modifiers already work.
* Interpreter runs and dumps core commands and tests. Comparators and
address-part modifiers have the desired effect. Match types other than :is are
not supported yet. Action commands have no effect.
Implemented extensions:
subaddress: full
comparator-i;ascii-numeric: full, but fails to handle leading zeros
vacation: validation and generation only. Execution is broken.
Other extensionsions will be added a soon as the necessary infrastructure is
available. Extensions supported by cmu-sieve have priority, although variables
might be implemented somewhere in between.
Design
------
The compiler consists of the following stages:
......@@ -62,14 +72,16 @@ INTERPRETER: sieve-interpreter.c
TODO
----
* Implement address-part execution
* Implement match-type execution
* Produce a fully working interpreter that actually executes actions
* Produce a fully working interpreter that actually executes actions, currently
tests are evaluated and actions just print their occurence.
* Give the binary format some more thought, it is currently quite rough and
to the point.
* Produce a substitute sieve plugin for deliver (currently a stub)
* Automate script tests
* Produce a substitute sieve plugin for deliver (currently a stub and not
part of the make process)
* Automate script tests; i.e. build a test suite.
* Use mmap for the binary script representation.
* Allow the currently in-memory byte-code to be stored as a script binary
* Use dovecot streams for code dump
* Use dovecot streams for code dump (debugging), currently the code is riddled
with printf()s.
......@@ -3,7 +3,7 @@
*
* Author: Stephan Bosch
* Specification: RFC 2244
* Implementation:
* Implementation: full, but fails to handle leading zeros.
* Status: experimental, largely untested
*
*/
......
/* Extension vacation
* ------------------
*
* Author: Stephan Bosch
* Specification: draft-ietf-sieve-vacation-07
* Implementation: validation and generation work, no interpretation/execution.
* Status: under development
*
*/
#include <stdio.h>
#include "sieve-common.h"
......@@ -274,8 +284,8 @@ static bool cmd_vacation_generate
sieve_generator_emit_opcode_ext(generator, ext_my_id);
/* Generate arguments */
if ( !sieve_generate_arguments(generator, ctx, NULL) )
return FALSE;
if ( !sieve_generate_arguments(generator, ctx, NULL) )
return FALSE;
return TRUE;
}
......
......@@ -61,7 +61,7 @@ static bool cmp_extension_load(int ext_id)
/*
* Validator context:
* name-based address-part registry.
* name-based comparator registry.
*
* FIXME: This code will be duplicated across all extensions that introduce
* a registry of some kind in the validator.
......@@ -69,7 +69,7 @@ static bool cmp_extension_load(int ext_id)
struct cmp_validator_registration {
int ext_id;
const struct sieve_comparator *address_part;
const struct sieve_comparator *comparator;
};
struct cmp_validator_context {
......@@ -90,7 +90,7 @@ static void _sieve_comparator_register
struct cmp_validator_registration *reg;
reg = p_new(pool, struct cmp_validator_registration, 1);
reg->address_part = cmp;
reg->comparator = cmp;
reg->ext_id = ext_id;
hash_insert(ctx->registrations, (void *) cmp->identifier, (void *) reg);
......@@ -130,11 +130,11 @@ bool cmp_validator_load(struct sieve_validator *validator)
struct cmp_validator_context *ctx =
p_new(pool, struct cmp_validator_context, 1);
/* Setup address-part registry */
/* Setup comparator registry */
ctx->registrations = hash_create
(pool, pool, 0, str_hash, (hash_cmp_callback_t *)strcmp);
/* Register core address-parts */
/* Register core comparators */
for ( i = 0; i < sieve_core_comparators_count; i++ ) {
const struct sieve_comparator *cmp = sieve_core_comparators[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.