pristine/qregex-20060423.patch
author Tomas Zeman <tzeman@volny.cz>
Sun, 08 Jul 2012 12:20:20 +0200
changeset 4 454df9357b4b
parent 1 b375914441b2
permissions -rw-r--r--
Imported pristine/qmail-103-oversize-dns.patch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
     1
qregex-20060423.patch
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
     2
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
     3
Changelog
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
     4
2006 04 23
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
     5
qregex adds the matched regex pattern to its log entries if the LOGREGEX
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
     6
environment variable is set.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
     7
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
     8
2004 07 25
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
     9
Added the badmailfromnorelay and badmailtonorelay control files.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    10
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    11
Surrounded addresses in log messages with '<' and '>' to make picking them
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    12
out of log files with scripts easier.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    13
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    14
2004 06 01
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    15
Updated README.qregex.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    16
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    17
2004 03 17
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    18
Added the badhelo control file. This allows qregex to do pattern matching
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    19
againt the HELO host name presented by the smtp client.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    20
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    21
Plugged a memory leak. The two stralloc structures in the bmcheck function in
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    22
qmail-smtpd have been made static. This prevents the structures from
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    23
allocating new memory every time the bmcheck function is called.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    24
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    25
2004 02 07
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    26
qregex now ignores empty envelope senders ('mail from' command). Empty envelope
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    27
senders will not be compared to any regular expressions in the badmailfrom
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    28
control file and will always be accepted by qregex. Prior to this version it
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    29
was possible to write regular expressions that would reject mail with empty
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    30
envelope senders.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    31
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    32
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/hier.c ./netqmail-1.05/netqmail-1.05/hier.c
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    33
--- ./netqmail-1.05.orig/netqmail-1.05/hier.c	1998-06-15 06:53:16.000000000 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    34
+++ ./netqmail-1.05/netqmail-1.05/hier.c	2006-04-22 21:45:16.106777997 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    35
@@ -76,6 +76,7 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    36
   c(auto_qmail,"boot","binm3+df",auto_uido,auto_gidq,0755);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    37
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    38
   c(auto_qmail,"doc","FAQ",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    39
+  c(auto_qmail,"doc","README.qregex",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    40
   c(auto_qmail,"doc","UPGRADE",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    41
   c(auto_qmail,"doc","SENDMAIL",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    42
   c(auto_qmail,"doc","INSTALL",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    43
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/install-big.c ./netqmail-1.05/netqmail-1.05/install-big.c
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    44
--- ./netqmail-1.05.orig/netqmail-1.05/install-big.c	1998-06-15 06:53:16.000000000 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    45
+++ ./netqmail-1.05/netqmail-1.05/install-big.c	2006-04-22 21:45:16.107777820 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    46
@@ -76,6 +76,7 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    47
   c(auto_qmail,"boot","binm3+df",auto_uido,auto_gidq,0755);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    48
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    49
   c(auto_qmail,"doc","FAQ",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    50
+  c(auto_qmail,"doc","README.qregex",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    51
   c(auto_qmail,"doc","UPGRADE",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    52
   c(auto_qmail,"doc","SENDMAIL",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    53
   c(auto_qmail,"doc","INSTALL",auto_uido,auto_gidq,0644);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    54
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/Makefile ./netqmail-1.05/netqmail-1.05/Makefile
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    55
--- ./netqmail-1.05.orig/netqmail-1.05/Makefile	2004-06-04 21:51:58.000000000 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    56
+++ ./netqmail-1.05/netqmail-1.05/Makefile	2006-04-22 21:45:16.109777466 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    57
@@ -1532,16 +1532,16 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    58
 	./compile qmail-showctl.c
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    59
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    60
 qmail-smtpd: \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    61
-load qmail-smtpd.o rcpthosts.o commands.o timeoutread.o \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    62
+load qmail-smtpd.o rcpthosts.o qregex.o commands.o timeoutread.o \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    63
 timeoutwrite.o ip.o ipme.o ipalloc.o control.o constmap.o received.o \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    64
 date822fmt.o now.o qmail.o cdb.a fd.a wait.a datetime.a getln.a \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    65
-open.a sig.a case.a env.a stralloc.a alloc.a substdio.a error.a str.a \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    66
+open.a sig.a case.a env.a stralloc.a alloc.a strerr.a substdio.a error.a str.a \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    67
 fs.a auto_qmail.o socket.lib
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    68
-	./load qmail-smtpd rcpthosts.o commands.o timeoutread.o \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    69
+	./load qmail-smtpd qregex.o rcpthosts.o commands.o timeoutread.o \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    70
 	timeoutwrite.o ip.o ipme.o ipalloc.o control.o constmap.o \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    71
 	received.o date822fmt.o now.o qmail.o cdb.a fd.a wait.a \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    72
 	datetime.a getln.a open.a sig.a case.a env.a stralloc.a \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    73
-	alloc.a substdio.a error.a str.a fs.a auto_qmail.o  `cat \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    74
+	alloc.a strerr.a substdio.a error.a str.a fs.a auto_qmail.o  `cat \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    75
 	socket.lib`
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    76
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    77
 qmail-smtpd.0: \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    78
@@ -1681,6 +1681,10 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    79
 constmap.h stralloc.h gen_alloc.h rcpthosts.h
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    80
 	./compile rcpthosts.c
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    81
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    82
+qregex.o: \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    83
+compile qregex.c qregex.h
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    84
+	./compile qregex.c
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    85
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    86
 readsubdir.o: \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    87
 compile readsubdir.c readsubdir.h direntry.h fmt.h scan.h str.h \
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    88
 auto_split.h
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    89
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/qmail-control.9 ./netqmail-1.05/netqmail-1.05/qmail-control.9
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    90
--- ./netqmail-1.05.orig/netqmail-1.05/qmail-control.9	1998-06-15 06:53:16.000000000 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    91
+++ ./netqmail-1.05/netqmail-1.05/qmail-control.9	2006-04-22 21:45:16.109777466 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    92
@@ -20,7 +20,11 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    93
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    94
 Comments are allowed
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    95
 in
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    96
+.IR badhelo ,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    97
 .IR badmailfrom ,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    98
+.IR badmailfromnorelay ,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
    99
+.IR badmailto ,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   100
+.IR badmailtonorelay ,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   101
 .IR locals ,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   102
 .IR percenthack ,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   103
 .IR qmqpservers ,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   104
@@ -40,7 +44,11 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   105
 .ta 5c 10c
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   106
 control	default	used by
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   107
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   108
+.I badhelo	\fR(none)	\fRqmail-smtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   109
 .I badmailfrom	\fR(none)	\fRqmail-smtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   110
+.I badmailfromnorelay	\fR(none)	\fRqmail-smtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   111
+.I badmailto	\fR(none)	\fRqmail-smtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   112
+.I badmailtonorelay	\fR(none)	\fRqmail-smtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   113
 .I bouncefrom	\fRMAILER-DAEMON	\fRqmail-send
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   114
 .I bouncehost	\fIme	\fRqmail-send
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   115
 .I concurrencylocal	\fR10	\fRqmail-send
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   116
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/qmail-showctl.c ./netqmail-1.05/netqmail-1.05/qmail-showctl.c
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   117
--- ./netqmail-1.05.orig/netqmail-1.05/qmail-showctl.c	1998-06-15 06:53:16.000000000 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   118
+++ ./netqmail-1.05/netqmail-1.05/qmail-showctl.c	2006-04-22 21:45:16.110777288 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   119
@@ -214,7 +214,11 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   120
     _exit(111);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   121
   }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   122
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   123
-  do_lst("badmailfrom","Any MAIL FROM is allowed.",""," not accepted in MAIL FROM.");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   124
+  do_lst("badhelo","Any HELO host name is allowed.",""," HELO host name denied if it matches this pattern.");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   125
+  do_lst("badmailfrom","Any MAIL FROM is allowed.",""," MAIL FROM denied if it matches this pattern.");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   126
+  do_lst("badmailfromnorelay","Any MAIL FROM is allowed.",""," MAIL FROM denied if it matches this pattern and RELAYCLIENT is not set.");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   127
+  do_lst("badmailto","No RCPT TO are specifically denied.",""," RCPT TO denied if it matches this pattern.");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   128
+  do_lst("badmailtonorelay","No RCPT TO are specifically denied.",""," RCPT TO denied if it matches this pattern and RELAYCLIENT is not set.");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   129
   do_str("bouncefrom",0,"MAILER-DAEMON","Bounce user name is ");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   130
   do_str("bouncehost",1,"bouncehost","Bounce host name is ");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   131
   do_int("concurrencylocal","10","Local concurrency is ","");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   132
@@ -267,7 +271,11 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   133
     if (str_equal(d->d_name,"..")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   134
     if (str_equal(d->d_name,"bouncefrom")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   135
     if (str_equal(d->d_name,"bouncehost")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   136
+    if (str_equal(d->d_name,"badhelo")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   137
     if (str_equal(d->d_name,"badmailfrom")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   138
+    if (str_equal(d->d_name,"badmailfromnorelay")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   139
+    if (str_equal(d->d_name,"badmailto")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   140
+    if (str_equal(d->d_name,"badmailtonorelay")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   141
     if (str_equal(d->d_name,"bouncefrom")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   142
     if (str_equal(d->d_name,"bouncehost")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   143
     if (str_equal(d->d_name,"concurrencylocal")) continue;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   144
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/qmail-smtpd.8 ./netqmail-1.05/netqmail-1.05/qmail-smtpd.8
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   145
--- ./netqmail-1.05.orig/netqmail-1.05/qmail-smtpd.8	1998-06-15 06:53:16.000000000 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   146
+++ ./netqmail-1.05/netqmail-1.05/qmail-smtpd.8	2006-04-22 21:45:16.110777288 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   147
@@ -37,11 +37,26 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   148
 even though such messages violate the SMTP protocol.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   149
 .SH "CONTROL FILES"
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   150
 .TP 5
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   151
+.I badhelo
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   152
+Unacceptable HELO/EHLO host names.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   153
+.B qmail-smtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   154
+will reject every recipient address for a message if
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   155
+the host name is listed in, 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   156
+or matches a POSIX regular expression pattern listed in,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   157
+.IR badhelo .
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   158
+If the 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   159
+.B NOBADHELO 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   160
+environment variable is set, then the contents of 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   161
+.IR badhelo 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   162
+will be ignored.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   163
+For more information, please have a look at doc/README.qregex.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   164
+.TP 5
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   165
 .I badmailfrom
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   166
 Unacceptable envelope sender addresses.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   167
 .B qmail-smtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   168
 will reject every recipient address for a message
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   169
-if the envelope sender address is listed in
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   170
+if the envelope sender address is listed in, or matches a POSIX regular expression
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   171
+pattern listed in,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   172
 .IR badmailfrom .
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   173
 A line in
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   174
 .I badmailfrom
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   175
@@ -49,6 +64,32 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   176
 .BR @\fIhost ,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   177
 meaning every address at
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   178
 .IR host .
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   179
+For more information, please have a look at doc/README.qregex.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   180
+.TP 5
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   181
+.I badmailfromnorelay
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   182
+Functions the same as the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   183
+.IR badmailfrom
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   184
+control file but is read only if the 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   185
+.B RELAYCLIENT 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   186
+environment variable is not set.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   187
+For more information, please have a look at doc/README.qregex.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   188
+.TP 5
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   189
+.I badmailto
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   190
+Unacceptable envelope recipient addresses.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   191
+.B qmail-smtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   192
+will reject every recipient address for a message if the recipient address
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   193
+is listed in,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   194
+or matches a POSIX regular expression pattern listed in,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   195
+.IR badmailto .
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   196
+For more information, please have a look at doc/README.qregex.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   197
+.TP 5
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   198
+.I badmailtonorelay
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   199
+Functions the same as the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   200
+.IR badmailto
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   201
+control file but is read only if the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   202
+.B RELAYCLIENT
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   203
+environment variable is not set.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   204
+For more information, please have a look at doc/README.qregex.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   205
 .TP 5
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   206
 .I databytes
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   207
 Maximum number of bytes allowed in a message,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   208
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/qmail-smtpd.c ./netqmail-1.05/netqmail-1.05/qmail-smtpd.c
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   209
--- ./netqmail-1.05.orig/netqmail-1.05/qmail-smtpd.c	2004-06-04 21:51:58.000000000 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   210
+++ ./netqmail-1.05/netqmail-1.05/qmail-smtpd.c	2006-04-23 00:12:33.441582382 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   211
@@ -23,6 +23,15 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   212
 #include "timeoutread.h"
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   213
 #include "timeoutwrite.h"
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   214
 #include "commands.h"
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   215
+#include "qregex.h"
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   216
+#include "strerr.h"
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   217
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   218
+#define BMCHECK_BMF 0
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   219
+#define BMCHECK_BMFNR 1
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   220
+#define BMCHECK_BMT 2
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   221
+#define BMCHECK_BMTNR 3
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   222
+#define BMCHECK_BHELO 4
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   223
+    
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   224
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   225
 #define MAXHOPS 100
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   226
 unsigned int databytes = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   227
@@ -49,7 +58,9 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   228
 void die_ipme() { out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); _exit(1); }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   229
 void straynewline() { out("451 See http://pobox.com/~djb/docs/smtplf.html.\r\n"); flush(); _exit(1); }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   230
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   231
-void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list (#5.7.1)\r\n"); }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   232
+void err_bmf() { out("553 sorry, your envelope sender has been denied (#5.7.1)\r\n"); }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   233
+void err_bmt() { out("553 sorry, your envelope recipient has been denied (#5.7.1)\r\n"); }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   234
+void err_bhelo() { out("553 sorry, your HELO host name has been denied (#5.7.1)\r\n"); }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   235
 void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)\r\n"); }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   236
 void err_unimpl(arg) char *arg; { out("502 unimplemented (#5.5.1)\r\n"); }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   237
 void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   238
@@ -93,9 +104,24 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   239
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   240
 int liphostok = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   241
 stralloc liphost = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   242
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   243
 int bmfok = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   244
 stralloc bmf = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   245
-struct constmap mapbmf;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   246
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   247
+int bmfnrok = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   248
+stralloc bmfnr = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   249
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   250
+int bmtok = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   251
+stralloc bmt = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   252
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   253
+int bmtnrok = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   254
+stralloc bmtnr = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   255
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   256
+int bhelook = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   257
+stralloc bhelo = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   258
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   259
+int logregex = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   260
+stralloc matchedregex = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   261
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   262
 void setup()
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   263
 {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   264
@@ -114,8 +140,21 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   265
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   266
   bmfok = control_readfile(&bmf,"control/badmailfrom",0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   267
   if (bmfok == -1) die_control();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   268
-  if (bmfok)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   269
-    if (!constmap_init(&mapbmf,bmf.s,bmf.len,0)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   270
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   271
+  bmfnrok = control_readfile(&bmfnr,"control/badmailfromnorelay",0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   272
+  if (bmfnrok == -1) die_control();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   273
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   274
+  bmtok = control_readfile(&bmt,"control/badmailto",0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   275
+  if (bmtok == -1) die_control();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   276
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   277
+  bmtnrok = control_readfile(&bmtnr,"control/badmailtonorelay",0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   278
+  if (bmtnrok == -1) die_control();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   279
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   280
+  bhelook = control_readfile(&bhelo, "control/badhelo",0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   281
+  if (bhelook == -1) die_control();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   282
+  if (env_get("NOBADHELO")) bhelook = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   283
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   284
+  if (env_get("LOGREGEX")) logregex = 1;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   285
  
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   286
   if (control_readint(&databytes,"control/databytes") == -1) die_control();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   287
   x = env_get("DATABYTES");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   288
@@ -197,14 +236,56 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   289
   return 1;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   290
 }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   291
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   292
-int bmfcheck()
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   293
+int bmcheck(which) int which;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   294
 {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   295
-  int j;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   296
-  if (!bmfok) return 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   297
-  if (constmap(&mapbmf,addr.s,addr.len - 1)) return 1;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   298
-  j = byte_rchr(addr.s,addr.len,'@');
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   299
-  if (j < addr.len)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   300
-    if (constmap(&mapbmf,addr.s + j,addr.len - j - 1)) return 1;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   301
+  int i = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   302
+  int j = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   303
+  int x = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   304
+  int negate = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   305
+  static stralloc bmb = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   306
+  static stralloc curregex = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   307
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   308
+  if (which == BMCHECK_BMF) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   309
+    if (!stralloc_copy(&bmb,&bmf)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   310
+  } else if (which == BMCHECK_BMFNR) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   311
+    if (!stralloc_copy(&bmb,&bmfnr)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   312
+  } else if (which == BMCHECK_BMT) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   313
+    if (!stralloc_copy(&bmb,&bmt)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   314
+  } else if (which == BMCHECK_BMTNR) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   315
+    if (!stralloc_copy(&bmb,&bmtnr)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   316
+  } else if (which == BMCHECK_BHELO) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   317
+    if (!stralloc_copy(&bmb,&bhelo)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   318
+  } else {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   319
+    die_control();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   320
+  }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   321
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   322
+  while (j < bmb.len) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   323
+    i = j;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   324
+    while ((bmb.s[i] != '\0') && (i < bmb.len)) i++;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   325
+    if (bmb.s[j] == '!') {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   326
+      negate = 1;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   327
+      j++;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   328
+    }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   329
+    if (!stralloc_copyb(&curregex,bmb.s + j,(i - j))) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   330
+    if (!stralloc_0(&curregex)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   331
+    if (which == BMCHECK_BHELO) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   332
+      x = matchregex(helohost.s, curregex.s);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   333
+    } else {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   334
+      x = matchregex(addr.s, curregex.s);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   335
+    }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   336
+    if ((negate) && (x == 0)) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   337
+      if (!stralloc_copyb(&matchedregex,bmb.s + j - 1,(i - j + 1))) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   338
+      if (!stralloc_0(&matchedregex)) die_nomem();      
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   339
+      return 1;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   340
+    }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   341
+    if (!(negate) && (x > 0)) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   342
+      if (!stralloc_copyb(&matchedregex,bmb.s + j,(i - j))) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   343
+      if (!stralloc_0(&matchedregex)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   344
+      return 1;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   345
+    }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   346
+    j = i + 1;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   347
+    negate = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   348
+  }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   349
   return 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   350
 }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   351
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   352
@@ -218,7 +299,9 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   353
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   354
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   355
 int seenmail = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   356
-int flagbarf; /* defined if seenmail */
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   357
+int flagbarfbmf; /* defined if seenmail */
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   358
+int flagbarfbmt;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   359
+int flagbarfbhelo;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   360
 stralloc mailfrom = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   361
 stralloc rcptto = {0};
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   362
 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   363
@@ -226,11 +309,13 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   364
 {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   365
   smtp_greet("250 "); out("\r\n");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   366
   seenmail = 0; dohelo(arg);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   367
+  if (bhelook) flagbarfbhelo = bmcheck(BMCHECK_BHELO);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   368
 }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   369
 void smtp_ehlo(arg) char *arg;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   370
 {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   371
   smtp_greet("250-"); out("\r\n250-PIPELINING\r\n250 8BITMIME\r\n");
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   372
   seenmail = 0; dohelo(arg);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   373
+  if (bhelook) flagbarfbhelo = bmcheck(BMCHECK_BHELO);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   374
 }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   375
 void smtp_rset(arg) char *arg;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   376
 {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   377
@@ -240,7 +325,11 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   378
 void smtp_mail(arg) char *arg;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   379
 {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   380
   if (!addrparse(arg)) { err_syntax(); return; }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   381
-  flagbarf = bmfcheck();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   382
+  flagbarfbmf = 0; /* bmcheck is skipped for empty envelope senders */
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   383
+  if ((bmfok) && (addr.len != 1)) flagbarfbmf = bmcheck(BMCHECK_BMF);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   384
+  if ((!flagbarfbmf) && (bmfnrok) && (addr.len != 1) && (!relayclient)) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   385
+    flagbarfbmf = bmcheck(BMCHECK_BMFNR);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   386
+  }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   387
   seenmail = 1;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   388
   if (!stralloc_copys(&rcptto,"")) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   389
   if (!stralloc_copys(&mailfrom,addr.s)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   390
@@ -250,7 +339,37 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   391
 void smtp_rcpt(arg) char *arg; {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   392
   if (!seenmail) { err_wantmail(); return; }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   393
   if (!addrparse(arg)) { err_syntax(); return; }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   394
-  if (flagbarf) { err_bmf(); return; }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   395
+  if (flagbarfbhelo) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   396
+    if (logregex) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   397
+      strerr_warn6("qmail-smtpd: badhelo: <",helohost.s,"> at ",remoteip," matches pattern: ",matchedregex.s,0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   398
+    } else {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   399
+      strerr_warn4("qmail-smtpd: badhelo: <",helohost.s,"> at ",remoteip,0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   400
+    }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   401
+    err_bhelo();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   402
+    return;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   403
+  }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   404
+  if (flagbarfbmf) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   405
+    if (logregex) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   406
+      strerr_warn6("qmail-smtpd: badmailfrom: <",mailfrom.s,"> at ",remoteip," matches pattern: ",matchedregex.s,0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   407
+    } else {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   408
+      strerr_warn4("qmail-smtpd: badmailfrom: <",mailfrom.s,"> at ",remoteip,0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   409
+    }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   410
+    err_bmf();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   411
+    return;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   412
+  }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   413
+  if (bmtok) flagbarfbmt = bmcheck(BMCHECK_BMT);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   414
+  if ((!flagbarfbmt) && (bmtnrok) && (!relayclient)) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   415
+    flagbarfbmt = bmcheck(BMCHECK_BMTNR);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   416
+  }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   417
+  if (flagbarfbmt) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   418
+    if (logregex) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   419
+      strerr_warn6("qmail-smtpd: badmailto: <",addr.s,"> at ",remoteip," matches pattern: ",matchedregex.s,0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   420
+    } else {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   421
+      strerr_warn4("qmail-smtpd: badmailto: <",addr.s,"> at ",remoteip,0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   422
+    }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   423
+    err_bmt();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   424
+    return;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   425
+  }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   426
   if (relayclient) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   427
     --addr.len;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   428
     if (!stralloc_cats(&addr,relayclient)) die_nomem();
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   429
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/qregex.c ./netqmail-1.05/netqmail-1.05/qregex.c
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   430
--- ./netqmail-1.05.orig/netqmail-1.05/qregex.c	1969-12-31 19:00:00.000000000 -0500
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   431
+++ ./netqmail-1.05/netqmail-1.05/qregex.c	2006-04-22 21:45:16.112776934 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   432
@@ -0,0 +1,57 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   433
+/*
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   434
+ * qregex (v2)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   435
+ * $Id: qregex.c,v 2.1 2001/12/28 07:05:21 evan Exp $
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   436
+ *
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   437
+ * Author  : Evan Borgstrom (evan at unixpimps dot org)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   438
+ * Created : 2001/12/14 23:08:16
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   439
+ * Modified: $Date: 2001/12/28 07:05:21 $
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   440
+ * Revision: $Revision: 2.1 $
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   441
+ *
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   442
+ * Do POSIX regex matching on addresses for anti-relay / spam control.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   443
+ * It logs to the maillog
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   444
+ * See the qregex-readme file included with this tarball.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   445
+ * If you didn't get this file in a tarball please see the following URL:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   446
+ *  http://www.unixpimps.org/software/qregex
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   447
+ *
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   448
+ * qregex.c is released under a BSD style copyright.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   449
+ * See http://www.unixpimps.org/software/qregex/copyright.html
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   450
+ *
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   451
+ * Note: this revision follows the coding guidelines set forth by the rest of
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   452
+ *       the qmail code and that described at the following URL.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   453
+ *       http://cr.yp.to/qmail/guarantee.html
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   454
+ * 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   455
+ */
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   456
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   457
+#include <sys/types.h>
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   458
+#include <regex.h>
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   459
+#include "qregex.h"
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   460
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   461
+#define REGCOMP(X,Y)    regcomp(&X, Y, REG_EXTENDED|REG_ICASE)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   462
+#define REGEXEC(X,Y)    regexec(&X, Y, (size_t)0, (regmatch_t *)0, (int)0)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   463
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   464
+int matchregex(char *text, char *regex) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   465
+  regex_t qreg;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   466
+  int retval = 0;
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   467
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   468
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   469
+  /* build the regex */
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   470
+  if ((retval = REGCOMP(qreg, regex)) != 0) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   471
+    regfree(&qreg);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   472
+    return(-retval);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   473
+  }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   474
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   475
+  /* execute the regex */
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   476
+  if ((retval = REGEXEC(qreg, text)) != 0) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   477
+    /* did we just not match anything? */
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   478
+    if (retval == REG_NOMATCH) {
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   479
+      regfree(&qreg);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   480
+      return(0);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   481
+    }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   482
+    regfree(&qreg);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   483
+    return(-retval);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   484
+  }
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   485
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   486
+  /* signal the match */
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   487
+  regfree(&qreg);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   488
+  return(1);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   489
+}
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   490
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/qregex.h ./netqmail-1.05/netqmail-1.05/qregex.h
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   491
--- ./netqmail-1.05.orig/netqmail-1.05/qregex.h	1969-12-31 19:00:00.000000000 -0500
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   492
+++ ./netqmail-1.05/netqmail-1.05/qregex.h	2006-04-22 21:45:16.112776934 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   493
@@ -0,0 +1,5 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   494
+/* simple header file for the matchregex prototype */
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   495
+#ifndef _QREGEX_H_
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   496
+#define _QREGEX_H_
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   497
+int matchregex(char *text, char *regex);
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   498
+#endif
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   499
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/README.qregex ./netqmail-1.05/netqmail-1.05/README.qregex
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   500
--- ./netqmail-1.05.orig/netqmail-1.05/README.qregex	1969-12-31 19:00:00.000000000 -0500
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   501
+++ ./netqmail-1.05/netqmail-1.05/README.qregex	2006-04-23 00:30:32.466336212 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   502
@@ -0,0 +1,203 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   503
+QREGEX (v2) 20060423 - README April 23, 2006
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   504
+A Regular Expression matching patch for qmail 1.03 and netqmail
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   505
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   506
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   507
+OVERVIEW:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   508
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   509
+qregex adds the ability to match address evelopes via Regular Expressions (REs)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   510
+in the qmail-smtpd process. It has the abiltiy to match `helo/ehlo` (host name),
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   511
+`mail from` (envelope sender), and `rcpt to` (envelope recipient) commands.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   512
+It follows all the base rules that are set out with qmail (ie using control
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   513
+files) so it makes for easy integretion into an existing setup (see the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   514
+install instructions for more info). The v2 is specified because qregex was
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   515
+re-written to better conform to the security guarantee set forth by the author
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   516
+of qmail. The original version used stdio.h and stdlib.h for reading the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   517
+control files whereas v2 now uses all stralloc functions which are much more
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   518
+regulated against buffer overruns and the like.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   519
+See: http://cr.yp.to/qmail/guarantee.html
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   520
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   521
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   522
+FEATURES:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   523
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   524
+Features of qregex include:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   525
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   526
+1. Performs pattern matching on envelope senders and envelope
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   527
+   recipients against REs in the badmailfrom and badmailto control
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   528
+   files. Two additional control files, badmailfromnorelay and
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   529
+   badmailtonorelay, are used for pattern matching when the 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   530
+   RELAYCLIENT environment variable is not set.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   531
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   532
+2. Performs pattern matching on the helo/ehlo host name. Setting the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   533
+   NOBADHELO environment variable prevents the host name from being
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   534
+   compared to the patterns in the badhelo control file.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   535
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   536
+3. Matches to patterns are logged. Setting the LOGREGEX environment
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   537
+   variable causes the matched regex pattern to be included in the log. 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   538
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   539
+4. Matching is case insensitive.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   540
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   541
+5. qregex ignores empty envelope senders. An empty envelope sender is not
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   542
+   compared to the patterns in the badmailfrom and badmailfromnorelay
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   543
+   control files and is always accepted.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   544
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   545
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   546
+PLATFORMS:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   547
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   548
+qregex has been built and tested on the following platforms. I'm sure it won't
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   549
+have any problems on any platform that qmail will run on (providing they have
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   550
+a regex interface) but if you run into problems let me know.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   551
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   552
+	- OpenBSD 3.x
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   553
+	- FreeBSD 4.x, 5.x
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   554
+	- Mandrake Linux 9.x
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   555
+	- SuSE Linux 8.x
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   556
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   557
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   558
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   559
+INSTALLATION INSTRUCTIONS:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   560
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   561
+Installation is very simple, there is only one requirement. You need to use the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   562
+GNU version of the patch utility (http://www.gnu.org/software/patch/patch.html).
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   563
+(For Solaris 8 users it is installed as 'gpatch')
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   564
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   565
+- If this is a new setup.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   566
+Unpack the qmail archive, cd into the qmail-1.03 directory and run
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   567
+"patch < /path/to/qregex-<version>.patch". Follow the instructions as per the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   568
+included qmail INSTALL file. Once you are done come back to this file and read
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   569
+the section on the control files.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   570
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   571
+If you are using netqmail, then unpack the netqmail archive. Run the collate.sh
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   572
+script and cd into the resulting netqmail-<version> directory. From there, run
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   573
+"patch < /path/to/qregex-<version>.patch". Complete the netqmail installation
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   574
+normally. Once you are done, come back to this file and read the section on the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   575
+control files.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   576
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   577
+- If this is an existing setup.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   578
+FIRST: create your control files (see below).
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   579
+cd into your existing qmail or netqmail source directory. Run
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   580
+"patch < /path/to/qregex-<version>.patch" then "make qmail-smtpd". Now run
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   581
+./qmail-smtpd and test your new rules to make sure they work as expected.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   582
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   583
+Install the new binary by cd'ing to /var/qmail/bin and as root (in one command)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   584
+copy the existing binary to 'qmail-smtpd.old' and copy the new binary from the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   585
+source directory to 'qmail-smtpd'.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   586
+(ex. cp qmail-smtpd qmail-smtpd.old && cp ~/qmail-1.03/qmail-smtpd qmail-smtpd)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   587
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   588
+You can also optionally just run "make setup check" as it will install the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   589
+updated documentation and man pages provided with this patch. Stopping qmail
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   590
+before doing the "make setup check" is always a good idea.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   591
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   592
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   593
+LOGGING:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   594
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   595
+qregex will log matches to the patterns in the various control files. Log
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   596
+messages will take these three forms depending on which control file was
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   597
+matched:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   598
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   599
+badhelo
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   600
+qmail-smtpd: badhelo: <host> at <remote IP>
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   601
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   602
+badmailfrom and badmailfromnorelay
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   603
+qmail-smtpd: badmailfrom: <sender address> at <remote IP>
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   604
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   605
+badmailto and badmailtonorelay
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   606
+qmail-smtpd: badmailto: <rcpt address> at <remote IP>
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   607
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   608
+When the LOGREGEX environment variable is set, the matched pattern will
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   609
+be included in the log. Log messages will have the regex pattern appended
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   610
+to them. For example, a badhelo log message will look like this:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   611
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   612
+qmail-smtpd: badhelo: <host> at <remote IP> matches pattern: <regex>
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   613
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   614
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   615
+CONTROL FILES:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   616
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   617
+qregex provides you with five control files. None of these control files
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   618
+is mandatory and you can use them in any combination you choose in your setup.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   619
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   620
+The "control/badmailfrom" and "control/badmailto" files contain your REs for
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   621
+matching against the 'mail from' (envelope sender) and 'rcpt to' (envelope
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   622
+recipient) smtp commands respectively.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   623
+The "control/badmailfromnorelay" and "control/badmailtonorelay" match against
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   624
+the same commands but are read only when the RELAYCLIENT environment variable
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   625
+is not set.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   626
+The "control/badhelo" file matches against the 'helo/ehlo' smtp command.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   627
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   628
+If you prefer you can symlink the badmailfrom and badmailto control files
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   629
+(ln -s badmailfrom badmailto) and maintain fewer sets of rules. Beware
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   630
+this might cause problems in certain setups.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   631
+        
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   632
+	Here's an example "badhelo" file.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   633
+	-----------------------------------
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   634
+	# block host strings with no dot (not a FQDN)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   635
+	!\.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   636
+	-----------------------------------
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   637
+	
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   638
+	An example "badmailfrom" file.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   639
+	-----------------------------------
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   640
+	# this will drop everything containing the string
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   641
+	# bad.domain.com or Bad.Domain.Com or BAD.domain.COM
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   642
+	bad\.domain\.com
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   643
+	# force users to fully qualify themselves
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   644
+	# (i.e. deny "user", accept "user@domain")
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   645
+	!@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   646
+	-----------------------------------
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   647
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   648
+	And "badmailto" (a little more interesting)
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   649
+	-----------------------------------
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   650
+	# must not contain invalid characters, brakets or multiple @'s
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   651
+	[!%#:*^(){}]
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   652
+	@.*@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   653
+	-----------------------------------
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   654
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   655
+You can use the non-RE character '!' to start an RE as a signal to qregex to
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   656
+negate the action. As used above in the badmailfrom file, by negating the '@'
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   657
+symbol qregex will signal qmail-smtpd to deny the 'mail from' command whenever
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   658
+the address doesn't contain an @ symbol. When used inside a bracket expression,
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   659
+the '!' character looses this special meaning. This is shown in the badmailto
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   660
+example.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   661
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   662
+The norelay control files follow the same rules as the other control files but
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   663
+are intended to address two specific scenarios.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   664
+The badmailfromnorelay file can be used to block mail trying to spoof a domain
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   665
+hosted on your mail server. It prevents a mail client that is not allowed to
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   666
+relay email through your server from using one of your hosted domains as its
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   667
+envelope sender.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   668
+The badmailtonorelay file can be used to create email addresses that cannot
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   669
+receive mail from any source not allowed to relay email through your server.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   670
+This is handy for creating email addresses for use only within your own 
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   671
+domain(s) that can't receive spam from the world at large.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   672
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   673
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   674
+INTERNALS:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   675
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   676
+qregex (or regexmatch as the function is called) will be called during the
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   677
+`helo/ehlo`, `rcpt to` and `mail from` handling routines in "qmail-smtpd.c".
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   678
+When called, it will read the proper control file then one by one compile and
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   679
+execute the regex on the string passed into qmail-smtpd. If the regex matches
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   680
+it returns TRUE (1) and the qmail-smtpd process will deny the user the ability
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   681
+to continue. If you change anything and think it betters this patch please
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   682
+send me a new diff file so I can take a peek.
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   683
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   684
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   685
+CONTACT:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   686
+qregex is maintained by:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   687
+	Andrew St. Jean
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   688
+	andrew@arda.homeunix.net
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   689
+	www.arda.homeunix.net/store/qmail/
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   690
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   691
+Contributers to qregex:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   692
+	Jeremy Kitchen	
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   693
+	kitchen at scriptkitchen dot com
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   694
+	http://www.scriptkitchen.com/qmail
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   695
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   696
+	Alex Pleiner
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   697
+	alex@zeitform.de
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   698
+	zeitform Internet Dienste
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   699
+	http://www.zeitform.de/
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   700
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   701
+	Thanos Massias
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   702
+
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   703
+Original qregex patch written by:
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   704
+	Evan Borgstrom
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   705
+	evan at unixpimps dot org
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   706
diff -u --unidirectional-new-file ./netqmail-1.05.orig/netqmail-1.05/TARGETS ./netqmail-1.05/netqmail-1.05/TARGETS
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   707
--- ./netqmail-1.05.orig/netqmail-1.05/TARGETS	1998-06-15 06:53:16.000000000 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   708
+++ ./netqmail-1.05/netqmail-1.05/TARGETS	2006-04-22 21:45:16.113776757 -0400
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   709
@@ -252,6 +252,7 @@
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   710
 qmail-qmtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   711
 qmail-smtpd.o
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   712
 qmail-smtpd
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   713
+qregex.o
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   714
 sendmail.o
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   715
 sendmail
b375914441b2 mq init; added pristine patches + fix for qregex
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff changeset
   716
 tcp-env.o