~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/lib/data-stack.c

  • Committer: Bazaar Package Importer
  • Author(s): CHuck Short, Chuck Short
  • Date: 2009-11-06 00:47:29 UTC
  • mfrom: (4.1.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091106004729-i39n7v9e7d4h51f6
Tags: 1:1.2.6-1ubuntu1
* Merge from debian testing, remaining changes:
  Add new binary pkg dovecot-postfix that integrates postfix and dovecot
  automatically: (LP: #164837)
  + debian/control:
    - add new binary with short description
    - set Architecture all for dovecot-postfix (LP: #329878)
  + debian/dovecot-postfix.postinst:
    - create initial certificate symlinks to snakeoil.
    - set up postfix with postconf to:
      - use Maildir/ as the default mailbox.
      - use dovecot as the sasl authentication server.
      - use dovecot LDA (deliver).
      - use tls for smtp{d} services.
    - fix certificates paths in postfix' main.cf
    - add reject_unauth_destination to postfix' recipient restrictions
    - add reject_unknown_sender_domain to postfix' sender restrictions
    - rename configuration name on remove, delete on purge
    - restart dovecot after linking certificates
    - handle use case when postfix is unconfigurated
   + debian/dovecot-postfix.dirs: create backup directory for postfix's configuration
   + restart postfix and dovecot.
   + debian/dovecot-postfix.postrm:
     - remove all dovecot related configuration from postfix.
     - restart postfix and dovecot.
   + debian/dovecot-common.init:
     - check if /etc/dovecot/dovecot-postfix.conf exists and use it
       as the configuration file if so.
   + debian/patches/warning-ubuntu-postfix.dpatch
     - add warning about dovecot-postfix.conf in dovecot default 
       configuration file
   + debian/patches/dovecot-postfix.conf.diff:
     - Ubuntu server custom changes to the default dovecot configuration for
       better interfation with postfix
     - enable sieve plugin
   + debian/patches/dovecot-postfix.conf.diff:
     + Ubuntu server custom changes to the default dovecot configuration for
       better integration with postfix:
       - enable imap, pop3, imaps, pop3s and managesieve by default.
       - enable dovecot LDA (deliver).
       - enable SASL auth socket in postfix private directory.
   + debian/rules:
     - copy, patch and install dovecot-postfix.conf in /etc/dovecot/.
     - build architecure independent packages too
   + 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/*.
   + Fast TearDown: Update the lsb init header to not stop in level 6.
   + Add ufw integration:
     - Created debian/dovecot-common.ufw.profile.
     - debian/rules:
       + install profile
     - debian/control:
       + Suggest ufw
   + debian/{control,rules}: enable PIE hardening.
   + dovecot-imapd, dovecot-pop3: Replaces dovecot-common (<< 1:1.1). LP: #254721
   + debian/control:
     - Update Vcs-* headers.
   + debian/rules:
     - Create emtpy stamp.h.in files in dovecot-sieve/ and dovecot-managesieve/
       if they're not there since empty files are not included in the diff.gz 
       file.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
   + Dropped:
     - debian/patches/security-CVE-2009-3235: Applied upstream.
     - debian/patches/fix-pop3-assertion.dpatch: Applied upstream.
     - dovecot-sieve and dovecot-managesieve: Use the debian patches instead.

  [Chuck Short]
  - Updated dovecot-sieve to 0.1.13.
  - Updated dovecot-managesieve to 0.11.9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        unsigned char data[128];
73
73
} outofmem_area;
74
74
 
75
 
static void data_stack_last_buffer_reset(void)
 
75
static void data_stack_last_buffer_reset(bool preserve_data ATTR_UNUSED)
76
76
{
77
77
        if (last_buffer_block != NULL) {
78
78
#ifdef DEBUG
79
 
                const unsigned char *p;
 
79
                unsigned char *p;
80
80
                unsigned int i;
81
81
 
82
82
                p = STACK_BLOCK_DATA(current_block) +
95
95
                        if (p[i] != CLEAR_CHR)
96
96
                                i_panic("t_buffer_get(): buffer overflow");
97
97
                }
 
98
 
 
99
                if (!preserve_data) {
 
100
                        p = STACK_BLOCK_DATA(current_block) +
 
101
                                (current_block->size - current_block->left);
 
102
                        memset(p, CLEAR_CHR, SENTRY_COUNT);
 
103
                }
98
104
#endif
99
105
        }
100
106
}
134
140
                frame_block->prev = current_frame_block;
135
141
                current_frame_block = frame_block;
136
142
        }
137
 
        data_stack_last_buffer_reset();
 
143
        data_stack_last_buffer_reset(FALSE);
138
144
 
139
145
        /* mark our current position */
140
146
        current_frame_block->block[frame_pos] = current_block;
197
203
                        }
198
204
                }
199
205
 
200
 
                /* we could verify here that the rest of the buffer contains
201
 
                   CLEAR_CHRs, but it would slow us down a bit too much. */
202
 
                max_pos = block->size - pos < SENTRY_COUNT ?
203
 
                        block->size - pos : SENTRY_COUNT;
204
 
                for (; pos < max_pos; pos++) {
205
 
                        if (p[pos] != CLEAR_CHR)
206
 
                                i_panic("data stack: buffer overflow");
207
 
                }
 
206
                /* if we had used t_buffer_get(), the rest of the buffer
 
207
                   may not contain CLEAR_CHRs. but we've already checked all
 
208
                   the allocations, so there's no need to check them anyway. */
208
209
                block = block->next;
209
210
                pos = 0;
210
211
        }
218
219
        if (unlikely(frame_pos < 0))
219
220
                i_panic("t_pop() called with empty stack");
220
221
 
 
222
        data_stack_last_buffer_reset(FALSE);
221
223
#ifdef DEBUG
222
224
        t_pop_verify();
223
225
#endif
224
 
        data_stack_last_buffer_reset();
225
226
 
226
227
        /* update the current block */
227
228
        current_block = current_frame_block->block[frame_pos];
317
318
                data_stack_init();
318
319
        }
319
320
 
320
 
        data_stack_last_buffer_reset();
321
 
 
322
321
        /* allocate only aligned amount of memory so alignment comes
323
322
           always properly */
324
323
#ifndef DEBUG
326
325
#else
327
326
        alloc_size = MEM_ALIGN(sizeof(size)) + MEM_ALIGN(size + SENTRY_COUNT);
328
327
#endif
 
328
        data_stack_last_buffer_reset(TRUE);
329
329
 
330
330
        /* used for t_try_realloc() */
331
331
        current_frame_block->last_alloc_size[frame_pos] = alloc_size;