~ubuntu-dev/ubuntu/lucid/dovecot/lucid-201002101901

« back to all changes in this revision

Viewing changes to libsieve/src/testsuite/testsuite-log.c

  • Committer: Chuck Short
  • Date: 2010-01-21 20:21:25 UTC
  • mfrom: (4.1.11 squeeze)
  • Revision ID: zulcss@ubuntu.com-20100121202125-pme73o491kfwj5nc
* 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 restriction
    - 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 config
    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.
    - 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.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
* New upstream release.
* debian/patches/gold-fix.patch: Removed. Fixed upstream.
* Moved libexec to lib corrections in dovecot-managesieve.patch and
  dovecot-managesieve-dist.patch to dovecot-example.patch
* debian/patches/dovecot-mboxlocking.patch: Regenerated to avoid FTBFS
  when quilt isn't installed.
* debian/patches/quota-mountpoint.patch: Removed. Not needed anymore.
* debian/patches/dovecot-quota.patch: Removed. Quotas aren't properly
  enabled unless mail_plugins = quota imap_quota.
* debian/patches/gold-fix.patch: Fixed configure script to build even
  with binutils-gold or --no-add-needed linker flag (Closes: #554306)
* debian/dovecot-common.init: fixed LSB headers. Thanks to Pascal Volk.
  (Closes: #558040)
* debian/changelog: added CVE references to previous changelog entry.
* debian/rules: checked up the build system. It's not fragile anymore.
  (Closes: 493803)
* debian/dovecot-common.postinst: Now invoking dpkg-reconfigure
  on dovecot-common is enough to generate new certificates
  if the previous ones were removed. (Closes: #545582)
* debian/rules: No longer install convert-tool in /usr/bin.
  It isn't an user utility and it should stay in /usr/lib/dovecot
  like all other similar tool.
* New upstream release. (Closes: #557601)
* [SECURITY] Fixes local information disclosure and denial of service.
  (see: http://www.dovecot.org/list/dovecot-news/2009-November/000143.html
  and CVE-2009-3897)
* Added myself to uploaders.
* Switched to the new source format "3.0 (quilt)":
  - removed dpatch from build-depends
  - removed debian/README.source because now we use only standard
    dpkg features
  - regenerated all patches
* Prepared to switch to multi-origin source:
  - recreated dovecot-libsieve.patch and dovecot-managesieve-dist.patch
    starting from the upstream tarball
  - removed all autotools related build-depends and build-conflict
  - renamed dovecot-libsieve and dovecot-managesieve directories
    to libsieve and managesieve.
* debian/rules: Moved the configuration of libsieve and managesieve from
  the build phase to the configuration phase
* Added dovecot-dbg package  with debugging symbols.  Thanks Stephan Bosch.
  (Closes: #554710)
* Fixed some stray libexec'isms in the default configuration.
* New upstream release.
* debian/dovecot-common.init:
  - use $CONF when starting the daemon. (Closes: #549944)
  - always output start/stop messages. (Closes: #523810)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2002-2009 Dovecot Sieve authors, see the included COPYING file
 
2
 */
 
3
 
 
4
#include "lib.h"
 
5
#include "array.h"
 
6
 
 
7
#include "sieve-common.h"
 
8
#include "sieve-error-private.h"
 
9
 
 
10
#include "testsuite-log.h"
 
11
 
 
12
/* 
 
13
 * Testsuite error handler
 
14
 */
 
15
 
 
16
struct sieve_error_handler *testsuite_log_ehandler = NULL;
 
17
 
 
18
struct _testsuite_log_message {
 
19
        const char *location;
 
20
        const char *message;
 
21
};
 
22
 
 
23
bool _testsuite_log_stdout = FALSE;
 
24
 
 
25
unsigned int _testsuite_log_error_index = 0;
 
26
 
 
27
static pool_t _testsuite_logmsg_pool = NULL;
 
28
ARRAY_DEFINE(_testsuite_log_errors, struct _testsuite_log_message);
 
29
 
 
30
static void _testsuite_log_verror
 
31
(struct sieve_error_handler *ehandler ATTR_UNUSED, const char *location,
 
32
        const char *fmt, va_list args)
 
33
{
 
34
        pool_t pool = _testsuite_logmsg_pool;
 
35
        struct _testsuite_log_message msg;
 
36
 
 
37
        if ( _testsuite_log_stdout )    
 
38
        {
 
39
                va_list args_copy;
 
40
                VA_COPY(args_copy, args);
 
41
                printf("error: %s: %s.\n", location, t_strdup_vprintf(fmt, args_copy));
 
42
        }
 
43
        
 
44
        msg.location = p_strdup(pool, location);
 
45
        msg.message = p_strdup_vprintf(pool, fmt, args);
 
46
 
 
47
        array_append(&_testsuite_log_errors, &msg, 1);  
 
48
}
 
49
 
 
50
static struct sieve_error_handler *_testsuite_log_ehandler_create(void)
 
51
{
 
52
        pool_t pool;
 
53
        struct sieve_error_handler *ehandler;
 
54
 
 
55
        /* Pool is not strictly necessary, but other handler types will need a pool,
 
56
         * so this one will have one too.
 
57
         */
 
58
        pool = pool_alloconly_create
 
59
                ("testsuite_log_handler", sizeof(struct sieve_error_handler));
 
60
        ehandler = p_new(pool, struct sieve_error_handler, 1);
 
61
        sieve_error_handler_init(ehandler, pool, 0);
 
62
 
 
63
        ehandler->verror = _testsuite_log_verror;
 
64
 
 
65
        return ehandler;
 
66
}
 
67
 
 
68
void testsuite_log_clear_messages(void)
 
69
{
 
70
        if ( _testsuite_logmsg_pool != NULL ) {
 
71
                if ( array_count(&_testsuite_log_errors) == 0 )
 
72
                        return;
 
73
                pool_unref(&_testsuite_logmsg_pool);
 
74
        }
 
75
 
 
76
        _testsuite_logmsg_pool = pool_alloconly_create
 
77
                ("testsuite_log_messages", 8192);
 
78
        
 
79
        p_array_init(&_testsuite_log_errors, _testsuite_logmsg_pool, 128);      
 
80
 
 
81
        sieve_error_handler_reset(testsuite_log_ehandler);
 
82
}
 
83
 
 
84
void testsuite_log_get_error_init(void)
 
85
{
 
86
        _testsuite_log_error_index = 0;
 
87
}
 
88
 
 
89
const char *testsuite_log_get_error_next(bool location)
 
90
{
 
91
        const struct _testsuite_log_message *msg;
 
92
 
 
93
        if ( _testsuite_log_error_index >= array_count(&_testsuite_log_errors) )
 
94
                return NULL;
 
95
 
 
96
        msg = array_idx(&_testsuite_log_errors, _testsuite_log_error_index++);
 
97
 
 
98
        if ( location ) 
 
99
                return msg->location;
 
100
 
 
101
        return msg->message;            
 
102
}
 
103
 
 
104
void testsuite_log_init(void)
 
105
{
 
106
        testsuite_log_ehandler = _testsuite_log_ehandler_create();      
 
107
        sieve_error_handler_accept_infolog(testsuite_log_ehandler, TRUE);
 
108
 
 
109
        sieve_system_ehandler_set(testsuite_log_ehandler);
 
110
 
 
111
        testsuite_log_clear_messages();
 
112
}
 
113
 
 
114
void testsuite_log_deinit(void)
 
115
{
 
116
        sieve_system_ehandler_reset();
 
117
 
 
118
        sieve_error_handler_unref(&testsuite_log_ehandler);
 
119
 
 
120
        pool_unref(&_testsuite_logmsg_pool);
 
121
}
 
122
 
 
123
 
 
124
 
 
125