Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 90631 | Differences between
and this patch

Collapse All | Expand All

(-)qmail-1.03/Makefile (-6 / +11 lines)
Lines 1419-1431 Link Here
1419
	nroff -man qmail-qstat.8 > qmail-qstat.0
1419
	nroff -man qmail-qstat.8 > qmail-qstat.0
1420
1420
1421
qmail-queue: \
1421
qmail-queue: \
1422
load qmail-queue.o triggerpull.o fmtqfn.o now.o date822fmt.o \
1422
load qmail-queue.o triggerpull.o fmtqfn.o now.o date822fmt.o qregex.o \
1423
datetime.a seek.a ndelay.a open.a sig.a alloc.a substdio.a error.a \
1423
datetime.a seek.a case.a ndelay.a open.a sig.a getln.a stralloc.a alloc.a \
1424
str.a fs.a auto_qmail.o auto_split.o auto_uids.o
1424
substdio.a error.a control.o constmap.o str.a fs.a auto_qmail.o \
1425
auto_split.o auto_uids.o 
1425
	./load qmail-queue triggerpull.o fmtqfn.o now.o \
1426
	./load qmail-queue triggerpull.o fmtqfn.o now.o \
1426
	date822fmt.o datetime.a seek.a ndelay.a open.a sig.a \
1427
	date822fmt.o qregex.o control.o constmap.o datetime.a case.a seek.a \
1427
	alloc.a substdio.a error.a str.a fs.a auto_qmail.o \
1428
	ndelay.a open.a sig.a getln.a stralloc.a alloc.a substdio.a error.a \
1428
	auto_split.o auto_uids.o 
1429
	str.a fs.a auto_qmail.o auto_split.o auto_uids.o
1429
1430
1430
qmail-queue.0: \
1431
qmail-queue.0: \
1431
qmail-queue.8
1432
qmail-queue.8
Lines 1681-1686 Link Here
1681
constmap.h stralloc.h gen_alloc.h rcpthosts.h
1682
constmap.h stralloc.h gen_alloc.h rcpthosts.h
1682
	./compile rcpthosts.c
1683
	./compile rcpthosts.c
1683
1684
1685
qregex.o: \
1686
compile qregex.c qregex.h
1687
	./compile qregex.c
1688
1684
readsubdir.o: \
1689
readsubdir.o: \
1685
compile readsubdir.c readsubdir.h direntry.h fmt.h scan.h str.h \
1690
compile readsubdir.c readsubdir.h direntry.h fmt.h scan.h str.h \
1686
auto_split.h
1691
auto_split.h
(-)qmail-1.03/qmail-control.9 (+3 lines)
Lines 63-68 Link Here
63
.I rcpthosts	\fR(none)	\fRqmail-smtpd
63
.I rcpthosts	\fR(none)	\fRqmail-smtpd
64
.I smtpgreeting	\fIme	\fRqmail-smtpd
64
.I smtpgreeting	\fIme	\fRqmail-smtpd
65
.I smtproutes	\fR(none)	\fRqmail-remote
65
.I smtproutes	\fR(none)	\fRqmail-remote
66
.I taps	\fR(none)	\fRqmail-queue
67
.I tapscopy	\fR(none)	\fRqmail-queue
66
.I timeoutconnect	\fR60	\fRqmail-remote
68
.I timeoutconnect	\fR60	\fRqmail-remote
67
.I timeoutremote	\fR1200	\fRqmail-remote
69
.I timeoutremote	\fR1200	\fRqmail-remote
68
.I timeoutsmtpd	\fR1200	\fRqmail-smtpd
70
.I timeoutsmtpd	\fR1200	\fRqmail-smtpd
Lines 72-77 Link Here
72
.SH "SEE ALSO"
74
.SH "SEE ALSO"
73
qmail-inject(8),
75
qmail-inject(8),
74
qmail-qmqpc(8),
76
qmail-qmqpc(8),
77
qmail-queue(8),
75
qmail-remote(8),
78
qmail-remote(8),
76
qmail-send(8),
79
qmail-send(8),
77
qmail-showctl(8),
80
qmail-showctl(8),
(-)qmail-1.03/qmail-queue.8 (+7 lines)
Lines 40-45 Link Here
40
However, the recipients probably expect to see a proper header,
40
However, the recipients probably expect to see a proper header,
41
as described in
41
as described in
42
.BR qmail-header(5) .
42
.BR qmail-header(5) .
43
.SH "CONTROL FILES"
44
.TP 5
45
.I taps
46
Should contain regex syntax of email addresses to tap.
47
.TP 5
48
.I tapscopy
49
Email address for all tapped mail copies. 
43
.SH "FILESYSTEM RESTRICTIONS"
50
.SH "FILESYSTEM RESTRICTIONS"
44
.B qmail-queue
51
.B qmail-queue
45
imposes two constraints on the queue structure:
52
imposes two constraints on the queue structure:
(-)qmail-1.03/qmail-queue.c (+84 lines)
Lines 16-21 Link Here
16
#include "auto_uids.h"
16
#include "auto_uids.h"
17
#include "date822fmt.h"
17
#include "date822fmt.h"
18
#include "fmtqfn.h"
18
#include "fmtqfn.h"
19
#include "stralloc.h"
20
#include "constmap.h"
19
21
20
#define DEATH 86400 /* 24 hours; _must_ be below q-s's OSSIFIED (36 hours) */
22
#define DEATH 86400 /* 24 hours; _must_ be below q-s's OSSIFIED (36 hours) */
21
#define ADDR 1003
23
#define ADDR 1003
Lines 25-30 Link Here
25
char outbuf[256];
27
char outbuf[256];
26
struct substdio ssout;
28
struct substdio ssout;
27
29
30
int tapok = 0;
31
stralloc tap = {0};
32
struct constmap maptap;
33
stralloc chkaddr = {0};
34
int tapped;
35
stralloc tapaddr = {0};
36
stralloc controlfile = {0};
37
28
datetime_sec starttime;
38
datetime_sec starttime;
29
struct datetime dt;
39
struct datetime dt;
30
unsigned long mypid;
40
unsigned long mypid;
Lines 175-180 Link Here
175
185
176
 alarm(DEATH);
186
 alarm(DEATH);
177
187
188
 stralloc_copys( &controlfile, auto_qmail);
189
 stralloc_cats( &controlfile, "/control/taps");
190
 stralloc_0( &controlfile);
191
 tapok = control_readfile(&tap,controlfile.s,0);
192
 if (tapok == -1) die(65);
193
 if (!constmap_init(&maptap,tap.s,tap.len,0)) die(65);
194
195
 stralloc_copys( &controlfile, auto_qmail);
196
 stralloc_cats( &controlfile, "/control/tapscopy");
197
 stralloc_0( &controlfile);
198
 if ( control_readline(&tapaddr,controlfile.s) == -1 ) die(65);
199
178
 pidopen();
200
 pidopen();
179
 if (fstat(messfd,&pidst) == -1) die(63);
201
 if (fstat(messfd,&pidst) == -1) die(63);
180
202
Lines 219-232 Link Here
219
 if (substdio_get(&ssin,&ch,1) < 1) die_read();
241
 if (substdio_get(&ssin,&ch,1) < 1) die_read();
220
 if (ch != 'F') die(91);
242
 if (ch != 'F') die(91);
221
 if (substdio_bput(&ssout,&ch,1) == -1) die_write();
243
 if (substdio_bput(&ssout,&ch,1) == -1) die_write();
244
 stralloc_0(&chkaddr);
222
 for (len = 0;len < ADDR;++len)
245
 for (len = 0;len < ADDR;++len)
223
  {
246
  {
247
   if ( len == 1 ) stralloc_copyb(&chkaddr, &ch,1);
248
   else if ( len > 1 ) stralloc_catb(&chkaddr, &ch,1);
224
   if (substdio_get(&ssin,&ch,1) < 1) die_read();
249
   if (substdio_get(&ssin,&ch,1) < 1) die_read();
225
   if (substdio_put(&ssout,&ch,1) == -1) die_write();
250
   if (substdio_put(&ssout,&ch,1) == -1) die_write();
226
   if (!ch) break;
251
   if (!ch) break;
227
  }
252
  }
228
 if (len >= ADDR) die(11);
253
 if (len >= ADDR) die(11);
229
254
255
 /* check the from address */
256
 stralloc_0(&chkaddr);
257
 if (tapped == 0 && tapcheck()==1 ) 
258
  {
259
   tapped = 1;
260
   if ( tapaddr.len > 0 ) 
261
    {
262
     if (substdio_bput(&ssout,"T",1) == -1) die_write();
263
     if (substdio_bput(&ssout,tapaddr.s,tapaddr.len) == -1) die_write();
264
     if (substdio_bput(&ssout,"",1) == -1) die_write();
265
    }
266
 }
267
230
 if (substdio_bput(&ssout,QUEUE_EXTRA,QUEUE_EXTRALEN) == -1) die_write();
268
 if (substdio_bput(&ssout,QUEUE_EXTRA,QUEUE_EXTRALEN) == -1) die_write();
231
269
232
 for (;;)
270
 for (;;)
Lines 237-246 Link Here
237
   if (substdio_bput(&ssout,&ch,1) == -1) die_write();
275
   if (substdio_bput(&ssout,&ch,1) == -1) die_write();
238
   for (len = 0;len < ADDR;++len)
276
   for (len = 0;len < ADDR;++len)
239
    {
277
    {
278
     if ( len == 1 ) stralloc_copyb(&chkaddr, &ch,1);
279
     else if ( len > 1 ) stralloc_catb(&chkaddr, &ch,1);
240
     if (substdio_get(&ssin,&ch,1) < 1) die_read();
280
     if (substdio_get(&ssin,&ch,1) < 1) die_read();
241
     if (substdio_bput(&ssout,&ch,1) == -1) die_write();
281
     if (substdio_bput(&ssout,&ch,1) == -1) die_write();
242
     if (!ch) break;
282
     if (!ch) break;
243
    }
283
    }
284
285
    /* check the to address */
286
    stralloc_0(&chkaddr);
287
    if (tapped == 0 && tapcheck()==1 ) 
288
	 {
289
      tapped = 1;
290
      if ( tapaddr.len > 0 ) 
291
	   {
292
        if (substdio_bput(&ssout,"T",1) == -1) die_write();
293
        if (substdio_bput(&ssout,tapaddr.s,tapaddr.len) == -1) die_write();
294
        if (substdio_bput(&ssout,"",1) == -1) die_write();
295
       }
296
     }
297
244
   if (len >= ADDR) die(11);
298
   if (len >= ADDR) die(11);
245
  }
299
  }
246
300
Lines 252-254 Link Here
252
 triggerpull();
306
 triggerpull();
253
 die(0);
307
 die(0);
254
}
308
}
309
310
int tapcheck()
311
{
312
 int i = 0;
313
 int j = 0;
314
 int x = 0;
315
 int negate = 0;
316
 stralloc curregex = {0};
317
 char tmpbuf[200];
318
319
 while (j < tap.len) 
320
  {
321
   i = j;
322
   while ((tap.s[i] != '\0') && (i < tap.len)) i++;
323
   if (tap.s[j] == '!') 
324
    {
325
     negate = 1;
326
     j++;
327
    }
328
   stralloc_copyb(&curregex,tap.s + j,(i - j));
329
   stralloc_0(&curregex);
330
   x = matchregex(chkaddr.s, curregex.s, tmpbuf);
331
  
332
   if ((negate) && (x == 0)) return 1;
333
   if (!(negate) && (x > 0)) return 1;
334
   j = i + 1;
335
   negate = 0;
336
  }
337
  return 0;
338
}
(-)qmail-1.03/README.tap (+33 lines)
Line 0 Link Here
1
qmail provides the ability to make a copy of each email that flows through the system.
2
This is done using the QUEUE_EXTRA code. See qmail FAQ #8.2
3
4
The qmail tap patch adds additional functionality:
5
1) Specify which email addresses tap using a regex style control file. With the
6
   regex function, you can specify full domains or individual email addresses.
7
2) Specify which email address to send the emails to using a control file.
8
3) Qmail does not need to be recompiled to change the above. Just updated 
9
   the control files.
10
11
The regex match is applied to both the to and from email addresses. So email
12
sent to or from the addresses will be copied.
13
14
The queue tap patch adds two new control files:
15
16
1) control/taps
17
Contains a regex style list of addresses to tap.
18
19
Examples:
20
a) To tap a whole domain add a line like:
21
.*@domain.com
22
23
24
b) To tap an individual email address add a line like:
25
user@domain.com
26
27
2) control/tapscopy
28
Contains the email address to send the copies to.
29
30
example:
31
backup@otherdomain.com
32
33
The tapscopy address can be a local or remote email address.
(-)qmail-1.03/TARGETS (+1 lines)
Lines 385-387 Link Here
385
man
385
man
386
setup
386
setup
387
check
387
check
388
qregex.o

Return to bug 90631