~ubuntu-branches/ubuntu/quantal/dovecot/quantal

« back to all changes in this revision

Viewing changes to sieve/src/testsuite/tst-test-multiscript.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short, Scott Kitterman
  • Date: 2010-06-22 10:33:51 UTC
  • mfrom: (1.13.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100622103351-ifbmnklp8kxrhb30
Tags: 1:1.2.12-0ubuntu1
* New upstream release:
  - deliver: Don't crash when a message with Auto-submitted: header gets
   rejected.
  - lib-storage: Fixed header searches to work correctly when there are
    multiple headers with same name.
  - dict client: Disconnect from dict server after 1 second of idling.
  - dict: If process crashed, it wasn't automatically restarted
  - dict file: If dict file's group permissions equal world permissions,
    don't try to change its gid.
  - maildir: Fixed a memory leak when copying with hardlinks.
  - maildir: Expunging last messages may have assert-crashed if their
    filenames had just changed.
 * Update sieve patch to 0.1.17
 * debian/dovecot-common.postinst: Add warning about expired certificate.
   (Debian Bug: #576455)
 * Silence lintian warnings.

 [Scott Kitterman]
 * Rename dovecot-postfix to mail-stack-delivery per server-maverick-mail-
   integration spec.
   - Update debian/rules
   - Convert existing package to a dummy package and add new binary in debian/control
   - Update maintainer scripts.
   - Move previously installed backups and config files to new package name
     space in preinst
   - Add new debian/mail-stack-delivery.prerm to handle downgrades
   - Rename debian/dovecot-postfix.* to debian/mail-stack-delivery.*

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
/*
19
19
 * Test_multiscript command
20
20
 *
21
 
 * Syntax:
 
21
 * Syntax:   
22
22
 *   test_multiscript <scripts: string-list>
23
23
 */
24
24
 
27
27
static bool tst_test_multiscript_generate
28
28
        (const struct sieve_codegen_env *cgenv, struct sieve_command *tst);
29
29
 
30
 
const struct sieve_command_def tst_test_multiscript = {
31
 
        "test_multiscript",
32
 
        SCT_TEST,
 
30
const struct sieve_command_def tst_test_multiscript = { 
 
31
        "test_multiscript", 
 
32
        SCT_TEST, 
33
33
        1, 0, FALSE, FALSE,
34
34
        NULL, NULL,
35
 
        tst_test_multiscript_validate,
36
 
        tst_test_multiscript_generate,
37
 
        NULL
 
35
        tst_test_multiscript_validate, 
 
36
        tst_test_multiscript_generate, 
 
37
        NULL 
38
38
};
39
39
 
40
 
/*
41
 
 * Operation
 
40
/* 
 
41
 * Operation 
42
42
 */
43
43
 
44
44
static bool tst_test_multiscript_operation_dump
46
46
static int tst_test_multiscript_operation_execute
47
47
        (const struct sieve_runtime_env *renv, sieve_size_t *address);
48
48
 
49
 
const struct sieve_operation_def test_multiscript_operation = {
 
49
const struct sieve_operation_def test_multiscript_operation = { 
50
50
        "TEST_MULTISCRIPT",
51
 
        &testsuite_extension,
 
51
        &testsuite_extension, 
52
52
        TESTSUITE_OPERATION_TEST_MULTISCRIPT,
53
 
        tst_test_multiscript_operation_dump,
54
 
        tst_test_multiscript_operation_execute
 
53
        tst_test_multiscript_operation_dump, 
 
54
        tst_test_multiscript_operation_execute 
55
55
};
56
56
 
57
 
/*
58
 
 * Validation
 
57
/* 
 
58
 * Validation 
59
59
 */
60
60
 
61
61
static bool tst_test_multiscript_validate
62
 
(struct sieve_validator *valdtr, struct sieve_command *tst)
 
62
(struct sieve_validator *valdtr, struct sieve_command *tst) 
63
63
{
64
64
        struct sieve_ast_argument *arg = tst->first_positional;
65
 
 
 
65
        
66
66
        if ( !sieve_validate_positional_argument
67
67
                (valdtr, tst, arg, "scripts", 1, SAAT_STRING_LIST) ) {
68
68
                return FALSE;
69
69
        }
70
 
 
 
70
        
71
71
        return sieve_validator_argument_activate(valdtr, tst, arg, FALSE);
72
72
}
73
73
 
74
 
/*
75
 
 * Code generation
 
74
/* 
 
75
 * Code generation 
76
76
 */
77
77
 
78
78
static bool tst_test_multiscript_generate
84
84
        return sieve_generate_arguments(cgenv, tst, NULL);
85
85
}
86
86
 
87
 
/*
 
87
/* 
88
88
 * Code dump
89
89
 */
90
 
 
 
90
 
91
91
static bool tst_test_multiscript_operation_dump
92
92
(const struct sieve_dumptime_env *denv, sieve_size_t *address)
93
93
{
94
94
        sieve_code_dumpf(denv, "TEST_MULTISCRIPT:");
95
95
        sieve_code_descend(denv);
96
96
 
97
 
        if ( !sieve_opr_stringlist_dump(denv, address, "scripts") )
 
97
        if ( !sieve_opr_stringlist_dump(denv, address, "scripts") ) 
98
98
                return FALSE;
99
99
 
100
100
        return TRUE;
131
131
        t_array_init(&scriptfiles, 16);
132
132
 
133
133
        script_path = sieve_script_dirpath(renv->script);
134
 
        if ( script_path == NULL )
 
134
        if ( script_path == NULL ) 
135
135
                return SIEVE_EXEC_FAILURE;
136
136
 
137
137
        script_name = NULL;
138
 
        while ( result &&
 
138
        while ( result && 
139
139
                (result=sieve_coded_stringlist_next_item(scripts_list, &script_name))
140
 
                && script_name != NULL ) {
 
140
                && script_name != NULL ) {      
141
141
 
142
 
                const char *path =
 
142
                const char *path = 
143
143
                        t_strconcat(script_path, "/", str_c(script_name), NULL);
144
144
 
145
145
                /* Attempt script compile */
146
 
                array_append(&scriptfiles, &path, 1);
 
146
                array_append(&scriptfiles, &path, 1);   
147
147
        }
148
148
 
149
149
        result = result && testsuite_script_multiscript(renv, &scriptfiles);