~ubuntu-branches/ubuntu/trusty/dovecot/trusty-updates

« back to all changes in this revision

Viewing changes to pigeonhole/src/testsuite/cmd-test-binary.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (1.15.3) (96.1.1 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20140108093549-814nkqdcxfbvgktg
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file
 
1
/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file
2
2
 */
3
3
 
4
4
#include "sieve-common.h"
25
25
 
26
26
/* Test_binary_load command
27
27
 *
28
 
 * Syntax:   
 
28
 * Syntax:
29
29
 *   test_binary_load <binary-name: string>
30
30
 */
31
31
 
32
 
const struct sieve_command_def cmd_test_binary_load = { 
33
 
        "test_binary_load", 
34
 
        SCT_COMMAND, 
 
32
const struct sieve_command_def cmd_test_binary_load = {
 
33
        "test_binary_load",
 
34
        SCT_COMMAND,
35
35
        1, 0, FALSE, FALSE,
36
 
        NULL, 
 
36
        NULL,
37
37
        NULL,
38
38
        cmd_test_binary_validate,
39
39
        NULL,
40
 
        cmd_test_binary_generate, 
41
 
        NULL 
 
40
        cmd_test_binary_generate,
 
41
        NULL
42
42
};
43
43
 
44
44
/* Test_binary_save command
45
45
 *
46
 
 * Syntax:   
 
46
 * Syntax:
47
47
 *   test_binary_save <binary-name: string>
48
48
 */
49
49
 
50
 
const struct sieve_command_def cmd_test_binary_save = { 
51
 
        "test_binary_save", 
52
 
        SCT_COMMAND, 
 
50
const struct sieve_command_def cmd_test_binary_save = {
 
51
        "test_binary_save",
 
52
        SCT_COMMAND,
53
53
        1, 0, FALSE, FALSE,
54
 
        NULL, 
 
54
        NULL,
55
55
        NULL,
56
56
        cmd_test_binary_validate,
57
57
        NULL,
58
 
        cmd_test_binary_generate, 
59
 
        NULL 
 
58
        cmd_test_binary_generate,
 
59
        NULL
60
60
};
61
61
 
62
 
/* 
 
62
/*
63
63
 * Operations
64
 
 */ 
 
64
 */
65
65
 
66
66
static bool cmd_test_binary_operation_dump
67
67
        (const struct sieve_dumptime_env *denv, sieve_size_t *address);
68
68
static int cmd_test_binary_operation_execute
69
69
        (const struct sieve_runtime_env *renv, sieve_size_t *address);
70
 
 
 
70
 
71
71
/* test_binary_create operation */
72
72
 
73
 
const struct sieve_operation_def test_binary_load_operation = { 
 
73
const struct sieve_operation_def test_binary_load_operation = {
74
74
        "TEST_BINARY_LOAD",
75
 
        &testsuite_extension, 
 
75
        &testsuite_extension,
76
76
        TESTSUITE_OPERATION_TEST_BINARY_LOAD,
77
 
        cmd_test_binary_operation_dump, 
78
 
        cmd_test_binary_operation_execute 
 
77
        cmd_test_binary_operation_dump,
 
78
        cmd_test_binary_operation_execute
79
79
};
80
80
 
81
81
/* test_binary_delete operation */
82
82
 
83
 
const struct sieve_operation_def test_binary_save_operation = { 
 
83
const struct sieve_operation_def test_binary_save_operation = {
84
84
        "TEST_BINARY_SAVE",
85
 
        &testsuite_extension, 
 
85
        &testsuite_extension,
86
86
        TESTSUITE_OPERATION_TEST_BINARY_SAVE,
87
 
        cmd_test_binary_operation_dump, 
88
 
        cmd_test_binary_operation_execute 
 
87
        cmd_test_binary_operation_dump,
 
88
        cmd_test_binary_operation_execute
89
89
};
90
90
 
91
 
/* 
92
 
 * Validation 
 
91
/*
 
92
 * Validation
93
93
 */
94
94
 
95
95
static bool cmd_test_binary_validate
96
 
(struct sieve_validator *valdtr, struct sieve_command *cmd) 
97
 
{       
 
96
(struct sieve_validator *valdtr, struct sieve_command *cmd)
 
97
{
98
98
        struct sieve_ast_argument *arg = cmd->first_positional;
99
 
                        
 
99
 
100
100
        if ( !sieve_validate_positional_argument
101
101
                (valdtr, cmd, arg, "binary-name", 1, SAAT_STRING) ) {
102
102
                return FALSE;
103
103
        }
104
 
        
 
104
 
105
105
        return sieve_validator_argument_activate(valdtr, cmd, arg, FALSE);
106
106
}
107
107
 
108
 
/* 
109
 
 * Code generation 
 
108
/*
 
109
 * Code generation
110
110
 */
111
111
 
112
112
static bool cmd_test_binary_generate
119
119
                sieve_operation_emit(cgenv->sblock, cmd->ext, &test_binary_save_operation);
120
120
        else
121
121
                i_unreached();
122
 
                        
 
122
 
123
123
        /* Generate arguments */
124
124
        if ( !sieve_generate_arguments(cgenv, cmd, NULL) )
125
125
                return FALSE;
127
127
        return TRUE;
128
128
}
129
129
 
130
 
/* 
 
130
/*
131
131
 * Code dump
132
132
 */
133
 
 
 
133
 
134
134
static bool cmd_test_binary_operation_dump
135
135
(const struct sieve_dumptime_env *denv, sieve_size_t *address)
136
136
{
137
137
        sieve_code_dumpf(denv, "%s:", sieve_operation_mnemonic(denv->oprtn));
138
 
        
 
138
 
139
139
        sieve_code_descend(denv);
140
 
        
 
140
 
141
141
        return sieve_opr_string_dump(denv, address, "binary-name");
142
142
}
143
143
 
144
144
/*
145
145
 * Intepretation
146
146
 */
147
 
 
 
147
 
148
148
static int cmd_test_binary_operation_execute
149
149
(const struct sieve_runtime_env *renv, sieve_size_t *address)
150
150
{
152
152
        string_t *binary_name = NULL;
153
153
        int ret;
154
154
 
155
 
        /* 
156
 
         * Read operands 
 
155
        /*
 
156
         * Read operands
157
157
         */
158
158
 
159
159
        /* Binary Name */
176
176
                }
177
177
 
178
178
                if ( sbin != NULL ) {
179
 
                        testsuite_script_set_binary(sbin);
 
179
                        testsuite_script_set_binary(renv, sbin);
180
180
 
181
181
                        sieve_binary_unref(&sbin);
182
182
                } else {
186
186
                }
187
187
 
188
188
        } else if ( sieve_operation_is(oprtn, test_binary_save_operation) ) {
189
 
                struct sieve_binary *sbin = testsuite_script_get_binary();
 
189
                struct sieve_binary *sbin = testsuite_script_get_binary(renv);
190
190
 
191
191
                if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) {
192
192
                        sieve_runtime_trace(renv, 0, "testsuite: test_binary_save command");
194
194
                        sieve_runtime_trace(renv, 0, "save binary `%s'", str_c(binary_name));
195
195
                }
196
196
 
197
 
                if ( sbin != NULL ) 
 
197
                if ( sbin != NULL )
198
198
                        testsuite_binary_save(sbin, str_c(binary_name));
199
199
                else {
200
200
                        sieve_sys_error(testsuite_sieve_instance,