xref: /freebsd/contrib/sendmail/cf/m4/cfhead.m4 (revision f95c930e6701aa675377bc5871ea490dd565eeba)
1#
2# Copyright (c) 1998-2004, 2009, 2010 Proofpoint, Inc. and its suppliers.
3#	All rights reserved.
4# Copyright (c) 1983, 1995 Eric P. Allman.  All rights reserved.
5# Copyright (c) 1988, 1993
6#	The Regents of the University of California.  All rights reserved.
7#
8# By using this file, you agree to the terms and conditions set
9# forth in the LICENSE file which can be found at the top level of
10# the sendmail distribution.
11#
12# $FreeBSD$
13#
14
15######################################################################
16######################################################################
17#####
18#####		SENDMAIL CONFIGURATION FILE
19#####
20ifdef(`__win32__', `dnl', `dnl
21ifdef(`TEMPFILE', `dnl', `define(`TEMPFILE', maketemp(/tmp/cfXXXXXX))dnl
22syscmd(sh _CF_DIR_`'sh/makeinfo.sh _CF_DIR_ > TEMPFILE)dnl
23ifdef(`_NO_MAKEINFO_',, `include(TEMPFILE)')dnl
24syscmd(rm -f TEMPFILE)dnl')')
25#####
26######################################################################
27#####
28#####	DO NOT EDIT THIS FILE!  Only edit the source .mc file.
29#####
30######################################################################
31######################################################################
32
33divert(-1)
34
35changecom()
36undefine(`format')
37undefine(`hpux')
38ifdef(`pushdef', `',
39	`errprint(`You need a newer version of M4, at least as new as
40System V or GNU')
41	include(NoSuchFile)')
42define(`PUSHDIVERT', `pushdef(`__D__', divnum)divert($1)')
43define(`POPDIVERT', `divert(__D__)popdef(`__D__')')
44define(`OSTYPE',
45	`PUSHDIVERT(-1)
46	ifdef(`__OSTYPE__', `errprint(`duplicate OSTYPE'($1)
47)')
48	define(`__OSTYPE__', $1)
49	define(`_ARG_', $2)
50	include(_CF_DIR_`'ostype/$1.m4)POPDIVERT`'')
51## helpful functions
52define(`lower', `translit(`$1', `ABCDEFGHIJKLMNOPQRSTUVWXYZ', `abcdefghijklmnopqrstuvwxyz')')
53define(`strcasecmp', `ifelse(lower($1), lower($2), `1', `0')')
54## access to further arguments in FEATURE/HACK
55define(`_ACC_ARG_1_',`$1')
56define(`_ACC_ARG_2_',`$2')
57define(`_ACC_ARG_3_',`$3')
58define(`_ACC_ARG_4_',`$4')
59define(`_ACC_ARG_5_',`$5')
60define(`_ACC_ARG_6_',`$6')
61define(`_ACC_ARG_7_',`$7')
62define(`_ACC_ARG_8_',`$8')
63define(`_ACC_ARG_9_',`$9')
64define(`_ARG1_',`_ACC_ARG_1_(_ARGS_)')
65define(`_ARG2_',`_ACC_ARG_2_(_ARGS_)')
66define(`_ARG3_',`_ACC_ARG_3_(_ARGS_)')
67define(`_ARG4_',`_ACC_ARG_4_(_ARGS_)')
68define(`_ARG5_',`_ACC_ARG_5_(_ARGS_)')
69define(`_ARG6_',`_ACC_ARG_6_(_ARGS_)')
70define(`_ARG7_',`_ACC_ARG_7_(_ARGS_)')
71define(`_ARG8_',`_ACC_ARG_8_(_ARGS_)')
72define(`_ARG9_',`_ACC_ARG_9_(_ARGS_)')
73dnl define if not yet defined: if `$1' is not defined it will be `$2'
74define(`_DEFIFNOT',`ifdef(`$1',`',`define(`$1',`$2')')')
75dnl ----------------------------------------
76dnl add a char $2 to a string $1 if it is not there
77define(`_ADDCHAR_',`define(`_I_',`eval(index(`$1',`$2') >= 0)')`'ifelse(_I_,`1',`$1',`$1$2')')
78dnl ----
79dnl delete a char $2 from a string $1 if it is there
80define(`_DELCHAR_',`define(`_IDX_',`index(`$1',`$2')')`'define(`_I_',`eval(_IDX_ >= 0)')`'ifelse(_I_,`1',`substr(`$1',0,_IDX_)`'substr(`$1',eval(_IDX_+1))',`$1')')
81dnl ----
82dnl apply a macro to a whole string by recursion (one char at a time)
83dnl $1: macro
84dnl $2: first argument to macro
85dnl $3: list that is split up into characters
86define(`_AP_',`ifelse(`$3',`',`$2',`_AP_(`$1',$1(`$2',substr(`$3',0,1)),substr(`$3',1))')')
87dnl ----
88dnl MODIFY_MAILER_FLAGS: append tail of $2 to $1_MF_A/D_
89dnl A if head($2) = +
90dnl D if head($2) = -
91dnl $1_MF_ is set otherwise; set _A/D_ to `'
92define(`MODIFY_MAILER_FLAGS',`define(`_hd_',`substr(`$2',0,1)')define(`_tl_',`substr(`$2',1)')`'ifelse(_hd_,`+',`ifdef($1`'_MF_A_, `define($1`'_MF_A_,$1_MF_A_`'_tl_)', `define($1`'_MF_A_, _tl_)')',_hd_,`-',`ifdef($1`'_MF_D_, `define($1`'_MF_D_,$1_MF_D_`'_tl_)', `define($1`'_MF_D_,_tl_)')',`define($1`'_MF_,`$2')define($1`'_MF_A_,`')define($1`'_MF_D_,`')')')
93dnl ----
94dnl actually modify flags:
95dnl $1: flags (strings) to modify
96dnl $2: name of flags (just first part) to modify
97dnl WARNING: the order might be important: if someone adds and delete the
98dnl same characters, he does not deserve any better, does he?
99dnl this could be coded more efficiently... (do not apply the macro if _MF_A/D_ is undefined)
100define(`_MODMF_',`ifdef($2`'_MF_,`$2_MF_',`_AP_(`_ADDCHAR_',_AP_(`_DELCHAR_',$1,ifdef($2`'_MF_D_,`$2_MF_D_',`')),ifdef($2`'_MF_A_,`$2_MF_A_',`'))')')
101dnl usage:
102dnl MODIFY_MAILER_FLAGS(`LOCAL',`+FlaGs')dnl
103dnl in MAILER.m4: _MODMF_(LMF,`LOCAL')
104dnl ----------------------------------------
105define(`MAILER',
106`define(`_M_N_', `ifelse(`$2', `', `$1', `$2')')dnl
107ifdef(`_MAILER_DEFINED_', `', `define(`_MAILER_DEFINED_', `1')')dnl
108ifdef(_MAILER_`'_M_N_`'_,
109`errprint(`*** ERROR: MAILER('_M_N_`) already included
110')',
111`define(_MAILER_`'_M_N_`'_, `')define(`_ARG_', `$2')define(`_ARGS_', `shift($@)')PUSHDIVERT(7)include(_CF_DIR_`'mailer/$1.m4)POPDIVERT`'')')
112define(`DOMAIN', `PUSHDIVERT(-1)define(`_ARG_', `$2')include(_CF_DIR_`'domain/$1.m4)POPDIVERT`'')
113define(`FEATURE', `PUSHDIVERT(-1)ifdef(`_MAILER_DEFINED_',`errprint(`*** ERROR: FEATURE() should be before MAILER()
114')')define(`_ARG_', `$2')define(`_ARGS_', `shift($@)')include(_CF_DIR_`'feature/$1.m4)POPDIVERT`'')
115define(`HACK', `PUSHDIVERT(-1)define(`_ARG_', `$2')define(`_ARGS_', `shift($@)')include(_CF_DIR_`'hack/$1.m4)POPDIVERT`'')
116define(`_DPO_',`')
117define(`DAEMON_OPTIONS', `define(`_DPO_', defn(`_DPO_')
118O DaemonPortOptions=`$1')')
119define(`_CPO_',`')
120define(`CLIENT_OPTIONS', `define(`_CPO_', defn(`_CPO_')
121O ClientPortOptions=`$1')')
122define(`_MAIL_FILTERS_', `')
123define(`_MAIL_FILTERS_DEF', `')
124define(`MAIL_FILTER', `define(`_MAIL_FILTERS_', defn(`_MAIL_FILTERS_')
125X`'$1`, '`$2')
126define(`_MAIL_FILTERS_DEF', defn(`_MAIL_FILTERS_DEF')`X')')
127define(`INPUT_MAIL_FILTER', `MAIL_FILTER(`$1', `$2')
128ifelse(defn(`confINPUT_MAIL_FILTERS')X, `X',
129`define(`confINPUT_MAIL_FILTERS', $1)',
130`define(`confINPUT_MAIL_FILTERS', defn(`confINPUT_MAIL_FILTERS')`, '`$1')')')
131define(`_QUEUE_GROUP_', `')
132define(`QUEUE_GROUP', `define(`_QUEUE_GROUP_', defn(`_QUEUE_GROUP_')
133Q`'$1`, '`$2')')
134define(`CF_LEVEL', `10')dnl
135define(`VERSIONID', ``#####  $1  #####'')
136define(`LOCAL_RULE_0', `divert(3)')
137dnl for UUCP...
138define(`LOCAL_UUCP', `divert(4)')
139define(`LOCAL_RULE_1',
140`divert(9)dnl
141#######################################
142###  Ruleset 1 -- Sender Rewriting  ###
143#######################################
144
145Ssender=1
146')
147define(`LOCAL_RULE_2',
148`divert(9)dnl
149##########################################
150###  Ruleset 2 -- Recipient Rewriting  ###
151##########################################
152
153Srecipient=2
154')
155define(`LOCAL_RULESETS',
156`divert(9)
157
158')
159define(`LOCAL_SRV_FEATURES',
160`define(`_LOCAL_SRV_FEATURES_')
161ifdef(`_MAILER_DEFINED_',,`errprint(`*** WARNING: MAILER() should be before LOCAL_SRV_FEATURES
162')')
163divert(9)
164SLocal_srv_features')
165define(`LOCAL_TRY_TLS',
166`define(`_LOCAL_TRY_TLS_')
167ifdef(`_MAILER_DEFINED_',,`errprint(`*** WARNING: MAILER() should be before LOCAL_TRY_TLS
168')')
169divert(9)
170SLocal_try_tls')
171define(`LOCAL_TLS_RCPT',
172`define(`_LOCAL_TLS_RCPT_')
173ifdef(`_MAILER_DEFINED_',,`errprint(`*** WARNING: MAILER() should be before LOCAL_TLS_RCPT
174')')
175divert(9)
176SLocal_tls_rcpt')
177define(`LOCAL_TLS_CLIENT',
178`define(`_LOCAL_TLS_CLIENT_')
179ifdef(`_MAILER_DEFINED_',,`errprint(`*** WARNING: MAILER() should be before LOCAL_TLS_CLIENT
180')')
181divert(9)
182SLocal_tls_client')
183define(`LOCAL_TLS_SERVER',
184`define(`_LOCAL_TLS_SERVER_')
185ifdef(`_MAILER_DEFINED_',,`errprint(`*** WARNING: MAILER() should be before LOCAL_TLS_SERVER
186')')
187divert(9)
188SLocal_tls_server')
189define(`LOCAL_RULE_3', `divert(2)')
190define(`LOCAL_CONFIG', `divert(6)')
191define(`MAILER_DEFINITIONS', `divert(7)')
192define(`LOCAL_DNSBL', `divert(8)')
193define(`LOCAL_NET_CONFIG', `define(`_LOCAL_RULES_', 1)divert(1)')
194define(`UUCPSMTP', `R DOL(*) < @ $1 .UUCP > DOL(*)	DOL(1) < @ $2 > DOL(2)')
195define(`CONCAT', `$1$2$3$4$5$6$7')
196define(`DOL', ``$'$1')
197define(`SITECONFIG',
198`CONCAT(D, $3, $2)
199define(`_CLASS_$3_', `')dnl
200ifelse($3, U, C{w}$2 $2.UUCP, `dnl')
201define(`SITE', `ifelse(CONCAT($'2`, $3), SU,
202		CONCAT(CY, $'1`),
203		CONCAT(C, $3, $'1`))')
204sinclude(_CF_DIR_`'siteconfig/$1.m4)')
205define(`EXPOSED_USER', `PUSHDIVERT(5)C{E}$1
206POPDIVERT`'dnl`'')
207define(`EXPOSED_USER_FILE', `PUSHDIVERT(5)F{E}$1
208POPDIVERT`'dnl`'')
209define(`LOCAL_USER', `PUSHDIVERT(5)C{L}$1
210POPDIVERT`'dnl`'')
211define(`LOCAL_USER_FILE', `PUSHDIVERT(5)F{L}$1
212POPDIVERT`'dnl`'')
213define(`MASQUERADE_AS', `define(`MASQUERADE_NAME', $1)')
214define(`MASQUERADE_DOMAIN', `PUSHDIVERT(5)C{M}$1
215POPDIVERT`'dnl`'')
216define(`MASQUERADE_EXCEPTION', `PUSHDIVERT(5)C{N}$1
217POPDIVERT`'dnl`'')
218define(`MASQUERADE_DOMAIN_FILE', `PUSHDIVERT(5)F{M}$1
219POPDIVERT`'dnl`'')
220define(`MASQUERADE_EXCEPTION_FILE', `PUSHDIVERT(5)F{N}$1
221POPDIVERT`'dnl`'')
222define(`LOCAL_DOMAIN', `PUSHDIVERT(5)C{w}$1
223POPDIVERT`'dnl`'')
224define(`CANONIFY_DOMAIN', `PUSHDIVERT(5)C{Canonify}$1
225POPDIVERT`'dnl`'')
226define(`CANONIFY_DOMAIN_FILE', `PUSHDIVERT(5)F{Canonify}$1
227POPDIVERT`'dnl`'')
228define(`GENERICS_DOMAIN', `PUSHDIVERT(5)C{G}$1
229POPDIVERT`'dnl`'')
230define(`GENERICS_DOMAIN_FILE', `PUSHDIVERT(5)F{G}$1
231POPDIVERT`'dnl`'')
232define(`LDAPROUTE_DOMAIN', `PUSHDIVERT(5)C{LDAPRoute}$1
233POPDIVERT`'dnl`'')
234define(`LDAPROUTE_DOMAIN_FILE', `PUSHDIVERT(5)F{LDAPRoute}$1
235POPDIVERT`'dnl`'')
236define(`LDAPROUTE_EQUIVALENT', `PUSHDIVERT(5)C{LDAPRouteEquiv}$1
237POPDIVERT`'dnl`'')
238define(`LDAPROUTE_EQUIVALENT_FILE', `PUSHDIVERT(5)F{LDAPRouteEquiv}$1
239POPDIVERT`'dnl`'')
240define(`VIRTUSER_DOMAIN', `PUSHDIVERT(5)C{VirtHost}$1
241define(`_VIRTHOSTS_')
242POPDIVERT`'dnl`'')
243define(`VIRTUSER_DOMAIN_FILE', `PUSHDIVERT(5)F{VirtHost}$1
244define(`_VIRTHOSTS_')
245POPDIVERT`'dnl`'')
246define(`RELAY_DOMAIN', `PUSHDIVERT(5)C{R}$1
247POPDIVERT`'dnl`'')
248define(`RELAY_DOMAIN_FILE', `PUSHDIVERT(5)F{R}$1
249POPDIVERT`'dnl`'')
250define(`TRUST_AUTH_MECH', `_DEFIFNOT(`_USE_AUTH_',`1')PUSHDIVERT(5)C{TrustAuthMech}$1
251POPDIVERT`'dnl`'')
252define(`_OPTINS', `ifdef(`$1', `$2$1$3')')
253
254
255m4wrap(`include(_CF_DIR_`m4/proto.m4')')
256
257# default location for files
258ifdef(`MAIL_SETTINGS_DIR', , `define(`MAIL_SETTINGS_DIR', `/etc/mail/')')
259
260# set our default hashed database type
261define(`DATABASE_MAP_TYPE', `hash')
262
263# set up default values for options
264define(`ALIAS_FILE', `MAIL_SETTINGS_DIR`'aliases')
265define(`confMAILER_NAME', ``MAILER-DAEMON'')
266define(`confFROM_LINE', `From $g $d')
267define(`confOPERATORS', `.:%@!^/[]+')
268define(`confSMTP_LOGIN_MSG', `$j Sendmail $v/$Z; $b')
269define(`_REC_AUTH_', `$.$?{auth_type}(authenticated')
270define(`_REC_FULL_AUTH_', `$.$?{auth_type}(user=${auth_authen} $?{auth_author}author=${auth_author} $.mech=${auth_type}')
271define(`_REC_HDR_', `$?sfrom $s $.$?_($?s$|from $.$_)')
272define(`_REC_END_', `for $u; $|;
273	$.$b$?g
274	(envelope-from $g)$.')
275define(`_REC_TLS_', `(version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u')
276define(`_REC_BY_', `$.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}')
277define(`confRECEIVED_HEADER', `_REC_HDR_
278	_REC_AUTH_$?{auth_ssf} bits=${auth_ssf}$.)
279	_REC_BY_
280	_REC_TLS_
281	_REC_END_')
282define(`confSEVEN_BIT_INPUT', `False')
283define(`confALIAS_WAIT', `10')
284define(`confMIN_FREE_BLOCKS', `100')
285define(`confBLANK_SUB', `.')
286define(`confCON_EXPENSIVE', `False')
287define(`confDELIVERY_MODE', `background')
288define(`confTEMP_FILE_MODE', `0600')
289define(`confMCI_CACHE_SIZE', `2')
290define(`confMCI_CACHE_TIMEOUT', `5m')
291define(`confUSE_ERRORS_TO', `False')
292define(`confLOG_LEVEL', `9')
293define(`confCHECK_ALIASES', `False')
294define(`confOLD_STYLE_HEADERS', `True')
295define(`confPRIVACY_FLAGS', `authwarnings')
296define(`confSAFE_QUEUE', `True')
297define(`confTO_QUEUERETURN', `5d')
298define(`confTO_QUEUEWARN', `4h')
299define(`confTIME_ZONE', `USE_SYSTEM')
300define(`confCW_FILE', `MAIL_SETTINGS_DIR`'local-host-names')
301define(`confMIME_FORMAT_ERRORS', `True')
302define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward')
303define(`confCR_FILE', `-o MAIL_SETTINGS_DIR`'relay-domains')
304define(`confMILTER_MACROS_CONNECT', ``j, _, {daemon_name}, {if_name}, {if_addr}'')
305define(`confMILTER_MACROS_HELO', ``{tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer}'')
306define(`confMILTER_MACROS_ENVFROM', ``i, {auth_type}, {auth_authen}, {auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr}'')
307define(`confMILTER_MACROS_ENVRCPT', ``{rcpt_mailer}, {rcpt_host}, {rcpt_addr}'')
308define(`confMILTER_MACROS_EOM', `{msg_id}')
309
310
311divert(0)dnl
312VERSIONID(`$Id: cfhead.m4,v 8.122 2013-11-22 20:51:13 ca Exp $')
313