~ubuntu-branches/ubuntu/vivid/postfix/vivid-proposed

« back to all changes in this revision

Viewing changes to src/local/indirect.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2005-02-27 09:33:07 UTC
  • Revision ID: james.westby@ubuntu.com-20050227093307-cn789t27ibnlh6tf
Tags: upstream-2.1.5
ImportĀ upstreamĀ versionĀ 2.1.5

Show diffs side-by-side

added added

removed removed

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