~ubuntu-branches/ubuntu/saucy/dovecot/saucy-updates

« back to all changes in this revision

Viewing changes to pigeonhole/src/lib-sieve/cmp-i-octet.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-04-04 14:56:38 UTC
  • mfrom: (1.15.1) (4.1.26 sid)
  • Revision ID: package-import@ubuntu.com-20120404145638-qmvdul6vwpcqparv
Tags: 1:2.0.19-0ubuntu1
* New upstream release (LP: #970782).
* Merge from Debian testing, 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/{control,rules}: enable PIE hardening.
  + 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/patches/fix-racey-restart.patch: Backported patch from current
    development release which ensures all child processes terminate prior
    to the main dovecot process.
  + debian/patches/CVE-2011-4318.patch: Dropped - applied upstream
  + 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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2002-2011 Pigeonhole authors, see the included COPYING file
 
1
/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file 
2
2
 */
3
3
 
4
 
/* Comparator 'i;octet':
 
4
/* Comparator 'i;octet': 
5
5
 *
6
6
 */
7
7
 
21
21
        (const struct sieve_comparator *cmp,
22
22
                const char *val1, size_t val1_size, const char *val2, size_t val2_size);
23
23
static bool cmp_i_octet_char_match
24
 
        (const struct sieve_comparator *cmp, const char **val1, const char *val1_end,
 
24
        (const struct sieve_comparator *cmp, const char **val1, const char *val1_end, 
25
25
                const char **val2, const char *val2_end);
26
26
 
27
27
/*
34
34
                SIEVE_COMPARATOR_FLAG_SUBSTRING_MATCH | SIEVE_COMPARATOR_FLAG_PREFIX_MATCH,
35
35
        cmp_i_octet_compare,
36
36
        cmp_i_octet_char_match,
37
 
        sieve_comparator_octet_skip
 
37
        sieve_comparator_octet_skip     
38
38
};
39
39
 
40
40
/*
41
41
 * Comparator implementation
42
42
 */
43
 
 
 
43
 
44
44
static int cmp_i_octet_compare(
45
45
        const struct sieve_comparator *cmp ATTR_UNUSED,
46
46
        const char *val1, size_t val1_size, const char *val2, size_t val2_size)
49
49
 
50
50
        if ( val1_size == val2_size ) {
51
51
                return memcmp((void *) val1, (void *) val2, val1_size);
52
 
        }
53
 
 
 
52
        } 
 
53
        
54
54
        if ( val1_size > val2_size ) {
55
55
                result = memcmp((void *) val1, (void *) val2, val2_size);
56
 
 
 
56
                
57
57
                if ( result == 0 ) return 1;
58
 
 
 
58
                
59
59
                return result;
60
 
        }
 
60
        } 
61
61
 
62
62
        result = memcmp((void *) val1, (void *) val2, val1_size);
63
 
 
 
63
                
64
64
        if ( result == 0 ) return -1;
65
 
 
 
65
                
66
66
        return result;
67
67
}
68
68
 
69
69
static bool cmp_i_octet_char_match
70
 
        (const struct sieve_comparator *cmp ATTR_UNUSED,
71
 
                const char **val, const char *val_end,
 
70
        (const struct sieve_comparator *cmp ATTR_UNUSED, 
 
71
                const char **val, const char *val_end, 
72
72
                const char **key, const char *key_end)
73
73
{
74
74
        const char *val_begin = *val;
75
75
        const char *key_begin = *key;
76
 
 
 
76
        
77
77
        while ( **val == **key && *val < val_end && *key < key_end ) {
78
78
                (*val)++;
79
79
                (*key)++;
80
80
        }
81
 
 
 
81
        
82
82
        if ( *key < key_end ) {
83
83
                /* Reset */
84
84
                *val = val_begin;
85
 
                *key = key_begin;
86
 
 
 
85
                *key = key_begin;       
 
86
        
87
87
                return FALSE;
88
88
        }
89
 
 
 
89
        
90
90
        return TRUE;
91
91
}
 
92
 
 
93