1 From aad149d8eae95620d3ed9a2bd0cd81c8a01ce79d Mon Sep 17 00:00:00 2001 |
1 ospam |
2 From: Tomas Zeman <tzeman@volny.cz> |
|
3 Date: Sun, 16 Dec 2007 00:18:44 +0100 |
|
4 Subject: [PATCH] ospam-0.01-1-i686: |
|
5 *added |
|
6 |
|
7 --- |
|
8 source/custom/ospam/FrugalBuild | 25 ++++++++++++ |
|
9 source/custom/ospam/ospam.patch | 82 +++++++++++++++++++++++++++++++++++++++ |
|
10 2 files changed, 107 insertions(+), 0 deletions(-) |
|
11 create mode 100644 source/custom/ospam/FrugalBuild |
|
12 create mode 100644 source/custom/ospam/ospam.patch |
|
13 |
2 |
14 diff --git a/source/custom/ospam/FrugalBuild b/source/custom/ospam/FrugalBuild |
3 diff --git a/source/custom/ospam/FrugalBuild b/source/custom/ospam/FrugalBuild |
15 new file mode 100644 |
4 new file mode 100644 |
16 index 0000000..d1191b7 |
5 index 0000000..d1191b7 |
17 --- /dev/null |
6 --- /dev/null |
128 + |
117 + |
129 + ################################################# |
118 + ################################################# |
130 + |
119 + |
131 +Only in ospam-0.01: ospam-dotqmail.pl~ |
120 +Only in ospam-0.01: ospam-dotqmail.pl~ |
132 +Common subdirectories: ospam-0.01.orig/sql and ospam-0.01/sql |
121 +Common subdirectories: ospam-0.01.orig/sql and ospam-0.01/sql |
133 -- |
122 diff --git a/source/custom/ospam/spamclam b/source/custom/ospam/spamclam |
134 1.5.3.4 |
123 new file mode 100755 |
135 |
124 index 0000000..dae445b |
|
125 --- /dev/null |
|
126 +++ b/source/custom/ospam/spamclam |
|
127 @@ -0,0 +1,97 @@ |
|
128 +#!/bin/sh |
|
129 + |
|
130 +[ -f /etc/ospam/spamclam ] && . /etc/ospam/spamclam |
|
131 + |
|
132 +# CONFIG |
|
133 +SPAMC=${SPAMC:-/usr/bin/spamc} |
|
134 +CLAMDSCAN=${CLAMDSCAN:-/usr/bin/clamdscan} |
|
135 +FORWARDBIN=${FORWARDBIN:-/var/qmail/bin/forward} |
|
136 +M822FIELD=${M822FIELD:-/usr/bin/822field} |
|
137 +FILEPIPE=${FILEPIPE:-/command/seekablepipe} #/usr/bin/filepipe |
|
138 +VDELIVER=${VDELIVER:-/usr/bin/vdeliver} |
|
139 +TMP=${TMP:-.} |
|
140 + |
|
141 +[ -x $SPAMC -a -x $CLAMDSCAN -a -x $FORWARDBIN -a -x $M822FIELD ] || { |
|
142 + echo -e "$0: Required programs do not exist" |
|
143 + cat | $FILEPIPE $VDELIVER |
|
144 + exit 0 |
|
145 +} |
|
146 + |
|
147 +ADDR_QUARANTINE="$1" |
|
148 +DELIVER_VIRUS="$2" |
|
149 +ADDR_SPAM="$3" |
|
150 +DELIVER_SPAM="$4" |
|
151 +MAILUSER="$5" |
|
152 + |
|
153 +if [ -z "$ADDR_QUARANTINE" -o -z "$ADDR_SPAM" -o -z "$DELIVER_VIRUS" -o -z "$DELIVER_SPAM" ]; then |
|
154 + echo -e "Usage: $0 quarantine_address deliver_virus_to_recipient(0/1) spam_address deliver_spam_to_recipient(0/1) [mailuser address]" |
|
155 + echo -e "address may be: _ignore_ -> checking of that feature is ignored" |
|
156 + echo -e " _noaddr_ -> if infected, do not forward" |
|
157 + cat |
|
158 + exit 0 |
|
159 +fi |
|
160 + |
|
161 +MAILFILE="$TMP/mail.tmp.$$" |
|
162 + |
|
163 +cat >$MAILFILE |
|
164 + |
|
165 +VIRUS=0 |
|
166 +SPAM=0 |
|
167 +STATUS=0 |
|
168 + |
|
169 +spam_flags="" |
|
170 + |
|
171 +if [ "$ADDR_QUARANTINE" != "_ignore_" ]; then |
|
172 + virus=`$CLAMDSCAN --disable-summary --stdout $MAILFILE | grep FOUND` |
|
173 + if [ ! "$virus" = "" ]; then |
|
174 + VIRUS=1 |
|
175 + cat $MAILFILE | sed -e 's/^Subject:/Subject: [virus]/' > $MAILFILE.1 |
|
176 + fi |
|
177 +fi |
|
178 + |
|
179 +if [ $VIRUS -eq 0 -a "$ADDR_SPAM" != "_ignore_" ]; then |
|
180 + if [ ! -z $MAILUSER ]; then |
|
181 + spam_flags="-u $MAILUSER" |
|
182 + fi |
|
183 + $SPAMC $spam_flags < $MAILFILE > $MAILFILE.1 |
|
184 + isspam=`$M822FIELD X-Spam-Flag < $MAILFILE.1 | grep YES | wc -l` |
|
185 + if [ $isspam -ne 0 ]; then |
|
186 + SPAM=1 |
|
187 + fi |
|
188 +fi |
|
189 + |
|
190 + |
|
191 +if [ $VIRUS -eq 1 ]; then |
|
192 + STATUS=99 |
|
193 + if [ $DELIVER_VIRUS -eq 1 ]; then |
|
194 + cat $MAILFILE.1 | $FILEPIPE $VDELIVER |
|
195 + fi |
|
196 + if [ "$ADDR_QUARANTINE" != "_noaddr_" ]; then |
|
197 + $FORWARDBIN $ADDR_QUARANTINE < $MAILFILE.1 |
|
198 + if [ $? -ne 0 ]; then |
|
199 + STATUS=111 |
|
200 + fi |
|
201 + fi |
|
202 +else |
|
203 +if [ $SPAM -eq 1 ]; then |
|
204 + STATUS=99 |
|
205 + if [ $DELIVER_SPAM -eq 1 ]; then |
|
206 + cat $MAILFILE.1 | $FILEPIPE $VDELIVER |
|
207 + fi |
|
208 + if [ "$ADDR_SPAM" != "_noaddr_" ]; then |
|
209 + $FORWARDBIN $ADDR_SPAM < $MAILFILE.1 |
|
210 + if [ $? -ne 0 ]; then |
|
211 + STATUS=111 |
|
212 + fi |
|
213 + fi |
|
214 +fi |
|
215 +fi |
|
216 + |
|
217 +if [ $VIRUS -eq 0 -a $SPAM -eq 0 ]; then |
|
218 + cat $MAILFILE | $FILEPIPE $VDELIVER |
|
219 +fi |
|
220 + |
|
221 +rm -f $MAILFILE $MAILFILE.1 |
|
222 + |
|
223 +exit $STATUS |
|
224 + |