xref: /titanic_51/usr/src/cmd/sendmail/cf/mailer/local.m4 (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gatePUSHDIVERT(-1)
2*7c478bd9Sstevel@tonic-gate#
3*7c478bd9Sstevel@tonic-gate# Copyright (c) 1998-2000, 2004 Sendmail, Inc. and its suppliers.
4*7c478bd9Sstevel@tonic-gate#	All rights reserved.
5*7c478bd9Sstevel@tonic-gate# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
6*7c478bd9Sstevel@tonic-gate# Copyright (c) 1988, 1993
7*7c478bd9Sstevel@tonic-gate#	The Regents of the University of California.  All rights reserved.
8*7c478bd9Sstevel@tonic-gate#
9*7c478bd9Sstevel@tonic-gate# By using this file, you agree to the terms and conditions set
10*7c478bd9Sstevel@tonic-gate# forth in the LICENSE file which can be found at the top level of
11*7c478bd9Sstevel@tonic-gate# the sendmail distribution.
12*7c478bd9Sstevel@tonic-gate#
13*7c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
14*7c478bd9Sstevel@tonic-gate#
15*7c478bd9Sstevel@tonic-gate_DEFIFNOT(`_DEF_LOCAL_MAILER_FLAGS', `lsDFMAw5:/|@q')
16*7c478bd9Sstevel@tonic-gate_DEFIFNOT(`LOCAL_MAILER_FLAGS', `Prmn9')
17*7c478bd9Sstevel@tonic-gateifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/mail)')
18*7c478bd9Sstevel@tonic-gateifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -d $u')')
19*7c478bd9Sstevel@tonic-gateifdef(`LOCAL_MAILER_DSN_DIAGNOSTIC_CODE',, `define(`LOCAL_MAILER_DSN_DIAGNOSTIC_CODE', `X-Unix')')
20*7c478bd9Sstevel@tonic-gate_DEFIFNOT(`_DEF_LOCAL_SHELL_FLAGS', `lsDFMoq')
21*7c478bd9Sstevel@tonic-gate_DEFIFNOT(`LOCAL_SHELL_FLAGS', `eu9')
22*7c478bd9Sstevel@tonic-gateifdef(`LOCAL_SHELL_PATH',, `define(`LOCAL_SHELL_PATH', /bin/sh)')
23*7c478bd9Sstevel@tonic-gateifdef(`LOCAL_SHELL_ARGS',, `define(`LOCAL_SHELL_ARGS', `sh -c $u')')
24*7c478bd9Sstevel@tonic-gateifdef(`LOCAL_SHELL_DIR',, `define(`LOCAL_SHELL_DIR', `$z:/')')
25*7c478bd9Sstevel@tonic-gatedefine(`LOCAL_RWR', `ifdef(`_LOCAL_LMTP_',
26*7c478bd9Sstevel@tonic-gate`S=EnvFromSMTP/HdrFromL, R=EnvToL/HdrToL',
27*7c478bd9Sstevel@tonic-gate`S=EnvFromL/HdrFromL, R=EnvToL/HdrToL')')
28*7c478bd9Sstevel@tonic-gatedefine(`_LOCAL_QGRP', `ifelse(defn(`LOCAL_MAILER_QGRP'),`',`', ` Q=LOCAL_MAILER_QGRP,')')dnl
29*7c478bd9Sstevel@tonic-gatedefine(`_PROG_QGRP', `ifelse(defn(`LOCAL_PROG_QGRP'),`',`', ` Q=LOCAL_PROG_QGRP,')')dnl
30*7c478bd9Sstevel@tonic-gatePOPDIVERT
31*7c478bd9Sstevel@tonic-gate
32*7c478bd9Sstevel@tonic-gate##################################################
33*7c478bd9Sstevel@tonic-gate###   Local and Program Mailer specification   ###
34*7c478bd9Sstevel@tonic-gate##################################################
35*7c478bd9Sstevel@tonic-gate
36*7c478bd9Sstevel@tonic-gateVERSIONID(`$Id: local.m4,v 8.59 2004/11/23 00:37:25 ca Exp $')
37*7c478bd9Sstevel@tonic-gate
38*7c478bd9Sstevel@tonic-gate#
39*7c478bd9Sstevel@tonic-gate#  Envelope sender rewriting
40*7c478bd9Sstevel@tonic-gate#
41*7c478bd9Sstevel@tonic-gateSEnvFromL
42*7c478bd9Sstevel@tonic-gateR<@>			$n			errors to mailer-daemon
43*7c478bd9Sstevel@tonic-gateR@ <@ $*>		$n			temporarily bypass Sun bogosity
44*7c478bd9Sstevel@tonic-gateR$+			$: $>AddDomain $1	add local domain if needed
45*7c478bd9Sstevel@tonic-gateifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
46*7c478bd9Sstevel@tonic-gateR$*			$: $>MasqEnv $1		do masquerading')
47*7c478bd9Sstevel@tonic-gate
48*7c478bd9Sstevel@tonic-gate#
49*7c478bd9Sstevel@tonic-gate#  Envelope recipient rewriting
50*7c478bd9Sstevel@tonic-gate#
51*7c478bd9Sstevel@tonic-gateSEnvToL
52*7c478bd9Sstevel@tonic-gateR$+ < @ $* >		$: $1			strip host part
53*7c478bd9Sstevel@tonic-gateifdef(`confUSERDB_SPEC', `dnl', `dnl
54*7c478bd9Sstevel@tonic-gateR$+ + $*		$: < $&{addr_type} > $1 + $2	mark with addr type
55*7c478bd9Sstevel@tonic-gateR<e s> $+ + $*		$: $1			remove +detail for sender
56*7c478bd9Sstevel@tonic-gateR< $* > $+		$: $2			else remove mark')
57*7c478bd9Sstevel@tonic-gate
58*7c478bd9Sstevel@tonic-gate#
59*7c478bd9Sstevel@tonic-gate#  Header sender rewriting
60*7c478bd9Sstevel@tonic-gate#
61*7c478bd9Sstevel@tonic-gateSHdrFromL
62*7c478bd9Sstevel@tonic-gateR<@>			$n			errors to mailer-daemon
63*7c478bd9Sstevel@tonic-gateR@ <@ $*>		$n			temporarily bypass Sun bogosity
64*7c478bd9Sstevel@tonic-gateR$+			$: $>AddDomain $1	add local domain if needed
65*7c478bd9Sstevel@tonic-gateifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
66*7c478bd9Sstevel@tonic-gateR$*			$: $>MasqHdr $1		do masquerading')
67*7c478bd9Sstevel@tonic-gate
68*7c478bd9Sstevel@tonic-gate#
69*7c478bd9Sstevel@tonic-gate#  Header recipient rewriting
70*7c478bd9Sstevel@tonic-gate#
71*7c478bd9Sstevel@tonic-gateSHdrToL
72*7c478bd9Sstevel@tonic-gateR$+			$: $>AddDomain $1	add local domain if needed
73*7c478bd9Sstevel@tonic-gateifdef(`_ALL_MASQUERADE_', `dnl
74*7c478bd9Sstevel@tonic-gateifdef(`_LOCAL_NO_MASQUERADE_', `dnl', `dnl
75*7c478bd9Sstevel@tonic-gateR$*			$: $>MasqHdr $1		do all-masquerading')',
76*7c478bd9Sstevel@tonic-gate`R$* < @ *LOCAL* > $*	$: $1 < @ $j . > $2')
77*7c478bd9Sstevel@tonic-gate
78*7c478bd9Sstevel@tonic-gate#
79*7c478bd9Sstevel@tonic-gate#  Common code to add local domain name (only if always-add-domain)
80*7c478bd9Sstevel@tonic-gate#
81*7c478bd9Sstevel@tonic-gateSAddDomain
82*7c478bd9Sstevel@tonic-gateifdef(`_ALWAYS_ADD_DOMAIN_', `dnl
83*7c478bd9Sstevel@tonic-gateR$* < @ $* > $* 	$@ $1 < @ $2 > $3	already fully qualified
84*7c478bd9Sstevel@tonic-gateifelse(len(X`'_ALWAYS_ADD_DOMAIN_),`1',`
85*7c478bd9Sstevel@tonic-gateR$+			$@ $1 < @ *LOCAL* >	add local qualification',
86*7c478bd9Sstevel@tonic-gate`R$+			$@ $1 < @ _ALWAYS_ADD_DOMAIN_ >	add qualification')',
87*7c478bd9Sstevel@tonic-gate`dnl')
88*7c478bd9Sstevel@tonic-gate
89*7c478bd9Sstevel@tonic-gateMlocal,		P=LOCAL_MAILER_PATH, F=_MODMF_(CONCAT(_DEF_LOCAL_MAILER_FLAGS, LOCAL_MAILER_FLAGS), `LOCAL'), LOCAL_RWR,_OPTINS(`LOCAL_MAILER_EOL', ` E=', `, ')
90*7c478bd9Sstevel@tonic-gate		_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*7c478bd9Sstevel@tonic-gate		A=LOCAL_MAILER_ARGS
92*7c478bd9Sstevel@tonic-gateMprog,		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*7c478bd9Sstevel@tonic-gate		_OPTINS(`LOCAL_MAILER_MAX', `M=', `, ')T=X-Unix/X-Unix/X-Unix,_PROG_QGRP
94*7c478bd9Sstevel@tonic-gate		A=LOCAL_SHELL_ARGS
95