xref: /freebsd/contrib/sendmail/cf/feature/check_other.m4 (revision 02e9120893770924227138ba49df1edb3896112a)
1divert(-1)
2#
3# Copyright (c) 2021 Proofpoint, Inc. and its suppliers.
4#	All rights reserved.
5#
6# By using this file, you agree to the terms and conditions set
7# forth in the LICENSE file which can be found at the top level of
8# the sendmail distribution.
9#
10#
11dnl bogus Id, just here to show up in the generated cf file
12divert(0)
13VERSIONID(`$Id: check_other.m4,v 1.0 2021-04-30 00:01:11 ca Exp $')
14divert(-1)
15dnl
16dnl Options:
17dnl first arg:
18dnl  empty: use default regex
19dnl  else: use as regex
20dnl  [not implemented: NOREGEX: do not use any regex]
21dnl
22dnl Possible enhancements:
23dnl select which SMTP reply type(s) should be allowed to match?
24dnl maybe add "exceptions":
25dnl   - via an "OK" regex?
26dnl   - access map lookup for clients to be "ok" (Connect:... {ok,relay})
27dnl more args? possible matches for rejections:
28dnl	does not seem to worth the effort: too inflexible.
29dnl
30dnl Note: sendmail removes whitespace before ':' ("tokenization")
31ifelse(
32   defn(`_ARG_'), `', `define(`CHKORX', `^[[:print:]]+ *:')',
33   dnl defn(`_ARG_'), `NOREGEX', `define(`CHKORX', `')',
34  `define(`CHKORX', defn(`_ARG_'))')
35LOCAL_CONFIG
36ifelse(defn(`CHKORX'), `', `', `dnl
37Kbadcmd regex -m -a<BADCMD> defn(`CHKORX')')
38LOCAL_RULESETS
39Scheck_other
40dnl accept anything that will be accepted by the MTA
41R$* $| 2	$@ ok
42ifelse(defn(`CHKORX'), `', `', `dnl
43R$+ $| 5	$: $(badcmd $1 $)
44R$*<BADCMD>	$#error $@ 4.7.0 $: 421 bad command')
45dnl terminate on any bad command?
46dnl R$* $| 5	$#error $@ 4.7.0 $: 421 bad command
47