Sieve: carry global variables from sieve_before to user sieve scripts
Alexander 'Leo' Bergolth
leo at strike.wu.ac.at
Sat Oct 25 13:50:58 UTC 2014
On 20.10.2014 11:48, Alexander 'Leo' Bergolth wrote:
> Is there a way to initialize global variables with default values in
> sieve_before scripts that can be used in the sieve_default script or in
> user scripts?
OK. I guess that's currently not possible. I had a quick look in the
code, the global variable namespace seems to be copied from the parent
script during execution of the include statement. (In
ext_include_generate_include() which calls
ext_include_create_ast_context().)
So maybe it is possible to take another approach:
Instead of executing sieve_before scripts and sieve_default side by
side, maybe it is feasible to set the "before-script" as sieve_default
and include the default personal user script from there if it exists?
That way global variable inheritance should work, shouldn't it?
Did anyone try this approach? Any caveats? Any security implications?
Cheers,
--leo
> I've tried the following code but this doesn't work..
>
> before.d/10-set-defaults.sieve:
> -------------------- 8< --------------------
> require ["variables", "include"];
> require "vnd.dovecot.debug";
> set "global.S_TESTVAR leo";
> debug_log "LEO SIEVE: in before.d/10-set-defaults, S_TESTVAR:
> ${global.S_TESTVAR}";
> -------------------- 8< --------------------
>
> default.sieve:
> -------------------- 8< --------------------
> require ["variables", "include"];
> require "vnd.dovecot.debug";
>
> global "S_TESTVAR";
> debug_log "LEO SIEVE: in default.sieve: S_TESTVAR: ${global.S_TESTVAR},
> ${S_TESTVAR}";
> -------------------- 8< --------------------
>
> Is there any other way to set up defaults in a global sieve script?
--
e-mail ::: Leo.Bergolth (at) wu.ac.at
fax ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria
More information about the dovecot
mailing list