File: rc.request.least.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 (246 lines) | stat: -rw-r--r-- 6,109 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# BEFORE editing this file, you should make sure that it is not linked to
# the master version (../.etc/rc.request) anymore (i.e. "delink rc.request"
# if you do not want your changes to affect all lists).
#
# New mails can be temporarily stalled by creating the file rc.lock (either in
# ../.etc for all lists or in the current directory for this list only).

#$Id: rc.request,v 1.72 1994/10/31 18:57:21 berg Exp $

INCLUDERC=$RC_INIT
INCLUDERC=$RC_CUSTOM

INCLUDERC=$RC_LOCAL_REQUEST_00

LOCKFILE=tmp.lock	# for reusing tmp.(request|from)
			# also makes sure that the load doesn't go sky-high
			# when a lot of mail arrives concurrently

#
# We now check:
#	If the length is roughly within bounds.
#	That it is not a reply or something.
#	That we didn't send it ourselves.
#	That it wasn't sent by a daemon of some kind.
#
# If everything matches, we extract the sender address into tmp.from
#

:0
* < 8192
* $$daemon_bias
* $!^(X-(Loop: $listaddr|Diagnostic:)|$X_COMMAND:)
* -100^0 ^FROM_DAEMON
*    1^0
{

:0
* -100^0 ^Subject:(.*[^a-z])?(Re:|erro|change|problem|((can)?not|.*n't)\>)
*  100^0 ^Subject:[	 ]*archive
*    1^0
{
  :0 whc
  | formail -rtz -xTo: >tmp.from

#
# Store the whole mail in tmp.request, for later reference.
#

  :0 wc
  | formail -IIn-Reply-To: -ICc: >tmp.request

#
# Check for a missing Subject: line.
#

  :0 wfh
  * !^Subject:
  | formail -a "Subject: "

  INCLUDERC=$RC_LOCAL_REQUEST_10

###############################################################################
# Reader beware, the following four regular expressions are not for the faint #
# of heart.  It'll suffice to say that they accomplish their intended job 98% #
# of the time.								      #
###############################################################################

#
# Is it an archive retrieval command?
#

  :0 HB w
  * ^^(.+$)*Subject:[	 ]*(([(<]none[>)])?$(.+$)*(^[	 ]*)+)?\
     (archive:?([	 ]|$)|\
     (version|search|rel(evance)?|(r)?[fe]?grep|(r)?date|(r)?rchron(ological)?)([	 ]+[^	 ]*)?$)
  {
    :0 W
    * 1^1 $${restrict_archive:+!}
    * 2^0 ? formail -X"From " -xFrom: -xReply-To: -xSender: -xResent-From: \
	     -xResent-Reply-To: -xResent-Sender: -xReturn-Path: | \
	     multigram -b1 -m -l$submit_threshold -L$domain \
	      -x$listaddr -x$listreq accept accept2
    | arch_retrieve

    :0 E fhw
    | formail -A "X-Diagnostic: Return address not on the accept list"
  }

#
# Is it an info or help request?  Send back the help.txt and the
# optional info.txt file.
# We do the same on a complete empty mail (except for perhaps a signature).
#

  :0 EHB
  *  3^0 ^^(.+$)*Subject:[	 ]*(([(<]none[>)])?$(.+$)*(^[	 ]*)+)?\
     [a-z,.	 ]*(help|info(rm(ation)?)?)\>
  *  1^0 ^^(.+$)*Subject:[	 ]*([(<]none[>)])?$
  * -2^0 ^^(.+$)*(^[	 ]*)+[a-z]
  *  3^0 ^^(.+$)*^([	 ]*$)*--
  {
    :0 hw ${cc_requests:+c}
    | (formail -i"From: $listreq" -rtA"X-Loop: $listaddr"; \
       cat help.txt info.txt 2>/dev/null ) | $SENDMAIL $sendmailOPT -t

    :0 wfh
    | formail -A "X-Diagnostic: help sent"
  }

  INCLUDERC=$RC_LOCAL_REQUEST_20

  LOGABSTRACT=yes

#
# If auto_help is set, anything undecipherable gets back the help.txt and the
# optional info.txt file.
#

  :0 EhB w ${cc_requests:+c}
  * $!${auto_help:+!}
  * $!X-Loop: $listaddr
  {
    :0 hw ${cc_requests:+c}
    | (formail -i"From: $listreq" -rtA"X-Loop: $listaddr"; \
       cat help.txt info.txt 2>/dev/null ) | $SENDMAIL $sendmailOPT -t

    :0 wfh
    | formail -A "X-Diagnostic: undecipherable, help sent"
  }

}
}

LOGABSTRACT=yes

#
# Could it be a bounce message from a daemon?  Hand it down to procbounce
# which will evaluate it.
#

:0 wic
* $!^(Subject:(.*[^a-z])?Re:|\
     X-(Loop: $listaddr|Diagnostic:)|$X_COMMAND:)
* ^FROM_DAEMON
| sed -e $cutoff_bounce' q' >tmp.request

  #
  # Sink all messages we can recognise to be queue warnings
  #

  :0 Ah
  * ^Subject: \
     (WARNING: message delayed|\
      Returned mail: warning: cannot send message for|\
      Undeliverable (RFC822 )?mail: temporarily unable to deliver|\
      \*\*\* WARNING - Undelivered mail in mailqueue)
  /dev/null

  :0 Ah
  * ^Subject: (Warning from|mail warning|Waiting Mail)
  * ^(From|Sender):.*(uucp|mmdf)
  /dev/null

  :0 AhBD
  * $^(..?)?X-Loop: $listaddr \(bounce\)
  * ^(..?)?Subject: You have been removed from
  /dev/null

  #
  # Anything that still survived is most likely to be a bounce message.
  #

  :0 Ahfw
  | procbounce

#
# Or is it a remote X-Command from our maintainer?
#

:0 wf:dist.lock
* $^$X_COMMAND:.*$maintainer[	 ]*$X_COMMAND_PASSWORD
* $!^X-Loop: $listaddr
| x_command

LOCKFILE				# we don't need the lockfile anymore

#
# Anything not taken care of yet will be served to the maintainer of the list.
#
# To make it easier on him, we include a small hint about what might be the
# problem (by adding X-Diagnostic: fields to the header).
#

:0 wfh
* !< $size_limit
| formail -A "X-Diagnostic: Submission size exceeds $size_limit bytes"

:0 wfh
* ^FROM_DAEMON
| formail -A "X-Diagnostic: Mail coming from a daemon, ignored"

:0 HB wfh
* $^X-Loop: $listaddr
| formail -A "X-Diagnostic: Possible loopback problem"

:0
* !^X-(Diagnostic|Processed):
{
  :0 wfh
  * $^$X_COMMAND:
  | formail -A "X-Diagnostic: Suspicious $X_COMMAND format"

  :0 HB wfh
  * ? formail -IReceived: -IX-Envelope-To: -IIn-Reply-To: -ICc: | \
       multigram -b1 -x$listreq -x$listaddr -l$reject_threshold dist
  | formail -A "X-Diagnostic: Already on the subscriber list" \
     -A "X-Diagnostic: `multigram -b1 -x$listreq -x$listaddr \
     -l$reject_threshold dist`"
}

INCLUDERC=$RC_LOCAL_REQUEST_30

:0 wfh
* !^X-(Diagnostic|Processed):
| formail -A"X-Diagnostic: Unprocessed"

:0 wfh
| formail -A"X-Envelope-To: $X_ENVELOPE_TO"

#
# If this list does not have a maintainer e-mail address, drop things in
# the file request.
#

:0:
* $${maintainer:+!}
request

:0 w
| formail -R"From X-Envelope-From:" -iDate: -iReturn-Receipt-To: \
   -iAcknowledge-To: | $SENDMAIL $sendmailOPT $sendmailOPTp $maintainer

:0 wfh
| formail -A"X-Diagnostic: Maintainer $maintainer could not be reached"

HOST=continue_with_../.etc/rc.post