| author | Tomas Zeman <tzeman@volny.cz> |
| Wed, 15 Feb 2012 15:39:27 +0100 | |
| changeset 126 | df158d44c16f |
| parent 98 | ee6165a0b4ed |
| permissions | -rw-r--r-- |
|
28
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1 |
diet-qmail |
| 1 | 2 |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
3 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/FrugalBuild |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
4 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
5 |
+++ b/source/dietlibc/diet-qmail/FrugalBuild Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 6 |
@@ -0,0 +1,293 @@ |
7 |
+# Patched qmail: |
|
8 |
+# errno |
|
9 |
+# ext_todo |
|
10 |
+# qregex |
|
11 |
+# qmailqueue |
|
12 |
+# smtpd.spam |
|
13 |
+# dietlibc |
|
14 |
+# + queue-fix package with patches: |
|
15 |
+# errno |
|
16 |
+# dietlibc |
|
17 |
+# Maintainer: Tomas Zeman <tzeman@volny.cz> |
|
18 |
+ |
|
19 |
+branch=diet |
|
20 |
+pkgorig=qmail |
|
21 |
+pkgname=$branch-$pkgorig |
|
22 |
+pkgver=1.03 |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
23 |
+pkgrel=2 |
| 1 | 24 |
+pkgdesc="A secure, reliable, efficient, SMTP/POP3 server." |
25 |
+url="http://cr.yp.to/qmail.html" |
|
26 |
+depends=('daemontools' 'ucspi-tcp' 'openssl')
|
|
27 |
+makedepends=('dietlibc')
|
|
28 |
+backup=(var/qmail/supervise/qmail-pop3d/run \ |
|
29 |
+ var/qmail/supervise/qmail-pop3d/log/run \ |
|
30 |
+ var/qmail/supervise/qmail-send/run \ |
|
31 |
+ var/qmail/supervise/qmail-send/log/run \ |
|
32 |
+ var/qmail/supervise/qmail-smtpd/run \ |
|
33 |
+ var/qmail/supervise/qmail-smtpd/log/run \ |
|
34 |
+ var/qmail/control/concurrencyincoming \ |
|
35 |
+ var/qmail/control/defaultdelivery \ |
|
36 |
+ var/qmail/control/me \ |
|
37 |
+ etc/tcp.smtp etc/tcp.pop3) |
|
38 |
+provides=('smtp-server' 'pop3-server' 'qmail')
|
|
39 |
+install="$pkgorig.install" |
|
40 |
+archs=(i686) |
|
41 |
+up2date="1.03" |
|
42 |
+source=(http://cr.yp.to/software/$pkgorig-$pkgver.tar.gz \ |
|
43 |
+ qmail-1.03.errno.patch \ |
|
44 |
+ ext_todo-20030105.patch \ |
|
45 |
+ qmailqueue-patch \ |
|
46 |
+ qregex-20060423-qmail.patch \ |
|
47 |
+ qmail-dietlibc.patch \ |
|
48 |
+ qmail-smtpd.spam.patch \ |
|
49 |
+ http://www.netmeridian.com/e-huss/queue-fix-1.4.tar.gz \ |
|
50 |
+ queue-fix-errno.patch \ |
|
51 |
+ queue-fix-dietlibc.patch \ |
|
52 |
+ rc smtpd_run pop3d_run qmail.profile qmail.rc send_log_run \ |
|
53 |
+ send_run smtpd_log_run pop3d_log_run tcp.smtp tcp.pop3 \ |
|
54 |
+ make_cert.sh) |
|
55 |
+ |
|
56 |
+sha1sums=('18fb960481291a0503e93a94df3f6094edb7f27a' \
|
|
57 |
+ '5cab1d84f67987983d13f10be1577e3da274cb94' \ |
|
58 |
+ 'a1ecb939a4aaeeb325d947f3e6416aa63ae97d80' \ |
|
59 |
+ '76240289d52f2aca88004af47e5bd41c969880cf' \ |
|
60 |
+ '40b18255da69a2f36cf8698d8eb907f5f039c0a7' \ |
|
61 |
+ '605e93734c82373383f0284fabc64f85c4c06bfc' \ |
|
62 |
+ '25f4ef231560bbc5fc3c2a82f2f0cd0696deded9' \ |
|
63 |
+ 'ce42fcc4daf5076adcf8fea6a9a84f2e1716c67c' \ |
|
64 |
+ '72be22c7987ff3639692cda21c09dec340e06a4a' \ |
|
65 |
+ '7d3525ab4a2e0e2be2bcd074dd94ae2784309d1b' \ |
|
66 |
+ '3111cc689b5b1f6caa38997bf5f85aa3a516ef9c' \ |
|
67 |
+ '3a80e44c97fd3035ce16c68fd2f611a64c61d169' \ |
|
68 |
+ 'f14f63c7b1bdc2d1f527249235551dc7f21ad47d' \ |
|
69 |
+ '36951a4c195c72f4194c2d98ce3478c11d85c5bf' \ |
|
70 |
+ '2b29cf70c6cbf52ef5af5da7840c72ae626ccb50' \ |
|
71 |
+ '80543d062529a1eefde0c8b288c411a0b896e950' \ |
|
72 |
+ '5877c8e1896f655bd8f4d98d52e67231c63d9e42' \ |
|
73 |
+ '87ebef35a931cdf43b9ffc6dfe42529a21e562ba' \ |
|
74 |
+ 'e53e6248b347be058e3e1973434b2b885c65f091' \ |
|
75 |
+ '27ff6fcaa115d7b59b86f54f970b6271c84ca6d3' \ |
|
76 |
+ 'ac0994b0ec0ada5bd28fdce6f8e37e9827357f43' \ |
|
77 |
+ '3e91eb05c9bf51e230f237d19633fc572fbc3540') |
|
78 |
+ |
|
79 |
+# NOTE: This should be built only as root, |
|
80 |
+# not using fakeroot. |
|
81 |
+ |
|
82 |
+# a small function to add required groups |
|
83 |
+# & users before building. |
|
84 |
+pre_build_qmail() {
|
|
85 |
+ # create a tmp dir |
|
86 |
+ mkdir -p $startdir/src/tmp |
|
87 |
+ # group: qmail |
|
88 |
+ if [ ! `grep qmail /etc/group` ]; then |
|
89 |
+ echo "==> Adding group qmail (temporarily)" |
|
90 |
+ groupadd -g 2107 qmail &>/dev/null |
|
91 |
+ touch $startdir/src/tmp/group_qmail |
|
92 |
+ fi |
|
93 |
+ |
|
94 |
+ # group: nofiles |
|
95 |
+ if [ ! `grep nofiles /etc/group` ]; then |
|
96 |
+ echo "==> Adding group nofiles (temporarily)" |
|
97 |
+ groupadd -g 2108 nofiles &>/dev/null |
|
98 |
+ touch $startdir/src/tmp/group_nofiles |
|
99 |
+ fi |
|
100 |
+ |
|
101 |
+ # user: alias |
|
102 |
+ if ! id alias &>/dev/null; then |
|
103 |
+ echo "==> Adding user alias (temporarily)" |
|
104 |
+ useradd -u 7790 -g nofiles -d /var/qmail/alias -s /bin/false alias |
|
105 |
+ touch $startdir/src/tmp/user_alias |
|
106 |
+ fi |
|
107 |
+ |
|
108 |
+ # user: qmaild |
|
109 |
+ if ! id qmaild &>/dev/null; then |
|
110 |
+ echo "==> Adding user qmaild (temporarily)" |
|
111 |
+ useradd -u 7791 -g nofiles -d /var/qmail -s /bin/false qmaild |
|
112 |
+ touch $startdir/src/tmp/user_qmaild |
|
113 |
+ fi |
|
114 |
+ |
|
115 |
+ # user: qmaill |
|
116 |
+ if ! id qmaill &>/dev/null; then |
|
117 |
+ echo "==> Adding user qmaill (temporarily)" |
|
118 |
+ useradd -u 7792 -g nofiles -d /var/qmail -s /bin/false qmaill |
|
119 |
+ touch $startdir/src/tmp/user_qmaill |
|
120 |
+ fi |
|
121 |
+ |
|
122 |
+ # user: qmailp |
|
123 |
+ if ! id qmailp &>/dev/null; then |
|
124 |
+ echo "==> Adding user qmailp (temporarily)" |
|
125 |
+ useradd -u 7793 -g nofiles -d /var/qmail -s /bin/false qmailp |
|
126 |
+ touch $startdir/src/tmp/user_qmailp |
|
127 |
+ fi |
|
128 |
+ |
|
129 |
+ # user: qmailq |
|
130 |
+ if ! id qmailq &>/dev/null; then |
|
131 |
+ echo "==> Adding user qmailq (temporarily)" |
|
132 |
+ useradd -u 7794 -g qmail -d /var/qmail -s /bin/false qmailq |
|
133 |
+ touch $startdir/src/tmp/user_qmailq |
|
134 |
+ fi |
|
135 |
+ |
|
136 |
+ # user: qmailr |
|
137 |
+ if ! id qmailr &>/dev/null; then |
|
138 |
+ echo "==> Adding user: qmailr (temporarily)" |
|
139 |
+ useradd -u 7795 -g qmail -d /var/qmail -s /bin/false qmailr |
|
140 |
+ touch $startdir/src/tmp/user_qmailr |
|
141 |
+ fi |
|
142 |
+ |
|
143 |
+ # user: qmails |
|
144 |
+ if ! id qmails &>/dev/null; then |
|
145 |
+ echo "==> Adding user: qmails (temporarily)" |
|
146 |
+ useradd -u 7796 -g qmail -d /var/qmail -s /bin/false qmails |
|
147 |
+ touch $startdir/src/tmp/user_qmails |
|
148 |
+ fi |
|
149 |
+} |
|
150 |
+ |
|
151 |
+# a small function to remove users |
|
152 |
+# after the build. |
|
153 |
+post_build_qmail() {
|
|
154 |
+ # remove users |
|
155 |
+ for user in alias qmail{d,l,p,q,r,s}; do
|
|
156 |
+ if [ -f $startdir/src/tmp/user_${user} ]; then
|
|
157 |
+ echo "==> Removing user: ${user}"
|
|
158 |
+ userdel ${user} &> /dev/null
|
|
159 |
+ fi |
|
160 |
+ done |
|
161 |
+ |
|
162 |
+ # remove groups |
|
163 |
+ for group in nofiles qmail; do |
|
164 |
+ if [ -f $startdir/src/tmp/group_${group} ]; then
|
|
165 |
+ echo "==> Removing group: ${group}"
|
|
166 |
+ groupdel ${group} &> /dev/null
|
|
167 |
+ fi |
|
168 |
+ done |
|
169 |
+ |
|
170 |
+ # remove temp dir |
|
171 |
+ rm -rf $startdir/src/tmp |
|
172 |
+} |
|
173 |
+ |
|
174 |
+build() {
|
|
175 |
+ # save me some typing ;) |
|
176 |
+ qmail_dir=$Fdestdir/var/qmail |
|
177 |
+ |
|
178 |
+ |
|
179 |
+ # add the required groups & users |
|
180 |
+ pre_build_qmail || Fdie |
|
181 |
+ |
|
182 |
+ # start playing with qmail :) |
|
183 |
+ Fcd $pkgorig-$pkgver |
|
184 |
+ Fpatch qmail-1.03.errno.patch |
|
185 |
+ Fpatch ext_todo-20030105.patch |
|
186 |
+ Fpatch qmailqueue-patch |
|
187 |
+ Fpatch qregex-20060423-qmail.patch |
|
188 |
+ Fpatch qmail-dietlibc.patch |
|
189 |
+ Fpatch qmail-smtpd.spam.patch |
|
190 |
+ |
|
191 |
+ # compile qmail |
|
192 |
+ make it man || Fdie |
|
193 |
+ |
|
194 |
+ # create dirs |
|
195 |
+ install -d -m 755 -o root -g qmail $qmail_dir |
|
196 |
+ for i in bin boot control users; do |
|
197 |
+ install -d -m 755 -o root -g qmail $qmail_dir/$i |
|
198 |
+ done |
|
199 |
+ install -d -m 755 -o alias -g qmail $qmail_dir/alias |
|
200 |
+ install -d -m 755 -o qmaill $startdir/pkg/var/log/qmail |
|
201 |
+ install -d -m 755 -o qmaill $startdir/pkg/var/log/qmail/smtpd |
|
202 |
+ install -d -m 755 -o qmaill $startdir/pkg/var/log/qmail/pop3d |
|
203 |
+ install -d -m 755 -o qmaill $startdir/pkg/var/log/qmail/send |
|
204 |
+ mkdir -p $qmail_dir/supervise/qmail-{pop3d,send,smtpd}/log
|
|
205 |
+ install -d -m 710 -o qmailq -g qmail $qmail_dir/queue |
|
206 |
+ |
|
207 |
+ # install binaries |
|
208 |
+ for i in binm1{,+df} binm2{,+df} binm3{,+df} home{,+df} proc{,+df}; do
|
|
209 |
+ install -m 755 -o root -g qmail $i $qmail_dir/boot/$i |
|
210 |
+ done |
|
211 |
+ install -m 4711 -o qmailq -g qmail qmail-queue \ |
|
212 |
+ $qmail_dir/bin/qmail-queue |
|
213 |
+ for i in qmail-lspawn qmail-start qmail-newu qmail-newmrh; do |
|
214 |
+ install -m 700 -o root -g qmail $i $qmail_dir/bin/$i |
|
215 |
+ done |
|
216 |
+ for i in qmail-getpw qmail-local qmail-remote qmail-rspawn \ |
|
217 |
+ qmail-clean qmail-send splogger qmail-popup qmail-pw2u \ |
|
218 |
+ qmail-todo; do |
|
219 |
+ install -m 711 -o root -g qmail $i $qmail_dir/bin/$i |
|
220 |
+ done |
|
221 |
+ for i in qmail-inject predate datemail mailsubj qmail-showctl \ |
|
222 |
+ qmail-qread qmail-qstat qmail-tcpto qmail-tcpok qmail-pop3d \ |
|
223 |
+ qmail-popup qmail-qmqpc qmail-qmqpd qmail-qmtpd qmail-smtpd \ |
|
224 |
+ sendmail tcp-env qreceipt qsmhook qbiff forward preline \ |
|
225 |
+ condredirect bouncesaying except maildirmake maildir2mbox \ |
|
226 |
+ maildirwatch qail elq pinq config-fast; do |
|
227 |
+ install -m 755 -o root -g qmail $i $qmail_dir/bin/$i |
|
228 |
+ done |
|
229 |
+ |
|
230 |
+ # install manpages |
|
231 |
+ for i in bouncesaying except maildir2mbox maildirwatch preline qreceipt \ |
|
232 |
+ condredirect forward maildirmake mailsubj qbiff tcp-env; do |
|
233 |
+ install -D -m 644 -o root -g qmail ${i}.1 $qmail_dir/man/man1/${i}.1
|
|
234 |
+ done |
|
235 |
+ for i in addresses envelopes mbox qmail-header qmail-users dot-qmail \ |
|
236 |
+ maildir qmail-control qmail-log tcp-environ; do |
|
237 |
+ install -D -m 644 -o root -g qmail ${i}.5 $qmail_dir/man/man5/${i}.5
|
|
238 |
+ done |
|
239 |
+ for i in forgeries qmail-limits qmail; do |
|
240 |
+ install -D -m 644 -o root -g qmail ${i}.7 $qmail_dir/man/man7/${i}.7
|
|
241 |
+ done |
|
242 |
+ for i in qmail-clean qmail-newmrh qmail-qmqpd qmail-rspawn qmail-tcpto \ |
|
243 |
+ qmail-command qmail-newu qmail-qmtpd qmail-send splogger \ |
|
244 |
+ qmail-getpw qmail-pop3d qmail-qread qmail-showctl qmail-inject \ |
|
245 |
+ qmail-popup qmail-qstat qmail-smtpd qmail-local qmail-pw2u \ |
|
246 |
+ qmail-queue qmail-start qmail-lspawn qmail-qmqpc qmail-remote \ |
|
247 |
+ qmail-tcpok; do |
|
248 |
+ install -D -m 644 -o root -g qmail ${i}.8 $qmail_dir/man/man8/${i}.8
|
|
249 |
+ done |
|
250 |
+ |
|
251 |
+ # install supervise files |
|
252 |
+ for i in pop3d send smtpd; do |
|
253 |
+ install -m 755 $startdir/${i}_run \
|
|
254 |
+ $qmail_dir/supervise/qmail-${i}/run
|
|
255 |
+ install -m 755 $startdir/${i}_log_run \
|
|
256 |
+ $qmail_dir/supervise/qmail-${i}/log/run
|
|
257 |
+ done |
|
258 |
+ |
|
259 |
+ # install rc |
|
260 |
+ install -m 755 $startdir/rc \ |
|
261 |
+ $qmail_dir/rc |
|
262 |
+ |
|
263 |
+ # install concurrencyicoming & defaultdelivery files |
|
264 |
+ echo 20 > $qmail_dir/control/concurrencyincoming |
|
265 |
+ echo ./Maildir/ > $qmail_dir/control/defaultdelivery |
|
266 |
+ chmod 644 $qmail_dir/control/{concurrencyincoming,defaultdelivery}
|
|
267 |
+ |
|
268 |
+ # create sendmail symlinks for compatibility reasons |
|
269 |
+ for i in sbin lib; do |
|
270 |
+ mkdir -p $Fdestdir/usr/${i}
|
|
271 |
+ ln -sf /var/qmail/bin/sendmail $Fdestdir/usr/${i}/sendmail
|
|
272 |
+ done |
|
273 |
+ |
|
274 |
+ # install profile.d file |
|
275 |
+ install -D -m 755 $startdir/qmail.profile $Fdestdir/etc/profile.d/qmail.sh |
|
276 |
+ |
|
277 |
+ # install tcp files |
|
278 |
+ for i in smtp pop3; do |
|
279 |
+ install -D -m 644 $startdir/tcp.${i} $Fdestdir/etc/tcp.${i}
|
|
280 |
+ done |
|
281 |
+ |
|
282 |
+ # install cert making script |
|
283 |
+ install -D -m755 $startdir/make_cert.sh $qmail_dir/bin/make_cert.sh |
|
284 |
+ |
|
285 |
+ # install rc.d file |
|
286 |
+ install -D -m 755 $startdir/qmail.rc $Fdestdir/etc/rc.d/qmail |
|
287 |
+ |
|
288 |
+ # build and install queue-fix |
|
289 |
+ Fmessage "Now building queue-fix" |
|
290 |
+ cd $Fsrcdir/queue-fix-1.4 || Fdie |
|
291 |
+ Fpatch queue-fix-errno.patch |
|
292 |
+ Fpatch queue-fix-dietlibc.patch |
|
293 |
+ make || Fdie |
|
294 |
+ install -D -m755 queue-fix $qmail_dir/bin/queue-fix |
|
295 |
+ |
|
296 |
+ # remove groups & users |
|
297 |
+ post_build_qmail || Fdie |
|
298 |
+} |
|
299 |
+ |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
300 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/ext_todo-20030105.patch |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
301 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
302 |
+++ b/source/dietlibc/diet-qmail/ext_todo-20030105.patch Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 303 |
@@ -0,0 +1,1238 @@ |
304 |
+diff -uN qmail-1.03/EXTTODO qmail-exttodo/EXTTODO |
|
305 |
+--- qmail-1.03/EXTTODO Thu Jan 1 01:00:00 1970 |
|
306 |
++++ qmail-exttodo/EXTTODO Sun Jan 5 22:12:01 2003 |
|
307 |
+@@ -0,0 +1,114 @@ |
|
308 |
++EXTTODO by Claudio Jeker <jeker@n-r-g.com> and |
|
309 |
++Andre Oppermann <opi@nrg4u.com> |
|
310 |
++(c) 1998,1999,2000,2001,2002 Internet Business Solutions Ltd. |
|
311 |
++ |
|
312 |
++The EXTTODO patch is a part of the qmail-ldap patch. |
|
313 |
++This patches for qmail come with NO WARRANTY. |
|
314 |
++ |
|
315 |
++These patches are under the BSD license. |
|
316 |
++ |
|
317 |
++RELEASE: 5. Jan. 2003 |
|
318 |
++ |
|
319 |
++EXTTODO: |
|
320 |
++====================== |
|
321 |
++ |
|
322 |
++TOC: |
|
323 |
++ WHAT DOES IT DO |
|
324 |
++ INSTALL |
|
325 |
++ CONFIG FILES |
|
326 |
++ SETUP |
|
327 |
++ BIG PICTURE |
|
328 |
++ |
|
329 |
++NEWS: |
|
330 |
++ |
|
331 |
++ This is the first release of the EXTTODO patch. |
|
332 |
++ |
|
333 |
++================================================================================ |
|
334 |
++ |
|
335 |
++WHAT DOES IT DO |
|
336 |
++ |
|
337 |
++ The exttodo patch addresses a problem known as the silly qmail (queue) |
|
338 |
++ problem. This problem is found only on system with high injection rates. |
|
339 |
++ |
|
340 |
++ qmail with a big local and remote concurrency could deliver a tremendous |
|
341 |
++ amount of messages but normally this can not be achieved because qmail-send |
|
342 |
++ becomes a bottleneck on those high volumes servers. |
|
343 |
++ qmail-send preprocesses all new messages before distributing them for local |
|
344 |
++ or remote delivering. In one run qmail-send does one todo run but has the |
|
345 |
++ ability to close multiple jobs. Because of this layout qmail-send can not |
|
346 |
++ feed all the new available (local/remote) delivery slots and therefor it is |
|
347 |
++ not possible to achieve the maximum throughput. |
|
348 |
++ This would be a minor problem if one qmail-send run could be done in extreme |
|
349 |
++ short time but because of many file system calls (fsync and (un)link) a todo |
|
350 |
++ run is expensive and throttles the throughput. |
|
351 |
++ |
|
352 |
++ The exttodo patch tries to solve the problem by moving the todo routine into |
|
353 |
++ an external program. This reduces the run time in qmail-send. |
|
354 |
++ |
|
355 |
++ exttodo adds a new program to qmail called qmail-todo. qmail-todo prepares |
|
356 |
++ incoming messages for local and remote delivering (by creating info/<messid> |
|
357 |
++ local/<messid> and remote/<messid> and removing todo/<messid>). See also |
|
358 |
++ INTERNALS. As next qmail-todo transmits the <messid> to qmail-send which will |
|
359 |
++ add this message into the priority queue which schedules the message for |
|
360 |
++ delivery. |
|
361 |
++ |
|
362 |
++INSTALL |
|
363 |
++ |
|
364 |
++ To enable the exttodo patch you need to define EXTERNAL_TODO while compiling |
|
365 |
++ qmail(-ldap) this can be done with the -D flag of cc (e.g. cc -DEXTERNAL_TODO). |
|
366 |
++ |
|
367 |
++ NOTE: the exttodo patch can also be used on qmail systems without the |
|
368 |
++ qmail-ldap patch. |
|
369 |
++ |
|
370 |
++================================================================================ |
|
371 |
++ |
|
372 |
++CONFIG FILES |
|
373 |
++ |
|
374 |
++ No additional control files are used or needed. |
|
375 |
++ |
|
376 |
++================================================================================ |
|
377 |
++ |
|
378 |
++SETUP |
|
379 |
++ |
|
380 |
++ qmail-todo will be started by qmail-start and therefor no additional setup |
|
381 |
++ is needed. |
|
382 |
++ |
|
383 |
++ To verify that exttodo is running just check if qmail-todo is running. |
|
384 |
++ |
|
385 |
++================================================================================ |
|
386 |
++ |
|
387 |
++BIG PICTURE |
|
388 |
++ |
|
389 |
++ +-------+ +-------+ |
|
390 |
++ | clean | | clean | |
|
391 |
++ +--0-1--+ +--0-1--+ +-----------+ |
|
392 |
++ trigger ^ | ^ | +->0,1 lspawn | |
|
393 |
++ | | v | v / +-----------+ |
|
394 |
++ +-------+ v +--2-3--+ +--5-6--+ / |
|
395 |
++ | | | | 0<--7 1,2<-+ |
|
396 |
++ | queue |--+--| todo | | send | |
|
397 |
++ | | | | 1-->8 3,4<-+ |
|
398 |
++ +-------+ +-------+ +---0---+ \ |
|
399 |
++ | \ +-----------+ |
|
400 |
++ v +->0,1 rspwan | |
|
401 |
++ +---0---+ +-----------+ |
|
402 |
++ | logger| |
|
403 |
++ +-------+ |
|
404 |
++ |
|
405 |
++Communication between qmail-send and qmail-todo |
|
406 |
++ |
|
407 |
++todo -> send: |
|
408 |
++ D[LRB]<mesgid>\0 |
|
409 |
++ Start delivery for new message with id <messid>. |
|
410 |
++ the character L, R or B defines the type |
|
411 |
++ of delivery, local, remote or both respectively. |
|
412 |
++ L<string>\0 |
|
413 |
++ Dump string to the logger without adding additional \n or similar. |
|
414 |
++send -> todo: |
|
415 |
++ H Got a SIGHUP reread ~/control/locals and ~/control/virtualdomains |
|
416 |
++ X Quit ASAP. |
|
417 |
++ |
|
418 |
++qmail-todo sends "\0" terminated messages whereas qmail-send just send one |
|
419 |
++character to qmail-todo. |
|
420 |
++ |
|
421 |
++ |
|
422 |
+diff -uN qmail-1.03/EXTTODO-INFO qmail-exttodo/EXTTODO-INFO |
|
423 |
+--- qmail-1.03/EXTTODO-INFO Thu Jan 1 01:00:00 1970 |
|
424 |
++++ qmail-exttodo/EXTTODO-INFO Tue Apr 30 16:49:02 2002 |
|
425 |
+@@ -0,0 +1,11 @@ |
|
426 |
++Files modified: |
|
427 |
++Makefile |
|
428 |
++EXTTODO |
|
429 |
++FILES |
|
430 |
++TARGETS |
|
431 |
++qmail-send.c |
|
432 |
++qmail-todo.c |
|
433 |
++qmail-start.c |
|
434 |
++hier.c |
|
435 |
++install-big.c |
|
436 |
++ |
|
437 |
+diff -uN qmail-1.03/FILES qmail-exttodo/FILES |
|
438 |
+--- qmail-1.03/FILES Mon Jun 15 12:53:16 1998 |
|
439 |
++++ qmail-exttodo/FILES Mon Apr 22 13:59:28 2002 |
|
440 |
+@@ -431,3 +431,4 @@ |
|
441 |
+ tcp-environ.5 |
|
442 |
+ constmap.h |
|
443 |
+ constmap.c |
|
444 |
++qmail-todo.c |
|
445 |
+diff -uN qmail-1.03/Makefile qmail-exttodo/Makefile |
|
446 |
+--- qmail-1.03/Makefile Mon Jun 15 12:53:16 1998 |
|
447 |
++++ qmail-exttodo/Makefile Mon Apr 22 14:55:59 2002 |
|
448 |
+@@ -1,5 +1,7 @@ |
|
449 |
+ # Don't edit Makefile! Use conf-* for configuration. |
|
450 |
+ |
|
451 |
++DEFINES=-DEXTERNAL_TODO # use to enable external todo |
|
452 |
++ |
|
453 |
+ SHELL=/bin/sh |
|
454 |
+ |
|
455 |
+ default: it |
|
456 |
+@@ -703,7 +705,7 @@ |
|
457 |
+ |
|
458 |
+ hier.o: \ |
|
459 |
+ compile hier.c auto_qmail.h auto_split.h auto_uids.h fmt.h fifo.h |
|
460 |
+- ./compile hier.c |
|
461 |
++ ./compile $(DEFINES) hier.c |
|
462 |
+ |
|
463 |
+ home: \ |
|
464 |
+ home.sh conf-qmail |
|
465 |
+@@ -755,7 +757,7 @@ |
|
466 |
+ install-big.o: \ |
|
467 |
+ compile install-big.c auto_qmail.h auto_split.h auto_uids.h fmt.h \ |
|
468 |
+ fifo.h |
|
469 |
+- ./compile install-big.c |
|
470 |
++ ./compile $(DEFINES) install-big.c |
|
471 |
+ |
|
472 |
+ install.o: \ |
|
473 |
+ compile install.c substdio.h strerr.h error.h open.h readwrite.h \ |
|
474 |
+@@ -808,7 +810,7 @@ |
|
475 |
+ forward preline condredirect bouncesaying except maildirmake \ |
|
476 |
+ maildir2mbox maildirwatch qail elq pinq idedit install-big install \ |
|
477 |
+ instcheck home home+df proc proc+df binm1 binm1+df binm2 binm2+df \ |
|
478 |
+-binm3 binm3+df |
|
479 |
++binm3 binm3+df qmail-todo |
|
480 |
+ |
|
481 |
+ load: \ |
|
482 |
+ make-load warn-auto.sh systype |
|
483 |
+@@ -1509,7 +1511,7 @@ |
|
484 |
+ scan.h case.h auto_qmail.h trigger.h newfield.h stralloc.h quote.h \ |
|
485 |
+ qmail.h substdio.h qsutil.h prioq.h datetime.h gen_alloc.h constmap.h \ |
|
486 |
+ fmtqfn.h readsubdir.h direntry.h |
|
487 |
+- ./compile qmail-send.c |
|
488 |
++ ./compile $(DEFINES) qmail-send.c |
|
489 |
+ |
|
490 |
+ qmail-showctl: \ |
|
491 |
+ load qmail-showctl.o auto_uids.o control.o open.a getln.a stralloc.a \ |
|
492 |
+@@ -1574,7 +1576,7 @@ |
|
493 |
+ |
|
494 |
+ qmail-start.o: \ |
|
495 |
+ compile qmail-start.c fd.h prot.h exit.h fork.h auto_uids.h |
|
496 |
+- ./compile qmail-start.c |
|
497 |
++ ./compile $(DEFINES) qmail-start.c |
|
498 |
+ |
|
499 |
+ qmail-tcpok: \ |
|
500 |
+ load qmail-tcpok.o open.a lock.a strerr.a substdio.a error.a str.a \ |
|
501 |
+@@ -1605,6 +1607,20 @@ |
|
502 |
+ compile qmail-tcpto.c substdio.h subfd.h substdio.h auto_qmail.h \ |
|
503 |
+ fmt.h ip.h lock.h error.h exit.h datetime.h now.h datetime.h |
|
504 |
+ ./compile qmail-tcpto.c |
|
505 |
++ |
|
506 |
++qmail-todo: \ |
|
507 |
++load qmail-todo.o control.o constmap.o trigger.o fmtqfn.o now.o \ |
|
508 |
++readsubdir.o case.a ndelay.a getln.a sig.a open.a stralloc.a alloc.a \ |
|
509 |
++substdio.a error.a str.a fs.a auto_qmail.o auto_split.o |
|
510 |
++ ./load qmail-todo control.o constmap.o trigger.o fmtqfn.o now.o \ |
|
511 |
++ readsubdir.o case.a ndelay.a getln.a sig.a open.a stralloc.a \ |
|
512 |
++ alloc.a substdio.a error.a str.a fs.a auto_qmail.o auto_split.o |
|
513 |
++ |
|
514 |
++qmail-todo.o: \ |
|
515 |
++compile alloc.h auto_qmail.h byte.h constmap.h control.h direntry.h error.h \ |
|
516 |
++exit.h fmt.h fmtqfn.h getln.h open.h ndelay.h now.h readsubdir.h readwrite.h \ |
|
517 |
++scan.h select.h str.h stralloc.h substdio.h trigger.h |
|
518 |
++ ./compile $(DEFINES) qmail-todo.c |
|
519 |
+ |
|
520 |
+ qmail-upq: \ |
|
521 |
+ warn-auto.sh qmail-upq.sh conf-qmail conf-break conf-split |
|
522 |
+diff -uN qmail-1.03/TARGETS qmail-exttodo/TARGETS |
|
523 |
+--- qmail-1.03/TARGETS Mon Jun 15 12:53:16 1998 |
|
524 |
++++ qmail-exttodo/TARGETS Mon Apr 22 13:59:32 2002 |
|
525 |
+@@ -385,3 +385,5 @@ |
|
526 |
+ man |
|
527 |
+ setup |
|
528 |
+ check |
|
529 |
++qmail-todo.o |
|
530 |
++qmail-todo |
|
531 |
+diff -uN qmail-1.03/hier.c qmail-exttodo/hier.c |
|
532 |
+--- qmail-1.03/hier.c Mon Jun 15 12:53:16 1998 |
|
533 |
++++ qmail-exttodo/hier.c Mon Apr 22 14:01:58 2002 |
|
534 |
+@@ -108,6 +108,9 @@ |
|
535 |
+ c(auto_qmail,"bin","qmail-rspawn",auto_uido,auto_gidq,0711); |
|
536 |
+ c(auto_qmail,"bin","qmail-clean",auto_uido,auto_gidq,0711); |
|
537 |
+ c(auto_qmail,"bin","qmail-send",auto_uido,auto_gidq,0711); |
|
538 |
++#ifdef EXTERNAL_TODO |
|
539 |
++ c(auto_qmail,"bin","qmail-todo",auto_uido,auto_gidq,0711); |
|
540 |
++#endif |
|
541 |
+ c(auto_qmail,"bin","splogger",auto_uido,auto_gidq,0711); |
|
542 |
+ c(auto_qmail,"bin","qmail-newu",auto_uido,auto_gidq,0700); |
|
543 |
+ c(auto_qmail,"bin","qmail-newmrh",auto_uido,auto_gidq,0700); |
|
544 |
+diff -uN qmail-1.03/install-big.c qmail-exttodo/install-big.c |
|
545 |
+--- qmail-1.03/install-big.c Mon Jun 15 12:53:16 1998 |
|
546 |
++++ qmail-exttodo/install-big.c Mon Apr 22 14:02:11 2002 |
|
547 |
+@@ -108,6 +108,9 @@ |
|
548 |
+ c(auto_qmail,"bin","qmail-rspawn",auto_uido,auto_gidq,0711); |
|
549 |
+ c(auto_qmail,"bin","qmail-clean",auto_uido,auto_gidq,0711); |
|
550 |
+ c(auto_qmail,"bin","qmail-send",auto_uido,auto_gidq,0711); |
|
551 |
++#ifdef EXTERNAL_TODO |
|
552 |
++ c(auto_qmail,"bin","qmail-todo",auto_uido,auto_gidq,0711); |
|
553 |
++#endif |
|
554 |
+ c(auto_qmail,"bin","splogger",auto_uido,auto_gidq,0711); |
|
555 |
+ c(auto_qmail,"bin","qmail-newu",auto_uido,auto_gidq,0700); |
|
556 |
+ c(auto_qmail,"bin","qmail-newmrh",auto_uido,auto_gidq,0700); |
|
557 |
+diff -uN qmail-1.03/qmail-send.c qmail-exttodo/qmail-send.c |
|
558 |
+--- qmail-1.03/qmail-send.c Mon Jun 15 12:53:16 1998 |
|
559 |
++++ qmail-exttodo/qmail-send.c Sun Jan 5 22:09:42 2003 |
|
560 |
+@@ -1215,6 +1215,7 @@ |
|
561 |
+ |
|
562 |
+ /* this file is too long ---------------------------------------------- TODO */ |
|
563 |
+ |
|
564 |
++#ifndef EXTERNAL_TODO |
|
565 |
+ datetime_sec nexttodorun; |
|
566 |
+ DIR *tododir; /* if 0, have to opendir again */ |
|
567 |
+ stralloc todoline = {0};
|
|
568 |
+@@ -1438,6 +1439,143 @@ |
|
569 |
+ if (fdchan[c] != -1) close(fdchan[c]); |
|
570 |
+ } |
|
571 |
+ |
|
572 |
++#endif |
|
573 |
++ |
|
574 |
++/* this file is too long ------------------------------------- EXTERNAL TODO */ |
|
575 |
++ |
|
576 |
++#ifdef EXTERNAL_TODO |
|
577 |
++stralloc todoline = {0};
|
|
578 |
++char todobuf[2048]; |
|
579 |
++int todofdin; |
|
580 |
++int todofdout; |
|
581 |
++int flagtodoalive; |
|
582 |
++ |
|
583 |
++void tododied() { log1("alert: oh no! lost qmail-todo connection! dying...\n");
|
|
584 |
++ flagexitasap = 1; flagtodoalive = 0; } |
|
585 |
++ |
|
586 |
++void todo_init() |
|
587 |
++{
|
|
588 |
++ todofdout = 7; |
|
589 |
++ todofdin = 8; |
|
590 |
++ flagtodoalive = 1; |
|
591 |
++ /* sync with external todo */ |
|
592 |
++ if (write(todofdout, "S", 1) != 1) tododied(); |
|
593 |
++ |
|
594 |
++ return; |
|
595 |
++} |
|
596 |
++ |
|
597 |
++void todo_selprep(nfds,rfds,wakeup) |
|
598 |
++int *nfds; |
|
599 |
++fd_set *rfds; |
|
600 |
++datetime_sec *wakeup; |
|
601 |
++{
|
|
602 |
++ if (flagexitasap) {
|
|
603 |
++ if (flagtodoalive) {
|
|
604 |
++ write(todofdout, "X", 1); |
|
605 |
++ } |
|
606 |
++ } |
|
607 |
++ if (flagtodoalive) {
|
|
608 |
++ FD_SET(todofdin,rfds); |
|
609 |
++ if (*nfds <= todofdin) |
|
610 |
++ *nfds = todofdin + 1; |
|
611 |
++ } |
|
612 |
++} |
|
613 |
++ |
|
614 |
++void todo_del(char* s) |
|
615 |
++{
|
|
616 |
++ int flagchan[CHANNELS]; |
|
617 |
++ struct prioq_elt pe; |
|
618 |
++ unsigned long id; |
|
619 |
++ unsigned int len; |
|
620 |
++ int c; |
|
621 |
++ |
|
622 |
++ for (c = 0;c < CHANNELS;++c) flagchan[c] = 0; |
|
623 |
++ switch(*s++) {
|
|
624 |
++ case 'L': |
|
625 |
++ flagchan[0] = 1; |
|
626 |
++ break; |
|
627 |
++ case 'R': |
|
628 |
++ flagchan[1] = 1; |
|
629 |
++ break; |
|
630 |
++ case 'B': |
|
631 |
++ flagchan[0] = 1; |
|
632 |
++ flagchan[1] = 1; |
|
633 |
++ break; |
|
634 |
++ case 'X': |
|
635 |
++ break; |
|
636 |
++ default: |
|
637 |
++ log1("warning: qmail-send unable to understand qmail-todo\n");
|
|
638 |
++ return; |
|
639 |
++ } |
|
640 |
++ |
|
641 |
++ len = scan_ulong(s,&id); |
|
642 |
++ if (!len || s[len]) {
|
|
643 |
++ log1("warning: qmail-send unable to understand qmail-todo\n");
|
|
644 |
++ return; |
|
645 |
++ } |
|
646 |
++ |
|
647 |
++ pe.id = id; pe.dt = now(); |
|
648 |
++ for (c = 0;c < CHANNELS;++c) |
|
649 |
++ if (flagchan[c]) |
|
650 |
++ while (!prioq_insert(&pqchan[c],&pe)) nomem(); |
|
651 |
++ |
|
652 |
++ for (c = 0;c < CHANNELS;++c) if (flagchan[c]) break; |
|
653 |
++ if (c == CHANNELS) |
|
654 |
++ while (!prioq_insert(&pqdone,&pe)) nomem(); |
|
655 |
++ |
|
656 |
++ return; |
|
657 |
++} |
|
658 |
++ |
|
659 |
++void todo_do(rfds) |
|
660 |
++fd_set *rfds; |
|
661 |
++{
|
|
662 |
++ int r; |
|
663 |
++ char ch; |
|
664 |
++ int i; |
|
665 |
++ |
|
666 |
++ if (!flagtodoalive) return; |
|
667 |
++ if (!FD_ISSET(todofdin,rfds)) return; |
|
668 |
++ |
|
669 |
++ r = read(todofdin,todobuf,sizeof(todobuf)); |
|
670 |
++ if (r == -1) return; |
|
671 |
++ if (r == 0) {
|
|
672 |
++ if (flagexitasap) |
|
673 |
++ flagtodoalive = 0; |
|
674 |
++ else |
|
675 |
++ tododied(); |
|
676 |
++ return; |
|
677 |
++ } |
|
678 |
++ for (i = 0;i < r;++i) {
|
|
679 |
++ ch = todobuf[i]; |
|
680 |
++ while (!stralloc_append(&todoline,&ch)) nomem(); |
|
681 |
++ if (todoline.len > REPORTMAX) |
|
682 |
++ todoline.len = REPORTMAX; |
|
683 |
++ /* qmail-todo is responsible for keeping it short */ |
|
684 |
++ if (!ch && (todoline.len > 1)) {
|
|
685 |
++ switch (todoline.s[0]) {
|
|
686 |
++ case 'D': |
|
687 |
++ if (flagexitasap) break; |
|
688 |
++ todo_del(todoline.s + 1); |
|
689 |
++ break; |
|
690 |
++ case 'L': |
|
691 |
++ log1(todoline.s + 1); |
|
692 |
++ break; |
|
693 |
++ case 'X': |
|
694 |
++ if (flagexitasap) |
|
695 |
++ flagtodoalive = 0; |
|
696 |
++ else |
|
697 |
++ tododied(); |
|
698 |
++ break; |
|
699 |
++ default: |
|
700 |
++ log1("warning: qmail-send unable to understand qmail-todo: report mangled\n");
|
|
701 |
++ break; |
|
702 |
++ } |
|
703 |
++ todoline.len = 0; |
|
704 |
++ } |
|
705 |
++ } |
|
706 |
++} |
|
707 |
++ |
|
708 |
++#endif |
|
709 |
+ |
|
710 |
+ /* this file is too long ---------------------------------------------- MAIN */ |
|
711 |
+ |
|
712 |
+@@ -1504,6 +1642,9 @@ |
|
713 |
+ log1("alert: unable to reread controls: unable to switch to home directory\n");
|
|
714 |
+ return; |
|
715 |
+ } |
|
716 |
++#ifdef EXTERNAL_TODO |
|
717 |
++ write(todofdout, "H", 1); |
|
718 |
++#endif |
|
719 |
+ regetcontrols(); |
|
720 |
+ while (chdir("queue") == -1)
|
|
721 |
+ {
|
|
722 |
+@@ -1568,8 +1709,12 @@ |
|
723 |
+ todo_init(); |
|
724 |
+ cleanup_init(); |
|
725 |
+ |
|
726 |
++#ifdef EXTERNAL_TODO |
|
727 |
++ while (!flagexitasap || !del_canexit() || flagtodoalive) |
|
728 |
++#else |
|
729 |
+ while (!flagexitasap || !del_canexit()) |
|
730 |
+- {
|
|
731 |
++#endif |
|
732 |
++ {
|
|
733 |
+ recent = now(); |
|
734 |
+ |
|
735 |
+ if (flagrunasap) { flagrunasap = 0; pqrun(); }
|
|
736 |
+diff -uN qmail-1.03/qmail-start.c qmail-exttodo/qmail-start.c |
|
737 |
+--- qmail-1.03/qmail-start.c Mon Jun 15 12:53:16 1998 |
|
738 |
++++ qmail-exttodo/qmail-start.c Mon Apr 22 13:55:48 2002 |
|
739 |
+@@ -8,6 +8,9 @@ |
|
740 |
+ char *(qcargs[]) = { "qmail-clean", 0 };
|
|
741 |
+ char *(qlargs[]) = { "qmail-lspawn", "./Mailbox", 0 };
|
|
742 |
+ char *(qrargs[]) = { "qmail-rspawn", 0 };
|
|
743 |
++#ifdef EXTERNAL_TODO |
|
744 |
++char *(qtargs[]) = { "qmail-todo", 0};
|
|
745 |
++#endif |
|
746 |
+ |
|
747 |
+ void die() { _exit(111); }
|
|
748 |
+ |
|
749 |
+@@ -18,13 +21,28 @@ |
|
750 |
+ int pi4[2]; |
|
751 |
+ int pi5[2]; |
|
752 |
+ int pi6[2]; |
|
753 |
+- |
|
754 |
+-void close23456() { close(2); close(3); close(4); close(5); close(6); }
|
|
755 |
++#ifdef EXTERNAL_TODO |
|
756 |
++int pi7[2]; |
|
757 |
++int pi8[2]; |
|
758 |
++int pi9[2]; |
|
759 |
++int pi10[2]; |
|
760 |
++#endif |
|
761 |
++ |
|
762 |
++void close23456() {
|
|
763 |
++ close(2); close(3); close(4); close(5); close(6); |
|
764 |
++#ifdef EXTERNAL_TODO |
|
765 |
++ close(7); close(8); |
|
766 |
++#endif |
|
767 |
++} |
|
768 |
+ |
|
769 |
+ void closepipes() {
|
|
770 |
+ close(pi1[0]); close(pi1[1]); close(pi2[0]); close(pi2[1]); |
|
771 |
+ close(pi3[0]); close(pi3[1]); close(pi4[0]); close(pi4[1]); |
|
772 |
+ close(pi5[0]); close(pi5[1]); close(pi6[0]); close(pi6[1]); |
|
773 |
++#ifdef EXTERNAL_TODO |
|
774 |
++ close(pi7[0]); close(pi7[1]); close(pi8[0]); close(pi8[1]); |
|
775 |
++ close(pi9[0]); close(pi9[1]); close(pi10[0]); close(pi10[1]); |
|
776 |
++#endif |
|
777 |
+ } |
|
778 |
+ |
|
779 |
+ void main(argc,argv) |
|
780 |
+@@ -40,6 +58,10 @@ |
|
781 |
+ if (fd_copy(4,0) == -1) die(); |
|
782 |
+ if (fd_copy(5,0) == -1) die(); |
|
783 |
+ if (fd_copy(6,0) == -1) die(); |
|
784 |
++#ifdef EXTERNAL_TODO |
|
785 |
++ if (fd_copy(7,0) == -1) die(); |
|
786 |
++ if (fd_copy(8,0) == -1) die(); |
|
787 |
++#endif |
|
788 |
+ |
|
789 |
+ if (argv[1]) {
|
|
790 |
+ qlargs[1] = argv[1]; |
|
791 |
+@@ -70,6 +92,12 @@ |
|
792 |
+ if (pipe(pi4) == -1) die(); |
|
793 |
+ if (pipe(pi5) == -1) die(); |
|
794 |
+ if (pipe(pi6) == -1) die(); |
|
795 |
++#ifdef EXTERNAL_TODO |
|
796 |
++ if (pipe(pi7) == -1) die(); |
|
797 |
++ if (pipe(pi8) == -1) die(); |
|
798 |
++ if (pipe(pi9) == -1) die(); |
|
799 |
++ if (pipe(pi10) == -1) die(); |
|
800 |
++#endif |
|
801 |
+ |
|
802 |
+ switch(fork()) {
|
|
803 |
+ case -1: die(); |
|
804 |
+@@ -105,6 +133,34 @@ |
|
805 |
+ execvp(*qcargs,qcargs); |
|
806 |
+ die(); |
|
807 |
+ } |
|
808 |
++ |
|
809 |
++#ifdef EXTERNAL_TODO |
|
810 |
++ switch(fork()) {
|
|
811 |
++ case -1: die(); |
|
812 |
++ case 0: |
|
813 |
++ if (prot_uid(auto_uids) == -1) die(); |
|
814 |
++ if (fd_copy(0,pi7[0]) == -1) die(); |
|
815 |
++ if (fd_copy(1,pi8[1]) == -1) die(); |
|
816 |
++ close23456(); |
|
817 |
++ if (fd_copy(2,pi9[1]) == -1) die(); |
|
818 |
++ if (fd_copy(3,pi10[0]) == -1) die(); |
|
819 |
++ closepipes(); |
|
820 |
++ execvp(*qtargs,qtargs); |
|
821 |
++ die(); |
|
822 |
++ } |
|
823 |
++ |
|
824 |
++ switch(fork()) {
|
|
825 |
++ case -1: die(); |
|
826 |
++ case 0: |
|
827 |
++ if (prot_uid(auto_uidq) == -1) die(); |
|
828 |
++ if (fd_copy(0,pi9[0]) == -1) die(); |
|
829 |
++ if (fd_copy(1,pi10[1]) == -1) die(); |
|
830 |
++ close23456(); |
|
831 |
++ closepipes(); |
|
832 |
++ execvp(*qcargs,qcargs); |
|
833 |
++ die(); |
|
834 |
++ } |
|
835 |
++#endif |
|
836 |
+ |
|
837 |
+ if (prot_uid(auto_uids) == -1) die(); |
|
838 |
+ if (fd_copy(0,1) == -1) die(); |
|
839 |
+@@ -114,6 +170,10 @@ |
|
840 |
+ if (fd_copy(4,pi4[0]) == -1) die(); |
|
841 |
+ if (fd_copy(5,pi5[1]) == -1) die(); |
|
842 |
+ if (fd_copy(6,pi6[0]) == -1) die(); |
|
843 |
++#ifdef EXTERNAL_TODO |
|
844 |
++ if (fd_copy(7,pi7[1]) == -1) die(); |
|
845 |
++ if (fd_copy(8,pi8[0]) == -1) die(); |
|
846 |
++#endif |
|
847 |
+ closepipes(); |
|
848 |
+ execvp(*qsargs,qsargs); |
|
849 |
+ die(); |
|
850 |
+diff -uN qmail-1.03/qmail-todo.c qmail-exttodo/qmail-todo.c |
|
851 |
+--- qmail-1.03/qmail-todo.c Thu Jan 1 01:00:00 1970 |
|
852 |
++++ qmail-exttodo/qmail-todo.c Sun Jan 5 22:16:34 2003 |
|
853 |
+@@ -0,0 +1,688 @@ |
|
854 |
++#include <sys/types.h> |
|
855 |
++#include <sys/stat.h> |
|
856 |
++#include "alloc.h" |
|
857 |
++#include "auto_qmail.h" |
|
858 |
++#include "byte.h" |
|
859 |
++#include "constmap.h" |
|
860 |
++#include "control.h" |
|
861 |
++#include "direntry.h" |
|
862 |
++#include "error.h" |
|
863 |
++#include "exit.h" |
|
864 |
++#include "fmt.h" |
|
865 |
++#include "fmtqfn.h" |
|
866 |
++#include "getln.h" |
|
867 |
++#include "open.h" |
|
868 |
++#include "ndelay.h" |
|
869 |
++#include "now.h" |
|
870 |
++#include "readsubdir.h" |
|
871 |
++#include "readwrite.h" |
|
872 |
++#include "scan.h" |
|
873 |
++#include "select.h" |
|
874 |
++#include "str.h" |
|
875 |
++#include "stralloc.h" |
|
876 |
++#include "substdio.h" |
|
877 |
++#include "trigger.h" |
|
878 |
++ |
|
879 |
++/* critical timing feature #1: if not triggered, do not busy-loop */ |
|
880 |
++/* critical timing feature #2: if triggered, respond within fixed time */ |
|
881 |
++/* important timing feature: when triggered, respond instantly */ |
|
882 |
++#define SLEEP_TODO 1500 /* check todo/ every 25 minutes in any case */ |
|
883 |
++#define SLEEP_FUZZ 1 /* slop a bit on sleeps to avoid zeno effect */ |
|
884 |
++#define SLEEP_FOREVER 86400 /* absolute maximum time spent in select() */ |
|
885 |
++#define SLEEP_SYSFAIL 123 |
|
886 |
++ |
|
887 |
++stralloc percenthack = {0};
|
|
888 |
++struct constmap mappercenthack; |
|
889 |
++stralloc locals = {0};
|
|
890 |
++struct constmap maplocals; |
|
891 |
++stralloc vdoms = {0};
|
|
892 |
++struct constmap mapvdoms; |
|
893 |
++stralloc envnoathost = {0};
|
|
894 |
++ |
|
895 |
++char strnum[FMT_ULONG]; |
|
896 |
++ |
|
897 |
++/* XXX not good, if qmail-send.c changes this has to be updated */ |
|
898 |
++#define CHANNELS 2 |
|
899 |
++char *chanaddr[CHANNELS] = { "local/", "remote/" };
|
|
900 |
++ |
|
901 |
++datetime_sec recent; |
|
902 |
++ |
|
903 |
++void log1(char *x); |
|
904 |
++void log3(char* x, char* y, char* z); |
|
905 |
++ |
|
906 |
++int flagstopasap = 0; |
|
907 |
++void sigterm(void) |
|
908 |
++{
|
|
909 |
++ if (flagstopasap == 0) |
|
910 |
++ log1("status: qmail-todo stop processing asap\n");
|
|
911 |
++ flagstopasap = 1; |
|
912 |
++} |
|
913 |
++ |
|
914 |
++int flagreadasap = 0; void sighup(void) { flagreadasap = 1; }
|
|
915 |
++int flagsendalive = 1; void senddied(void) { flagsendalive = 0; }
|
|
916 |
++ |
|
917 |
++void nomem() { log1("alert: out of memory, sleeping...\n"); sleep(10); }
|
|
918 |
++void pausedir(dir) char *dir; |
|
919 |
++{ log3("alert: unable to opendir ",dir,", sleeping...\n"); sleep(10); }
|
|
920 |
++ |
|
921 |
++void cleandied() |
|
922 |
++{
|
|
923 |
++ log1("alert: qmail-todo: oh no! lost qmail-clean connection! dying...\n");
|
|
924 |
++ flagstopasap = 1; |
|
925 |
++} |
|
926 |
++ |
|
927 |
++ |
|
928 |
++/* this file is not so long ------------------------------------- FILENAMES */ |
|
929 |
++ |
|
930 |
++stralloc fn = {0};
|
|
931 |
++ |
|
932 |
++void fnmake_init(void) |
|
933 |
++{
|
|
934 |
++ while (!stralloc_ready(&fn,FMTQFN)) nomem(); |
|
935 |
++} |
|
936 |
++ |
|
937 |
++void fnmake_info(unsigned long id) { fn.len = fmtqfn(fn.s,"info/",id,1); }
|
|
938 |
++void fnmake_todo(unsigned long id) { fn.len = fmtqfn(fn.s,"todo/",id,0); }
|
|
939 |
++void fnmake_mess(unsigned long id) { fn.len = fmtqfn(fn.s,"mess/",id,1); }
|
|
940 |
++void fnmake_chanaddr(unsigned long id, int c) |
|
941 |
++{ fn.len = fmtqfn(fn.s,chanaddr[c],id,1); }
|
|
942 |
++ |
|
943 |
++ |
|
944 |
++/* this file is not so long ------------------------------------- REWRITING */ |
|
945 |
++ |
|
946 |
++stralloc rwline = {0};
|
|
947 |
++ |
|
948 |
++/* 1 if by land, 2 if by sea, 0 if out of memory. not allowed to barf. */ |
|
949 |
++/* may trash recip. must set up rwline, between a T and a \0. */ |
|
950 |
++int rewrite(char *recip) |
|
951 |
++{
|
|
952 |
++ int i; |
|
953 |
++ int j; |
|
954 |
++ char *x; |
|
955 |
++ static stralloc addr = {0};
|
|
956 |
++ int at; |
|
957 |
++ |
|
958 |
++ if (!stralloc_copys(&rwline,"T")) return 0; |
|
959 |
++ if (!stralloc_copys(&addr,recip)) return 0; |
|
960 |
++ |
|
961 |
++ i = byte_rchr(addr.s,addr.len,'@'); |
|
962 |
++ if (i == addr.len) {
|
|
963 |
++ if (!stralloc_cats(&addr,"@")) return 0; |
|
964 |
++ if (!stralloc_cat(&addr,&envnoathost)) return 0; |
|
965 |
++ } |
|
966 |
++ |
|
967 |
++ while (constmap(&mappercenthack,addr.s + i + 1,addr.len - i - 1)) {
|
|
968 |
++ j = byte_rchr(addr.s,i,'%'); |
|
969 |
++ if (j == i) break; |
|
970 |
++ addr.len = i; |
|
971 |
++ i = j; |
|
972 |
++ addr.s[i] = '@'; |
|
973 |
++ } |
|
974 |
++ |
|
975 |
++ at = byte_rchr(addr.s,addr.len,'@'); |
|
976 |
++ |
|
977 |
++ if (constmap(&maplocals,addr.s + at + 1,addr.len - at - 1)) {
|
|
978 |
++ if (!stralloc_cat(&rwline,&addr)) return 0; |
|
979 |
++ if (!stralloc_0(&rwline)) return 0; |
|
980 |
++ return 1; |
|
981 |
++ } |
|
982 |
++ |
|
983 |
++ for (i = 0;i <= addr.len;++i) |
|
984 |
++ if (!i || (i == at + 1) || (i == addr.len) || ((i > at) && (addr.s[i] == '.'))) |
|
985 |
++ if (x = constmap(&mapvdoms,addr.s + i,addr.len - i)) {
|
|
986 |
++ if (!*x) break; |
|
987 |
++ if (!stralloc_cats(&rwline,x)) return 0; |
|
988 |
++ if (!stralloc_cats(&rwline,"-")) return 0; |
|
989 |
++ if (!stralloc_cat(&rwline,&addr)) return 0; |
|
990 |
++ if (!stralloc_0(&rwline)) return 0; |
|
991 |
++ return 1; |
|
992 |
++ } |
|
993 |
++ |
|
994 |
++ if (!stralloc_cat(&rwline,&addr)) return 0; |
|
995 |
++ if (!stralloc_0(&rwline)) return 0; |
|
996 |
++ return 2; |
|
997 |
++} |
|
998 |
++ |
|
999 |
++/* this file is not so long --------------------------------- COMMUNICATION */ |
|
1000 |
++ |
|
1001 |
++substdio sstoqc; char sstoqcbuf[1024]; |
|
1002 |
++substdio ssfromqc; char ssfromqcbuf[1024]; |
|
1003 |
++stralloc comm_buf = {0};
|
|
1004 |
++int comm_pos; |
|
1005 |
++int fdout = -1; |
|
1006 |
++int fdin = -1; |
|
1007 |
++ |
|
1008 |
++void comm_init(void) |
|
1009 |
++{
|
|
1010 |
++ substdio_fdbuf(&sstoqc,write,2,sstoqcbuf,sizeof(sstoqcbuf)); |
|
1011 |
++ substdio_fdbuf(&ssfromqc,read,3,ssfromqcbuf,sizeof(ssfromqcbuf)); |
|
1012 |
++ |
|
1013 |
++ fdout = 1; /* stdout */ |
|
1014 |
++ fdin = 0; /* stdin */ |
|
1015 |
++ if (ndelay_on(fdout) == -1) |
|
1016 |
++ /* this is so stupid: NDELAY semantics should be default on write */ |
|
1017 |
++ senddied(); /* drastic, but better than risking deadlock */ |
|
1018 |
++ |
|
1019 |
++ while (!stralloc_ready(&comm_buf,1024)) nomem(); |
|
1020 |
++} |
|
1021 |
++ |
|
1022 |
++int comm_canwrite(void) |
|
1023 |
++{
|
|
1024 |
++ /* XXX: could allow a bigger buffer; say 10 recipients */ |
|
1025 |
++ /* XXX: returns true if there is something in the buffer */ |
|
1026 |
++ if (!flagsendalive) return 0; |
|
1027 |
++ if (comm_buf.s && comm_buf.len) return 1; |
|
1028 |
++ return 0; |
|
1029 |
++} |
|
1030 |
++ |
|
1031 |
++void log1(char* x) |
|
1032 |
++{
|
|
1033 |
++ int pos; |
|
1034 |
++ |
|
1035 |
++ pos = comm_buf.len; |
|
1036 |
++ if (!stralloc_cats(&comm_buf,"L")) goto fail; |
|
1037 |
++ if (!stralloc_cats(&comm_buf,x)) goto fail; |
|
1038 |
++ if (!stralloc_0(&comm_buf)) goto fail; |
|
1039 |
++ return; |
|
1040 |
++ |
|
1041 |
++fail: |
|
1042 |
++ /* either all or nothing */ |
|
1043 |
++ comm_buf.len = pos; |
|
1044 |
++} |
|
1045 |
++ |
|
1046 |
++void log3(char* x, char *y, char *z) |
|
1047 |
++{
|
|
1048 |
++ int pos; |
|
1049 |
++ |
|
1050 |
++ pos = comm_buf.len; |
|
1051 |
++ if (!stralloc_cats(&comm_buf,"L")) goto fail; |
|
1052 |
++ if (!stralloc_cats(&comm_buf,x)) goto fail; |
|
1053 |
++ if (!stralloc_cats(&comm_buf,y)) goto fail; |
|
1054 |
++ if (!stralloc_cats(&comm_buf,z)) goto fail; |
|
1055 |
++ if (!stralloc_0(&comm_buf)) goto fail; |
|
1056 |
++ return; |
|
1057 |
++ |
|
1058 |
++fail: |
|
1059 |
++ /* either all or nothing */ |
|
1060 |
++ comm_buf.len = pos; |
|
1061 |
++} |
|
1062 |
++ |
|
1063 |
++void comm_write(unsigned long id, int local, int remote) |
|
1064 |
++{
|
|
1065 |
++ int pos; |
|
1066 |
++ char *s; |
|
1067 |
++ |
|
1068 |
++ if(local && remote) s="B"; |
|
1069 |
++ else if(local) s="L"; |
|
1070 |
++ else if(remote) s="R"; |
|
1071 |
++ else s="X"; |
|
1072 |
++ |
|
1073 |
++ pos = comm_buf.len; |
|
1074 |
++ strnum[fmt_ulong(strnum,id)] = 0; |
|
1075 |
++ if (!stralloc_cats(&comm_buf,"D")) goto fail; |
|
1076 |
++ if (!stralloc_cats(&comm_buf,s)) goto fail; |
|
1077 |
++ if (!stralloc_cats(&comm_buf,strnum)) goto fail; |
|
1078 |
++ if (!stralloc_0(&comm_buf)) goto fail; |
|
1079 |
++ return; |
|
1080 |
++ |
|
1081 |
++fail: |
|
1082 |
++ /* either all or nothing */ |
|
1083 |
++ comm_buf.len = pos; |
|
1084 |
++} |
|
1085 |
++ |
|
1086 |
++static int issafe(char ch) |
|
1087 |
++{
|
|
1088 |
++ if (ch == '%') return 0; /* general principle: allman's code is crap */ |
|
1089 |
++ if (ch < 33) return 0; |
|
1090 |
++ if (ch > 126) return 0; |
|
1091 |
++ return 1; |
|
1092 |
++} |
|
1093 |
++ |
|
1094 |
++void comm_info(unsigned long id, unsigned long size, char* from, unsigned long pid, unsigned long uid) |
|
1095 |
++{
|
|
1096 |
++ int pos; |
|
1097 |
++ int i; |
|
1098 |
++ |
|
1099 |
++ pos = comm_buf.len; |
|
1100 |
++ if (!stralloc_cats(&comm_buf,"Linfo msg ")) goto fail; |
|
1101 |
++ strnum[fmt_ulong(strnum,id)] = 0; |
|
1102 |
++ if (!stralloc_cats(&comm_buf,strnum)) goto fail; |
|
1103 |
++ if (!stralloc_cats(&comm_buf,": bytes ")) goto fail; |
|
1104 |
++ strnum[fmt_ulong(strnum,size)] = 0; |
|
1105 |
++ if (!stralloc_cats(&comm_buf,strnum)) goto fail; |
|
1106 |
++ if (!stralloc_cats(&comm_buf," from <")) goto fail; |
|
1107 |
++ i = comm_buf.len; |
|
1108 |
++ if (!stralloc_cats(&comm_buf,from)) goto fail; |
|
1109 |
++ for (;i < comm_buf.len;++i) |
|
1110 |
++ if (comm_buf.s[i] == '\n') |
|
1111 |
++ comm_buf.s[i] = '/'; |
|
1112 |
++ else |
|
1113 |
++ if (!issafe(comm_buf.s[i])) |
|
1114 |
++ comm_buf.s[i] = '_'; |
|
1115 |
++ if (!stralloc_cats(&comm_buf,"> qp ")) goto fail; |
|
1116 |
++ strnum[fmt_ulong(strnum,pid)] = 0; |
|
1117 |
++ if (!stralloc_cats(&comm_buf,strnum)) goto fail; |
|
1118 |
++ if (!stralloc_cats(&comm_buf," uid ")) goto fail; |
|
1119 |
++ strnum[fmt_ulong(strnum,uid)] = 0; |
|
1120 |
++ if (!stralloc_cats(&comm_buf,strnum)) goto fail; |
|
1121 |
++ if (!stralloc_cats(&comm_buf,"\n")) goto fail; |
|
1122 |
++ if (!stralloc_0(&comm_buf)) goto fail; |
|
1123 |
++ return; |
|
1124 |
++ |
|
1125 |
++fail: |
|
1126 |
++ /* either all or nothing */ |
|
1127 |
++ comm_buf.len = pos; |
|
1128 |
++} |
|
1129 |
++ |
|
1130 |
++void comm_exit(void) |
|
1131 |
++{
|
|
1132 |
++ int w; |
|
1133 |
++ |
|
1134 |
++ /* if it fails exit, we have already stoped */ |
|
1135 |
++ if (!stralloc_cats(&comm_buf,"X")) _exit(1); |
|
1136 |
++ if (!stralloc_0(&comm_buf)) _exit(1); |
|
1137 |
++} |
|
1138 |
++ |
|
1139 |
++void comm_selprep(int *nfds, fd_set *wfds, fd_set *rfds) |
|
1140 |
++{
|
|
1141 |
++ if (flagsendalive) {
|
|
1142 |
++ if (flagstopasap && comm_canwrite() == 0) |
|
1143 |
++ comm_exit(); |
|
1144 |
++ if (comm_canwrite()) {
|
|
1145 |
++ FD_SET(fdout,wfds); |
|
1146 |
++ if (*nfds <= fdout) |
|
1147 |
++ *nfds = fdout + 1; |
|
1148 |
++ } |
|
1149 |
++ FD_SET(fdin,rfds); |
|
1150 |
++ if (*nfds <= fdin) |
|
1151 |
++ *nfds = fdin + 1; |
|
1152 |
++ } |
|
1153 |
++} |
|
1154 |
++ |
|
1155 |
++void comm_do(fd_set *wfds, fd_set *rfds) |
|
1156 |
++{
|
|
1157 |
++ /* first write then read */ |
|
1158 |
++ if (flagsendalive) |
|
1159 |
++ if (comm_canwrite()) |
|
1160 |
++ if (FD_ISSET(fdout,wfds)) {
|
|
1161 |
++ int w; |
|
1162 |
++ int len; |
|
1163 |
++ len = comm_buf.len; |
|
1164 |
++ w = write(fdout,comm_buf.s + comm_pos,len - comm_pos); |
|
1165 |
++ if (w <= 0) {
|
|
1166 |
++ if ((w == -1) && (errno == error_pipe)) |
|
1167 |
++ senddied(); |
|
1168 |
++ } else {
|
|
1169 |
++ comm_pos += w; |
|
1170 |
++ if (comm_pos == len) {
|
|
1171 |
++ comm_buf.len = 0; |
|
1172 |
++ comm_pos = 0; |
|
1173 |
++ } |
|
1174 |
++ } |
|
1175 |
++ } |
|
1176 |
++ if (flagsendalive) |
|
1177 |
++ if (FD_ISSET(fdin,rfds)) {
|
|
1178 |
++ /* there are only two messages 'H' and 'X' */ |
|
1179 |
++ char c; |
|
1180 |
++ int r; |
|
1181 |
++ r = read(fdin, &c, 1); |
|
1182 |
++ if (r <= 0) {
|
|
1183 |
++ if ((r == -1) && (errno != error_intr)) |
|
1184 |
++ senddied(); |
|
1185 |
++ } else {
|
|
1186 |
++ switch(c) {
|
|
1187 |
++ case 'H': |
|
1188 |
++ sighup(); |
|
1189 |
++ break; |
|
1190 |
++ case 'X': |
|
1191 |
++ sigterm(); |
|
1192 |
++ break; |
|
1193 |
++ default: |
|
1194 |
++ log1("warning: qmail-todo: qmail-send speaks an obscure dialect\n");
|
|
1195 |
++ break; |
|
1196 |
++ } |
|
1197 |
++ } |
|
1198 |
++ } |
|
1199 |
++} |
|
1200 |
++ |
|
1201 |
++/* this file is not so long ------------------------------------------ TODO */ |
|
1202 |
++ |
|
1203 |
++datetime_sec nexttodorun; |
|
1204 |
++DIR *tododir; /* if 0, have to opendir again */ |
|
1205 |
++stralloc todoline = {0};
|
|
1206 |
++char todobuf[SUBSTDIO_INSIZE]; |
|
1207 |
++char todobufinfo[512]; |
|
1208 |
++char todobufchan[CHANNELS][1024]; |
|
1209 |
++ |
|
1210 |
++void todo_init(void) |
|
1211 |
++{
|
|
1212 |
++ tododir = 0; |
|
1213 |
++ nexttodorun = now(); |
|
1214 |
++ trigger_set(); |
|
1215 |
++} |
|
1216 |
++ |
|
1217 |
++void todo_selprep(int *nfds, fd_set *rfds, datetime_sec *wakeup) |
|
1218 |
++{
|
|
1219 |
++ if (flagstopasap) return; |
|
1220 |
++ trigger_selprep(nfds,rfds); |
|
1221 |
++ if (tododir) *wakeup = 0; |
|
1222 |
++ if (*wakeup > nexttodorun) *wakeup = nexttodorun; |
|
1223 |
++} |
|
1224 |
++ |
|
1225 |
++void todo_do(fd_set *rfds) |
|
1226 |
++{
|
|
1227 |
++ struct stat st; |
|
1228 |
++ substdio ss; int fd; |
|
1229 |
++ substdio ssinfo; int fdinfo; |
|
1230 |
++ substdio sschan[CHANNELS]; |
|
1231 |
++ int fdchan[CHANNELS]; |
|
1232 |
++ int flagchan[CHANNELS]; |
|
1233 |
++ char ch; |
|
1234 |
++ int match; |
|
1235 |
++ unsigned long id; |
|
1236 |
++ unsigned int len; |
|
1237 |
++ direntry *d; |
|
1238 |
++ int c; |
|
1239 |
++ unsigned long uid; |
|
1240 |
++ unsigned long pid; |
|
1241 |
++ |
|
1242 |
++ fd = -1; |
|
1243 |
++ fdinfo = -1; |
|
1244 |
++ for (c = 0;c < CHANNELS;++c) fdchan[c] = -1; |
|
1245 |
++ |
|
1246 |
++ if (flagstopasap) return; |
|
1247 |
++ |
|
1248 |
++ if (!tododir) |
|
1249 |
++ {
|
|
1250 |
++ if (!trigger_pulled(rfds)) |
|
1251 |
++ if (recent < nexttodorun) |
|
1252 |
++ return; |
|
1253 |
++ trigger_set(); |
|
1254 |
++ tododir = opendir("todo");
|
|
1255 |
++ if (!tododir) |
|
1256 |
++ {
|
|
1257 |
++ pausedir("todo");
|
|
1258 |
++ return; |
|
1259 |
++ } |
|
1260 |
++ nexttodorun = recent + SLEEP_TODO; |
|
1261 |
++ } |
|
1262 |
++ |
|
1263 |
++ d = readdir(tododir); |
|
1264 |
++ if (!d) |
|
1265 |
++ {
|
|
1266 |
++ closedir(tododir); |
|
1267 |
++ tododir = 0; |
|
1268 |
++ return; |
|
1269 |
++ } |
|
1270 |
++ if (str_equal(d->d_name,".")) return; |
|
1271 |
++ if (str_equal(d->d_name,"..")) return; |
|
1272 |
++ len = scan_ulong(d->d_name,&id); |
|
1273 |
++ if (!len || d->d_name[len]) return; |
|
1274 |
++ |
|
1275 |
++ fnmake_todo(id); |
|
1276 |
++ |
|
1277 |
++ fd = open_read(fn.s); |
|
1278 |
++ if (fd == -1) { log3("warning: qmail-todo: unable to open ",fn.s,"\n"); return; }
|
|
1279 |
++ |
|
1280 |
++ fnmake_mess(id); |
|
1281 |
++ /* just for the statistics */ |
|
1282 |
++ if (stat(fn.s,&st) == -1) |
|
1283 |
++ { log3("warning: qmail-todo: unable to stat ",fn.s,"\n"); goto fail; }
|
|
1284 |
++ |
|
1285 |
++ for (c = 0;c < CHANNELS;++c) |
|
1286 |
++ {
|
|
1287 |
++ fnmake_chanaddr(id,c); |
|
1288 |
++ if (unlink(fn.s) == -1) if (errno != error_noent) |
|
1289 |
++ { log3("warning: qmail-todo: unable to unlink ",fn.s,"\n"); goto fail; }
|
|
1290 |
++ } |
|
1291 |
++ |
|
1292 |
++ fnmake_info(id); |
|
1293 |
++ if (unlink(fn.s) == -1) if (errno != error_noent) |
|
1294 |
++ { log3("warning: qmail-todo: unable to unlink ",fn.s,"\n"); goto fail; }
|
|
1295 |
++ |
|
1296 |
++ fdinfo = open_excl(fn.s); |
|
1297 |
++ if (fdinfo == -1) |
|
1298 |
++ { log3("warning: qmail-todo: unable to create ",fn.s,"\n"); goto fail; }
|
|
1299 |
++ |
|
1300 |
++ strnum[fmt_ulong(strnum,id)] = 0; |
|
1301 |
++ log3("new msg ",strnum,"\n");
|
|
1302 |
++ |
|
1303 |
++ for (c = 0;c < CHANNELS;++c) flagchan[c] = 0; |
|
1304 |
++ |
|
1305 |
++ substdio_fdbuf(&ss,read,fd,todobuf,sizeof(todobuf)); |
|
1306 |
++ substdio_fdbuf(&ssinfo,write,fdinfo,todobufinfo,sizeof(todobufinfo)); |
|
1307 |
++ |
|
1308 |
++ uid = 0; |
|
1309 |
++ pid = 0; |
|
1310 |
++ |
|
1311 |
++ for (;;) |
|
1312 |
++ {
|
|
1313 |
++ if (getln(&ss,&todoline,&match,'\0') == -1) |
|
1314 |
++ {
|
|
1315 |
++ /* perhaps we're out of memory, perhaps an I/O error */ |
|
1316 |
++ fnmake_todo(id); |
|
1317 |
++ log3("warning: qmail-todo: trouble reading ",fn.s,"\n"); goto fail;
|
|
1318 |
++ } |
|
1319 |
++ if (!match) break; |
|
1320 |
++ |
|
1321 |
++ switch(todoline.s[0]) |
|
1322 |
++ {
|
|
1323 |
++ case 'u': |
|
1324 |
++ scan_ulong(todoline.s + 1,&uid); |
|
1325 |
++ break; |
|
1326 |
++ case 'p': |
|
1327 |
++ scan_ulong(todoline.s + 1,&pid); |
|
1328 |
++ break; |
|
1329 |
++ case 'F': |
|
1330 |
++ if (substdio_putflush(&ssinfo,todoline.s,todoline.len) == -1) |
|
1331 |
++ {
|
|
1332 |
++ fnmake_info(id); |
|
1333 |
++ log3("warning: qmail-todo: trouble writing to ",fn.s,"\n"); goto fail;
|
|
1334 |
++ } |
|
1335 |
++ comm_info(id, (unsigned long) st.st_size, todoline.s + 1, pid, uid); |
|
1336 |
++ break; |
|
1337 |
++ case 'T': |
|
1338 |
++ switch(rewrite(todoline.s + 1)) |
|
1339 |
++ {
|
|
1340 |
++ case 0: nomem(); goto fail; |
|
1341 |
++ case 2: c = 1; break; |
|
1342 |
++ default: c = 0; break; |
|
1343 |
++ } |
|
1344 |
++ if (fdchan[c] == -1) |
|
1345 |
++ {
|
|
1346 |
++ fnmake_chanaddr(id,c); |
|
1347 |
++ fdchan[c] = open_excl(fn.s); |
|
1348 |
++ if (fdchan[c] == -1) |
|
1349 |
++ { log3("warning: qmail-todo: unable to create ",fn.s,"\n"); goto fail; }
|
|
1350 |
++ substdio_fdbuf(&sschan[c] |
|
1351 |
++ ,write,fdchan[c],todobufchan[c],sizeof(todobufchan[c])); |
|
1352 |
++ flagchan[c] = 1; |
|
1353 |
++ } |
|
1354 |
++ if (substdio_bput(&sschan[c],rwline.s,rwline.len) == -1) |
|
1355 |
++ {
|
|
1356 |
++ fnmake_chanaddr(id,c); |
|
1357 |
++ log3("warning: qmail-todo: trouble writing to ",fn.s,"\n"); goto fail;
|
|
1358 |
++ } |
|
1359 |
++ break; |
|
1360 |
++ default: |
|
1361 |
++ fnmake_todo(id); |
|
1362 |
++ log3("warning: qmail-todo: unknown record type in ",fn.s,"\n"); goto fail;
|
|
1363 |
++ } |
|
1364 |
++ } |
|
1365 |
++ |
|
1366 |
++ close(fd); fd = -1; |
|
1367 |
++ |
|
1368 |
++ fnmake_info(id); |
|
1369 |
++ if (substdio_flush(&ssinfo) == -1) |
|
1370 |
++ { log3("warning: qmail-todo: trouble writing to ",fn.s,"\n"); goto fail; }
|
|
1371 |
++ if (fsync(fdinfo) == -1) |
|
1372 |
++ { log3("warning: qmail-todo: trouble fsyncing ",fn.s,"\n"); goto fail; }
|
|
1373 |
++ close(fdinfo); fdinfo = -1; |
|
1374 |
++ |
|
1375 |
++ for (c = 0;c < CHANNELS;++c) |
|
1376 |
++ if (fdchan[c] != -1) |
|
1377 |
++ {
|
|
1378 |
++ fnmake_chanaddr(id,c); |
|
1379 |
++ if (substdio_flush(&sschan[c]) == -1) |
|
1380 |
++ { log3("warning: qmail-todo: trouble writing to ",fn.s,"\n"); goto fail; }
|
|
1381 |
++ if (fsync(fdchan[c]) == -1) |
|
1382 |
++ { log3("warning: qmail-todo: trouble fsyncing ",fn.s,"\n"); goto fail; }
|
|
1383 |
++ close(fdchan[c]); fdchan[c] = -1; |
|
1384 |
++ } |
|
1385 |
++ |
|
1386 |
++ fnmake_todo(id); |
|
1387 |
++ if (substdio_putflush(&sstoqc,fn.s,fn.len) == -1) { cleandied(); return; }
|
|
1388 |
++ if (substdio_get(&ssfromqc,&ch,1) != 1) { cleandied(); return; }
|
|
1389 |
++ if (ch != '+') |
|
1390 |
++ {
|
|
1391 |
++ log3("warning: qmail-clean unable to clean up ",fn.s,"\n");
|
|
1392 |
++ return; |
|
1393 |
++ } |
|
1394 |
++ |
|
1395 |
++ comm_write(id, flagchan[0], flagchan[1]); |
|
1396 |
++ |
|
1397 |
++ return; |
|
1398 |
++ |
|
1399 |
++ fail: |
|
1400 |
++ if (fd != -1) close(fd); |
|
1401 |
++ if (fdinfo != -1) close(fdinfo); |
|
1402 |
++ for (c = 0;c < CHANNELS;++c) |
|
1403 |
++ if (fdchan[c] != -1) close(fdchan[c]); |
|
1404 |
++} |
|
1405 |
++ |
|
1406 |
++/* this file is too long ---------------------------------------------- MAIN */ |
|
1407 |
++ |
|
1408 |
++int getcontrols(void) |
|
1409 |
++{
|
|
1410 |
++ if (control_init() == -1) return 0; |
|
1411 |
++ if (control_rldef(&envnoathost,"control/envnoathost",1,"envnoathost") != 1) return 0; |
|
1412 |
++ if (control_readfile(&locals,"control/locals",1) != 1) return 0; |
|
1413 |
++ if (!constmap_init(&maplocals,locals.s,locals.len,0)) return 0; |
|
1414 |
++ switch(control_readfile(&percenthack,"control/percenthack",0)) |
|
1415 |
++ {
|
|
1416 |
++ case -1: return 0; |
|
1417 |
++ case 0: if (!constmap_init(&mappercenthack,"",0,0)) return 0; break; |
|
1418 |
++ case 1: if (!constmap_init(&mappercenthack,percenthack.s,percenthack.len,0)) return 0; break; |
|
1419 |
++ } |
|
1420 |
++ switch(control_readfile(&vdoms,"control/virtualdomains",0)) |
|
1421 |
++ {
|
|
1422 |
++ case -1: return 0; |
|
1423 |
++ case 0: if (!constmap_init(&mapvdoms,"",0,1)) return 0; break; |
|
1424 |
++ case 1: if (!constmap_init(&mapvdoms,vdoms.s,vdoms.len,1)) return 0; break; |
|
1425 |
++ } |
|
1426 |
++ return 1; |
|
1427 |
++} |
|
1428 |
++ |
|
1429 |
++stralloc newlocals = {0};
|
|
1430 |
++stralloc newvdoms = {0};
|
|
1431 |
++ |
|
1432 |
++void regetcontrols(void) |
|
1433 |
++{
|
|
1434 |
++ int r; |
|
1435 |
++ |
|
1436 |
++ if (control_readfile(&newlocals,"control/locals",1) != 1) |
|
1437 |
++ { log1("alert: qmail-todo: unable to reread control/locals\n"); return; }
|
|
1438 |
++ r = control_readfile(&newvdoms,"control/virtualdomains",0); |
|
1439 |
++ if (r == -1) |
|
1440 |
++ { log1("alert: qmail-todo: unable to reread control/virtualdomains\n"); return; }
|
|
1441 |
++ |
|
1442 |
++ constmap_free(&maplocals); |
|
1443 |
++ constmap_free(&mapvdoms); |
|
1444 |
++ |
|
1445 |
++ while (!stralloc_copy(&locals,&newlocals)) nomem(); |
|
1446 |
++ while (!constmap_init(&maplocals,locals.s,locals.len,0)) nomem(); |
|
1447 |
++ |
|
1448 |
++ if (r) |
|
1449 |
++ {
|
|
1450 |
++ while (!stralloc_copy(&vdoms,&newvdoms)) nomem(); |
|
1451 |
++ while (!constmap_init(&mapvdoms,vdoms.s,vdoms.len,1)) nomem(); |
|
1452 |
++ } |
|
1453 |
++ else |
|
1454 |
++ while (!constmap_init(&mapvdoms,"",0,1)) nomem(); |
|
1455 |
++} |
|
1456 |
++ |
|
1457 |
++void reread(void) |
|
1458 |
++{
|
|
1459 |
++ if (chdir(auto_qmail) == -1) |
|
1460 |
++ {
|
|
1461 |
++ log1("alert: qmail-todo: unable to reread controls: unable to switch to home directory\n");
|
|
1462 |
++ return; |
|
1463 |
++ } |
|
1464 |
++ regetcontrols(); |
|
1465 |
++ while (chdir("queue") == -1)
|
|
1466 |
++ {
|
|
1467 |
++ log1("alert: qmail-todo: unable to switch back to queue directory; HELP! sleeping...\n");
|
|
1468 |
++ sleep(10); |
|
1469 |
++ } |
|
1470 |
++} |
|
1471 |
++ |
|
1472 |
++void main() |
|
1473 |
++{
|
|
1474 |
++ datetime_sec wakeup; |
|
1475 |
++ fd_set rfds; |
|
1476 |
++ fd_set wfds; |
|
1477 |
++ int nfds; |
|
1478 |
++ struct timeval tv; |
|
1479 |
++ int r; |
|
1480 |
++ char c; |
|
1481 |
++ |
|
1482 |
++ if (chdir(auto_qmail) == -1) |
|
1483 |
++ { log1("alert: qmail-todo: cannot start: unable to switch to home directory\n"); _exit(111); }
|
|
1484 |
++ if (!getcontrols()) |
|
1485 |
++ { log1("alert: qmail-todo: cannot start: unable to read controls\n"); _exit(111); }
|
|
1486 |
++ if (chdir("queue") == -1)
|
|
1487 |
++ { log1("alert: qmail-todo: cannot start: unable to switch to queue directory\n"); _exit(111); }
|
|
1488 |
++ sig_pipeignore(); |
|
1489 |
++ umask(077); |
|
1490 |
++ |
|
1491 |
++ fnmake_init(); |
|
1492 |
++ |
|
1493 |
++ todo_init(); |
|
1494 |
++ comm_init(); |
|
1495 |
++ |
|
1496 |
++ do {
|
|
1497 |
++ r = read(fdin, &c, 1); |
|
1498 |
++ if ((r == -1) && (errno != error_intr)) |
|
1499 |
++ _exit(100); /* read failed probably qmail-send died */ |
|
1500 |
++ } while (r =! 1); /* we assume it is a 'S' */ |
|
1501 |
++ |
|
1502 |
++ for (;;) |
|
1503 |
++ {
|
|
1504 |
++ recent = now(); |
|
1505 |
++ |
|
1506 |
++ if (flagreadasap) { flagreadasap = 0; reread(); }
|
|
1507 |
++ if (!flagsendalive) {
|
|
1508 |
++ /* qmail-send finaly exited, so do the same. */ |
|
1509 |
++ if (flagstopasap) _exit(0); |
|
1510 |
++ /* qmail-send died. We can not log and we can not work therefor _exit(1). */ |
|
1511 |
++ _exit(1); |
|
1512 |
++ } |
|
1513 |
++ |
|
1514 |
++ wakeup = recent + SLEEP_FOREVER; |
|
1515 |
++ FD_ZERO(&rfds); |
|
1516 |
++ FD_ZERO(&wfds); |
|
1517 |
++ nfds = 1; |
|
1518 |
++ |
|
1519 |
++ todo_selprep(&nfds,&rfds,&wakeup); |
|
1520 |
++ comm_selprep(&nfds,&wfds,&rfds); |
|
1521 |
++ |
|
1522 |
++ if (wakeup <= recent) tv.tv_sec = 0; |
|
1523 |
++ else tv.tv_sec = wakeup - recent + SLEEP_FUZZ; |
|
1524 |
++ tv.tv_usec = 0; |
|
1525 |
++ |
|
1526 |
++ if (select(nfds,&rfds,&wfds,(fd_set *) 0,&tv) == -1) |
|
1527 |
++ if (errno == error_intr) |
|
1528 |
++ ; |
|
1529 |
++ else |
|
1530 |
++ log1("warning: qmail-todo: trouble in select\n");
|
|
1531 |
++ else |
|
1532 |
++ {
|
|
1533 |
++ recent = now(); |
|
1534 |
++ |
|
1535 |
++ todo_do(&rfds); |
|
1536 |
++ comm_do(&wfds, &rfds); |
|
1537 |
++ } |
|
1538 |
++ } |
|
1539 |
++ /* NOTREACHED */ |
|
1540 |
++} |
|
1541 |
++ |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1542 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/make_cert.sh |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1543 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1544 |
+++ b/source/dietlibc/diet-qmail/make_cert.sh Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 1545 |
@@ -0,0 +1,57 @@ |
1546 |
+#!/bin/sh |
|
1547 |
+# |
|
1548 |
+# This script creates ssl certificates for |
|
1549 |
+# use with qmail. |
|
1550 |
+# |
|
1551 |
+ |
|
1552 |
+cert() {
|
|
1553 |
+if openssl req -new -x509 -nodes -out /var/qmail/control/servercert.pem \ |
|
1554 |
+ -days 366 -keyout /var/qmail/control/servercert.pem; then |
|
1555 |
+ chmod 640 /var/qmail/control/servercert.pem |
|
1556 |
+ chown qmaild.qmail /var/qmail/control/servercert.pem |
|
1557 |
+ ln -s /var/qmail/control/servercert.pem /var/qmail/control/clientcert.pem |
|
1558 |
+ echo "==> Process done." |
|
1559 |
+else |
|
1560 |
+ echo "==> Certificate creation failed." |
|
1561 |
+ exit 1 |
|
1562 |
+fi |
|
1563 |
+} |
|
1564 |
+ |
|
1565 |
+cert_req() {
|
|
1566 |
+if openssl req -new -nodes -out req.pem \ |
|
1567 |
+ -keyout /var/qmail/control/servercert.pem; then |
|
1568 |
+ chmod 640 /var/qmail/control/servercert.pem |
|
1569 |
+ chown qmaild.qmail /var/qmail/control/servercert.pem |
|
1570 |
+ ln -s /var/qmail/control/servercert.pem /var/qmail/control/clientcert.pem |
|
1571 |
+ cat << EOF |
|
1572 |
+ |
|
1573 |
+==> Process done. |
|
1574 |
+==> Send req.pem to your CA to obtain signed_req.pem, and do: |
|
1575 |
+==> cat signed_req.pem >> /var/qmail/control/servercert.pem |
|
1576 |
+ |
|
1577 |
+EOF |
|
1578 |
+else |
|
1579 |
+ echo "==> Certificate creation failed." |
|
1580 |
+ exit 1 |
|
1581 |
+fi |
|
1582 |
+} |
|
1583 |
+ |
|
1584 |
+case "$1" in |
|
1585 |
+ -h|--help) |
|
1586 |
+ cat << EOF |
|
1587 |
+ |
|
1588 |
+This script creates SSL certificates to use with qmail. |
|
1589 |
+Options : |
|
1590 |
+ -h --help This help screen |
|
1591 |
+ -r --req Creates a certificate verification request to |
|
1592 |
+ send to your CA. |
|
1593 |
+EOF |
|
1594 |
+ ;; |
|
1595 |
+ -r|--req) |
|
1596 |
+ cert_req |
|
1597 |
+ ;; |
|
1598 |
+ *) |
|
1599 |
+ cert |
|
1600 |
+ ;; |
|
1601 |
+esac |
|
1602 |
+ |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1603 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/pop3d_log_run |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1604 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1605 |
+++ b/source/dietlibc/diet-qmail/pop3d_log_run Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 1606 |
@@ -0,0 +1,20 @@ |
1607 |
+#!/bin/sh |
|
1608 |
+# |
|
1609 |
+# Edit this file to match your setup. |
|
1610 |
+# NOTE: This file is automatically backed-up by pacman, |
|
1611 |
+# during updates |
|
1612 |
+# |
|
1613 |
+ |
|
1614 |
+# Log size rotate size. |
|
1615 |
+LOG_SIZE="1048576" |
|
1616 |
+ |
|
1617 |
+# Number of logs to keep. |
|
1618 |
+LOGS="5" |
|
1619 |
+ |
|
1620 |
+# Don't change from this point on, unless |
|
1621 |
+# you really know what you're doing :). |
|
1622 |
+ |
|
1623 |
+exec /usr/bin/setuidgid qmaill \ |
|
1624 |
+ /usr/bin/multilog t \ |
|
1625 |
+ n${LOGS} s${LOG_SIZE} \
|
|
1626 |
+ /var/log/qmail/pop3d 2>&1 |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1627 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/pop3d_run |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1628 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1629 |
+++ b/source/dietlibc/diet-qmail/pop3d_run Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 1630 |
@@ -0,0 +1,33 @@ |
1631 |
+#!/bin/sh |
|
1632 |
+# |
|
1633 |
+# Edit this file to match your setup. |
|
1634 |
+# NOTE: This file is automatically backed-up by pacman, |
|
1635 |
+# during updates |
|
1636 |
+# |
|
1637 |
+ |
|
1638 |
+# Password checking program (ie. checkpasswd, vpopmail). |
|
1639 |
+PASSPROG="" |
|
1640 |
+ |
|
1641 |
+# FQDN as set in /var/qmail/control/me |
|
1642 |
+LOCAL=`head -1 /var/qmail/control/me` |
|
1643 |
+ |
|
1644 |
+# Maximum memory qmail-pop3d is allowed to use. |
|
1645 |
+MAX_MEM="2000000" |
|
1646 |
+ |
|
1647 |
+# Maximum allowed concurrent connections. |
|
1648 |
+MAX_CON="30" |
|
1649 |
+ |
|
1650 |
+# Relay control. |
|
1651 |
+TCP_CDB="/etc/tcp.pop3.cdb" |
|
1652 |
+ |
|
1653 |
+# Don't change from this point on, unless |
|
1654 |
+# you really know what you're doing :). |
|
1655 |
+POPUP="/var/qmail/bin/qmail-popup" |
|
1656 |
+POP3D="/var/qmail/bin/qmail-pop3d" |
|
1657 |
+PORT="110" |
|
1658 |
+ |
|
1659 |
+exec /usr/bin/softlimit -m $MAX_MEM \ |
|
1660 |
+ /usr/bin/tcpserver -H -l $LOCAL \ |
|
1661 |
+ -v -x $TCP_CDB \ |
|
1662 |
+ -c $MAX_CON -R 0 $PORT \ |
|
1663 |
+ $POPUP $LOCAL $PASSPROG $POP3D Maildir 2>&1 |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1664 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/qmail-1.03.errno.patch |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1665 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1666 |
+++ b/source/dietlibc/diet-qmail/qmail-1.03.errno.patch Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 1667 |
@@ -0,0 +1,47 @@ |
1668 |
+diff -u qmail-1.03.old/cdb_seek.c qmail-1.03/cdb_seek.c |
|
1669 |
+--- qmail-1.03.old/cdb_seek.c 1998-06-15 05:52:55.000000000 -0500 |
|
1670 |
++++ qmail-1.03/cdb_seek.c 2003-01-08 15:55:53.000000000 -0600 |
|
1671 |
+@@ -1,6 +1,5 @@ |
|
1672 |
+ #include <sys/types.h> |
|
1673 |
+ #include <errno.h> |
|
1674 |
+-extern int errno; |
|
1675 |
+ #include "cdb.h" |
|
1676 |
+ |
|
1677 |
+ #ifndef SEEK_SET |
|
1678 |
+diff -u qmail-1.03.old/dns.c qmail-1.03/dns.c |
|
1679 |
+--- qmail-1.03.old/dns.c 1998-06-15 05:52:55.000000000 -0500 |
|
1680 |
++++ qmail-1.03/dns.c 2003-01-08 16:00:32.000000000 -0600 |
|
1681 |
+@@ -7,8 +7,6 @@ |
|
1682 |
+ #include <errno.h> |
|
1683 |
+ extern int res_query(); |
|
1684 |
+ extern int res_search(); |
|
1685 |
+-extern int errno; |
|
1686 |
+-extern int h_errno; |
|
1687 |
+ #include "ip.h" |
|
1688 |
+ #include "ipalloc.h" |
|
1689 |
+ #include "fmt.h" |
|
1690 |
+diff -u qmail-1.03.old/error.3 qmail-1.03/error.3 |
|
1691 |
+--- qmail-1.03.old/error.3 1998-06-15 05:52:55.000000000 -0500 |
|
1692 |
++++ qmail-1.03/error.3 2003-01-08 15:58:13.000000000 -0600 |
|
1693 |
+@@ -3,8 +3,7 @@ |
|
1694 |
+ error \- syscall error codes |
|
1695 |
+ .SH SYNTAX |
|
1696 |
+ .B #include <error.h> |
|
1697 |
+- |
|
1698 |
+-extern int \fBerrno\fP; |
|
1699 |
++.B #include <errno.h> |
|
1700 |
+ |
|
1701 |
+ extern int \fBerror_intr\fP; |
|
1702 |
+ .br |
|
1703 |
+diff -u qmail-1.03.old/error.h qmail-1.03/error.h |
|
1704 |
+--- qmail-1.03.old/error.h 1998-06-15 05:52:55.000000000 -0500 |
|
1705 |
++++ qmail-1.03/error.h 2003-01-08 15:59:13.000000000 -0600 |
|
1706 |
+@@ -1,7 +1,7 @@ |
|
1707 |
+ #ifndef ERROR_H |
|
1708 |
+ #define ERROR_H |
|
1709 |
+ |
|
1710 |
+-extern int errno; |
|
1711 |
++#include <errno.h> |
|
1712 |
+ |
|
1713 |
+ extern int error_intr; |
|
1714 |
+ extern int error_nomem; |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1715 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/qmail-dietlibc.patch |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1716 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1717 |
+++ b/source/dietlibc/diet-qmail/qmail-dietlibc.patch Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 1718 |
@@ -0,0 +1,40 @@ |
1719 |
+dietlibc compile |
|
1720 |
+ |
|
1721 |
+diff -r df48dd6b95fa conf-cc |
|
1722 |
+--- a/conf-cc Thu Nov 01 16:30:40 2007 +0100 |
|
1723 |
++++ b/conf-cc Thu Nov 01 16:46:06 2007 +0100 |
|
1724 |
+@@ -1,3 +1,3 @@ cc -O2 |
|
1725 |
+-cc -O2 |
|
1726 |
++diet gcc -O2 |
|
1727 |
+ |
|
1728 |
+ This will be used to compile .c files. |
|
1729 |
+diff -r df48dd6b95fa conf-ld |
|
1730 |
+--- a/conf-ld Thu Nov 01 16:30:40 2007 +0100 |
|
1731 |
++++ b/conf-ld Thu Nov 01 16:46:06 2007 +0100 |
|
1732 |
+@@ -1,3 +1,3 @@ cc -s |
|
1733 |
+-cc -s |
|
1734 |
++diet gcc -s -static |
|
1735 |
+ |
|
1736 |
+ This will be used to link .o files into an executable. |
|
1737 |
+diff -r df48dd6b95fa predate.c |
|
1738 |
+--- a/predate.c Thu Nov 01 16:30:40 2007 +0100 |
|
1739 |
++++ b/predate.c Thu Nov 01 16:46:06 2007 +0100 |
|
1740 |
+@@ -8,7 +8,6 @@ |
|
1741 |
+ #include "strerr.h" |
|
1742 |
+ #include "substdio.h" |
|
1743 |
+ #include "subfd.h" |
|
1744 |
+-#include "readwrite.h" |
|
1745 |
+ #include "exit.h" |
|
1746 |
+ |
|
1747 |
+ #define FATAL "predate: fatal: " |
|
1748 |
+diff -r df48dd6b95fa qbiff.c |
|
1749 |
+--- a/qbiff.c Thu Nov 01 16:30:40 2007 +0100 |
|
1750 |
++++ b/qbiff.c Thu Nov 01 16:46:06 2007 +0100 |
|
1751 |
+@@ -8,7 +8,6 @@ |
|
1752 |
+ #define UTMP_FILE "/etc/utmp" |
|
1753 |
+ #endif |
|
1754 |
+ #endif |
|
1755 |
+-#include "readwrite.h" |
|
1756 |
+ #include "stralloc.h" |
|
1757 |
+ #include "substdio.h" |
|
1758 |
+ #include "subfd.h" |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1759 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/qmail-smtpd.spam.patch |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1760 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1761 |
+++ b/source/dietlibc/diet-qmail/qmail-smtpd.spam.patch Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 1762 |
@@ -0,0 +1,74 @@ |
1763 |
+stika.net antispam |
|
1764 |
+ |
|
1765 |
+diff -r 72430e923db2 qmail-smtpd.c |
|
1766 |
+--- a/qmail-smtpd.c Thu Nov 01 16:46:06 2007 +0100 |
|
1767 |
++++ b/qmail-smtpd.c Thu Nov 01 16:54:59 2007 +0100 |
|
1768 |
+@@ -31,6 +31,7 @@ |
|
1769 |
+ #define BMCHECK_BMT 2 |
|
1770 |
+ #define BMCHECK_BMTNR 3 |
|
1771 |
+ #define BMCHECK_BHELO 4 |
|
1772 |
++#define BMCHECK_GMF 5 // 20041202 tz - goodmailfrom functionality |
|
1773 |
+ |
|
1774 |
+ |
|
1775 |
+ #define MAXHOPS 100 |
|
1776 |
+@@ -108,6 +109,9 @@ int bmfok = 0; |
|
1777 |
+ int bmfok = 0; |
|
1778 |
+ stralloc bmf = {0};
|
|
1779 |
+ |
|
1780 |
++int gmfok = 0; |
|
1781 |
++stralloc gmf = {0};
|
|
1782 |
++ |
|
1783 |
+ int bmfnrok = 0; |
|
1784 |
+ stralloc bmfnr = {0};
|
|
1785 |
+ |
|
1786 |
+@@ -140,6 +144,9 @@ void setup() |
|
1787 |
+ |
|
1788 |
+ bmfok = control_readfile(&bmf,"control/badmailfrom",0); |
|
1789 |
+ if (bmfok == -1) die_control(); |
|
1790 |
++ |
|
1791 |
++ gmfok = control_readfile(&gmf,"control/goodmailfrom",0); |
|
1792 |
++ if (gmfok == -1) die_control(); |
|
1793 |
+ |
|
1794 |
+ bmfnrok = control_readfile(&bmfnr,"control/badmailfromnorelay",0); |
|
1795 |
+ if (bmfnrok == -1) die_control(); |
|
1796 |
+@@ -247,6 +254,8 @@ int bmcheck(which) int which; |
|
1797 |
+ |
|
1798 |
+ if (which == BMCHECK_BMF) {
|
|
1799 |
+ if (!stralloc_copy(&bmb,&bmf)) die_nomem(); |
|
1800 |
++ } else if (which == BMCHECK_GMF) { // 20041202 tz - goodmailfrom
|
|
1801 |
++ if (!stralloc_copy(&bmb,&gmf)) die_nomem(); |
|
1802 |
+ } else if (which == BMCHECK_BMFNR) {
|
|
1803 |
+ if (!stralloc_copy(&bmb,&bmfnr)) die_nomem(); |
|
1804 |
+ } else if (which == BMCHECK_BMT) {
|
|
1805 |
+@@ -304,6 +313,7 @@ int flagbarfbhelo; |
|
1806 |
+ int flagbarfbhelo; |
|
1807 |
+ stralloc mailfrom = {0};
|
|
1808 |
+ stralloc rcptto = {0};
|
|
1809 |
++int senderallowed = 0; /* 20021121 tz - our anti-spam */ |
|
1810 |
+ |
|
1811 |
+ void smtp_helo(arg) char *arg; |
|
1812 |
+ {
|
|
1813 |
+@@ -327,6 +337,7 @@ void smtp_mail(arg) char *arg; |
|
1814 |
+ if (!addrparse(arg)) { err_syntax(); return; }
|
|
1815 |
+ flagbarfbmf = 0; /* bmcheck is skipped for empty envelope senders */ |
|
1816 |
+ if ((bmfok) && (addr.len != 1)) flagbarfbmf = bmcheck(BMCHECK_BMF); |
|
1817 |
++ if (flagbarfbmf && gmfok) flagbarfbmf = !bmcheck(BMCHECK_GMF); // 20041202 tz - goodmailfrom |
|
1818 |
+ if ((!flagbarfbmf) && (bmfnrok) && (addr.len != 1) && (!relayclient)) {
|
|
1819 |
+ flagbarfbmf = bmcheck(BMCHECK_BMFNR); |
|
1820 |
+ } |
|
1821 |
+@@ -334,6 +345,7 @@ void smtp_mail(arg) char *arg; |
|
1822 |
+ if (!stralloc_copys(&rcptto,"")) die_nomem(); |
|
1823 |
+ if (!stralloc_copys(&mailfrom,addr.s)) die_nomem(); |
|
1824 |
+ if (!stralloc_0(&mailfrom)) die_nomem(); |
|
1825 |
++ senderallowed = addrallowed(); /* 20021121 tz - our anti-spam */ |
|
1826 |
+ out("250 ok\r\n");
|
|
1827 |
+ } |
|
1828 |
+ void smtp_rcpt(arg) char *arg; {
|
|
1829 |
+@@ -377,6 +389,7 @@ void smtp_rcpt(arg) char *arg; {
|
|
1830 |
+ } |
|
1831 |
+ else |
|
1832 |
+ if (!addrallowed()) { err_nogateway(); return; }
|
|
1833 |
++ if (!(addrallowed() || senderallowed)) { err_nogateway(); return; } /* 20021121 tz - our anti-spam */
|
|
1834 |
+ if (!stralloc_cats(&rcptto,"T")) die_nomem(); |
|
1835 |
+ if (!stralloc_cats(&rcptto,addr.s)) die_nomem(); |
|
1836 |
+ if (!stralloc_0(&rcptto)) die_nomem(); |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1837 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/qmail.install |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1838 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1839 |
+++ b/source/dietlibc/diet-qmail/qmail.install Wed Feb 15 15:10:10 2012 +0100 |
|
28
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1840 |
@@ -0,0 +1,82 @@ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1841 |
+post_install() {
|
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1842 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1843 |
+ # add required groups |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1844 |
+ if [ ! `grep qmail /etc/group` ]; then |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1845 |
+ groupadd -g 2107 qmail &>/dev/null |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1846 |
+ fi |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1847 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1848 |
+ if [ ! `grep nofiles /etc/group` ]; then |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1849 |
+ groupadd -g 2108 nofiles &>/dev/null |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1850 |
+ fi |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1851 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1852 |
+ # add required users |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1853 |
+ id alias &>/dev/null || \ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1854 |
+ useradd -u 7790 -g nofiles -d /var/qmail/alias -s /bin/false alias |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1855 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1856 |
+ id qmaild &>/dev/null || \ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1857 |
+ useradd -u 7791 -g nofiles -d /var/qmail -s /bin/false qmaild |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1858 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1859 |
+ id qmaill &>/dev/null || \ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1860 |
+ useradd -u 7792 -g nofiles -d /var/qmail -s /bin/false qmaill |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1861 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1862 |
+ id qmailp &>/dev/null || \ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1863 |
+ useradd -u 7793 -g nofiles -d /var/qmail -s /bin/false qmailp |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1864 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1865 |
+ id qmailq &>/dev/null || \ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1866 |
+ useradd -u 7794 -g qmail -d /var/qmail -s /bin/false qmailq |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1867 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1868 |
+ id qmailr &>/dev/null || \ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1869 |
+ useradd -u 7795 -g qmail -d /var/qmail -s /bin/false qmailr |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1870 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1871 |
+ id qmails &>/dev/null || \ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1872 |
+ useradd -u 7796 -g qmail -d /var/qmail -s /bin/false qmails |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1873 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1874 |
+ # create FQDN file |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1875 |
+ if ! [ -f /var/qmail/control/me ]; then |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1876 |
+ /bin/hostname -f > /var/qmail/control/me |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1877 |
+ chmod 644 /var/qmail/control/me |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1878 |
+ fi |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1879 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1880 |
+ # create aliases |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1881 |
+ for i in postmaster mailer-daemon root; do |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1882 |
+ if ! [ -f ~alias/.qmail-${i} ]; then
|
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1883 |
+ touch ~alias/.qmail-${i}
|
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1884 |
+ chmod 644 ~alias/.qmail-${i}
|
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1885 |
+ fi |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1886 |
+ done |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1887 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1888 |
+ # create /var/qmail/queue |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1889 |
+ echo "==> Setting up message queue directory (/var/qmail/queue)" |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1890 |
+ /var/qmail/bin/queue-fix /var/qmail/queue &> /dev/null |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1891 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1892 |
+ cat << EOF |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1893 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1894 |
+Log out & back in (or source /etc/profile) before running qmail. |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1895 |
+To setup qmail run: |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1896 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1897 |
+ $ config-fast FQDN |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1898 |
+replacing FQDN with your fully qualified domain. |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1899 |
+Then : |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1900 |
+$ ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1901 |
+In order to create SSL certificates run make_cert.sh (use -h for more options). |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1902 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1903 |
+EOF |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1904 |
+} |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1905 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1906 |
+post_upgrade() {
|
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1907 |
+ post_install $1 |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1908 |
+} |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1909 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1910 |
+pre_remove() {
|
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1911 |
+ for user in alias qmail{d,l,p,q,r,s}; do
|
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1912 |
+ userdel ${user} &> /dev/null
|
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1913 |
+ done |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1914 |
+ for group in nofiles qmail; do |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1915 |
+ groupdel ${group} &> /dev/null
|
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1916 |
+ done |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1917 |
+} |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1918 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1919 |
+op=$1 |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1920 |
+shift |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1921 |
+ |
|
4733b8aac58d
diet-qmail: merged w/ diet-qmail-fix-qmail.install
Tomas Zeman <tzeman@volny.cz>
parents:
1
diff
changeset
|
1922 |
+$op $* |
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1923 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/qmail.profile |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1924 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1925 |
+++ b/source/dietlibc/diet-qmail/qmail.profile Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 1926 |
@@ -0,0 +1,5 @@ |
1927 |
+#!/bin/sh |
|
1928 |
+ |
|
1929 |
+export QMAILDIR=/var/qmail |
|
1930 |
+export PATH=$PATH:$QMAILDIR/bin |
|
1931 |
+export MANPATH=$MANPATH:$QMAILDIR/man |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1932 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/qmail.rc |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1933 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
1934 |
+++ b/source/dietlibc/diet-qmail/qmail.rc Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 1935 |
@@ -0,0 +1,167 @@ |
1936 |
+#!/bin/sh |
|
1937 |
+# |
|
1938 |
+# qmailctl script (based on lifewithqmail) |
|
1939 |
+# modified for ArchLinux |
|
1940 |
+# |
|
1941 |
+ |
|
1942 |
+. /etc/rc.conf |
|
1943 |
+. /etc/rc.d/functions |
|
1944 |
+ |
|
1945 |
+QMAILDUID=`id -u qmaild` |
|
1946 |
+NOFILESGID=`id -g qmaild` |
|
1947 |
+ |
|
1948 |
+case "$1" in |
|
1949 |
+ start) |
|
1950 |
+ stat_busy "Starting qmail" |
|
1951 |
+ for i in send smtpd pop3d; do |
|
1952 |
+ if svok /service/qmail-${i} &>/dev/null ; then
|
|
1953 |
+ echo -n " ${i}"
|
|
1954 |
+ svc -u /service/qmail-${i}
|
|
1955 |
+ fi |
|
1956 |
+ done |
|
1957 |
+ if [ $? -gt 0 ]; then |
|
1958 |
+ stat_fail |
|
1959 |
+ else |
|
1960 |
+ add_daemon qmail |
|
1961 |
+ stat_done |
|
1962 |
+ fi |
|
1963 |
+ ;; |
|
1964 |
+ stop) |
|
1965 |
+ stat_busy "Stopping qmail" |
|
1966 |
+ for i in send smtpd pop3d; do |
|
1967 |
+ if svok /service/qmail-${i} &>/dev/null ; then
|
|
1968 |
+ echo -n " ${i}"
|
|
1969 |
+ svc -d /service/qmail-${i}
|
|
1970 |
+ fi |
|
1971 |
+ done |
|
1972 |
+ if [ $? -gt 0 ]; then |
|
1973 |
+ stat_fail |
|
1974 |
+ else |
|
1975 |
+ rm_daemon qmail |
|
1976 |
+ stat_done |
|
1977 |
+ fi |
|
1978 |
+ ;; |
|
1979 |
+ stat) |
|
1980 |
+ for i in send smtpd pop3d; do |
|
1981 |
+ if svok /service/qmail-${i} &>/dev/null ; then
|
|
1982 |
+ svstat /service/qmail-${i}
|
|
1983 |
+ svstat /service/qmail-${i}/log
|
|
1984 |
+ fi |
|
1985 |
+ done |
|
1986 |
+ qmail-qstat |
|
1987 |
+ ;; |
|
1988 |
+ doqueue|alrm|flush) |
|
1989 |
+ stat_busy "Sending ALRM signal to qmail-send" |
|
1990 |
+ svc -a /service/qmail-send |
|
1991 |
+ if [ $? -gt 0 ]; then |
|
1992 |
+ stat_fail |
|
1993 |
+ else |
|
1994 |
+ stat_done |
|
1995 |
+ fi |
|
1996 |
+ ;; |
|
1997 |
+ queue) |
|
1998 |
+ qmail-qstat |
|
1999 |
+ qmail-qread |
|
2000 |
+ ;; |
|
2001 |
+ reload|hup) |
|
2002 |
+ stat_busy "Sending HUP signal to qmail-send" |
|
2003 |
+ svc -h /service/qmail-send |
|
2004 |
+ if [ $? -gt 0 ]; then |
|
2005 |
+ stat_fail |
|
2006 |
+ else |
|
2007 |
+ stat_done |
|
2008 |
+ fi |
|
2009 |
+ ;; |
|
2010 |
+ pause) |
|
2011 |
+ stat_busy "Pausing qmail" |
|
2012 |
+ for i in send smtpd pop3d; do |
|
2013 |
+ if svok /service/qmail-${i} &>/dev/null ; then
|
|
2014 |
+ echo -n " ${i}"
|
|
2015 |
+ svc -p /service/qmail-${i}
|
|
2016 |
+ fi |
|
2017 |
+ done |
|
2018 |
+ if [ $? -gt 0 ]; then |
|
2019 |
+ stat_fail |
|
2020 |
+ else |
|
2021 |
+ stat_done |
|
2022 |
+ fi |
|
2023 |
+ ;; |
|
2024 |
+ cont) |
|
2025 |
+ stat_busy "Continuing qmail" |
|
2026 |
+ for i in send smtpd pop3d; do |
|
2027 |
+ if svok /service/qmail-${i} &>/dev/null ; then
|
|
2028 |
+ echo -n " ${i}"
|
|
2029 |
+ svc -c /service/qmail-${i}
|
|
2030 |
+ fi |
|
2031 |
+ done |
|
2032 |
+ if [ $? -gt 0 ]; then |
|
2033 |
+ stat_fail |
|
2034 |
+ else |
|
2035 |
+ stat_done |
|
2036 |
+ fi |
|
2037 |
+ ;; |
|
2038 |
+ restart) |
|
2039 |
+ stat_busy "Restarting qmail" |
|
2040 |
+ if svok /service/qmail-smtpd &>/dev/null ; then |
|
2041 |
+ echo -n " Stopping qmail-smtpd" |
|
2042 |
+ svc -d /service/qmail-smtpd |
|
2043 |
+ fi |
|
2044 |
+ if svok /service/qmail-send &>/dev/null ; then |
|
2045 |
+ echo -n " Sending qmail-send SIGTERM and restarting" |
|
2046 |
+ svc -t /service/qmail-send |
|
2047 |
+ fi |
|
2048 |
+ if svok /service/qmail-pop3d &>/dev/null ; then |
|
2049 |
+ echo -n " Restarting qmail-pop3d" |
|
2050 |
+ svc -t /service/qmail-pop3d |
|
2051 |
+ fi |
|
2052 |
+ if svok /service/qmail-smtpd &>/dev/null ; then |
|
2053 |
+ echo -n " Restarting qmail-smtpd" |
|
2054 |
+ svc -u /service/qmail-smtpd |
|
2055 |
+ fi |
|
2056 |
+ if [ $? -gt 0 ]; then |
|
2057 |
+ stat_fail |
|
2058 |
+ else |
|
2059 |
+ stat_done |
|
2060 |
+ fi |
|
2061 |
+ ;; |
|
2062 |
+ cdb) |
|
2063 |
+ stat_busy "Reload qmail access control" |
|
2064 |
+ if [ -f /etc/tcp.smtp ]; then |
|
2065 |
+ echo -n " SMTP" |
|
2066 |
+ tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp |
|
2067 |
+ chmod 644 /etc/tcp.smtp.cdb |
|
2068 |
+ fi |
|
2069 |
+ if [ -f /etc/tcp.pop3 ]; then |
|
2070 |
+ echo -n " POP3" |
|
2071 |
+ tcprules /etc/tcp.pop3.cdb /etc/tcp.pop3.tmp < /etc/tcp.pop3 |
|
2072 |
+ chmod 644 /etc/tcp.pop3.cdb |
|
2073 |
+ fi |
|
2074 |
+ if [ $? -gt 0 ]; then |
|
2075 |
+ stat_fail |
|
2076 |
+ else |
|
2077 |
+ stat_done |
|
2078 |
+ fi |
|
2079 |
+ ;; |
|
2080 |
+ help) |
|
2081 |
+ cat <<HELP |
|
2082 |
+ stop -- stops mail service (smtp connections refused, nothing goes out) |
|
2083 |
+ start -- starts mail service (smtp connection accepted, mail can go out) |
|
2084 |
+ pause -- temporarily stops mail service (connections accepted, nothing leaves) |
|
2085 |
+ cont -- continues paused mail service |
|
2086 |
+ stat -- displays status of mail service |
|
2087 |
+ cdb -- rebuild the tcpserver cdb file for smtp |
|
2088 |
+restart -- stops and restarts smtp, sends qmail-send a TERM & restarts it |
|
2089 |
+doqueue -- sends qmail-send ALRM, scheduling queued messages for delivery |
|
2090 |
+ reload -- sends qmail-send HUP, rereading locals and virtualdomains |
|
2091 |
+ queue -- shows status of queue |
|
2092 |
+ alrm -- same as doqueue |
|
2093 |
+ flush -- same as doqueue |
|
2094 |
+ hup -- same as reload |
|
2095 |
+HELP |
|
2096 |
+ ;; |
|
2097 |
+ *) |
|
2098 |
+ echo "Usage: $0 {start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help}"
|
|
2099 |
+ exit 1 |
|
2100 |
+ ;; |
|
2101 |
+esac |
|
2102 |
+exit 0 |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2103 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/qmailqueue-patch |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2104 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2105 |
+++ b/source/dietlibc/diet-qmail/qmailqueue-patch Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 2106 |
@@ -0,0 +1,72 @@ |
2107 |
+From: Bruce Guenter <bguenter-djb-qmail@qcc.sk.ca> |
|
2108 |
+To: qmail@list.cr.yp.to |
|
2109 |
+Subject: QMAILQUEUE patch for qmail-1.03 |
|
2110 |
+Date: Mon, 25 Jan 1999 15:37:21 -0600 |
|
2111 |
+ |
|
2112 |
+Greetings. |
|
2113 |
+ |
|
2114 |
+Appended is a patch to qmail-1.03 that causes any program that would run |
|
2115 |
+qmail-queue to look for an environment variable QMAILQUEUE. If it is |
|
2116 |
+present, it is used in place of the string "bin/qmail-queue" when |
|
2117 |
+running qmail-queue. This could be used, for example, to add a program |
|
2118 |
+into the qmail-smtpd->qmail-queue pipeline that could do filtering, |
|
2119 |
+rewrite broken headers, etc. (this is my planned usage for it). |
|
2120 |
+ |
|
2121 |
+This has undergone virtually no testing, but it looks so simple that it |
|
2122 |
+almost has to be correct. No warranties, etc. Note that the chdir to |
|
2123 |
+/var/qmail is always done before exec'ing the program. |
|
2124 |
+ |
|
2125 |
+Does this look like a reasonable thing to do? |
|
2126 |
+-- |
|
2127 |
+Bruce Guenter, QCC Communications Corp. EMail: bruce.guenter@qcc.sk.ca |
|
2128 |
+Phone: (306)249-0220 WWW: http://www.qcc.sk.ca/~bguenter/ |
|
2129 |
+ |
|
2130 |
+diff -u qmail-1.03-orig/Makefile qmail-1.03/Makefile |
|
2131 |
+--- qmail-1.03-orig/Makefile Mon Jun 15 04:53:16 1998 |
|
2132 |
++++ qmail-1.03/Makefile Tue Jan 19 10:52:24 1999 |
|
2133 |
+@@ -1483,12 +1483,12 @@ |
|
2134 |
+ trigger.o fmtqfn.o quote.o now.o readsubdir.o qmail.o date822fmt.o \ |
|
2135 |
+ datetime.a case.a ndelay.a getln.a wait.a seek.a fd.a sig.a open.a \ |
|
2136 |
+ lock.a stralloc.a alloc.a substdio.a error.a str.a fs.a auto_qmail.o \ |
|
2137 |
+-auto_split.o |
|
2138 |
++auto_split.o env.a |
|
2139 |
+ ./load qmail-send qsutil.o control.o constmap.o newfield.o \ |
|
2140 |
+ prioq.o trigger.o fmtqfn.o quote.o now.o readsubdir.o \ |
|
2141 |
+ qmail.o date822fmt.o datetime.a case.a ndelay.a getln.a \ |
|
2142 |
+ wait.a seek.a fd.a sig.a open.a lock.a stralloc.a alloc.a \ |
|
2143 |
+- substdio.a error.a str.a fs.a auto_qmail.o auto_split.o |
|
2144 |
++ substdio.a error.a str.a fs.a auto_qmail.o auto_split.o env.a |
|
2145 |
+ |
|
2146 |
+ qmail-send.0: \ |
|
2147 |
+ qmail-send.8 |
|
2148 |
+diff -u qmail-1.03-orig/qmail.c qmail-1.03/qmail.c |
|
2149 |
+--- qmail-1.03-orig/qmail.c Mon Jun 15 04:53:16 1998 |
|
2150 |
++++ qmail-1.03/qmail.c Tue Jan 19 09:57:36 1999 |
|
2151 |
+@@ -6,14 +6,25 @@ |
|
2152 |
+ #include "fd.h" |
|
2153 |
+ #include "qmail.h" |
|
2154 |
+ #include "auto_qmail.h" |
|
2155 |
++#include "env.h" |
|
2156 |
+ |
|
2157 |
+-static char *binqqargs[2] = { "bin/qmail-queue", 0 } ;
|
|
2158 |
++static char *binqqargs[2] = { 0, 0 } ;
|
|
2159 |
++ |
|
2160 |
++static void setup_qqargs() |
|
2161 |
++{
|
|
2162 |
++ if(!binqqargs[0]) |
|
2163 |
++ binqqargs[0] = env_get("QMAILQUEUE");
|
|
2164 |
++ if(!binqqargs[0]) |
|
2165 |
++ binqqargs[0] = "bin/qmail-queue"; |
|
2166 |
++} |
|
2167 |
+ |
|
2168 |
+ int qmail_open(qq) |
|
2169 |
+ struct qmail *qq; |
|
2170 |
+ {
|
|
2171 |
+ int pim[2]; |
|
2172 |
+ int pie[2]; |
|
2173 |
++ |
|
2174 |
++ setup_qqargs(); |
|
2175 |
+ |
|
2176 |
+ if (pipe(pim) == -1) return -1; |
|
2177 |
+ if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }
|
|
2178 |
+ |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2179 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/qregex-20060423-qmail.patch |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2180 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2181 |
+++ b/source/dietlibc/diet-qmail/qregex-20060423-qmail.patch Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 2182 |
@@ -0,0 +1,688 @@ |
2183 |
+Fixed qregex-20060423 (pristine is against netqmail) |
|
2184 |
+ |
|
2185 |
+diff -r 1510847ae5bf Makefile |
|
2186 |
+--- a/Makefile Thu Nov 01 16:23:16 2007 +0100 |
|
2187 |
++++ b/Makefile Thu Nov 01 16:24:02 2007 +0100 |
|
2188 |
+@@ -1534,16 +1534,16 @@ auto_split.h |
|
2189 |
+ ./compile qmail-showctl.c |
|
2190 |
+ |
|
2191 |
+ qmail-smtpd: \ |
|
2192 |
+-load qmail-smtpd.o rcpthosts.o commands.o timeoutread.o \ |
|
2193 |
++load qmail-smtpd.o rcpthosts.o qregex.o commands.o timeoutread.o \ |
|
2194 |
+ timeoutwrite.o ip.o ipme.o ipalloc.o control.o constmap.o received.o \ |
|
2195 |
+ date822fmt.o now.o qmail.o cdb.a fd.a wait.a datetime.a getln.a \ |
|
2196 |
+-open.a sig.a case.a env.a stralloc.a alloc.a substdio.a error.a str.a \ |
|
2197 |
++open.a sig.a case.a env.a stralloc.a alloc.a strerr.a substdio.a error.a str.a \ |
|
2198 |
+ fs.a auto_qmail.o socket.lib |
|
2199 |
+- ./load qmail-smtpd rcpthosts.o commands.o timeoutread.o \ |
|
2200 |
++ ./load qmail-smtpd qregex.o rcpthosts.o commands.o timeoutread.o \ |
|
2201 |
+ timeoutwrite.o ip.o ipme.o ipalloc.o control.o constmap.o \ |
|
2202 |
+ received.o date822fmt.o now.o qmail.o cdb.a fd.a wait.a \ |
|
2203 |
+ datetime.a getln.a open.a sig.a case.a env.a stralloc.a \ |
|
2204 |
+- alloc.a substdio.a error.a str.a fs.a auto_qmail.o `cat \ |
|
2205 |
++ alloc.a strerr.a substdio.a error.a str.a fs.a auto_qmail.o `cat \ |
|
2206 |
+ socket.lib` |
|
2207 |
+ |
|
2208 |
+ qmail-smtpd.0: \ |
|
2209 |
+@@ -1696,6 +1696,10 @@ compile rcpthosts.c cdb.h uint32.h byte. |
|
2210 |
+ compile rcpthosts.c cdb.h uint32.h byte.h open.h error.h control.h \ |
|
2211 |
+ constmap.h stralloc.h gen_alloc.h rcpthosts.h |
|
2212 |
+ ./compile rcpthosts.c |
|
2213 |
++ |
|
2214 |
++qregex.o: \ |
|
2215 |
++compile qregex.c qregex.h |
|
2216 |
++ ./compile qregex.c |
|
2217 |
+ |
|
2218 |
+ readsubdir.o: \ |
|
2219 |
+ compile readsubdir.c readsubdir.h direntry.h fmt.h scan.h str.h \ |
|
2220 |
+diff -r 1510847ae5bf README.qregex |
|
2221 |
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2222 |
++++ b/README.qregex Thu Nov 01 16:24:02 2007 +0100 |
|
2223 |
+@@ -0,0 +1,203 @@ |
|
2224 |
++QREGEX (v2) 20060423 - README April 23, 2006 |
|
2225 |
++A Regular Expression matching patch for qmail 1.03 and netqmail |
|
2226 |
++ |
|
2227 |
++ |
|
2228 |
++OVERVIEW: |
|
2229 |
++ |
|
2230 |
++qregex adds the ability to match address evelopes via Regular Expressions (REs) |
|
2231 |
++in the qmail-smtpd process. It has the abiltiy to match `helo/ehlo` (host name), |
|
2232 |
++`mail from` (envelope sender), and `rcpt to` (envelope recipient) commands. |
|
2233 |
++It follows all the base rules that are set out with qmail (ie using control |
|
2234 |
++files) so it makes for easy integretion into an existing setup (see the |
|
2235 |
++install instructions for more info). The v2 is specified because qregex was |
|
2236 |
++re-written to better conform to the security guarantee set forth by the author |
|
2237 |
++of qmail. The original version used stdio.h and stdlib.h for reading the |
|
2238 |
++control files whereas v2 now uses all stralloc functions which are much more |
|
2239 |
++regulated against buffer overruns and the like. |
|
2240 |
++See: http://cr.yp.to/qmail/guarantee.html |
|
2241 |
++ |
|
2242 |
++ |
|
2243 |
++FEATURES: |
|
2244 |
++ |
|
2245 |
++Features of qregex include: |
|
2246 |
++ |
|
2247 |
++1. Performs pattern matching on envelope senders and envelope |
|
2248 |
++ recipients against REs in the badmailfrom and badmailto control |
|
2249 |
++ files. Two additional control files, badmailfromnorelay and |
|
2250 |
++ badmailtonorelay, are used for pattern matching when the |
|
2251 |
++ RELAYCLIENT environment variable is not set. |
|
2252 |
++ |
|
2253 |
++2. Performs pattern matching on the helo/ehlo host name. Setting the |
|
2254 |
++ NOBADHELO environment variable prevents the host name from being |
|
2255 |
++ compared to the patterns in the badhelo control file. |
|
2256 |
++ |
|
2257 |
++3. Matches to patterns are logged. Setting the LOGREGEX environment |
|
2258 |
++ variable causes the matched regex pattern to be included in the log. |
|
2259 |
++ |
|
2260 |
++4. Matching is case insensitive. |
|
2261 |
++ |
|
2262 |
++5. qregex ignores empty envelope senders. An empty envelope sender is not |
|
2263 |
++ compared to the patterns in the badmailfrom and badmailfromnorelay |
|
2264 |
++ control files and is always accepted. |
|
2265 |
++ |
|
2266 |
++ |
|
2267 |
++PLATFORMS: |
|
2268 |
++ |
|
2269 |
++qregex has been built and tested on the following platforms. I'm sure it won't |
|
2270 |
++have any problems on any platform that qmail will run on (providing they have |
|
2271 |
++a regex interface) but if you run into problems let me know. |
|
2272 |
++ |
|
2273 |
++ - OpenBSD 3.x |
|
2274 |
++ - FreeBSD 4.x, 5.x |
|
2275 |
++ - Mandrake Linux 9.x |
|
2276 |
++ - SuSE Linux 8.x |
|
2277 |
++ |
|
2278 |
++ |
|
2279 |
++ |
|
2280 |
++INSTALLATION INSTRUCTIONS: |
|
2281 |
++ |
|
2282 |
++Installation is very simple, there is only one requirement. You need to use the |
|
2283 |
++GNU version of the patch utility (http://www.gnu.org/software/patch/patch.html). |
|
2284 |
++(For Solaris 8 users it is installed as 'gpatch') |
|
2285 |
++ |
|
2286 |
++- If this is a new setup. |
|
2287 |
++Unpack the qmail archive, cd into the qmail-1.03 directory and run |
|
2288 |
++"patch < /path/to/qregex-<version>.patch". Follow the instructions as per the |
|
2289 |
++included qmail INSTALL file. Once you are done come back to this file and read |
|
2290 |
++the section on the control files. |
|
2291 |
++ |
|
2292 |
++If you are using netqmail, then unpack the netqmail archive. Run the collate.sh |
|
2293 |
++script and cd into the resulting netqmail-<version> directory. From there, run |
|
2294 |
++"patch < /path/to/qregex-<version>.patch". Complete the netqmail installation |
|
2295 |
++normally. Once you are done, come back to this file and read the section on the |
|
2296 |
++control files. |
|
2297 |
++ |
|
2298 |
++- If this is an existing setup. |
|
2299 |
++FIRST: create your control files (see below). |
|
2300 |
++cd into your existing qmail or netqmail source directory. Run |
|
2301 |
++"patch < /path/to/qregex-<version>.patch" then "make qmail-smtpd". Now run |
|
2302 |
++./qmail-smtpd and test your new rules to make sure they work as expected. |
|
2303 |
++ |
|
2304 |
++Install the new binary by cd'ing to /var/qmail/bin and as root (in one command) |
|
2305 |
++copy the existing binary to 'qmail-smtpd.old' and copy the new binary from the |
|
2306 |
++source directory to 'qmail-smtpd'. |
|
2307 |
++(ex. cp qmail-smtpd qmail-smtpd.old && cp ~/qmail-1.03/qmail-smtpd qmail-smtpd) |
|
2308 |
++ |
|
2309 |
++You can also optionally just run "make setup check" as it will install the |
|
2310 |
++updated documentation and man pages provided with this patch. Stopping qmail |
|
2311 |
++before doing the "make setup check" is always a good idea. |
|
2312 |
++ |
|
2313 |
++ |
|
2314 |
++LOGGING: |
|
2315 |
++ |
|
2316 |
++qregex will log matches to the patterns in the various control files. Log |
|
2317 |
++messages will take these three forms depending on which control file was |
|
2318 |
++matched: |
|
2319 |
++ |
|
2320 |
++badhelo |
|
2321 |
++qmail-smtpd: badhelo: <host> at <remote IP> |
|
2322 |
++ |
|
2323 |
++badmailfrom and badmailfromnorelay |
|
2324 |
++qmail-smtpd: badmailfrom: <sender address> at <remote IP> |
|
2325 |
++ |
|
2326 |
++badmailto and badmailtonorelay |
|
2327 |
++qmail-smtpd: badmailto: <rcpt address> at <remote IP> |
|
2328 |
++ |
|
2329 |
++When the LOGREGEX environment variable is set, the matched pattern will |
|
2330 |
++be included in the log. Log messages will have the regex pattern appended |
|
2331 |
++to them. For example, a badhelo log message will look like this: |
|
2332 |
++ |
|
2333 |
++qmail-smtpd: badhelo: <host> at <remote IP> matches pattern: <regex> |
|
2334 |
++ |
|
2335 |
++ |
|
2336 |
++CONTROL FILES: |
|
2337 |
++ |
|
2338 |
++qregex provides you with five control files. None of these control files |
|
2339 |
++is mandatory and you can use them in any combination you choose in your setup. |
|
2340 |
++ |
|
2341 |
++The "control/badmailfrom" and "control/badmailto" files contain your REs for |
|
2342 |
++matching against the 'mail from' (envelope sender) and 'rcpt to' (envelope |
|
2343 |
++recipient) smtp commands respectively. |
|
2344 |
++The "control/badmailfromnorelay" and "control/badmailtonorelay" match against |
|
2345 |
++the same commands but are read only when the RELAYCLIENT environment variable |
|
2346 |
++is not set. |
|
2347 |
++The "control/badhelo" file matches against the 'helo/ehlo' smtp command. |
|
2348 |
++ |
|
2349 |
++If you prefer you can symlink the badmailfrom and badmailto control files |
|
2350 |
++(ln -s badmailfrom badmailto) and maintain fewer sets of rules. Beware |
|
2351 |
++this might cause problems in certain setups. |
|
2352 |
++ |
|
2353 |
++ Here's an example "badhelo" file. |
|
2354 |
++ ----------------------------------- |
|
2355 |
++ # block host strings with no dot (not a FQDN) |
|
2356 |
++ !\. |
|
2357 |
++ ----------------------------------- |
|
2358 |
++ |
|
2359 |
++ An example "badmailfrom" file. |
|
2360 |
++ ----------------------------------- |
|
2361 |
++ # this will drop everything containing the string |
|
2362 |
++ # bad.domain.com or Bad.Domain.Com or BAD.domain.COM |
|
2363 |
++ bad\.domain\.com |
|
2364 |
++ # force users to fully qualify themselves |
|
2365 |
++ # (i.e. deny "user", accept "user@domain") |
|
2366 |
++ !@ |
|
2367 |
++ ----------------------------------- |
|
2368 |
++ |
|
2369 |
++ And "badmailto" (a little more interesting) |
|
2370 |
++ ----------------------------------- |
|
2371 |
++ # must not contain invalid characters, brakets or multiple @'s |
|
2372 |
++ [!%#:*^(){}]
|
|
2373 |
++ @.*@ |
|
2374 |
++ ----------------------------------- |
|
2375 |
++ |
|
2376 |
++You can use the non-RE character '!' to start an RE as a signal to qregex to |
|
2377 |
++negate the action. As used above in the badmailfrom file, by negating the '@' |
|
2378 |
++symbol qregex will signal qmail-smtpd to deny the 'mail from' command whenever |
|
2379 |
++the address doesn't contain an @ symbol. When used inside a bracket expression, |
|
2380 |
++the '!' character looses this special meaning. This is shown in the badmailto |
|
2381 |
++example. |
|
2382 |
++ |
|
2383 |
++The norelay control files follow the same rules as the other control files but |
|
2384 |
++are intended to address two specific scenarios. |
|
2385 |
++The badmailfromnorelay file can be used to block mail trying to spoof a domain |
|
2386 |
++hosted on your mail server. It prevents a mail client that is not allowed to |
|
2387 |
++relay email through your server from using one of your hosted domains as its |
|
2388 |
++envelope sender. |
|
2389 |
++The badmailtonorelay file can be used to create email addresses that cannot |
|
2390 |
++receive mail from any source not allowed to relay email through your server. |
|
2391 |
++This is handy for creating email addresses for use only within your own |
|
2392 |
++domain(s) that can't receive spam from the world at large. |
|
2393 |
++ |
|
2394 |
++ |
|
2395 |
++INTERNALS: |
|
2396 |
++ |
|
2397 |
++qregex (or regexmatch as the function is called) will be called during the |
|
2398 |
++`helo/ehlo`, `rcpt to` and `mail from` handling routines in "qmail-smtpd.c". |
|
2399 |
++When called, it will read the proper control file then one by one compile and |
|
2400 |
++execute the regex on the string passed into qmail-smtpd. If the regex matches |
|
2401 |
++it returns TRUE (1) and the qmail-smtpd process will deny the user the ability |
|
2402 |
++to continue. If you change anything and think it betters this patch please |
|
2403 |
++send me a new diff file so I can take a peek. |
|
2404 |
++ |
|
2405 |
++ |
|
2406 |
++CONTACT: |
|
2407 |
++qregex is maintained by: |
|
2408 |
++ Andrew St. Jean |
|
2409 |
++ andrew@arda.homeunix.net |
|
2410 |
++ www.arda.homeunix.net/store/qmail/ |
|
2411 |
++ |
|
2412 |
++Contributers to qregex: |
|
2413 |
++ Jeremy Kitchen |
|
2414 |
++ kitchen at scriptkitchen dot com |
|
2415 |
++ http://www.scriptkitchen.com/qmail |
|
2416 |
++ |
|
2417 |
++ Alex Pleiner |
|
2418 |
++ alex@zeitform.de |
|
2419 |
++ zeitform Internet Dienste |
|
2420 |
++ http://www.zeitform.de/ |
|
2421 |
++ |
|
2422 |
++ Thanos Massias |
|
2423 |
++ |
|
2424 |
++Original qregex patch written by: |
|
2425 |
++ Evan Borgstrom |
|
2426 |
++ evan at unixpimps dot org |
|
2427 |
+diff -r 1510847ae5bf TARGETS |
|
2428 |
+--- a/TARGETS Thu Nov 01 16:23:16 2007 +0100 |
|
2429 |
++++ b/TARGETS Thu Nov 01 16:24:02 2007 +0100 |
|
2430 |
+@@ -252,6 +252,7 @@ qmail-qmtpd |
|
2431 |
+ qmail-qmtpd |
|
2432 |
+ qmail-smtpd.o |
|
2433 |
+ qmail-smtpd |
|
2434 |
++qregex.o |
|
2435 |
+ sendmail.o |
|
2436 |
+ sendmail |
|
2437 |
+ tcp-env.o |
|
2438 |
+diff -r 1510847ae5bf hier.c |
|
2439 |
+--- a/hier.c Thu Nov 01 16:23:16 2007 +0100 |
|
2440 |
++++ b/hier.c Thu Nov 01 16:24:02 2007 +0100 |
|
2441 |
+@@ -76,6 +76,7 @@ void hier() |
|
2442 |
+ c(auto_qmail,"boot","binm3+df",auto_uido,auto_gidq,0755); |
|
2443 |
+ |
|
2444 |
+ c(auto_qmail,"doc","FAQ",auto_uido,auto_gidq,0644); |
|
2445 |
++ c(auto_qmail,"doc","README.qregex",auto_uido,auto_gidq,0644); |
|
2446 |
+ c(auto_qmail,"doc","UPGRADE",auto_uido,auto_gidq,0644); |
|
2447 |
+ c(auto_qmail,"doc","SENDMAIL",auto_uido,auto_gidq,0644); |
|
2448 |
+ c(auto_qmail,"doc","INSTALL",auto_uido,auto_gidq,0644); |
|
2449 |
+diff -r 1510847ae5bf install-big.c |
|
2450 |
+--- a/install-big.c Thu Nov 01 16:23:16 2007 +0100 |
|
2451 |
++++ b/install-big.c Thu Nov 01 16:24:02 2007 +0100 |
|
2452 |
+@@ -76,6 +76,7 @@ void hier() |
|
2453 |
+ c(auto_qmail,"boot","binm3+df",auto_uido,auto_gidq,0755); |
|
2454 |
+ |
|
2455 |
+ c(auto_qmail,"doc","FAQ",auto_uido,auto_gidq,0644); |
|
2456 |
++ c(auto_qmail,"doc","README.qregex",auto_uido,auto_gidq,0644); |
|
2457 |
+ c(auto_qmail,"doc","UPGRADE",auto_uido,auto_gidq,0644); |
|
2458 |
+ c(auto_qmail,"doc","SENDMAIL",auto_uido,auto_gidq,0644); |
|
2459 |
+ c(auto_qmail,"doc","INSTALL",auto_uido,auto_gidq,0644); |
|
2460 |
+diff -r 1510847ae5bf qmail-control.9 |
|
2461 |
+--- a/qmail-control.9 Thu Nov 01 16:23:16 2007 +0100 |
|
2462 |
++++ b/qmail-control.9 Thu Nov 01 16:24:02 2007 +0100 |
|
2463 |
+@@ -20,7 +20,11 @@ other hostname-related control files. |
|
2464 |
+ |
|
2465 |
+ Comments are allowed |
|
2466 |
+ in |
|
2467 |
++.IR badhelo , |
|
2468 |
+ .IR badmailfrom , |
|
2469 |
++.IR badmailfromnorelay , |
|
2470 |
++.IR badmailto , |
|
2471 |
++.IR badmailtonorelay , |
|
2472 |
+ .IR locals , |
|
2473 |
+ .IR percenthack , |
|
2474 |
+ .IR qmqpservers , |
|
2475 |
+@@ -40,7 +44,11 @@ See the corresponding man pages for furt |
|
2476 |
+ .ta 5c 10c |
|
2477 |
+ control default used by |
|
2478 |
+ |
|
2479 |
++.I badhelo \fR(none) \fRqmail-smtpd |
|
2480 |
+ .I badmailfrom \fR(none) \fRqmail-smtpd |
|
2481 |
++.I badmailfromnorelay \fR(none) \fRqmail-smtpd |
|
2482 |
++.I badmailto \fR(none) \fRqmail-smtpd |
|
2483 |
++.I badmailtonorelay \fR(none) \fRqmail-smtpd |
|
2484 |
+ .I bouncefrom \fRMAILER-DAEMON \fRqmail-send |
|
2485 |
+ .I bouncehost \fIme \fRqmail-send |
|
2486 |
+ .I concurrencylocal \fR10 \fRqmail-send |
|
2487 |
+diff -r 1510847ae5bf qmail-showctl.c |
|
2488 |
+--- a/qmail-showctl.c Thu Nov 01 16:23:16 2007 +0100 |
|
2489 |
++++ b/qmail-showctl.c Thu Nov 01 16:24:02 2007 +0100 |
|
2490 |
+@@ -214,7 +214,11 @@ void main() |
|
2491 |
+ _exit(111); |
|
2492 |
+ } |
|
2493 |
+ |
|
2494 |
+- do_lst("badmailfrom","Any MAIL FROM is allowed.",""," not accepted in MAIL FROM.");
|
|
2495 |
++ do_lst("badhelo","Any HELO host name is allowed.",""," HELO host name denied if it matches this pattern.");
|
|
2496 |
++ do_lst("badmailfrom","Any MAIL FROM is allowed.",""," MAIL FROM denied if it matches this pattern.");
|
|
2497 |
++ do_lst("badmailfromnorelay","Any MAIL FROM is allowed.",""," MAIL FROM denied if it matches this pattern and RELAYCLIENT is not set.");
|
|
2498 |
++ do_lst("badmailto","No RCPT TO are specifically denied.",""," RCPT TO denied if it matches this pattern.");
|
|
2499 |
++ do_lst("badmailtonorelay","No RCPT TO are specifically denied.",""," RCPT TO denied if it matches this pattern and RELAYCLIENT is not set.");
|
|
2500 |
+ do_str("bouncefrom",0,"MAILER-DAEMON","Bounce user name is ");
|
|
2501 |
+ do_str("bouncehost",1,"bouncehost","Bounce host name is ");
|
|
2502 |
+ do_int("concurrencylocal","10","Local concurrency is ","");
|
|
2503 |
+@@ -267,7 +271,11 @@ void main() |
|
2504 |
+ if (str_equal(d->d_name,"..")) continue; |
|
2505 |
+ if (str_equal(d->d_name,"bouncefrom")) continue; |
|
2506 |
+ if (str_equal(d->d_name,"bouncehost")) continue; |
|
2507 |
++ if (str_equal(d->d_name,"badhelo")) continue; |
|
2508 |
+ if (str_equal(d->d_name,"badmailfrom")) continue; |
|
2509 |
++ if (str_equal(d->d_name,"badmailfromnorelay")) continue; |
|
2510 |
++ if (str_equal(d->d_name,"badmailto")) continue; |
|
2511 |
++ if (str_equal(d->d_name,"badmailtonorelay")) continue; |
|
2512 |
+ if (str_equal(d->d_name,"bouncefrom")) continue; |
|
2513 |
+ if (str_equal(d->d_name,"bouncehost")) continue; |
|
2514 |
+ if (str_equal(d->d_name,"concurrencylocal")) continue; |
|
2515 |
+diff -r 1510847ae5bf qmail-smtpd.8 |
|
2516 |
+--- a/qmail-smtpd.8 Thu Nov 01 16:23:16 2007 +0100 |
|
2517 |
++++ b/qmail-smtpd.8 Thu Nov 01 16:24:02 2007 +0100 |
|
2518 |
+@@ -37,11 +37,26 @@ even though such messages violate the SM |
|
2519 |
+ even though such messages violate the SMTP protocol. |
|
2520 |
+ .SH "CONTROL FILES" |
|
2521 |
+ .TP 5 |
|
2522 |
++.I badhelo |
|
2523 |
++Unacceptable HELO/EHLO host names. |
|
2524 |
++.B qmail-smtpd |
|
2525 |
++will reject every recipient address for a message if |
|
2526 |
++the host name is listed in, |
|
2527 |
++or matches a POSIX regular expression pattern listed in, |
|
2528 |
++.IR badhelo . |
|
2529 |
++If the |
|
2530 |
++.B NOBADHELO |
|
2531 |
++environment variable is set, then the contents of |
|
2532 |
++.IR badhelo |
|
2533 |
++will be ignored. |
|
2534 |
++For more information, please have a look at doc/README.qregex. |
|
2535 |
++.TP 5 |
|
2536 |
+ .I badmailfrom |
|
2537 |
+ Unacceptable envelope sender addresses. |
|
2538 |
+ .B qmail-smtpd |
|
2539 |
+ will reject every recipient address for a message |
|
2540 |
+-if the envelope sender address is listed in |
|
2541 |
++if the envelope sender address is listed in, or matches a POSIX regular expression |
|
2542 |
++pattern listed in, |
|
2543 |
+ .IR badmailfrom . |
|
2544 |
+ A line in |
|
2545 |
+ .I badmailfrom |
|
2546 |
+@@ -49,6 +64,32 @@ may be of the form |
|
2547 |
+ .BR @\fIhost , |
|
2548 |
+ meaning every address at |
|
2549 |
+ .IR host . |
|
2550 |
++For more information, please have a look at doc/README.qregex. |
|
2551 |
++.TP 5 |
|
2552 |
++.I badmailfromnorelay |
|
2553 |
++Functions the same as the |
|
2554 |
++.IR badmailfrom |
|
2555 |
++control file but is read only if the |
|
2556 |
++.B RELAYCLIENT |
|
2557 |
++environment variable is not set. |
|
2558 |
++For more information, please have a look at doc/README.qregex. |
|
2559 |
++.TP 5 |
|
2560 |
++.I badmailto |
|
2561 |
++Unacceptable envelope recipient addresses. |
|
2562 |
++.B qmail-smtpd |
|
2563 |
++will reject every recipient address for a message if the recipient address |
|
2564 |
++is listed in, |
|
2565 |
++or matches a POSIX regular expression pattern listed in, |
|
2566 |
++.IR badmailto . |
|
2567 |
++For more information, please have a look at doc/README.qregex. |
|
2568 |
++.TP 5 |
|
2569 |
++.I badmailtonorelay |
|
2570 |
++Functions the same as the |
|
2571 |
++.IR badmailto |
|
2572 |
++control file but is read only if the |
|
2573 |
++.B RELAYCLIENT |
|
2574 |
++environment variable is not set. |
|
2575 |
++For more information, please have a look at doc/README.qregex. |
|
2576 |
+ .TP 5 |
|
2577 |
+ .I databytes |
|
2578 |
+ Maximum number of bytes allowed in a message, |
|
2579 |
+diff -r 1510847ae5bf qmail-smtpd.c |
|
2580 |
+--- a/qmail-smtpd.c Thu Nov 01 16:23:16 2007 +0100 |
|
2581 |
++++ b/qmail-smtpd.c Thu Nov 01 16:24:02 2007 +0100 |
|
2582 |
+@@ -23,6 +23,15 @@ |
|
2583 |
+ #include "timeoutread.h" |
|
2584 |
+ #include "timeoutwrite.h" |
|
2585 |
+ #include "commands.h" |
|
2586 |
++#include "qregex.h" |
|
2587 |
++#include "strerr.h" |
|
2588 |
++ |
|
2589 |
++#define BMCHECK_BMF 0 |
|
2590 |
++#define BMCHECK_BMFNR 1 |
|
2591 |
++#define BMCHECK_BMT 2 |
|
2592 |
++#define BMCHECK_BMTNR 3 |
|
2593 |
++#define BMCHECK_BHELO 4 |
|
2594 |
++ |
|
2595 |
+ |
|
2596 |
+ #define MAXHOPS 100 |
|
2597 |
+ unsigned int databytes = 0; |
|
2598 |
+@@ -49,7 +58,9 @@ void die_ipme() { out("421 unable to fig
|
|
2599 |
+ void die_ipme() { out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); _exit(1); }
|
|
2600 |
+ void straynewline() { out("451 See http://pobox.com/~djb/docs/smtplf.html.\r\n"); flush(); _exit(1); }
|
|
2601 |
+ |
|
2602 |
+-void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list (#5.7.1)\r\n"); }
|
|
2603 |
++void err_bmf() { out("553 sorry, your envelope sender has been denied (#5.7.1)\r\n"); }
|
|
2604 |
++void err_bmt() { out("553 sorry, your envelope recipient has been denied (#5.7.1)\r\n"); }
|
|
2605 |
++void err_bhelo() { out("553 sorry, your HELO host name has been denied (#5.7.1)\r\n"); }
|
|
2606 |
+ void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)\r\n"); }
|
|
2607 |
+ void err_unimpl() { out("502 unimplemented (#5.5.1)\r\n"); }
|
|
2608 |
+ void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); }
|
|
2609 |
+@@ -93,9 +104,24 @@ void dohelo(arg) char *arg; {
|
|
2610 |
+ |
|
2611 |
+ int liphostok = 0; |
|
2612 |
+ stralloc liphost = {0};
|
|
2613 |
++ |
|
2614 |
+ int bmfok = 0; |
|
2615 |
+ stralloc bmf = {0};
|
|
2616 |
+-struct constmap mapbmf; |
|
2617 |
++ |
|
2618 |
++int bmfnrok = 0; |
|
2619 |
++stralloc bmfnr = {0};
|
|
2620 |
++ |
|
2621 |
++int bmtok = 0; |
|
2622 |
++stralloc bmt = {0};
|
|
2623 |
++ |
|
2624 |
++int bmtnrok = 0; |
|
2625 |
++stralloc bmtnr = {0};
|
|
2626 |
++ |
|
2627 |
++int bhelook = 0; |
|
2628 |
++stralloc bhelo = {0};
|
|
2629 |
++ |
|
2630 |
++int logregex = 0; |
|
2631 |
++stralloc matchedregex = {0};
|
|
2632 |
+ |
|
2633 |
+ void setup() |
|
2634 |
+ {
|
|
2635 |
+@@ -114,8 +140,21 @@ void setup() |
|
2636 |
+ |
|
2637 |
+ bmfok = control_readfile(&bmf,"control/badmailfrom",0); |
|
2638 |
+ if (bmfok == -1) die_control(); |
|
2639 |
+- if (bmfok) |
|
2640 |
+- if (!constmap_init(&mapbmf,bmf.s,bmf.len,0)) die_nomem(); |
|
2641 |
++ |
|
2642 |
++ bmfnrok = control_readfile(&bmfnr,"control/badmailfromnorelay",0); |
|
2643 |
++ if (bmfnrok == -1) die_control(); |
|
2644 |
++ |
|
2645 |
++ bmtok = control_readfile(&bmt,"control/badmailto",0); |
|
2646 |
++ if (bmtok == -1) die_control(); |
|
2647 |
++ |
|
2648 |
++ bmtnrok = control_readfile(&bmtnr,"control/badmailtonorelay",0); |
|
2649 |
++ if (bmtnrok == -1) die_control(); |
|
2650 |
++ |
|
2651 |
++ bhelook = control_readfile(&bhelo, "control/badhelo",0); |
|
2652 |
++ if (bhelook == -1) die_control(); |
|
2653 |
++ if (env_get("NOBADHELO")) bhelook = 0;
|
|
2654 |
++ |
|
2655 |
++ if (env_get("LOGREGEX")) logregex = 1;
|
|
2656 |
+ |
|
2657 |
+ if (control_readint(&databytes,"control/databytes") == -1) die_control(); |
|
2658 |
+ x = env_get("DATABYTES");
|
|
2659 |
+@@ -197,14 +236,56 @@ char *arg; |
|
2660 |
+ return 1; |
|
2661 |
+ } |
|
2662 |
+ |
|
2663 |
+-int bmfcheck() |
|
2664 |
+-{
|
|
2665 |
+- int j; |
|
2666 |
+- if (!bmfok) return 0; |
|
2667 |
+- if (constmap(&mapbmf,addr.s,addr.len - 1)) return 1; |
|
2668 |
+- j = byte_rchr(addr.s,addr.len,'@'); |
|
2669 |
+- if (j < addr.len) |
|
2670 |
+- if (constmap(&mapbmf,addr.s + j,addr.len - j - 1)) return 1; |
|
2671 |
++int bmcheck(which) int which; |
|
2672 |
++{
|
|
2673 |
++ int i = 0; |
|
2674 |
++ int j = 0; |
|
2675 |
++ int x = 0; |
|
2676 |
++ int negate = 0; |
|
2677 |
++ static stralloc bmb = {0};
|
|
2678 |
++ static stralloc curregex = {0};
|
|
2679 |
++ |
|
2680 |
++ if (which == BMCHECK_BMF) {
|
|
2681 |
++ if (!stralloc_copy(&bmb,&bmf)) die_nomem(); |
|
2682 |
++ } else if (which == BMCHECK_BMFNR) {
|
|
2683 |
++ if (!stralloc_copy(&bmb,&bmfnr)) die_nomem(); |
|
2684 |
++ } else if (which == BMCHECK_BMT) {
|
|
2685 |
++ if (!stralloc_copy(&bmb,&bmt)) die_nomem(); |
|
2686 |
++ } else if (which == BMCHECK_BMTNR) {
|
|
2687 |
++ if (!stralloc_copy(&bmb,&bmtnr)) die_nomem(); |
|
2688 |
++ } else if (which == BMCHECK_BHELO) {
|
|
2689 |
++ if (!stralloc_copy(&bmb,&bhelo)) die_nomem(); |
|
2690 |
++ } else {
|
|
2691 |
++ die_control(); |
|
2692 |
++ } |
|
2693 |
++ |
|
2694 |
++ while (j < bmb.len) {
|
|
2695 |
++ i = j; |
|
2696 |
++ while ((bmb.s[i] != '\0') && (i < bmb.len)) i++; |
|
2697 |
++ if (bmb.s[j] == '!') {
|
|
2698 |
++ negate = 1; |
|
2699 |
++ j++; |
|
2700 |
++ } |
|
2701 |
++ if (!stralloc_copyb(&curregex,bmb.s + j,(i - j))) die_nomem(); |
|
2702 |
++ if (!stralloc_0(&curregex)) die_nomem(); |
|
2703 |
++ if (which == BMCHECK_BHELO) {
|
|
2704 |
++ x = matchregex(helohost.s, curregex.s); |
|
2705 |
++ } else {
|
|
2706 |
++ x = matchregex(addr.s, curregex.s); |
|
2707 |
++ } |
|
2708 |
++ if ((negate) && (x == 0)) {
|
|
2709 |
++ if (!stralloc_copyb(&matchedregex,bmb.s + j - 1,(i - j + 1))) die_nomem(); |
|
2710 |
++ if (!stralloc_0(&matchedregex)) die_nomem(); |
|
2711 |
++ return 1; |
|
2712 |
++ } |
|
2713 |
++ if (!(negate) && (x > 0)) {
|
|
2714 |
++ if (!stralloc_copyb(&matchedregex,bmb.s + j,(i - j))) die_nomem(); |
|
2715 |
++ if (!stralloc_0(&matchedregex)) die_nomem(); |
|
2716 |
++ return 1; |
|
2717 |
++ } |
|
2718 |
++ j = i + 1; |
|
2719 |
++ negate = 0; |
|
2720 |
++ } |
|
2721 |
+ return 0; |
|
2722 |
+ } |
|
2723 |
+ |
|
2724 |
+@@ -218,7 +299,9 @@ int addrallowed() |
|
2725 |
+ |
|
2726 |
+ |
|
2727 |
+ int seenmail = 0; |
|
2728 |
+-int flagbarf; /* defined if seenmail */ |
|
2729 |
++int flagbarfbmf; /* defined if seenmail */ |
|
2730 |
++int flagbarfbmt; |
|
2731 |
++int flagbarfbhelo; |
|
2732 |
+ stralloc mailfrom = {0};
|
|
2733 |
+ stralloc rcptto = {0};
|
|
2734 |
+ |
|
2735 |
+@@ -226,11 +309,13 @@ void smtp_helo(arg) char *arg; |
|
2736 |
+ {
|
|
2737 |
+ smtp_greet("250 "); out("\r\n");
|
|
2738 |
+ seenmail = 0; dohelo(arg); |
|
2739 |
++ if (bhelook) flagbarfbhelo = bmcheck(BMCHECK_BHELO); |
|
2740 |
+ } |
|
2741 |
+ void smtp_ehlo(arg) char *arg; |
|
2742 |
+ {
|
|
2743 |
+ smtp_greet("250-"); out("\r\n250-PIPELINING\r\n250 8BITMIME\r\n");
|
|
2744 |
+ seenmail = 0; dohelo(arg); |
|
2745 |
++ if (bhelook) flagbarfbhelo = bmcheck(BMCHECK_BHELO); |
|
2746 |
+ } |
|
2747 |
+ void smtp_rset() |
|
2748 |
+ {
|
|
2749 |
+@@ -240,7 +325,11 @@ void smtp_mail(arg) char *arg; |
|
2750 |
+ void smtp_mail(arg) char *arg; |
|
2751 |
+ {
|
|
2752 |
+ if (!addrparse(arg)) { err_syntax(); return; }
|
|
2753 |
+- flagbarf = bmfcheck(); |
|
2754 |
++ flagbarfbmf = 0; /* bmcheck is skipped for empty envelope senders */ |
|
2755 |
++ if ((bmfok) && (addr.len != 1)) flagbarfbmf = bmcheck(BMCHECK_BMF); |
|
2756 |
++ if ((!flagbarfbmf) && (bmfnrok) && (addr.len != 1) && (!relayclient)) {
|
|
2757 |
++ flagbarfbmf = bmcheck(BMCHECK_BMFNR); |
|
2758 |
++ } |
|
2759 |
+ seenmail = 1; |
|
2760 |
+ if (!stralloc_copys(&rcptto,"")) die_nomem(); |
|
2761 |
+ if (!stralloc_copys(&mailfrom,addr.s)) die_nomem(); |
|
2762 |
+@@ -250,7 +339,37 @@ void smtp_rcpt(arg) char *arg; {
|
|
2763 |
+ void smtp_rcpt(arg) char *arg; {
|
|
2764 |
+ if (!seenmail) { err_wantmail(); return; }
|
|
2765 |
+ if (!addrparse(arg)) { err_syntax(); return; }
|
|
2766 |
+- if (flagbarf) { err_bmf(); return; }
|
|
2767 |
++ if (flagbarfbhelo) {
|
|
2768 |
++ if (logregex) {
|
|
2769 |
++ strerr_warn6("qmail-smtpd: badhelo: <",helohost.s,"> at ",remoteip," matches pattern: ",matchedregex.s,0);
|
|
2770 |
++ } else {
|
|
2771 |
++ strerr_warn4("qmail-smtpd: badhelo: <",helohost.s,"> at ",remoteip,0);
|
|
2772 |
++ } |
|
2773 |
++ err_bhelo(); |
|
2774 |
++ return; |
|
2775 |
++ } |
|
2776 |
++ if (flagbarfbmf) {
|
|
2777 |
++ if (logregex) {
|
|
2778 |
++ strerr_warn6("qmail-smtpd: badmailfrom: <",mailfrom.s,"> at ",remoteip," matches pattern: ",matchedregex.s,0);
|
|
2779 |
++ } else {
|
|
2780 |
++ strerr_warn4("qmail-smtpd: badmailfrom: <",mailfrom.s,"> at ",remoteip,0);
|
|
2781 |
++ } |
|
2782 |
++ err_bmf(); |
|
2783 |
++ return; |
|
2784 |
++ } |
|
2785 |
++ if (bmtok) flagbarfbmt = bmcheck(BMCHECK_BMT); |
|
2786 |
++ if ((!flagbarfbmt) && (bmtnrok) && (!relayclient)) {
|
|
2787 |
++ flagbarfbmt = bmcheck(BMCHECK_BMTNR); |
|
2788 |
++ } |
|
2789 |
++ if (flagbarfbmt) {
|
|
2790 |
++ if (logregex) {
|
|
2791 |
++ strerr_warn6("qmail-smtpd: badmailto: <",addr.s,"> at ",remoteip," matches pattern: ",matchedregex.s,0);
|
|
2792 |
++ } else {
|
|
2793 |
++ strerr_warn4("qmail-smtpd: badmailto: <",addr.s,"> at ",remoteip,0);
|
|
2794 |
++ } |
|
2795 |
++ err_bmt(); |
|
2796 |
++ return; |
|
2797 |
++ } |
|
2798 |
+ if (relayclient) {
|
|
2799 |
+ --addr.len; |
|
2800 |
+ if (!stralloc_cats(&addr,relayclient)) die_nomem(); |
|
2801 |
+diff -r 1510847ae5bf qregex.c |
|
2802 |
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2803 |
++++ b/qregex.c Thu Nov 01 16:24:02 2007 +0100 |
|
2804 |
+@@ -0,0 +1,57 @@ |
|
2805 |
++/* |
|
2806 |
++ * qregex (v2) |
|
2807 |
++ * $Id: qregex.c,v 2.1 2001/12/28 07:05:21 evan Exp $ |
|
2808 |
++ * |
|
2809 |
++ * Author : Evan Borgstrom (evan at unixpimps dot org) |
|
2810 |
++ * Created : 2001/12/14 23:08:16 |
|
2811 |
++ * Modified: $Date: 2001/12/28 07:05:21 $ |
|
2812 |
++ * Revision: $Revision: 2.1 $ |
|
2813 |
++ * |
|
2814 |
++ * Do POSIX regex matching on addresses for anti-relay / spam control. |
|
2815 |
++ * It logs to the maillog |
|
2816 |
++ * See the qregex-readme file included with this tarball. |
|
2817 |
++ * If you didn't get this file in a tarball please see the following URL: |
|
2818 |
++ * http://www.unixpimps.org/software/qregex |
|
2819 |
++ * |
|
2820 |
++ * qregex.c is released under a BSD style copyright. |
|
2821 |
++ * See http://www.unixpimps.org/software/qregex/copyright.html |
|
2822 |
++ * |
|
2823 |
++ * Note: this revision follows the coding guidelines set forth by the rest of |
|
2824 |
++ * the qmail code and that described at the following URL. |
|
2825 |
++ * http://cr.yp.to/qmail/guarantee.html |
|
2826 |
++ * |
|
2827 |
++ */ |
|
2828 |
++ |
|
2829 |
++#include <sys/types.h> |
|
2830 |
++#include <regex.h> |
|
2831 |
++#include "qregex.h" |
|
2832 |
++ |
|
2833 |
++#define REGCOMP(X,Y) regcomp(&X, Y, REG_EXTENDED|REG_ICASE) |
|
2834 |
++#define REGEXEC(X,Y) regexec(&X, Y, (size_t)0, (regmatch_t *)0, (int)0) |
|
2835 |
++ |
|
2836 |
++int matchregex(char *text, char *regex) {
|
|
2837 |
++ regex_t qreg; |
|
2838 |
++ int retval = 0; |
|
2839 |
++ |
|
2840 |
++ |
|
2841 |
++ /* build the regex */ |
|
2842 |
++ if ((retval = REGCOMP(qreg, regex)) != 0) {
|
|
2843 |
++ regfree(&qreg); |
|
2844 |
++ return(-retval); |
|
2845 |
++ } |
|
2846 |
++ |
|
2847 |
++ /* execute the regex */ |
|
2848 |
++ if ((retval = REGEXEC(qreg, text)) != 0) {
|
|
2849 |
++ /* did we just not match anything? */ |
|
2850 |
++ if (retval == REG_NOMATCH) {
|
|
2851 |
++ regfree(&qreg); |
|
2852 |
++ return(0); |
|
2853 |
++ } |
|
2854 |
++ regfree(&qreg); |
|
2855 |
++ return(-retval); |
|
2856 |
++ } |
|
2857 |
++ |
|
2858 |
++ /* signal the match */ |
|
2859 |
++ regfree(&qreg); |
|
2860 |
++ return(1); |
|
2861 |
++} |
|
2862 |
+diff -r 1510847ae5bf qregex.h |
|
2863 |
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2864 |
++++ b/qregex.h Thu Nov 01 16:24:02 2007 +0100 |
|
2865 |
+@@ -0,0 +1,5 @@ |
|
2866 |
++/* simple header file for the matchregex prototype */ |
|
2867 |
++#ifndef _QREGEX_H_ |
|
2868 |
++#define _QREGEX_H_ |
|
2869 |
++int matchregex(char *text, char *regex); |
|
2870 |
++#endif |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2871 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/queue-fix-dietlibc.patch |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2872 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2873 |
+++ b/source/dietlibc/diet-qmail/queue-fix-dietlibc.patch Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 2874 |
@@ -0,0 +1,18 @@ |
2875 |
+Compile with dietlibc |
|
2876 |
+ |
|
2877 |
+diff -r 6becbe0d87fa conf-cc |
|
2878 |
+--- a/conf-cc Thu Nov 01 15:04:39 2007 +0100 |
|
2879 |
++++ b/conf-cc Thu Nov 01 15:06:54 2007 +0100 |
|
2880 |
+@@ -1,3 +1,3 @@ gcc -O2 |
|
2881 |
+-gcc -O2 |
|
2882 |
++diet gcc -O2 |
|
2883 |
+ |
|
2884 |
+ This will be used to compile .c files. |
|
2885 |
+diff -r 6becbe0d87fa conf-ld |
|
2886 |
+--- a/conf-ld Thu Nov 01 15:04:39 2007 +0100 |
|
2887 |
++++ b/conf-ld Thu Nov 01 15:06:54 2007 +0100 |
|
2888 |
+@@ -1,3 +1,3 @@ gcc -s |
|
2889 |
+-gcc -s |
|
2890 |
++diet gcc -s -static |
|
2891 |
+ |
|
2892 |
+ This will be used to link .o files into an executable. |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2893 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/queue-fix-errno.patch |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2894 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2895 |
+++ b/source/dietlibc/diet-qmail/queue-fix-errno.patch Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 2896 |
@@ -0,0 +1,14 @@ |
2897 |
+errno fix |
|
2898 |
+ |
|
2899 |
+diff -r c045670f36e9 error.h |
|
2900 |
+--- a/error.h Thu Nov 01 14:46:11 2007 +0100 |
|
2901 |
++++ b/error.h Thu Nov 01 15:02:39 2007 +0100 |
|
2902 |
+@@ -1,7 +1,7 @@ |
|
2903 |
+ #ifndef ERROR_H |
|
2904 |
+ #define ERROR_H |
|
2905 |
+ |
|
2906 |
+-extern int errno; |
|
2907 |
++#include <errno.h> |
|
2908 |
+ |
|
2909 |
+ extern int error_intr; |
|
2910 |
+ extern int error_nomem; |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2911 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/rc |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2912 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2913 |
+++ b/source/dietlibc/diet-qmail/rc Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 2914 |
@@ -0,0 +1,7 @@ |
2915 |
+#!/bin/sh |
|
2916 |
+# |
|
2917 |
+# Using stdout for logging |
|
2918 |
+# Using control/defaultdelivery from qmail-local to deliver messages by default |
|
2919 |
+# |
|
2920 |
+exec env - PATH="/var/qmail/bin:$PATH" \ |
|
2921 |
+ qmail-start "`cat /var/qmail/control/defaultdelivery`" |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2922 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/send_log_run |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2923 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2924 |
+++ b/source/dietlibc/diet-qmail/send_log_run Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 2925 |
@@ -0,0 +1,20 @@ |
2926 |
+#!/bin/sh |
|
2927 |
+# |
|
2928 |
+# Edit this file to match your setup. |
|
2929 |
+# NOTE: This file is automatically backed-up by pacman, |
|
2930 |
+# during updates |
|
2931 |
+# |
|
2932 |
+ |
|
2933 |
+# Log size rotate size. |
|
2934 |
+LOG_SIZE="1048576" |
|
2935 |
+ |
|
2936 |
+# Number of logs to keep. |
|
2937 |
+LOGS="5" |
|
2938 |
+ |
|
2939 |
+# Don't change from this point on, unless |
|
2940 |
+# you really know what you're doing :). |
|
2941 |
+ |
|
2942 |
+exec /usr/bin/setuidgid qmaill \ |
|
2943 |
+ /usr/bin/multilog t \ |
|
2944 |
+ n${LOGS} s${LOG_SIZE} \
|
|
2945 |
+ /var/log/qmail/send 2>&1 |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2946 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/send_run |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2947 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2948 |
+++ b/source/dietlibc/diet-qmail/send_run Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 2949 |
@@ -0,0 +1,8 @@ |
2950 |
+#!/bin/sh |
|
2951 |
+# |
|
2952 |
+# Edit this file to match your setup. |
|
2953 |
+# NOTE: This file is automatically backed-up by pacman, |
|
2954 |
+# during updates |
|
2955 |
+# |
|
2956 |
+ |
|
2957 |
+exec /var/qmail/rc |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2958 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/smtpd_log_run |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2959 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2960 |
+++ b/source/dietlibc/diet-qmail/smtpd_log_run Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 2961 |
@@ -0,0 +1,20 @@ |
2962 |
+#!/bin/sh |
|
2963 |
+# |
|
2964 |
+# Edit this file to match your setup. |
|
2965 |
+# NOTE: This file is automatically backed-up by pacman, |
|
2966 |
+# during updates |
|
2967 |
+# |
|
2968 |
+ |
|
2969 |
+# Log size rotate size. |
|
2970 |
+LOG_SIZE="1048576" |
|
2971 |
+ |
|
2972 |
+# Number of logs to keep. |
|
2973 |
+LOGS="5" |
|
2974 |
+ |
|
2975 |
+# Don't change from this point on, unless |
|
2976 |
+# you really know what you're doing :). |
|
2977 |
+ |
|
2978 |
+exec /usr/bin/setuidgid qmaill \ |
|
2979 |
+ /usr/bin/multilog t \ |
|
2980 |
+ n${LOGS} s${LOG_SIZE} \
|
|
2981 |
+ /var/log/qmail/smtpd 2>&1 |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2982 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/smtpd_run |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2983 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
2984 |
+++ b/source/dietlibc/diet-qmail/smtpd_run Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 2985 |
@@ -0,0 +1,45 @@ |
2986 |
+#!/bin/sh |
|
2987 |
+# |
|
2988 |
+# Edit this file to match your setup. |
|
2989 |
+# NOTE: This file is automatically backed-up by pacman, |
|
2990 |
+# during updates |
|
2991 |
+# |
|
2992 |
+ |
|
2993 |
+# uid & gid to run qmail-smtpd as. |
|
2994 |
+# optionally `id -u vpopmail' for vpopmail. |
|
2995 |
+QMAILDUID=`id -u qmaild` |
|
2996 |
+ |
|
2997 |
+# optionally `id -g vpopmail` for vpopmail. |
|
2998 |
+NOFILESGID=`id -g qmaild` |
|
2999 |
+ |
|
3000 |
+# Password checking program (ie. checkpasswd, vpopmail). |
|
3001 |
+PASSPROG="" |
|
3002 |
+ |
|
3003 |
+# FQDN as set in /var/qmail/control/me |
|
3004 |
+LOCAL=`head -1 /var/qmail/control/me` |
|
3005 |
+ |
|
3006 |
+# Maximum memory qmail-smtpd is allowed to use. |
|
3007 |
+MAX_MEM="2000000" |
|
3008 |
+ |
|
3009 |
+# Maximum allowed concurrent connections. |
|
3010 |
+MAX_CON=`cat /var/qmail/control/concurrencyincoming` |
|
3011 |
+ |
|
3012 |
+# Relay control. |
|
3013 |
+TCP_CDB="/etc/tcp.smtp.cdb" |
|
3014 |
+ |
|
3015 |
+# Relay denied message for open relays. |
|
3016 |
+RELAY_DENIED="relays.ordb.org: Your message was rejected because the mail server you use is configured to allow OPEN RELAY - More detailed information regarding this problem is available from http://www.ordb.org/lookup/?%IP% - Please forward this error through to your email server support staff for easy resolution." |
|
3017 |
+ |
|
3018 |
+# Don't change from this point on, unless |
|
3019 |
+# you really know what you're doing :). |
|
3020 |
+SMTPD="/var/qmail/bin/qmail-smtpd" |
|
3021 |
+PORT="25" |
|
3022 |
+ |
|
3023 |
+exec /usr/bin/softlimit -m $MAX_MEM \ |
|
3024 |
+ /usr/bin/tcpserver -H -l $LOCAL \ |
|
3025 |
+ -v -x $TCP_CDB \ |
|
3026 |
+ -c $MAX_CON -R 0 $PORT \ |
|
3027 |
+ -u $QMAILUID -g $NOFILESGID \ |
|
3028 |
+ /usr/bin/rblsmtpd -b -C \ |
|
3029 |
+ -r $RELAY_DENIED -t 5 \ |
|
3030 |
+ $SMTPD $PASSPROG /bin/true 2>&1 |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
3031 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/tcp.pop3 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
3032 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
3033 |
+++ b/source/dietlibc/diet-qmail/tcp.pop3 Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 3034 |
@@ -0,0 +1,6 @@ |
3035 |
+# to update the database after changing this file, run: |
|
3036 |
+# /etc/rc.d/qmail cdb |
|
3037 |
+# Allow any client to connect to us via POP3 |
|
3038 |
+# If people are abusing POP3 such as denial-of-service on POP3, |
|
3039 |
+# you can add their ips here to block them out |
|
3040 |
+:allow |
|
|
98
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
3041 |
diff -r 2be82bdba73b source/dietlibc/diet-qmail/tcp.smtp |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
3042 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
ee6165a0b4ed
diet-qmail.patch: folded w/ upgrade-0.9-diet-qmail.patch
Tomas Zeman <tzeman@volny.cz>
parents:
28
diff
changeset
|
3043 |
+++ b/source/dietlibc/diet-qmail/tcp.smtp Wed Feb 15 15:10:10 2012 +0100 |
| 1 | 3044 |
@@ -0,0 +1,81 @@ |
3045 |
+#------------------------------------------------------ |
|
3046 |
+# DESCRIPTION OF THE RULES TO REMIND ME OF HOW THIS FILE WORKS |
|
3047 |
+# |
|
3048 |
+# If you set 'allow', this means that our mail server will allow |
|
3049 |
+# the specified IP range to make a TCP connection to our server |
|
3050 |
+# |
|
3051 |
+# If you set 'deny', this means that our mail server will not allow |
|
3052 |
+# the specified IP range to make a TCP connection to our server |
|
3053 |
+# |
|
3054 |
+# If you set RELAYCLIENT="", this means that the listed IP range is |
|
3055 |
+# allowed to relay mail through our server |
|
3056 |
+# |
|
3057 |
+# If you dont set RELAYCLIENT="", this means that the listed IP range |
|
3058 |
+# will not be able to relay mail through our server |
|
3059 |
+# |
|
3060 |
+# If you set RBLSMTPD="", this means that the listed IP ranges will |
|
3061 |
+# not be checked against any of the RBL databases |
|
3062 |
+# |
|
3063 |
+# If you set RBLSMTPD="some text here", this means that an RBL lookup |
|
3064 |
+# wont be performed, but the mail will be rejected with the specified |
|
3065 |
+# text as a 4xx temp error message |
|
3066 |
+# |
|
3067 |
+# If you set RBLSMTPD="-some text here", this means that an RBL lookup |
|
3068 |
+# wont be performed, but the mail will be rejected with the specified |
|
3069 |
+# text as a 5xx perm error message |
|
3070 |
+# |
|
3071 |
+# If you do not set RBLSMTPD="" or ="some text", then an RBL lookup |
|
3072 |
+# will be performed. If the lookup is successful, then RBLSMTPD will |
|
3073 |
+# return your custom error message (as specified in the -r parameter |
|
3074 |
+# in smtpd supervise script) |
|
3075 |
+# |
|
3076 |
+#----------------------------------------------------- |
|
3077 |
+# HERE ARE THE RULES! : |
|
3078 |
+#----------------------------------------------------- |
|
3079 |
+# BYPASS OPEN RELAY CHECKING FOR THESE IPS : |
|
3080 |
+# |
|
3081 |
+# These IPs are ones that we have setup so that they arent RBL checked. |
|
3082 |
+# We have done this because these particular servers are RBL listed, |
|
3083 |
+# and for whatever reason they can't/won't fix their open relay problem, |
|
3084 |
+# and we still want to be able to receive mail from them. |
|
3085 |
+# |
|
3086 |
+# reminder text goes here for this entry so we know the story... |
|
3087 |
+111.111.111.111:allow,RBLSMTPD="" |
|
3088 |
+## reminder text goes here for this entry so we know the story... |
|
3089 |
+222.222.222.222:allow,RBLSMTPD="" |
|
3090 |
+# |
|
3091 |
+#----------------------------------------------------------------- |
|
3092 |
+# DONT ALLOW THESE IPS TO SEND MAIL TO US : |
|
3093 |
+# |
|
3094 |
+# mailXX.offermail.net connecting regularly and sending invalid |
|
3095 |
+# format messages causing exit with status 256 (bare linefeed normally) |
|
3096 |
+# entry added 15/12/2001 |
|
3097 |
+# after looking at the mail coming from these servers it was found to be spam |
|
3098 |
+216.242.75.100-116:allow,RBLSMTPD="-Connections from this IP have been banned." |
|
3099 |
+# |
|
3100 |
+# heaps of spam from replyto of *@freeamateurhotties.com dec2001 |
|
3101 |
+64.228.127.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" |
|
3102 |
+154.20.94.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" |
|
3103 |
+209.151.132.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" |
|
3104 |
+216.18.85.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" |
|
3105 |
+# |
|
3106 |
+#----------------------------------------------------------------- |
|
3107 |
+# ALLOW THESE IPS TO RELAY MAIL THROUGH OUR SERVER |
|
3108 |
+# |
|
3109 |
+# Local class-c's from our LAN are allowed to relay, |
|
3110 |
+# and we wont bother doing any RBL checking. |
|
3111 |
+#123.123.123.:allow,RELAYCLIENT="",RBLSMTPD="" |
|
3112 |
+#123.111.111.:allow,RELAYCLIENT="",RBLSMTPD="" |
|
3113 |
+# |
|
3114 |
+# Connections from localhost are allowed to relay |
|
3115 |
+# (because the WebMail server runs on localhost), |
|
3116 |
+# and obviously there is no point trying to perform an RBL check. |
|
3117 |
+127.0.0.1:allow,RELAYCLIENT="",RBLSMTPD="" |
|
3118 |
+# |
|
3119 |
+#----------------------------------------------------------------- |
|
3120 |
+# ALLOW EVERYONE ELSE TO SEND US MAIL |
|
3121 |
+# |
|
3122 |
+# Everyone else can make connections to our server, |
|
3123 |
+# but not allowed to relay |
|
3124 |
+# RBL lookups are performed |
|
3125 |
+:allow |