xref: /freebsd/contrib/sendmail/cf/mailer/local.m4 (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1PUSHDIVERT(-1)
2#
3# Copyright (c) 1998-2000, 2004 Proofpoint, 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')
16ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/mail)')
17ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -d $u')')
18ifdef(`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')
21ifdef(`LOCAL_SHELL_PATH',, `define(`LOCAL_SHELL_PATH', /bin/sh)')
22ifdef(`LOCAL_SHELL_ARGS',, `define(`LOCAL_SHELL_ARGS', `sh -c $u')')
23ifdef(`LOCAL_SHELL_DIR',, `define(`LOCAL_SHELL_DIR', `$z:/')')
24define(`LOCAL_RWR', `ifdef(`_LOCAL_LMTP_',
25`S=EnvFromSMTP/HdrFromL, R=EnvToL/HdrToL',
26`S=EnvFromL/HdrFromL, R=EnvToL/HdrToL')')
27define(`_LOCAL_QGRP', `ifelse(defn(`LOCAL_MAILER_QGRP'),`',`', ` Q=LOCAL_MAILER_QGRP,')')dnl
28define(`_PROG_QGRP', `ifelse(defn(`LOCAL_PROG_QGRP'),`',`', ` Q=LOCAL_PROG_QGRP,')')dnl
29POPDIVERT
30
31##################################################
32###   Local and Program Mailer specification   ###
33##################################################
34
35VERSIONID(`$Id: local.m4,v 8.60 2013-11-22 20:51:14 ca Exp $')
36
37#
38#  Envelope sender rewriting
39#
40SEnvFromL
41R<@>			$n			errors to mailer-daemon
42R@ <@ $*>		$n			temporarily bypass Sun bogosity
43R$+			$: $>AddDomain $1	add local domain if needed
44ifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
45R$*			$: $>MasqEnv $1		do masquerading')
46
47#
48#  Envelope recipient rewriting
49#
50SEnvToL
51R$+ < @ $* >		$: $1			strip host part
52ifdef(`confUSERDB_SPEC', `dnl', `dnl
53R$+ + $*		$: < $&{addr_type} > $1 + $2	mark with addr type
54R<e s> $+ + $*		$: $1			remove +detail for sender
55R< $* > $+		$: $2			else remove mark')
56
57#
58#  Header sender rewriting
59#
60SHdrFromL
61R<@>			$n			errors to mailer-daemon
62R@ <@ $*>		$n			temporarily bypass Sun bogosity
63R$+			$: $>AddDomain $1	add local domain if needed
64ifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
65R$*			$: $>MasqHdr $1		do masquerading')
66
67#
68#  Header recipient rewriting
69#
70SHdrToL
71R$+			$: $>AddDomain $1	add local domain if needed
72ifdef(`_ALL_MASQUERADE_', `dnl
73ifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
74R$*			$: $>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#
80SAddDomain
81ifdef(`_ALWAYS_ADD_DOMAIN_', `dnl
82R$* < @ $* > $*		$@ $1 < @ $2 > $3	already fully qualified
83ifelse(len(X`'_ALWAYS_ADD_DOMAIN_),`1',`
84R$+			$@ $1 < @ *LOCAL* >	add local qualification',
85`R$+			$@ $1 < @ _ALWAYS_ADD_DOMAIN_ >	add qualification')',
86`dnl')
87
88Mlocal,		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
91Mprog,		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
94