No empty .Rs/.Re
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / local / indirect.c
blob0eec03e3124821322c00abb26847c265f5b10992
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* indirect 3
6 /* SUMMARY
7 /* indirect delivery
8 /* SYNOPSIS
9 /* #include "local.h"
11 /* void deliver_indirect(state)
12 /* LOCAL_STATE state;
13 /* char *recipient;
14 /* DESCRIPTION
15 /* deliver_indirect() delivers a message via the message
16 /* forwarding service, with duplicate filtering up to a
17 /* configurable number of recipients.
19 /* Arguments:
20 /* .IP state
21 /* The attributes that specify the message, sender and more.
22 /* A table with the results from expanding aliases or lists.
23 /* CONFIGURATION VARIABLES
24 /* duplicate_filter_limit, duplicate filter size limit
25 /* DIAGNOSTICS
26 /* The result is non-zero when the operation should be tried again.
27 /* LICENSE
28 /* .ad
29 /* .fi
30 /* The Secure Mailer license must be distributed with this software.
31 /* AUTHOR(S)
32 /* Wietse Venema
33 /* IBM T.J. Watson Research
34 /* P.O. Box 704
35 /* Yorktown Heights, NY 10598, USA
36 /*--*/
38 /* System library. */
40 #include <sys_defs.h>
41 #include <unistd.h>
43 /* Utility library. */
45 #include <msg.h>
46 #include <htable.h>
48 /* Global library. */
50 #include <mail_params.h>
51 #include <bounce.h>
52 #include <defer.h>
53 #include <been_here.h>
54 #include <sent.h>
56 /* Application-specific. */
58 #include "local.h"
60 /* deliver_indirect - deliver mail via forwarding service */
62 int deliver_indirect(LOCAL_STATE state)
66 * Suppress duplicate expansion results. Add some sugar to the name to
67 * avoid collisions with other duplicate filters. Allow the user to
68 * specify an upper bound on the size of the duplicate filter, so that we
69 * can handle huge mailing lists with millions of recipients.
71 if (msg_verbose)
72 msg_info("deliver_indirect: %s", state.msg_attr.rcpt.address);
73 if (been_here(state.dup_filter, "indirect %s",
74 state.msg_attr.rcpt.address))
75 return (0);
78 * Don't forward a trace-only request.
80 if (DEL_REQ_TRACE_ONLY(state.request->flags)) {
81 dsb_simple(state.msg_attr.why, "2.0.0", "forwards to %s",
82 state.msg_attr.rcpt.address);
83 return (sent(BOUNCE_FLAGS(state.request), SENT_ATTR(state.msg_attr)));
87 * Send the address to the forwarding service. Inherit the delivered
88 * attribute from the alias or from the .forward file owner.
90 if (forward_append(state.msg_attr)) {
91 dsb_simple(state.msg_attr.why, "4.3.0", "unable to forward message");
92 return (defer_append(BOUNCE_FLAGS(state.request),
93 BOUNCE_ATTR(state.msg_attr)));
95 return (0);