On Sun, Sep 07, 2003 at 07:05:17PM -0400, Courier User wrote:
On Sun, Sep 07, 2003 at 05:49:55PM -0400, Sam Varshavchik wrote:
Courier User writes:
On Sun, Sep 07, 2003 at 05:09:44PM -0400, Sam Varshavchik wrote:
Courier User writes:
However, the following case is not specifically mentioned, and so
can I therefore assume that it is not covered? ...
badfrom user@.domain
Reject all mail with the return address of
<user@anything.domain>.
Correct. It is not covered.
Thank you.
Was this case omitted for a specific reason, or was it left out as
an oversight?
This case was simply not implemented.
If there was no specific reason for this omission, is there any
chance that this case will be offered in a future release of
Courier?
If someone else does this, I'll look at the patch.
How about this (based on 0.43.1)?
Correction:
*** courier/bofh.c.orig Sun Sep 7 18:21:53 2003
--- courier/bofh.c Sun Sep 7 19:17:23 2003
***************
*** 220,225 ****
--- 220,247 ----
return (chkbadlist(pp, bofh_spamtrap));
}
+ static int chkusersubdom(const char *p, const char *d, const char *name)
+ {
+ const char *dn, *dn1, *d1;
+ int lp, ln, ldp, ldn;
+ if (p == NULL || d == NULL || d <= p || d[1] != '.'
+ || name == NULL || (dn = strrchr(name, '@')) == NULL)
+ {
+ return (0);
+ }
+
+ lp = d - p;
+ ln = dn - name;
+ if (lp != ln || strncmp(p, name, ln) != 0)
+ {
+ return (0);
+ }
+
+ return ((ldn = strlen(dn1 = dn + 1)) > 0
+ && (ldp = strlen(d1 = d + 1)) <= ldn
+ && strcmp(dn1 + (ldn - ldp), d1) == 0);
+ }
+
static int chkbadlist(const char *pp, struct bofh_list *b)
{
char *p=courier_malloc(strlen(pp)+1);
***************
*** 235,241 ****
for (; b; b=b->next)
{
if ((d && strcmp(d, b->name) == 0)
! || /* Entire domain */
strcmp(p, b->name) == 0
|| (d && strncmp(b->name, "@.", 2) == 0
&& (ll=strlen(b->name+1)) < l
--- 257,265 ----
for (; b; b=b->next)
{
if ((d && strcmp(d, b->name) == 0)
! || /* Entire domain with user ID */
! chkusersubdom(p, d, b->name)
! || /* Entire domain without user ID */
strcmp(p, b->name) == 0
|| (d && strncmp(b->name, "@.", 2) == 0
&& (ll=strlen(b->name+1)) < l