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

« back to all changes in this revision

Viewing changes to sieve/src/testsuite/cmd-test-set.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:
11
11
#include "sieve-commands.h"
12
12
#include "sieve-code.h"
13
13
#include "sieve-actions.h"
14
 
#include "sieve-validator.h"
 
14
#include "sieve-validator.h" 
15
15
#include "sieve-generator.h"
16
16
#include "sieve-interpreter.h"
17
17
#include "sieve-code-dumper.h"
22
22
 
23
23
#include <stdio.h>
24
24
 
25
 
/*
26
 
 * Test_set command
27
 
 *
 
25
/* 
 
26
 * Test_set command 
 
27
 * 
28
28
 * Syntax
29
29
 *   test_set <testsuite object (member): string> <value: string>
30
30
 */
34
34
static bool cmd_test_set_generate
35
35
        (const struct sieve_codegen_env *cgenv, struct sieve_command *cmd);
36
36
 
37
 
const struct sieve_command_def cmd_test_set = {
38
 
        "test_set",
 
37
const struct sieve_command_def cmd_test_set = { 
 
38
        "test_set", 
39
39
        SCT_COMMAND,
40
 
        2, 0, FALSE, FALSE,
 
40
        2, 0, FALSE, FALSE, 
41
41
        NULL, NULL,
42
 
        cmd_test_set_validate,
43
 
        cmd_test_set_generate,
44
 
        NULL
 
42
        cmd_test_set_validate, 
 
43
        cmd_test_set_generate, 
 
44
        NULL 
45
45
};
46
46
 
47
 
/*
48
 
 * Test_set operation
 
47
/* 
 
48
 * Test_set operation 
49
49
 */
50
50
 
51
51
static bool cmd_test_set_operation_dump
53
53
static int cmd_test_set_operation_execute
54
54
        (const struct sieve_runtime_env *renv, sieve_size_t *address);
55
55
 
56
 
const struct sieve_operation_def test_set_operation = {
 
56
const struct sieve_operation_def test_set_operation = { 
57
57
        "TEST_SET",
58
 
        &testsuite_extension,
 
58
        &testsuite_extension, 
59
59
        TESTSUITE_OPERATION_TEST_SET,
60
 
        cmd_test_set_operation_dump,
61
 
        cmd_test_set_operation_execute
 
60
        cmd_test_set_operation_dump, 
 
61
        cmd_test_set_operation_execute 
62
62
};
63
63
 
64
 
/*
65
 
 * Validation
 
64
/* 
 
65
 * Validation 
66
66
 */
67
 
 
 
67
 
68
68
static bool cmd_test_set_validate
69
 
(struct sieve_validator *valdtr, struct sieve_command *cmd)
 
69
(struct sieve_validator *valdtr, struct sieve_command *cmd) 
70
70
{
71
71
        struct sieve_ast_argument *arg = cmd->first_positional;
72
72
 
73
73
        /* Check arguments */
74
 
 
 
74
        
75
75
        if ( !sieve_validate_positional_argument
76
76
                (valdtr, cmd, arg, "object", 1, SAAT_STRING) ) {
77
77
                return FALSE;
78
78
        }
79
 
 
 
79
        
80
80
        if ( !testsuite_object_argument_activate(valdtr, arg, cmd) )
81
81
                return FALSE;
82
 
 
 
82
        
83
83
        arg = sieve_ast_argument_next(arg);
84
 
 
 
84
        
85
85
        if ( !sieve_validate_positional_argument
86
86
                (valdtr, cmd, arg, "value", 2, SAAT_STRING) ) {
87
87
                return FALSE;
88
88
        }
89
 
 
 
89
        
90
90
        return sieve_validator_argument_activate(valdtr, cmd, arg, FALSE);
91
91
}
92
92
 
93
93
/*
94
94
 * Code generation
95
95
 */
96
 
 
 
96
 
97
97
static bool cmd_test_set_generate
98
 
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
 
98
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd) 
99
99
{
100
100
        sieve_operation_emit(cgenv->sbin, cmd->ext, &test_set_operation);
101
101
 
103
103
        return sieve_generate_arguments(cgenv, cmd, NULL);
104
104
}
105
105
 
106
 
/*
 
106
/* 
107
107
 * Code dump
108
108
 */
109
 
 
 
109
 
110
110
static bool cmd_test_set_operation_dump
111
111
(const struct sieve_dumptime_env *denv, sieve_size_t *address)
112
112
{
113
113
        sieve_code_dumpf(denv, "TEST SET:");
114
114
        sieve_code_descend(denv);
115
115
 
116
 
        return
 
116
        return 
117
117
                testsuite_object_dump(denv, address) &&
118
118
                sieve_opr_string_dump(denv, address, "value");
119
119
}
140
140
                return SIEVE_EXEC_BIN_CORRUPT;
141
141
        }
142
142
 
143
 
        sieve_runtime_trace(renv, "TEST SET command (%s = \"%s\")",
 
143
        sieve_runtime_trace(renv, "TEST SET command (%s = \"%s\")", 
144
144
                testsuite_object_member_name(&tobj, member_id), str_c(value));
145
 
 
 
145
        
146
146
        if ( tobj.def == NULL || tobj.def->set_member == NULL ) {
147
147
                sieve_runtime_trace_error(renv, "unimplemented testsuite object");
148
148
                return SIEVE_EXEC_FAILURE;
149
149
        }
150
 
 
151
 
        tobj.def->set_member(renv, member_id, value);
 
150
                
 
151
        tobj.def->set_member(renv, member_id, value);   
152
152
        return SIEVE_EXEC_OK;
153
153
}
154
154