~ubuntu-dev/ubuntu/lucid/dovecot/lucid-201002101901

« back to all changes in this revision

Viewing changes to libsieve/src/lib-sieve/sieve-interpreter.h

  • Committer: Chuck Short
  • Date: 2010-01-21 20:21:25 UTC
  • mfrom: (4.1.11 squeeze)
  • Revision ID: zulcss@ubuntu.com-20100121202125-pme73o491kfwj5nc
* Merge from debian testing, remaining changes:
  + Add new binary pkg dovecot-postfix that integrates postfix and dovecot
    automatically: (LP: #164837)
  + debian/control:
    - add new binary with short description
    - set Architecture all for dovecot-postfix (LP: #329878)
  + debian/dovecot-postfix.postinst:
    - create initial certificate symlinks to snakeoil.
    - set up postfix with postconf to:
      - use Maildir/ as the default mailbox.
      - use dovecot as the sasl authentication server.
      - use dovecot LDA (deliver).
      - use tls for smtp{d} services.
    - fix certificates paths in postfix' main.cf
    - add reject_unauth_destination to postfix' recipient restrictions
    - add reject_unknown_sender_domain to postfix' sender restriction
    - rename configuration name on remove, delete on purge
    - restart dovecot after linking certificates
    - handle use case when postfix is unconfigurated
  + debian/dovecot-postfix.dirs: create backup directory for postfix's config
    configuration
  + restart postfix and dovecot.
  + debian/dovecot-postfix.postrm:
    - remove all dovecot related configuration from postfix.
    - restart postfix and dovecot.
  + debian/dovecot-common.init:
    - check if /etc/dovecot/dovecot-postfix.conf exists and use it
      as the configuration file if so.
  + debian/patches/warning-ubuntu-postfix.dpatch
    - add warning about dovecot-postfix.conf in dovecot default
      configuration file
  + debian/patches/dovecot-postfix.conf.diff:
    - Ubuntu server custom changes to the default dovecot configuration for
      better interfation with postfix.
    - enable sieve plugin.
    - Ubuntu server custom changes to the default dovecot configuration for
      better integration with postfix:
      - enable imap, pop3, imaps, pop3s and managesieve by default.
      - enable dovecot LDA (deliver).
      - enable SASL auth socket in postfix private directory
   + debian/rules:
     - copy, patch and install dovecot-postfix.conf in /etc/dovecot/.
     - build architecure independent packages too
   + Use Snakeoil SSL certificates by default.
     - debian/control: Depend on ssl-cert.
     - debian/patches/ssl-cert-snakeoil.dpatch: Change default SSL cert
       paths to snakeoil.
     - debian/dovecot-common.postinst: Relax grep for SSL_* a bit.
   + Add autopkgtest to debian/tests/*.
   + Fast TearDown: Update the lsb init header to not stop in level 6.
   + Add ufw integration:
     - Created debian/dovecot-common.ufw.profile.
     - debian/rules: install profile.
     - debian/control: suggest ufw.
   + debian/{control,rules}: enable PIE hardening.
   + dovecot-imapd, dovecot-pop3: Replaces dovecot-common (<< 1:1.1). (LP: #254721)
   + debian/control: Update Vcs-* headers.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
* New upstream release.
* debian/patches/gold-fix.patch: Removed. Fixed upstream.
* Moved libexec to lib corrections in dovecot-managesieve.patch and
  dovecot-managesieve-dist.patch to dovecot-example.patch
* debian/patches/dovecot-mboxlocking.patch: Regenerated to avoid FTBFS
  when quilt isn't installed.
* debian/patches/quota-mountpoint.patch: Removed. Not needed anymore.
* debian/patches/dovecot-quota.patch: Removed. Quotas aren't properly
  enabled unless mail_plugins = quota imap_quota.
* debian/patches/gold-fix.patch: Fixed configure script to build even
  with binutils-gold or --no-add-needed linker flag (Closes: #554306)
* debian/dovecot-common.init: fixed LSB headers. Thanks to Pascal Volk.
  (Closes: #558040)
* debian/changelog: added CVE references to previous changelog entry.
* debian/rules: checked up the build system. It's not fragile anymore.
  (Closes: 493803)
* debian/dovecot-common.postinst: Now invoking dpkg-reconfigure
  on dovecot-common is enough to generate new certificates
  if the previous ones were removed. (Closes: #545582)
* debian/rules: No longer install convert-tool in /usr/bin.
  It isn't an user utility and it should stay in /usr/lib/dovecot
  like all other similar tool.
* New upstream release. (Closes: #557601)
* [SECURITY] Fixes local information disclosure and denial of service.
  (see: http://www.dovecot.org/list/dovecot-news/2009-November/000143.html
  and CVE-2009-3897)
* Added myself to uploaders.
* Switched to the new source format "3.0 (quilt)":
  - removed dpatch from build-depends
  - removed debian/README.source because now we use only standard
    dpkg features
  - regenerated all patches
* Prepared to switch to multi-origin source:
  - recreated dovecot-libsieve.patch and dovecot-managesieve-dist.patch
    starting from the upstream tarball
  - removed all autotools related build-depends and build-conflict
  - renamed dovecot-libsieve and dovecot-managesieve directories
    to libsieve and managesieve.
* debian/rules: Moved the configuration of libsieve and managesieve from
  the build phase to the configuration phase
* Added dovecot-dbg package  with debugging symbols.  Thanks Stephan Bosch.
  (Closes: #554710)
* Fixed some stray libexec'isms in the default configuration.
* New upstream release.
* debian/dovecot-common.init:
  - use $CONF when starting the daemon. (Closes: #549944)
  - always output start/stop messages. (Closes: #523810)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2002-2009 Dovecot Sieve authors, see the included COPYING file
 
2
 */
 
3
 
 
4
#ifndef __SIEVE_INTERPRETER_H
 
5
#define __SIEVE_INTERPRETER_H
 
6
 
 
7
#include "lib.h"
 
8
#include "array.h"
 
9
#include "buffer.h"
 
10
#include "mail-storage.h"
 
11
 
 
12
#include "sieve-common.h"
 
13
 
 
14
/*
 
15
 * Forward declarations
 
16
 */
 
17
 
 
18
struct sieve_interpreter;
 
19
 
 
20
/*
 
21
 * Runtime environment
 
22
 */
 
23
 
 
24
struct sieve_runtime_env {
 
25
        struct sieve_interpreter *interp;
 
26
 
 
27
        struct sieve_script *script;
 
28
        const struct sieve_script_env *scriptenv;
 
29
        
 
30
        const struct sieve_message_data *msgdata;
 
31
        struct sieve_message_context *msgctx;
 
32
 
 
33
        struct sieve_binary *sbin;
 
34
        struct sieve_result *result;
 
35
        
 
36
        struct sieve_exec_status *exec_status;
 
37
        struct ostream *trace_stream;
 
38
};
 
39
 
 
40
/* 
 
41
 * Interpreter 
 
42
 */
 
43
 
 
44
struct sieve_interpreter *sieve_interpreter_create
 
45
        (struct sieve_binary *sbin, struct sieve_error_handler *ehandler);
 
46
void sieve_interpreter_free(struct sieve_interpreter **interp);
 
47
 
 
48
/*
 
49
 * Accessors
 
50
 */
 
51
 
 
52
pool_t sieve_interpreter_pool
 
53
        (struct sieve_interpreter *interp);
 
54
struct sieve_script *sieve_interpreter_script
 
55
        (struct sieve_interpreter *interp);
 
56
struct sieve_error_handler *sieve_interpreter_get_error_handler
 
57
        (struct sieve_interpreter *interp);
 
58
 
 
59
/* Do not use this function for normal sieve extensions. This is intended for
 
60
 * the testsuite only.
 
61
 */
 
62
void sieve_interpreter_set_result
 
63
        (struct sieve_interpreter *interp, struct sieve_result *result);
 
64
 
 
65
/*
 
66
 * Program flow
 
67
 */
 
68
 
 
69
void sieve_interpreter_reset
 
70
        (struct sieve_interpreter *interp);
 
71
void sieve_interpreter_interrupt
 
72
        (struct sieve_interpreter *interp);
 
73
sieve_size_t sieve_interpreter_program_counter
 
74
        (struct sieve_interpreter *interp);
 
75
 
 
76
int sieve_interpreter_program_jump
 
77
        (struct sieve_interpreter *interp, bool jump);
 
78
        
 
79
/*
 
80
 * Test results
 
81
 */     
 
82
        
 
83
void sieve_interpreter_set_test_result
 
84
        (struct sieve_interpreter *interp, bool result);
 
85
bool sieve_interpreter_get_test_result
 
86
        (struct sieve_interpreter *interp);
 
87
        
 
88
/* 
 
89
 * Error handling 
 
90
 */
 
91
 
 
92
/* This is not particularly user-friendly, so avoid using this.. */
 
93
const char *sieve_runtime_location(const struct sieve_runtime_env *runenv);
 
94
 
 
95
void sieve_runtime_error
 
96
        (const struct sieve_runtime_env *runenv, const char *location,
 
97
                const char *fmt, ...) ATTR_FORMAT(3, 4);
 
98
void sieve_runtime_warning
 
99
        (const struct sieve_runtime_env *runenv, const char *location,
 
100
                const char *fmt, ...) ATTR_FORMAT(3, 4);
 
101
void sieve_runtime_log
 
102
        (const struct sieve_runtime_env *runenv, const char *location, 
 
103
                const char *fmt, ...) ATTR_FORMAT(3, 4);
 
104
 
 
105
/* 
 
106
 * Runtime Trace 
 
107
 */
 
108
 
 
109
#ifdef SIEVE_RUNTIME_TRACE
 
110
                
 
111
void _sieve_runtime_trace
 
112
        (const struct sieve_runtime_env *runenv, const char *fmt, ...)
 
113
                ATTR_FORMAT(2, 3);
 
114
void _sieve_runtime_trace_error
 
115
        (const struct sieve_runtime_env *runenv, const char *fmt, ...)
 
116
                ATTR_FORMAT(2, 3);
 
117
                
 
118
# define sieve_runtime_trace(runenv, ...) STMT_START { \
 
119
                if ( (runenv)->trace_stream != NULL ) \
 
120
                        _sieve_runtime_trace((runenv), __VA_ARGS__); \
 
121
        } STMT_END
 
122
# define sieve_runtime_trace_error(runenv, ...) STMT_START { \
 
123
                if ( (runenv)->trace_stream != NULL ) \
 
124
                        _sieve_runtime_trace_error((runenv), __VA_ARGS__); \
 
125
                } STMT_END      
 
126
 
 
127
#else
 
128
# define sieve_runtime_trace(runenv, ...)
 
129
# define sieve_runtime_trace_error(runenv, ...)
 
130
#endif
 
131
 
 
132
/* 
 
133
 * Extension support 
 
134
 */
 
135
 
 
136
struct sieve_interpreter_extension {
 
137
        const struct sieve_extension *ext;      
 
138
 
 
139
        void (*run)(const struct sieve_runtime_env *renv, void *context);
 
140
        void (*free)(struct sieve_interpreter *interp, void *context);
 
141
};
 
142
 
 
143
void sieve_interpreter_extension_register
 
144
        (struct sieve_interpreter *interp, 
 
145
                const struct sieve_interpreter_extension *int_ext, void *context);
 
146
void sieve_interpreter_extension_set_context
 
147
        (struct sieve_interpreter *interp, const struct sieve_extension *ext, 
 
148
                void *context);
 
149
void *sieve_interpreter_extension_get_context
 
150
        (struct sieve_interpreter *interp, const struct sieve_extension *ext); 
 
151
 
 
152
/* 
 
153
 * Opcodes and operands 
 
154
 */
 
155
        
 
156
int sieve_interpreter_handle_optional_operands
 
157
        (const struct sieve_runtime_env *renv, sieve_size_t *address,
 
158
                struct sieve_side_effects_list **list);
 
159
 
 
160
/* 
 
161
 * Code execute 
 
162
 */
 
163
 
 
164
int sieve_interpreter_continue
 
165
        (struct sieve_interpreter *interp, bool *interrupted);
 
166
int sieve_interpreter_start
 
167
        (struct sieve_interpreter *interp, const struct sieve_message_data *msgdata,
 
168
                const struct sieve_script_env *senv, struct sieve_result *result, 
 
169
                bool *interrupted);
 
170
int sieve_interpreter_run
 
171
        (struct sieve_interpreter *interp, const struct sieve_message_data *msgdata,
 
172
                const struct sieve_script_env *senv, struct sieve_result *result);
 
173
 
 
174
#endif /* __SIEVE_INTERPRETER_H */