~ubuntu-branches/ubuntu/trusty/dovecot/trusty-proposed

« back to all changes in this revision

Viewing changes to pigeonhole/src/lib-sieve/plugins/include/ext-include-binary.c

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Ante Karamatic
  • Date: 2013-02-11 12:41:24 UTC
  • mfrom: (4.1.33 sid)
  • Revision ID: package-import@ubuntu.com-20130211124124-v7bdegzftlhw7yfr
Tags: 1:2.1.7-7ubuntu1
[ James Page ]
* Merge from Debian unstable (LP: #1117613, #1075456), 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.
  + d/control: Added Pre-Depends: dpkg (>= 1.15.6) to dovecot-dbg to support
    xz compression in Ubuntu.
  + d/control: Demote dovecot-common Recommends: to Suggests: to prevent
    install of extra packages on upgrade.
  + d/patches/dovecot-drac.patch: Updated with version for dovecot >= 2.0.0.
* Dropped changes, included in Debian:
  + d/{control,rules}: enable PIE hardening.
  + d/control: Drop B-D on systemd.
* d/p/mail-stack-delivery.postinst: Updated to ensure that configured SSL
  cert and key locations are used when configuring postfix, sorted out
  formatting.
* d/p/dovecot-core.postinst: Create compat links to old style, existing
  SSL cert and key if found.
* d/rules: Don't pass hardening flags for DRAC plugin.
* d/dovecot-{pop3d,imapd}.prerm: Re-sync with Debian.
* d/dovecot-core.lintian-overrides: Drop override for DRAC plugin as not
  required in Ubuntu.
* d/01-mail-stack-delivery: Renamed 99-mail-stack-delivery to ensure that
  the mail-stack-delivery configuration overrides configuration options
  set elsewhere, updated with new cert/key file locations.

[ Ante Karamatic ]
* Change configuration file for LDA on new installs and upgrades
  (LP: #671065).

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        ARRAY_DEFINE(include_index, struct ext_include_script_info *);
58
58
 
59
59
        struct sieve_variable_scope_binary *global_vars;
 
60
 
 
61
        unsigned int outdated:1;
60
62
};
61
63
 
62
 
 
63
64
static struct ext_include_binary_context *ext_include_binary_create_context
64
65
(const struct sieve_extension *this_ext, struct sieve_binary *sbin)
65
66
{
224
225
                sieve_binary_emit_unsigned(sblock, sieve_binary_block_get_id(incscript->block));
225
226
                sieve_binary_emit_byte(sblock, incscript->location);
226
227
                sieve_binary_emit_cstring(sblock, sieve_script_name(incscript->script));
 
228
                sieve_script_binary_write_metadata(incscript->script, sblock);
227
229
        }
228
230
 
229
231
        result = ext_include_variables_save(sblock, binctx->global_vars);
270
272
                struct sieve_binary_block *inc_block;
271
273
                unsigned int location;
272
274
                string_t *script_name;
273
 
                const char *script_dir;
 
275
                const char *script_location;
274
276
                struct sieve_script *script;
 
277
                int ret;
275
278
                
276
279
                if ( 
277
280
                        !sieve_binary_read_unsigned(sblock, &offset, &inc_block_id) ||
298
301
                        /* Binary is corrupt, recompile */
299
302
                        sieve_sys_error(svinst,
300
303
                                "include: dependency block %d of binary %s "
301
 
                                "reports invalid script location (id %d)", 
 
304
                                "uses invalid script location (id %d)", 
302
305
                                block_id, sieve_binary_path(sbin), location); 
303
306
                        return FALSE;
304
307
                }               
305
308
                
306
309
                /* Can we find/open the script dependency ? */
307
 
                script_dir = ext_include_get_script_directory
 
310
                script_location = ext_include_get_script_location
308
311
                        (ext, location, str_c(script_name));            
309
 
                if ( script_dir == NULL || 
310
 
                        !(script=sieve_script_create_in_directory
311
 
                                (ext->svinst, script_dir, str_c(script_name), NULL, NULL)) ) {
 
312
                if ( script_location == NULL || (script=sieve_script_create
 
313
                        (ext->svinst, script_location, str_c(script_name), NULL, NULL)) == NULL )
 
314
                        {
312
315
                        /* No, recompile */
313
316
                        return FALSE;
314
317
                }
 
318
 
 
319
                if ( (ret=sieve_script_binary_read_metadata(script, sblock, &offset))
 
320
                        < 0 ) {
 
321
                        /* Binary is corrupt, recompile */
 
322
                        sieve_sys_error(svinst,
 
323
                                "include: dependency block %d of binary %s "
 
324
                                "contains invalid script metadata for script %s", 
 
325
                                block_id, sieve_binary_path(sbin), sieve_script_location(script)); 
 
326
                        return FALSE;
 
327
                }
 
328
 
 
329
                if ( ret == 0 )
 
330
                        binctx->outdated = TRUE;
315
331
                
316
332
                (void)ext_include_binary_script_include
317
333
                        (binctx, script, location, inc_block);
327
343
}
328
344
 
329
345
static bool ext_include_binary_up_to_date
330
 
(const struct sieve_extension *ext ATTR_UNUSED, struct sieve_binary *sbin, 
331
 
        void *context, enum sieve_compile_flags cpflags ATTR_UNUSED)
 
346
(const struct sieve_extension *ext ATTR_UNUSED,
 
347
        struct sieve_binary *sbin ATTR_UNUSED, void *context,
 
348
        enum sieve_compile_flags cpflags ATTR_UNUSED)
332
349
{
333
350
        struct ext_include_binary_context *binctx = 
334
351
                (struct ext_include_binary_context *) context;
335
 
        struct hash_iterate_context *hctx;
336
 
        void *key, *value;
337
 
                
338
 
        /* Check all included scripts for changes */
339
 
        hctx = hash_table_iterate_init(binctx->included_scripts);
340
 
        while ( hash_table_iterate(hctx, &key, &value) ) {
341
 
                struct ext_include_script_info *incscript = 
342
 
                        (struct ext_include_script_info *) value;
343
 
                
344
 
                /* Is the binary old than this dependency? */
345
 
                if ( sieve_binary_script_newer(sbin, incscript->script) ) {
346
 
                        /* No, recompile */
347
 
                        return FALSE;
348
 
                }
349
 
        }
350
 
        hash_table_iterate_deinit(&hctx);
351
352
 
352
 
        return TRUE;
 
353
        return !binctx->outdated;
353
354
}
354
355
 
355
356
static void ext_include_binary_free