~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to pigeonhole/src/lib-sieve/sieve-binary-private.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
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
#ifndef __SIEVE_BINARY_PRIVATE_H
18
18
        pool_t pool;
19
19
        const char *path;
20
20
        struct sieve_instance *svinst;
21
 
        
 
21
 
22
22
        struct stat st;
23
23
        int fd;
24
24
        off_t offset;
34
34
                const char *path, enum sieve_error *error_r);
35
35
void sieve_binary_file_close(struct sieve_binary_file **file);
36
36
 
37
 
/* 
 
37
/*
38
38
 * Internal structures
39
39
 */
40
40
 
43
43
struct sieve_binary_extension_reg {
44
44
        /* The identifier of the extension within this binary */
45
45
        int index;
46
 
        
 
46
 
47
47
        /* Global extension object */
48
 
        const struct sieve_extension *extension; 
49
 
        
50
 
        /* Extension to the binary; typically used to manage extension-specific blocks 
 
48
        const struct sieve_extension *extension;
 
49
 
 
50
        /* Extension to the binary; typically used to manage extension-specific blocks
51
51
         * in the binary and as a means to get a binary_free notification to release
52
 
         * references held by extensions. 
 
52
         * references held by extensions.
53
53
         */
54
 
        const struct sieve_binary_extension *binext;    
55
 
        
 
54
        const struct sieve_binary_extension *binext;
 
55
 
56
56
        /* Context data associated to the binary by this extension */
57
57
        void *context;
58
 
        
 
58
 
59
59
        /* Main block for this extension */
60
60
        unsigned int block_id;
61
61
};
68
68
        int ext_index;
69
69
 
70
70
        buffer_t *data;
71
 
        
 
71
 
72
72
        uoff_t offset;
73
73
};
74
74
 
81
81
        int refcount;
82
82
 
83
83
        struct sieve_instance *svinst;
84
 
        
 
84
 
85
85
        struct sieve_script *script;
86
 
        
 
86
 
87
87
        struct sieve_binary_file *file;
88
 
        
 
88
 
89
89
        /* When the binary is loaded into memory or when it is being constructed by
90
90
         * the generator, extensions can be associated to the binary. The extensions
91
 
         * array is a sequential list of all linked extensions. The extension_index 
92
 
         * array is a mapping ext_id -> binary_extension. This is used to obtain the 
93
 
         * index code associated with an extension for this particular binary. The 
 
91
         * array is a sequential list of all linked extensions. The extension_index
 
92
         * array is a mapping ext_id -> binary_extension. This is used to obtain the
 
93
         * index code associated with an extension for this particular binary. The
94
94
         * linked_extensions list all extensions linked to this binary object other
95
 
         * than the preloaded language features implemented as 'extensions'. 
96
 
         * 
97
 
         * All arrays refer to the same extension registration objects. Upon loading 
98
 
         * a binary, the 'require'd extensions will sometimes need to associate 
99
 
         * context data to the binary object in memory. This is stored in these 
 
95
         * than the preloaded language features implemented as 'extensions'.
 
96
         *
 
97
         * All arrays refer to the same extension registration objects. Upon loading
 
98
         * a binary, the 'require'd extensions will sometimes need to associate
 
99
         * context data to the binary object in memory. This is stored in these
100
100
         * registration objects as well.
101
101
         */
102
 
        ARRAY_DEFINE(extensions, struct sieve_binary_extension_reg *); 
103
 
        ARRAY_DEFINE(extension_index, struct sieve_binary_extension_reg *); 
104
 
        ARRAY_DEFINE(linked_extensions, struct sieve_binary_extension_reg *); 
105
 
                
 
102
        ARRAY(struct sieve_binary_extension_reg *) extensions;
 
103
        ARRAY(struct sieve_binary_extension_reg *) extension_index;
 
104
        ARRAY(struct sieve_binary_extension_reg *) linked_extensions;
 
105
 
106
106
        /* Attributes of a loaded binary */
107
107
        const char *path;
108
 
                
 
108
 
109
109
        /* Blocks */
110
 
        ARRAY_DEFINE(blocks, struct sieve_binary_block *); 
 
110
        ARRAY(struct sieve_binary_block *) blocks;
111
111
};
112
112
 
113
113
struct sieve_binary *sieve_binary_create
116
116
/* Blocks management */
117
117
 
118
118
static inline struct sieve_binary_block *sieve_binary_block_index
119
 
(struct sieve_binary *sbin, unsigned int id) 
 
119
(struct sieve_binary *sbin, unsigned int id)
120
120
{
121
121
        struct sieve_binary_block * const *sblock;
122
122
 
123
123
        if  ( id >= array_count(&sbin->blocks) )
124
124
                return NULL;
125
 
        
 
125
 
126
126
        sblock = array_idx(&sbin->blocks, id);
127
127
 
128
128
        if ( *sblock == NULL ) {
158
158
        ereg = p_new(sbin->pool, struct sieve_binary_extension_reg, 1);
159
159
        ereg->index = index;
160
160
        ereg->extension = ext;
161
 
        
 
161
 
162
162
        array_idx_set(&sbin->extensions, (unsigned int) index, &ereg);
163
163
        array_idx_set(&sbin->extension_index, (unsigned int) ext->id, &ereg);
164
 
        
 
164
 
165
165
        return ereg;
166
166
}
167
167
 
168
 
static inline struct sieve_binary_extension_reg *sieve_binary_extension_get_reg 
169
 
(struct sieve_binary *sbin, const struct sieve_extension *ext, bool create) 
 
168
static inline struct sieve_binary_extension_reg *sieve_binary_extension_get_reg
 
169
(struct sieve_binary *sbin, const struct sieve_extension *ext, bool create)
170
170
{
171
171
        struct sieve_binary_extension_reg *reg = NULL;
172
172
 
173
173
        if ( ext->id >= 0 && ext->id < (int) array_count(&sbin->extension_index) ) {
174
 
                struct sieve_binary_extension_reg * const *ereg = 
 
174
                struct sieve_binary_extension_reg * const *ereg =
175
175
                        array_idx(&sbin->extension_index, (unsigned int) ext->id);
176
 
                
 
176
 
177
177
                reg = *ereg;
178
178
        }
179
179
 
185
185
}
186
186
 
187
187
static inline int sieve_binary_extension_register
188
 
(struct sieve_binary *sbin, const struct sieve_extension *ext, 
189
 
        struct sieve_binary_extension_reg **reg_r) 
 
188
(struct sieve_binary *sbin, const struct sieve_extension *ext,
 
189
        struct sieve_binary_extension_reg **reg_r)
190
190
{
191
191
        struct sieve_binary_extension_reg *ereg;
192
192
 
193
193
        if ( (ereg=sieve_binary_extension_get_reg(sbin, ext, FALSE)) == NULL ) {
194
194
                ereg = sieve_binary_extension_create_reg(sbin, ext);
195
 
                
 
195
 
196
196
                if ( ereg == NULL ) return -1;
197
197
 
198
198
                array_append(&sbin->linked_extensions, &ereg, 1);