Merge from vendor branch SENDMAIL:
[dragonfly.git] / contrib / sendmail-8.13.4 / cf / mailer / local.m4
1 PUSHDIVERT(-1)
2 #
3 # Copyright (c) 1998-2000, 2004 Sendmail, Inc. and its suppliers.
4 #       All rights reserved.
5 # Copyright (c) 1983 Eric P. Allman.  All rights reserved.
6 # Copyright (c) 1988, 1993
7 #       The Regents of the University of California.  All rights reserved.
8 #
9 # By using this file, you agree to the terms and conditions set
10 # forth in the LICENSE file which can be found at the top level of
11 # the sendmail distribution.
12 #
13 #
14 _DEFIFNOT(`_DEF_LOCAL_MAILER_FLAGS', `lsDFMAw5:/|@q')
15 _DEFIFNOT(`LOCAL_MAILER_FLAGS', `Prmn9')
16 ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/mail)')
17 ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -d $u')')
18 ifdef(`LOCAL_MAILER_DSN_DIAGNOSTIC_CODE',, `define(`LOCAL_MAILER_DSN_DIAGNOSTIC_CODE', `X-Unix')')
19 _DEFIFNOT(`_DEF_LOCAL_SHELL_FLAGS', `lsDFMoq')
20 _DEFIFNOT(`LOCAL_SHELL_FLAGS', `eu9')
21 ifdef(`LOCAL_SHELL_PATH',, `define(`LOCAL_SHELL_PATH', /bin/sh)')
22 ifdef(`LOCAL_SHELL_ARGS',, `define(`LOCAL_SHELL_ARGS', `sh -c $u')')
23 ifdef(`LOCAL_SHELL_DIR',, `define(`LOCAL_SHELL_DIR', `$z:/')')
24 define(`LOCAL_RWR', `ifdef(`_LOCAL_LMTP_',
25 `S=EnvFromSMTP/HdrFromL, R=EnvToL/HdrToL',
26 `S=EnvFromL/HdrFromL, R=EnvToL/HdrToL')')
27 define(`_LOCAL_QGRP', `ifelse(defn(`LOCAL_MAILER_QGRP'),`',`', ` Q=LOCAL_MAILER_QGRP,')')dnl
28 define(`_PROG_QGRP', `ifelse(defn(`LOCAL_PROG_QGRP'),`',`', ` Q=LOCAL_PROG_QGRP,')')dnl
29 POPDIVERT
30
31 ##################################################
32 ###   Local and Program Mailer specification   ###
33 ##################################################
34
35 VERSIONID(`$Id: local.m4,v 8.59 2004/11/23 00:37:25 ca Exp $')
36
37 #
38 #  Envelope sender rewriting
39 #
40 SEnvFromL
41 R<@>                    $n                      errors to mailer-daemon
42 R@ <@ $*>               $n                      temporarily bypass Sun bogosity
43 R$+                     $: $>AddDomain $1       add local domain if needed
44 ifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
45 R$*                     $: $>MasqEnv $1         do masquerading')
46
47 #
48 #  Envelope recipient rewriting
49 #
50 SEnvToL
51 R$+ < @ $* >            $: $1                   strip host part
52 ifdef(`confUSERDB_SPEC', `dnl', `dnl
53 R$+ + $*                $: < $&{addr_type} > $1 + $2    mark with addr type
54 R<e s> $+ + $*          $: $1                   remove +detail for sender
55 R< $* > $+              $: $2                   else remove mark')
56
57 #
58 #  Header sender rewriting
59 #
60 SHdrFromL
61 R<@>                    $n                      errors to mailer-daemon
62 R@ <@ $*>               $n                      temporarily bypass Sun bogosity
63 R$+                     $: $>AddDomain $1       add local domain if needed
64 ifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
65 R$*                     $: $>MasqHdr $1         do masquerading')
66
67 #
68 #  Header recipient rewriting
69 #
70 SHdrToL
71 R$+                     $: $>AddDomain $1       add local domain if needed
72 ifdef(`_ALL_MASQUERADE_', `dnl
73 ifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
74 R$*                     $: $>MasqHdr $1         do all-masquerading')',
75 `R$* < @ *LOCAL* > $*   $: $1 < @ $j . > $2')
76
77 #
78 #  Common code to add local domain name (only if always-add-domain)
79 #
80 SAddDomain
81 ifdef(`_ALWAYS_ADD_DOMAIN_', `dnl
82 R$* < @ $* > $*         $@ $1 < @ $2 > $3       already fully qualified
83 ifelse(len(X`'_ALWAYS_ADD_DOMAIN_),`1',`
84 R$+                     $@ $1 < @ *LOCAL* >     add local qualification',
85 `R$+                    $@ $1 < @ _ALWAYS_ADD_DOMAIN_ > add qualification')',
86 `dnl')
87
88 Mlocal,         P=LOCAL_MAILER_PATH, F=_MODMF_(CONCAT(_DEF_LOCAL_MAILER_FLAGS, LOCAL_MAILER_FLAGS), `LOCAL'), LOCAL_RWR,_OPTINS(`LOCAL_MAILER_EOL', ` E=', `, ')
89                 _OPTINS(`LOCAL_MAILER_MAX', `M=', `, ')_OPTINS(`LOCAL_MAILER_MAXMSGS', `m=', `, ')_OPTINS(`LOCAL_MAILER_MAXRCPTS', `r=', `, ')_OPTINS(`LOCAL_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/LOCAL_MAILER_DSN_DIAGNOSTIC_CODE,_LOCAL_QGRP
90                 A=LOCAL_MAILER_ARGS
91 Mprog,          P=LOCAL_SHELL_PATH, F=_MODMF_(CONCAT(_DEF_LOCAL_SHELL_FLAGS, LOCAL_SHELL_FLAGS), `SHELL'), S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=LOCAL_SHELL_DIR,
92                 _OPTINS(`LOCAL_MAILER_MAX', `M=', `, ')T=X-Unix/X-Unix/X-Unix,_PROG_QGRP
93                 A=LOCAL_SHELL_ARGS