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

« back to all changes in this revision

Viewing changes to libsieve/src/testsuite/tst-test-script-run.c

  • 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
#include "sieve-common.h"
 
5
#include "sieve-script.h"
 
6
#include "sieve-commands.h"
 
7
#include "sieve-validator.h"
 
8
#include "sieve-generator.h"
 
9
#include "sieve-interpreter.h"
 
10
#include "sieve-code.h"
 
11
#include "sieve-binary.h"
 
12
#include "sieve-dump.h"
 
13
#include "sieve.h"
 
14
 
 
15
#include "testsuite-common.h"
 
16
#include "testsuite-script.h"
 
17
#include "testsuite-result.h"
 
18
 
 
19
/*
 
20
 * Test_script_run command
 
21
 *
 
22
 * Syntax:   
 
23
 *   test_script_run
 
24
 */
 
25
 
 
26
static bool tst_test_script_run_registered
 
27
(struct sieve_validator *validator, struct sieve_command_registration *cmd_reg);
 
28
static bool tst_test_script_run_generate
 
29
        (const struct sieve_codegen_env *cgenv, struct sieve_command_context *ctx);
 
30
 
 
31
const struct sieve_command tst_test_script_run = { 
 
32
        "test_script_run", 
 
33
        SCT_TEST, 
 
34
        0, 0, FALSE, FALSE,
 
35
        tst_test_script_run_registered, 
 
36
        NULL, NULL,
 
37
        tst_test_script_run_generate, 
 
38
        NULL 
 
39
};
 
40
 
 
41
/* 
 
42
 * Operation 
 
43
 */
 
44
 
 
45
static bool tst_test_script_run_operation_dump
 
46
        (const struct sieve_operation *op,
 
47
                const struct sieve_dumptime_env *denv, sieve_size_t *address);
 
48
static int tst_test_script_run_operation_execute
 
49
        (const struct sieve_operation *op, 
 
50
                const struct sieve_runtime_env *renv, sieve_size_t *address);
 
51
 
 
52
const struct sieve_operation test_script_run_operation = { 
 
53
        "test_script_run",
 
54
        &testsuite_extension, 
 
55
        TESTSUITE_OPERATION_TEST_SCRIPT_RUN,
 
56
        tst_test_script_run_operation_dump, 
 
57
        tst_test_script_run_operation_execute 
 
58
};
 
59
 
 
60
/*
 
61
 * Tagged arguments
 
62
 */
 
63
 
 
64
/* Codes for optional arguments */
 
65
 
 
66
enum cmd_vacation_optional {
 
67
        OPT_END,
 
68
        OPT_APPEND_RESULT
 
69
};
 
70
 
 
71
/* Tags */
 
72
 
 
73
static const struct sieve_argument append_result_tag = { 
 
74
        "append_result",        
 
75
        NULL, NULL, NULL, NULL, NULL
 
76
};
 
77
 
 
78
static bool tst_test_script_run_registered
 
79
(struct sieve_validator *validator, struct sieve_command_registration *cmd_reg) 
 
80
{
 
81
        sieve_validator_register_tag
 
82
                (validator, cmd_reg, &append_result_tag, OPT_APPEND_RESULT);    
 
83
 
 
84
        return TRUE;
 
85
}
 
86
 
 
87
 
 
88
/* 
 
89
 * Code generation 
 
90
 */
 
91
 
 
92
static bool tst_test_script_run_generate
 
93
(const struct sieve_codegen_env *cgenv, 
 
94
        struct sieve_command_context *tst)
 
95
{
 
96
        sieve_operation_emit_code(cgenv->sbin, &test_script_run_operation);
 
97
 
 
98
        return sieve_generate_arguments(cgenv, tst, NULL);
 
99
}
 
100
 
 
101
/*
 
102
 * Code dump
 
103
 */
 
104
 
 
105
static bool tst_test_script_run_operation_dump
 
106
(const struct sieve_operation *op ATTR_UNUSED,
 
107
        const struct sieve_dumptime_env *denv, sieve_size_t *address)
 
108
{       
 
109
        int opt_code = 1;
 
110
        
 
111
        sieve_code_dumpf(denv, "TEST_SCRIPT_RUN");
 
112
        sieve_code_descend(denv);       
 
113
 
 
114
        /* Dump optional operands */
 
115
        if ( sieve_operand_optional_present(denv->sbin, address) ) {
 
116
                while ( opt_code != 0 ) {
 
117
                        sieve_code_mark(denv);
 
118
                        
 
119
                        if ( !sieve_operand_optional_read(denv->sbin, address, &opt_code) ) 
 
120
                                return FALSE;
 
121
 
 
122
                        switch ( opt_code ) {
 
123
                        case 0:
 
124
                                break;
 
125
                        case OPT_APPEND_RESULT:
 
126
                                sieve_code_dumpf(denv, "append_result");        
 
127
                                break;
 
128
                        
 
129
                        default:
 
130
                                return FALSE;
 
131
                        }
 
132
                }
 
133
        }
 
134
        
 
135
        return TRUE;
 
136
}
 
137
 
 
138
 
 
139
/*
 
140
 * Intepretation
 
141
 */
 
142
 
 
143
static int tst_test_script_run_operation_execute
 
144
(const struct sieve_operation *op ATTR_UNUSED,
 
145
        const struct sieve_runtime_env *renv, 
 
146
        sieve_size_t *address ATTR_UNUSED)
 
147
{
 
148
        bool append_result = FALSE;
 
149
        int opt_code = 1;
 
150
        bool result = TRUE;
 
151
 
 
152
        /*
 
153
         * Read operands
 
154
         */
 
155
 
 
156
        /* Optional operands */ 
 
157
        if ( sieve_operand_optional_present(renv->sbin, address) ) {
 
158
                while ( opt_code != 0 ) {
 
159
                        if ( !sieve_operand_optional_read(renv->sbin, address, &opt_code) ) {
 
160
                                sieve_runtime_trace_error(renv, "invalid optional operand");
 
161
                                return SIEVE_EXEC_BIN_CORRUPT;
 
162
                        }
 
163
 
 
164
                        switch ( opt_code ) {
 
165
                        case 0:
 
166
                                break;
 
167
                        case OPT_APPEND_RESULT:
 
168
                                append_result = TRUE;
 
169
                                break;
 
170
                        default:
 
171
                                sieve_runtime_trace_error(renv, 
 
172
                                        "unknown optional operand");
 
173
                                return SIEVE_EXEC_BIN_CORRUPT;
 
174
                        }
 
175
                }
 
176
        }
 
177
 
 
178
        /*
 
179
         * Perform operation
 
180
         */
 
181
 
 
182
        /* Reset result object */
 
183
        if ( !append_result ) 
 
184
                testsuite_result_reset(renv);
 
185
 
 
186
        /* Run script */
 
187
        result = testsuite_script_run(renv);
 
188
 
 
189
        /* Indicate test status */
 
190
        sieve_interpreter_set_test_result(renv->interp, result);
 
191
 
 
192
        return SIEVE_EXEC_OK;
 
193
}
 
194
 
 
195
 
 
196
 
 
197