~ubuntu-branches/ubuntu/quantal/dovecot/quantal

« back to all changes in this revision

Viewing changes to sieve/src/testsuite/testsuite-mailstore.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-29 09:21:32 UTC
  • mfrom: (4.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20100629092132-q4pr5lfuvmjqou19
Tags: 1:1.2.12-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  + Add mail-stack-delivery as per server-maverick-mail-integration spec:
   - Update debian/rules
   - Convert existing package to a dummy package and add new binary in debian/control
   - Update maintainer scripts.
   - Move previously installed backups and config files to new package name
     space in preinst
   - Add new debian/mail-stack-delivery.prerm to handle downgrades
   - Rename debian/dovecot-postfix.* to debian/mail-stack-delivery.*
  + 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/*.
  + Add ufw integration:
    - Created debian/dovecot-common.ufw.profile.
    - debian/rules: install profile.
    - debian/control: suggest ufw.
  + debian/{control,rules}: enable PIE hardening.
  + debian/control: Update Vcs-* headers.
  + Add SMTP-AUTH support for Outlook (login auth mechanism) 
  + debian/dovecot-common.dirs: Added usr/share/doc/dovecot-common
  + debian/patches/fix-dovecot-config-parser.patch: Fix ordering of external config 
    files. (LP: #597818)

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#include "mail-namespace.h"
11
11
#include "mail-storage.h"
12
12
 
13
 
#include "sieve-common.h" 
 
13
#include "sieve-common.h"
14
14
#include "sieve-error.h"
15
15
#include "sieve-interpreter.h"
16
 
 
 
16
 
17
17
#include "testsuite-message.h"
18
18
#include "testsuite-common.h"
19
19
#include "testsuite-smtp.h"
46
46
 */
47
47
 
48
48
void testsuite_mailstore_init(const char *user, const char *home)
49
 
{       
 
49
{
50
50
        testsuite_mailstore_tmp = i_strconcat
51
51
                (testsuite_tmp_dir_get(), "/mailstore", NULL);
52
52
 
53
53
        if ( mkdir(testsuite_mailstore_tmp, 0700) < 0 ) {
54
 
                i_fatal("failed to create temporary directory '%s': %m.", 
55
 
                        testsuite_mailstore_tmp);               
 
54
                i_fatal("failed to create temporary directory '%s': %m.",
 
55
                        testsuite_mailstore_tmp);
56
56
        }
57
57
 
58
58
        env_put(t_strdup_printf("NAMESPACE_1=maildir:%s", testsuite_mailstore_tmp));
64
64
        testsuite_mailstore_user = mail_user_init(user);
65
65
        mail_user_set_home(testsuite_mailstore_user, home);
66
66
        if (mail_namespaces_init(testsuite_mailstore_user) < 0)
67
 
                i_fatal("Namespace initialization failed");     
 
67
                i_fatal("Namespace initialization failed");
68
68
}
69
69
 
70
70
void testsuite_mailstore_deinit(void)
79
79
                i_warning("failed to remove temporary directory '%s': %m.",
80
80
                        testsuite_mailstore_tmp);
81
81
        }
82
 
        
83
 
        i_free(testsuite_mailstore_tmp);                
 
82
 
 
83
        i_free(testsuite_mailstore_tmp);
84
84
}
85
85
 
86
86
void testsuite_mailstore_reset(void)
115
115
 
116
116
        if ( testsuite_mailstore_trans != NULL )
117
117
                mailbox_transaction_rollback(&testsuite_mailstore_trans);
118
 
                
 
118
 
119
119
        if ( testsuite_mailstore_box != NULL )
120
120
                mailbox_close(&testsuite_mailstore_box);
121
121
 
125
125
 
126
126
static struct mail *testsuite_mailstore_open(const char *folder)
127
127
{
128
 
        enum mailbox_open_flags open_flags = 
129
 
                MAILBOX_OPEN_FAST | MAILBOX_OPEN_KEEP_RECENT | 
 
128
        enum mailbox_open_flags open_flags =
 
129
                MAILBOX_OPEN_FAST | MAILBOX_OPEN_KEEP_RECENT |
130
130
                MAILBOX_OPEN_SAVEONLY | MAILBOX_OPEN_POST_SESSION;
131
131
        struct mail_storage *storage = testsuite_mailstore_user->namespaces->storage;
132
132
        struct mailbox *box;
134
134
 
135
135
        if ( testsuite_mailstore_mail == NULL ) {
136
136
                testsuite_mailstore_close();
137
 
        } else if ( testsuite_mailstore_folder != NULL 
 
137
        } else if ( testsuite_mailstore_folder != NULL
138
138
                && strcmp(folder, testsuite_mailstore_folder) != 0  ) {
139
 
                testsuite_mailstore_close();    
 
139
                testsuite_mailstore_close();
140
140
        } else {
141
141
                return testsuite_mailstore_mail;
142
142
        }
144
144
        box = mailbox_open(&storage, folder, NULL, open_flags);
145
145
        if ( box == NULL ) {
146
146
                sieve_sys_error("testsuite: failed to open mailbox '%s'", folder);
147
 
                return NULL;    
 
147
                return NULL;
148
148
        }
149
 
        
 
149
 
150
150
        /* Sync mailbox */
151
151
 
152
152
        if ( mailbox_sync(box, MAILBOX_SYNC_FLAG_FULL_READ, 0, NULL) < 0 ) {