File: rc.submit.most.secure

package info (click to toggle)
rel 1.3-3
  • links: PTS
  • area: non-free
  • in suites: hamm, potato, slink
  • size: 496 kB
  • ctags: 216
  • sloc: ansic: 1,868; sh: 254; makefile: 142
file content (154 lines) | stat: -rw-r--r-- 3,799 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
INCLUDERC=$RC_INIT
INCLUDERC=$RC_CUSTOM

INCLUDERC=$RC_LOCAL_SUBMIT_00

#
# The following recipe makes sure that:
#     It does not look like an administrative request.
#     It wasn't sent by this list itself.
#     It wasn't sent by a daemon (misdirected bounce message perhaps).
#

#
# Does it look like a regular submission?  Or perhaps more like an
# administrative request?
#

:0
* 9876543210^0 ^\
    (Subject:(.*[^a-z])?(Re:|erro|change|problem|((can)?not|.*n't)\>)|\
    X-Diagnostic:)
* -100^0 ^\
    Subject:([	 ]*(archive:?([	 ]+(\
    version|search|rel(evance)?|(r)?[fe]?grep|(r)?date|(r)?chron(ological)?)\
    ([	 ]|$)|[	 ]*$)|\
    (help|info)[	 ]*$).*\>)
* -50^0 ^Subject:[	 ]*[(<]none[>)]$
*  50^0 ^Subject:.*[a-z]
*  25^2 >2048
{
    #
    # Look at the start of the body, and see if this could be an
    # administrative request, pass it on to rc.request in that case.
    #

    :0 B
    * $$=^0
    * -25^0 ^^([	 ]*$)*\
        ([	 ]*(archive:?([	 ]+(\
	version|search|rel(evance)?|(r)?[fe]?grep|(r)?date|(r)?chron(ological)?)\
	([	 ]|$)|[	 ]*$)|\
	(help|info)[	 ]*$).*\>)
    {

	#
	# Then check to see if the sender is on the accept list (if
	# foreign_submit is not set).
	#

	:0
	* 1^1 !$${foreign_submit:+!}
	* 2^0 ? formail -zrtxTo: | \
		   multigram -b1 -m -l$submit_threshold -L$domain \
		    -x$listaddr -x$listreq accept accept2
	{
	    #
	    # The message that is sent to the list will be stored in a
	    # directory name of yymm, with a file name that is the time
	    # stamp of the message.
	    #

	    FILE_NAME=`date +%y%m%d%H%M%S`.$$
	    DIRECTORY_NAME=`echo $FILE_NAME | cut -c1-4`

	    #
	    # Make sure the archive/yymm directory exists.
	    #

	    :0 Wic
	    * ? test ! -d archive/$DIRECTORY_NAME
	    | mkdir -m 700 archive/$DIRECTORY_NAME

	    #
	    # Eliminate duplicate submissions by checking the
	    # Message-ID: field.
	    #

	    :0 Wh :msgid.lock
	    | formail -D $idcache_size msgid.cache

	    ARCHIVE # Wipe ARCHIVE from the environment

	    :0 c
	    archive/$DIRECTORY_NAME/$FILE_NAME

	    ARCHIVE=$FILE_NAME # Remember where it was archived

	    #
	    # Main header munger for submissions passing through this
	    # list.
	    #

	    oldshellmetas="$SHELLMETAS" SHELLMETAS # Save a shell, procmail can do this one by itself.
	    :0 wfh
	    | formail -b -IFrom\  -IReceived: -IReturn-Receipt-To: -IErrors-To: \
		-IX-Pmrqc: -IAcknowledge-To: -IX-Diagnostic: -iStatus: \
		-iReturn-Path: -iX-Envelope-To: -iX-Envelope-From: \
		-I"Precedence: list" -I"Resent-Sender: $listreq" \
		-uDate: -aMessage-ID: -aResent-Message-ID: \
		-a"To: $listaddr" -a"Resent-From: $listaddr" -A"X-Loop: $listaddr" \
		-a"Subject: Unidentified subject!" ${reply_to:+"-a$reply_to"} \
		-a"X-Mailing-List: <$listaddr> $ARCHIVE"

	    SHELLMETAS="$oldshellmetas" oldshellmetas

	    INCLUDERC=$RC_LOCAL_SUBMIT_20

	    #
	    # The following recipe will distribute the message to the
	    # subscribers using the native $SENDMAIL, but only if you
	    # disabled the alternative sendmail (choplist).
	    #

	    :0 w: dist.lock
	    * $${alt_sendmail:+!}
	    ! $sendmailOPT $listdist

	    #
	    # Alternate sendmail call (used by default), does not use
	    # the file-including -dist alias.
	    #

	    :0 Ew: dist.lock
	    | $alt_sendmail $SENDMAIL $sendmailOPT

	    :0 wfh
	    | formail -A "X-Diagnostic: $SENDMAIL $listdist failed"

	    HOST=continue_with_rc.request
	}

	:0 E wfh
	| formail -A "X-Diagnostic: Not on the accept list"

	:0 A c
	* ? test -f accept.txt
	{
	  :0 fh
	  | formail -i"From: $listreq" -kbrtA"X-Loop: $listaddr" ; cat accept.txt

	  :0
	  ! $sendmailOPT -t
	}

    }

}

:0 fhw
* $!${pass_diverts:+!}
* !^X-Diagnostic:
| formail -A "X-Diagnostic: Diverted & unprocessed"

HOST=continue_with_rc.request