3
/* cleanup_out_recipient 3
5
/* envelope recipient output filter
7
/* #include "cleanup.h"
9
/* void cleanup_out_recipient(state, orig_recipient, recipient)
10
/* CLEANUP_STATE *state;
11
/* const char *orig_recipient;
12
/* const char *recipient;
14
/* This module implements an envelope recipient output filter.
16
/* cleanup_out_recipient() performs virtual table expansion
17
/* and recipient duplicate filtering, and appends the
18
/* resulting recipients to the output stream.
22
/* .IP local_duplicate_filter_limit
23
/* Upper bound to the size of the recipient duplicate filter.
24
/* Zero means no limit; this may cause the mail system to
26
/* .IP virtual_alias_maps
27
/* list of virtual address lookup tables.
31
/* The Secure Mailer license must be distributed with this software.
34
/* IBM T.J. Watson Research
36
/* Yorktown Heights, NY 10598, USA
44
#ifdef STRCASECMP_IN_STRINGS_H
48
/* Utility library. */
54
#include <been_here.h>
55
#include <mail_params.h>
58
#include <cleanup_user.h>
60
/* Application-specific. */
64
/* cleanup_out_recipient - envelope recipient output filter */
66
void cleanup_out_recipient(CLEANUP_STATE *state, const char *orcpt,
73
* XXX Not elegant, but eliminates complexity in the record reading loop.
75
if (!var_enable_orcpt)
79
* Distinguish between different original recipient addresses that map
80
* onto the same mailbox. The recipient will use our original recipient
81
* message header to figure things out.
83
#define STREQ(x, y) (strcmp((x), (y)) == 0)
85
if ((state->flags & CLEANUP_FLAG_MAP_OK) == 0
86
|| cleanup_virt_alias_maps == 0) {
87
if ((STREQ(orcpt, recip) ? been_here(state->dups, "%s", orcpt) :
88
been_here(state->dups, "%s\n%s", orcpt, recip)) == 0) {
89
cleanup_out_string(state, REC_TYPE_ORCP, orcpt);
90
cleanup_out_string(state, REC_TYPE_RCPT, recip);
94
argv = cleanup_map1n_internal(state, recip, cleanup_virt_alias_maps,
95
cleanup_ext_prop_mask & EXT_PROP_VIRTUAL);
96
for (cpp = argv->argv; *cpp; cpp++) {
97
if ((STREQ(orcpt, *cpp) ? been_here(state->dups, "%s", orcpt) :
98
been_here(state->dups, "%s\n%s", orcpt, *cpp)) == 0) {
99
cleanup_out_string(state, REC_TYPE_ORCP, orcpt);
100
cleanup_out_string(state, REC_TYPE_RCPT, *cpp);