I've revisited my hack, and made the following, much simpler change.

--- assp.pl.orig        2008-02-04 01:04:12.000000000 +1100
+++ assp.pl     2008-02-04 01:05:58.000000000 +1100
@@ -13449,6 +13449,7 @@
  $new=checkOptionList($new,$name,$init);
  $new=~s/([\.\[\]\-\(\)\*\+\\])/\\$1/g;
   if ($name eq "localDomains") {
+        $new=~s/\\\*/\.\{0,32\}/g;
        $localdomainre=$new;
        $localdomainre=~s/\|/\|by /g;
        $localdomainre="by $localdomainre";

I've essentially copied the code which converts '\*' to .{0,32} from the
ConfigMakeSLRe
function into ConfigMakeRe (where processing 'localDomains') thus
emulating the ability
to use '*' for a wildcard.   Wildcard domains (such as *mydomain.com and
*.mydomain.com)
are now dealt with cleanly and easily.

Regards
David


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David le
Blanc
Sent: Sunday, 3 February 2008 12:28 AM
To: ASSP development mailing list
Subject: [Assp-test] localdomains


Hi dev list,

I'm running a mail server for a site with 'wildcard' domains.  The
wildcard ('*.mydomain.com') means
that anyone can email '[EMAIL PROTECTED]', and it will be
delivered.

What is done with that email once it arrives usually depends on sendmail
trickery
and some scripting.


Now, I am using (a) local address validation and (b) 'localDomains',

For (a)..

The local address validation is two-fold, firstly with a localuser list,
which
looks like the 'localdomains' list, with '@' signs at the beginning of
each line,
however some domains are missing, which in turn fall through to the LDAP
verification.

This allows me to accepts ALL mail for some domains, and perform LDAP
verification for those
domains that require it.  

To support the 'wildcard' domains, I added '@*.mydomain.com' to the
local users list, and
ASSP.PL is clever enough to notice the '*' and convert it to '.{0,32}'
when compiling the
regular expression.  Very clever I must say.

For (b)..

The 'domains' file (file:files//localdomains) contains the exact set of
"base" domains, 
and when an email arrives for '[EMAIL PROTECTED]' it is
rejected for attempting
to relay.

Being easily excitable I added a '*', and imaging my surprise when the
localdomains handler
recognized the '*' and promptly escaped it!!

So solve for (b), I've edited the source (around line 13470) to the
following (hopefully
the formatting survives).



sub ConfigMakeRe {                                              sub
ConfigMakeRe {
 my ($name, $old, $new, $init)[EMAIL PROTECTED];                               
my
($name, $old, $new, $init)[EMAIL PROTECTED];
 mlog(0,"AdminUpdate: $name changed from '$old' to '$new'") u
mlog(0,"AdminUpdate: $name changed from '$old' to '$new'") u
 $new=checkOptionList($new,$name,$init);
$new=checkOptionList($new,$name,$init);
                                                              >
$new=~s/([\.\[\]\-\(\)\*\+\\])/\\$1/g;
  if ($name eq "localDomains") {                                  if
($name eq "localDomains") {
        $localdomainre=$new;
$localdomainre=$new;
        $localdomainre=~s/\|/\|by /g;
$localdomainre=~s/\|/\|by /g;
        $localdomainre="by $localdomainre";
$localdomainre="by $localdomainre";
        #mlog(0,"$localdomainre");
#mlog(0,"$localdomainre");
                                                              <
        } else {                                              <
        $new=~s/([\.\[\]\-\(\)\*\+\\])/\\$1/g;                <
        }
}

 $new||='^(?!)'; # regexp that never matches
$new||='^(?!)'; # regexp that never matches

 $MakeRE{$name}->($new);
$MakeRE{$name}->($new);
 '';                                                             '';
}                                                               }


As you can see, I've moved the line to escape the pattern into an 'else'
so it is not performed
when dealing with the 'localdomains' field.

This of course has its own problems, least of all 'localdomainre' is
built from an unescaped RE, the
consequences of which I've avoided thinking through, and the
localdomains RE is now completely
unescaped, meaning that '.'s have special meaning..... nasty all around.


My Question, Can the 'localdomains' field regular expression ($LDRE) be
handled the same as the LocalAddresses
field regular expression to allow expansion of wildcard domains?

BTW, I'm running 1.3.5 (13.4)

Thanks
David





------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Assp-test mailing list
Assp-test@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/assp-test

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Assp-test mailing list
Assp-test@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/assp-test

Reply via email to