~ubuntu-branches/ubuntu/raring/postfix/raring

« back to all changes in this revision

Viewing changes to src/cleanup/cleanup_addr.c

Tags: upstream-2.2.6
ImportĀ upstreamĀ versionĀ 2.2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
#include <mail_addr.h>
77
77
#include <canon_addr.h>
78
78
#include <mail_addr_find.h>
 
79
#include <mail_proto.h>
79
80
 
80
81
/* Application-specific. */
81
82
 
91
92
    VSTRING *clean_addr = vstring_alloc(100);
92
93
    const char *bcc;
93
94
 
94
 
    cleanup_rewrite_internal(clean_addr, buf);
 
95
    /*
 
96
     * Note: an unqualified envelope address is for all practical purposes
 
97
     * equivalent to a fully qualified local address, both for delivery and
 
98
     * for replying. Having to support both forms is error prone, therefore
 
99
     * an incomplete envelope address is rewritten to fully qualified form in
 
100
     * the local domain context.
 
101
     */
 
102
    cleanup_rewrite_internal(MAIL_ATTR_RWR_LOCAL, clean_addr, buf);
95
103
    if (strncasecmp(STR(clean_addr), MAIL_ADDR_MAIL_DAEMON "@",
96
104
                    sizeof(MAIL_ADDR_MAIL_DAEMON)) == 0) {
97
105
        canon_addr_internal(state->temp1, MAIL_ADDR_MAIL_DAEMON);
99
107
            vstring_strcpy(clean_addr, "");
100
108
    }
101
109
    if (state->flags & CLEANUP_FLAG_MAP_OK) {
102
 
        if (cleanup_send_canon_maps)
 
110
        if (cleanup_send_canon_maps
 
111
            && (cleanup_send_canon_flags & CLEANUP_CANON_FLAG_ENV_FROM))
103
112
            cleanup_map11_internal(state, clean_addr, cleanup_send_canon_maps,
104
113
                                cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
105
 
        if (cleanup_comm_canon_maps)
 
114
        if (cleanup_comm_canon_maps
 
115
            && (cleanup_comm_canon_flags & CLEANUP_CANON_FLAG_ENV_FROM))
106
116
            cleanup_map11_internal(state, clean_addr, cleanup_comm_canon_maps,
107
117
                                cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
108
118
        if (cleanup_masq_domains
128
138
    VSTRING *clean_addr = vstring_alloc(100);
129
139
    const char *bcc;
130
140
 
131
 
    cleanup_rewrite_internal(clean_addr, *buf ? buf : var_empty_addr);
 
141
    /*
 
142
     * Note: an unqualified envelope address is for all practical purposes
 
143
     * equivalent to a fully qualified local address, both for delivery and
 
144
     * for replying. Having to support both forms is error prone, therefore
 
145
     * an incomplete envelope address is rewritten to fully qualified form in
 
146
     * the local domain context.
 
147
     */
 
148
    cleanup_rewrite_internal(MAIL_ATTR_RWR_LOCAL,
 
149
                             clean_addr, *buf ? buf : var_empty_addr);
132
150
    if (state->flags & CLEANUP_FLAG_MAP_OK) {
133
 
        if (cleanup_rcpt_canon_maps)
 
151
        if (cleanup_rcpt_canon_maps
 
152
            && (cleanup_rcpt_canon_flags & CLEANUP_CANON_FLAG_ENV_RCPT))
134
153
            cleanup_map11_internal(state, clean_addr, cleanup_rcpt_canon_maps,
135
154
                                cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
136
 
        if (cleanup_comm_canon_maps)
 
155
        if (cleanup_comm_canon_maps
 
156
            && (cleanup_comm_canon_flags & CLEANUP_CANON_FLAG_ENV_RCPT))
137
157
            cleanup_map11_internal(state, clean_addr, cleanup_comm_canon_maps,
138
158
                                cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
139
159
        if (cleanup_masq_domains
158
178
{
159
179
    VSTRING *clean_addr = vstring_alloc(100);
160
180
 
161
 
    cleanup_rewrite_internal(clean_addr, bcc);
 
181
    /*
 
182
     * Note: BCC addresses are supplied locally, and must be rewritten in the
 
183
     * local address rewriting context.
 
184
     */
 
185
    cleanup_rewrite_internal(MAIL_ATTR_RWR_LOCAL, clean_addr, bcc);
162
186
    if (state->flags & CLEANUP_FLAG_MAP_OK) {
163
 
        if (cleanup_rcpt_canon_maps)
 
187
        if (cleanup_rcpt_canon_maps
 
188
            && (cleanup_rcpt_canon_flags & CLEANUP_CANON_FLAG_ENV_RCPT))
164
189
            cleanup_map11_internal(state, clean_addr, cleanup_rcpt_canon_maps,
165
190
                                cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
166
 
        if (cleanup_comm_canon_maps)
 
191
        if (cleanup_comm_canon_maps
 
192
            && (cleanup_comm_canon_flags & CLEANUP_CANON_FLAG_ENV_RCPT))
167
193
            cleanup_map11_internal(state, clean_addr, cleanup_comm_canon_maps,
168
194
                                cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
169
195
        if (cleanup_masq_domains