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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short, Scott Kitterman
  • Date: 2010-06-22 10:33:51 UTC
  • mfrom: (1.13.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100622103351-ifbmnklp8kxrhb30
Tags: 1:1.2.12-0ubuntu1
* New upstream release:
  - deliver: Don't crash when a message with Auto-submitted: header gets
   rejected.
  - lib-storage: Fixed header searches to work correctly when there are
    multiple headers with same name.
  - dict client: Disconnect from dict server after 1 second of idling.
  - dict: If process crashed, it wasn't automatically restarted
  - dict file: If dict file's group permissions equal world permissions,
    don't try to change its gid.
  - maildir: Fixed a memory leak when copying with hardlinks.
  - maildir: Expunging last messages may have assert-crashed if their
    filenames had just changed.
 * Update sieve patch to 0.1.17
 * debian/dovecot-common.postinst: Add warning about expired certificate.
   (Debian Bug: #576455)
 * Silence lintian warnings.

 [Scott Kitterman]
 * Rename dovecot-postfix to mail-stack-delivery 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.*

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#include "array.h"
6
6
#include "unlink-directory.h"
7
7
 
8
 
#include "sieve-common.h"
 
8
#include "sieve-common.h" 
9
9
#include "sieve-error.h"
10
10
#include "sieve-interpreter.h"
11
 
 
 
11
 
12
12
#include "testsuite-message.h"
13
13
#include "testsuite-common.h"
14
14
#include "testsuite-smtp.h"
33
33
void testsuite_smtp_init(void)
34
34
{
35
35
        pool_t pool;
36
 
 
37
 
        testsuite_smtp_pool = pool = pool_alloconly_create("testsuite_smtp", 8192);
38
 
 
 
36
        
 
37
        testsuite_smtp_pool = pool = pool_alloconly_create("testsuite_smtp", 8192);     
 
38
        
39
39
        testsuite_smtp_tmp = p_strconcat
40
40
                (pool, testsuite_tmp_dir_get(), "/smtp", NULL);
41
41
 
42
42
        if ( mkdir(testsuite_smtp_tmp, 0700) < 0 ) {
43
 
                i_fatal("failed to create temporary directory '%s': %m.",
44
 
                        testsuite_smtp_tmp);
 
43
                i_fatal("failed to create temporary directory '%s': %m.", 
 
44
                        testsuite_smtp_tmp);            
45
45
        }
46
 
 
 
46
        
47
47
        p_array_init(&testsuite_smtp_messages, pool, 16);
48
48
}
49
49
 
52
52
        if ( unlink_directory(testsuite_smtp_tmp, TRUE) < 0 )
53
53
                i_warning("failed to remove temporary directory '%s': %m.",
54
54
                        testsuite_smtp_tmp);
55
 
 
56
 
        pool_unref(&testsuite_smtp_pool);
 
55
        
 
56
        pool_unref(&testsuite_smtp_pool);               
57
57
}
58
58
 
59
59
void testsuite_smtp_reset(void)
65
65
/*
66
66
 * Simulated SMTP out
67
67
 */
68
 
 
 
68
 
69
69
struct testsuite_smtp {
70
70
        const char *tmp_path;
71
71
        FILE *mfile;
72
72
};
73
 
 
 
73
 
74
74
void *testsuite_smtp_open
75
75
        (const char *destination, const char *return_path, FILE **file_r)
76
 
{
 
76
{       
77
77
        struct testsuite_smtp_message smtp_msg;
78
78
        struct testsuite_smtp *smtp;
79
79
        unsigned int smtp_count = array_count(&testsuite_smtp_messages);
80
 
 
81
 
        smtp_msg.file = p_strdup_printf(testsuite_smtp_pool,
 
80
        
 
81
        smtp_msg.file = p_strdup_printf(testsuite_smtp_pool, 
82
82
                "%s/%d.eml", testsuite_smtp_tmp, smtp_count);
83
 
        smtp_msg.envelope_from =
 
83
        smtp_msg.envelope_from = 
84
84
                ( return_path != NULL ? p_strdup(testsuite_smtp_pool, return_path) : NULL );
85
85
        smtp_msg.envelope_to = p_strdup(testsuite_smtp_pool, destination);
86
 
 
 
86
         
87
87
        array_append(&testsuite_smtp_messages, &smtp_msg, 1);
88
 
 
 
88
        
89
89
        smtp = t_new(struct testsuite_smtp, 1);
90
90
        smtp->tmp_path = smtp_msg.file;
91
91
        smtp->mfile = fopen(smtp->tmp_path, "w");
94
94
                i_fatal("failed to open tmp file for SMTP simulation.");
95
95
 
96
96
        *file_r = smtp->mfile;
97
 
 
98
 
        return (void *) smtp;
 
97
        
 
98
        return (void *) smtp;   
99
99
}
100
100
 
101
101
bool testsuite_smtp_close(void *handle)
103
103
        struct testsuite_smtp *smtp = (struct testsuite_smtp *) handle;
104
104
 
105
105
        fclose(smtp->mfile);
106
 
 
 
106
        
107
107
        return TRUE;
108
108
}
109
109