xref: /titanic_50/usr/src/cmd/sendmail/cf/mailer/local.m4 (revision 275c9da86e89f8abf71135cf63d9fc23671b2e60)
1PUSHDIVERT(-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# ident	"%Z%%M%	%I%	%E% SMI"
14#
15_DEFIFNOT(`_DEF_LOCAL_MAILER_FLAGS', `lsDFMAw5:/|@q')
16_DEFIFNOT(`LOCAL_MAILER_FLAGS', `Prmn9')
17ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/mail)')
18ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -d $u')')
19ifdef(`LOCAL_MAILER_DSN_DIAGNOSTIC_CODE',, `define(`LOCAL_MAILER_DSN_DIAGNOSTIC_CODE', `X-Unix')')
20_DEFIFNOT(`_DEF_LOCAL_SHELL_FLAGS', `lsDFMoq')
21_DEFIFNOT(`LOCAL_SHELL_FLAGS', `eu9')
22ifdef(`LOCAL_SHELL_PATH',, `define(`LOCAL_SHELL_PATH', /bin/sh)')
23ifdef(`LOCAL_SHELL_ARGS',, `define(`LOCAL_SHELL_ARGS', `sh -c $u')')
24ifdef(`LOCAL_SHELL_DIR',, `define(`LOCAL_SHELL_DIR', `$z:/')')
25define(`LOCAL_RWR', `ifdef(`_LOCAL_LMTP_',
26`S=EnvFromSMTP/HdrFromL, R=EnvToL/HdrToL',
27`S=EnvFromL/HdrFromL, R=EnvToL/HdrToL')')
28define(`_LOCAL_QGRP', `ifelse(defn(`LOCAL_MAILER_QGRP'),`',`', ` Q=LOCAL_MAILER_QGRP,')')dnl
29define(`_PROG_QGRP', `ifelse(defn(`LOCAL_PROG_QGRP'),`',`', ` Q=LOCAL_PROG_QGRP,')')dnl
30POPDIVERT
31
32##################################################
33###   Local and Program Mailer specification   ###
34##################################################
35
36VERSIONID(`$Id: local.m4,v 8.59 2004/11/23 00:37:25 ca Exp $')
37
38#
39#  Envelope sender rewriting
40#
41SEnvFromL
42R<@>			$n			errors to mailer-daemon
43R@ <@ $*>		$n			temporarily bypass Sun bogosity
44R$+			$: $>AddDomain $1	add local domain if needed
45ifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
46R$*			$: $>MasqEnv $1		do masquerading')
47
48#
49#  Envelope recipient rewriting
50#
51SEnvToL
52R$+ < @ $* >		$: $1			strip host part
53ifdef(`confUSERDB_SPEC', `dnl', `dnl
54R$+ + $*		$: < $&{addr_type} > $1 + $2	mark with addr type
55R<e s> $+ + $*		$: $1			remove +detail for sender
56R< $* > $+		$: $2			else remove mark')
57
58#
59#  Header sender rewriting
60#
61SHdrFromL
62R<@>			$n			errors to mailer-daemon
63R@ <@ $*>		$n			temporarily bypass Sun bogosity
64R$+			$: $>AddDomain $1	add local domain if needed
65ifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
66R$*			$: $>MasqHdr $1		do masquerading')
67
68#
69#  Header recipient rewriting
70#
71SHdrToL
72R$+			$: $>AddDomain $1	add local domain if needed
73ifdef(`_ALL_MASQUERADE_', `dnl
74ifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
75R$*			$: $>MasqHdr $1		do all-masquerading')',
76`R$* < @ *LOCAL* > $*	$: $1 < @ $j . > $2')
77
78#
79#  Common code to add local domain name (only if always-add-domain)
80#
81SAddDomain
82ifdef(`_ALWAYS_ADD_DOMAIN_', `dnl
83R$* < @ $* > $* 	$@ $1 < @ $2 > $3	already fully qualified
84ifelse(len(X`'_ALWAYS_ADD_DOMAIN_),`1',`
85R$+			$@ $1 < @ *LOCAL* >	add local qualification',
86`R$+			$@ $1 < @ _ALWAYS_ADD_DOMAIN_ >	add qualification')',
87`dnl')
88
89Mlocal,		P=LOCAL_MAILER_PATH, F=_MODMF_(CONCAT(_DEF_LOCAL_MAILER_FLAGS, LOCAL_MAILER_FLAGS), `LOCAL'), LOCAL_RWR,_OPTINS(`LOCAL_MAILER_EOL', ` E=', `, ')
90		_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
91		A=LOCAL_MAILER_ARGS
92Mprog,		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,
93		_OPTINS(`LOCAL_MAILER_MAX', `M=', `, ')T=X-Unix/X-Unix/X-Unix,_PROG_QGRP
94		A=LOCAL_SHELL_ARGS
95