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

« back to all changes in this revision

Viewing changes to sieve/src/lib-sieve/cmd-keep.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-29 09:21:32 UTC
  • mfrom: (4.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20100629092132-q4pr5lfuvmjqou19
Tags: 1:1.2.12-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  + Add mail-stack-delivery as 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.*
  + 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/*.
  + Add ufw integration:
    - Created debian/dovecot-common.ufw.profile.
    - debian/rules: install profile.
    - debian/control: suggest ufw.
  + debian/{control,rules}: enable PIE hardening.
  + debian/control: Update Vcs-* headers.
  + Add SMTP-AUTH support for Outlook (login auth mechanism) 
  + debian/dovecot-common.dirs: Added usr/share/doc/dovecot-common
  + debian/patches/fix-dovecot-config-parser.patch: Fix ordering of external config 
    files. (LP: #597818)

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
#include "sieve-code.h"
9
9
#include "sieve-dump.h"
10
10
#include "sieve-actions.h"
11
 
#include "sieve-validator.h" 
 
11
#include "sieve-validator.h"
12
12
#include "sieve-generator.h"
13
13
#include "sieve-interpreter.h"
14
14
#include "sieve-result.h"
15
15
 
16
 
/* 
17
 
 * Keep command 
 
16
/*
 
17
 * Keep command
18
18
 *
19
19
 * Syntax:
20
20
 *   keep
21
 
 */     
 
21
 */
22
22
 
23
23
static bool cmd_keep_generate
24
24
        (const struct sieve_codegen_env *cgenv, struct sieve_command *cmd);
25
25
 
26
 
const struct sieve_command_def cmd_keep = { 
27
 
        "keep", 
28
 
        SCT_COMMAND, 
 
26
const struct sieve_command_def cmd_keep = {
 
27
        "keep",
 
28
        SCT_COMMAND,
29
29
        0, 0, FALSE, FALSE,
30
 
        NULL, NULL, NULL, 
31
 
        cmd_keep_generate, 
 
30
        NULL, NULL, NULL,
 
31
        cmd_keep_generate,
32
32
        NULL
33
33
};
34
34
 
35
 
/* 
36
 
 * Keep operation 
 
35
/*
 
36
 * Keep operation
37
37
 */
38
38
 
39
39
static bool cmd_keep_operation_dump
41
41
static int cmd_keep_operation_execute
42
42
        (const struct sieve_runtime_env *renv, sieve_size_t *address);
43
43
 
44
 
const struct sieve_operation_def cmd_keep_operation = { 
 
44
const struct sieve_operation_def cmd_keep_operation = {
45
45
        "KEEP",
46
46
        NULL,
47
47
        SIEVE_OPERATION_KEEP,
48
 
        cmd_keep_operation_dump, 
49
 
        cmd_keep_operation_execute 
 
48
        cmd_keep_operation_dump,
 
49
        cmd_keep_operation_execute
50
50
};
51
51
 
52
52
/*
54
54
 */
55
55
 
56
56
static bool cmd_keep_generate
57
 
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd) 
 
57
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
58
58
{
59
59
        /* Emit opcode */
60
60
        sieve_operation_emit(cgenv->sbin, NULL, &cmd_keep_operation);
66
66
        return sieve_generate_arguments(cgenv, cmd, NULL);
67
67
}
68
68
 
69
 
/* 
 
69
/*
70
70
 * Code dump
71
71
 */
72
72
 
88
88
 */
89
89
 
90
90
static int cmd_keep_operation_execute
91
 
(const struct sieve_runtime_env *renv ATTR_UNUSED, 
 
91
(const struct sieve_runtime_env *renv ATTR_UNUSED,
92
92
        sieve_size_t *address ATTR_UNUSED)
93
 
{       
 
93
{
94
94
        struct sieve_side_effects_list *slist = NULL;
95
95
        unsigned int source_line;
96
 
        int ret = 0;    
 
96
        int ret = 0;
97
97
 
98
98
        /* Source line */
99
99
        if ( !sieve_code_source_line_read(renv, address, &source_line) ) {
100
100
                sieve_runtime_trace_error(renv, "invalid source line");
101
101
                return SIEVE_EXEC_BIN_CORRUPT;
102
102
        }
103
 
        
 
103
 
104
104
        /* Optional operands (side effects only) */
105
105
        if ( (ret=sieve_interpreter_handle_optional_operands
106
 
                (renv, address, &slist)) <= 0 ) 
 
106
                (renv, address, &slist)) <= 0 )
107
107
                return ret;
108
108
 
109
109
        sieve_runtime_trace(renv, "KEEP action");
110
 
        
111
 
        /* Add keep action to result. 
 
110
 
 
111
        /* Add keep action to result.
112
112
         */
113
113
        ret = sieve_result_add_keep(renv, slist, source_line);
114
 
        
 
114
 
115
115
        return ( ret >= 0 );
116
116
}
117
117