xref: /freebsd/contrib/sendmail/cf/mailer/uucp.m4 (revision 27c43fe1f3795622c5bd4bbfc465a29a800c0799)
1PUSHDIVERT(-1)
2#
3# Copyright (c) 1998-2001 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
15ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')
16ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gC $h!rmail ($u)')')
17_DEFIFNOT(`UUCP_MAILER_FLAGS', `')
18ifdef(`UUCP_MAILER_MAX',,
19	`define(`UUCP_MAILER_MAX',
20		`ifdef(`UUCP_MAX_SIZE', `UUCP_MAX_SIZE', 100000)')')
21define(`_UUCP_QGRP', `ifelse(defn(`UUCP_MAILER_QGRP'),`',`', ` Q=UUCP_MAILER_QGRP,')')dnl
22POPDIVERT
23#####################################
24###   UUCP Mailer specification   ###
25#####################################
26
27VERSIONID(`$Id: uucp.m4,v 8.45 2013/11/22 20:51:14 ca Exp $')
28
29#
30#  envelope and header sender rewriting
31#
32SFromU
33
34# handle error address as a special case
35R<@>				$n			errors to mailer-daemon
36
37# list:; syntax should disappear
38R:; <@>				$@
39
40R$* < @ $* . > $*		$1 < @ $2 > $3		strip trailing dots
41R$* < @ $=w >			$1			strip local name
42R<@ $- . UUCP > : $+		$1 ! $2			convert to UUCP format
43R<@ $+ > : $+			$1 ! $2			convert to UUCP format
44R$* < @ $- . UUCP >		$2 ! $1			convert to UUCP format
45R$* < @ $+ >			$2 ! $1			convert to UUCP format
46R$&h ! $+ ! $+			$@ $1 ! $2		$h!...!user => ...!user
47R$&h ! $+			$@ $&h ! $1		$h!user => $h!user
48R$+				$: $U ! $1		prepend our name
49R! $+				$: $k ! $1		in case $U undefined
50
51#
52#  envelope recipient rewriting
53#
54SEnvToU
55
56# list:; should disappear
57R:; <@>				$@
58
59R$* < @ $* . > $*		$1 < @ $2 > $3		strip trailing dots
60R$* < @ $=w >			$1			strip local name
61R<@ $- . UUCP > : $+		$1 ! $2			convert to UUCP format
62R<@ $+ > : $+			$1 ! $2			convert to UUCP format
63R$* < @ $- . UUCP >		$2 ! $1			convert to UUCP format
64R$* < @ $+ >			$2 ! $1			convert to UUCP format
65
66#
67#  header recipient rewriting
68#
69SHdrToU
70
71# list:; syntax should disappear
72R:; <@>				$@
73
74R$* < @ $* . > $*		$1 < @ $2 > $3		strip trailing dots
75R$* < @ $=w >			$1			strip local name
76R<@ $- . UUCP > : $+		$1 ! $2			convert to UUCP format
77R<@ $+ > : $+			$1 ! $2			convert to UUCP format
78R$* < @ $- . UUCP >		$2 ! $1			convert to UUCP format
79R$* < @ $+ >			$2 ! $1			convert to UUCP format
80R$&h ! $+ ! $+			$@ $1 ! $2		$h!...!user => ...!user
81R$&h ! $+			$@ $&h ! $1		$h!user => $h!user
82R$+				$: $U ! $1		prepend our name
83R! $+				$: $k ! $1		in case $U undefined
84
85
86ifdef(`_MAILER_smtp_',
87`#
88#  envelope sender rewriting for uucp-dom mailer
89#
90SEnvFromUD
91
92# handle error address as a special case
93R<@>				$n			errors to mailer-daemon
94
95# pass everything to standard SMTP mailer rewriting
96R$*				$@ $>EnvFromSMTP $1
97
98#
99#  envelope sender rewriting for uucp-uudom mailer
100#
101SEnvFromUUD
102
103# handle error address as a special case
104R<@>				$n			errors to mailer-daemon
105
106# do standard SMTP mailer rewriting
107R$*				$: $>EnvFromSMTP $1
108
109R$* < @ $* . > $*		$1 < @ $2 > $3		strip trailing dots
110R<@ $- . UUCP > : $+		$@ $1 ! $2		convert to UUCP format
111R<@ $+ > : $+			$@ $1 ! $2		convert to UUCP format
112R$* < @ $- . UUCP >		$@ $2 ! $1		convert to UUCP format
113R$* < @ $+ >			$@ $2 ! $1		convert to UUCP format',
114`errprint(`*** MAILER(`smtp') must appear before MAILER(`uucp')
115    if uucp-dom should be included.')
116')
117
118PUSHDIVERT(4)
119# resolve locally connected UUCP links
120R$* < @ $=Z . UUCP. > $*	$#uucp-uudom $@ $2 $: $1 < @ $2 .UUCP. > $3
121R$* < @ $=Y . UUCP. > $*	$#uucp-new $@ $2 $: $1 < @ $2 .UUCP. > $3
122R$* < @ $=U . UUCP. > $*	$#uucp-old $@ $2 $: $1 < @ $2 .UUCP. > $3
123POPDIVERT
124
125#
126#  There are innumerable variations on the UUCP mailer.  It really
127#  is rather absurd.
128#
129
130# old UUCP mailer (two names)
131Muucp,		P=UUCP_MAILER_PATH, F=_MODMF_(CONCAT(`DFMhuUd', UUCP_MAILER_FLAGS), `UUCP'), S=FromU, R=EnvToU/HdrToU,
132		M=UUCP_MAILER_MAX, _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,_UUCP_QGRP
133		A=UUCP_MAILER_ARGS
134Muucp-old,	P=UUCP_MAILER_PATH, F=_MODMF_(CONCAT(`DFMhuUd', UUCP_MAILER_FLAGS), `UUCP'), S=FromU, R=EnvToU/HdrToU,
135		M=UUCP_MAILER_MAX, _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,_UUCP_QGRP
136		A=UUCP_MAILER_ARGS
137
138# smart UUCP mailer (handles multiple addresses) (two names)
139Msuucp,		P=UUCP_MAILER_PATH, F=_MODMF_(CONCAT(`mDFMhuUd', UUCP_MAILER_FLAGS), `UUCP'), S=FromU, R=EnvToU/HdrToU,
140		M=UUCP_MAILER_MAX, _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,_UUCP_QGRP
141		A=UUCP_MAILER_ARGS
142Muucp-new,	P=UUCP_MAILER_PATH, F=_MODMF_(CONCAT(`mDFMhuUd', UUCP_MAILER_FLAGS), `UUCP'), S=FromU, R=EnvToU/HdrToU,
143		M=UUCP_MAILER_MAX, _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,_UUCP_QGRP
144		A=UUCP_MAILER_ARGS
145
146ifdef(`_MAILER_smtp_',
147`# domain-ized UUCP mailer
148Muucp-dom,	P=UUCP_MAILER_PATH, F=_MODMF_(CONCAT(`mDFMhud', UUCP_MAILER_FLAGS), `UUCP'), S=EnvFromUD/HdrFromSMTP, R=ifdef(`_ALL_MASQUERADE_', `EnvToSMTP/HdrFromSMTP', `EnvToSMTP'),
149		M=UUCP_MAILER_MAX, _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,_UUCP_QGRP
150		A=UUCP_MAILER_ARGS
151
152# domain-ized UUCP mailer with UUCP-style sender envelope
153Muucp-uudom,	P=UUCP_MAILER_PATH, F=_MODMF_(CONCAT(`mDFMhud', UUCP_MAILER_FLAGS), `UUCP'), S=EnvFromUUD/HdrFromSMTP, R=ifdef(`_ALL_MASQUERADE_', `EnvToSMTP/HdrFromSMTP', `EnvToSMTP'),
154		M=UUCP_MAILER_MAX, _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,_UUCP_QGRP
155		A=UUCP_MAILER_ARGS')
156
157
158