(@|.)domain.com

Thomas




Von:    "K Post" <nntp.p...@gmail.com>
An:     "ASSP development mailing list" <assp-test@lists.sourceforge.net>
Datum:  24.10.2021 04:36
Betreff:        [Assp-test] Concept question with sample code: 
DKIMWLAddresses single line for .domain.com and @domain.com?



(I believe I have this working, see code please)

I estimate that at least 90% of the time that I want to add an entry to 
DKIMWLAddresses that I put two lines, one for @domain.com and the other to 
match the subdomains, so .domain.com.

That's fine,and works well, but I'd like to see ASSP allow admins to use a 
single line shorthand for signatures ending in both .domain.com and @
domain.com.  So instead of
@domain.com
.domain.com
just do the shorthand of
>>domain.com

The last time I asked for a new feature, you suggested that I try coding 
it myself, so I did.  There's no pride in authorship here, I'm a LOUSY 
coder.  I'd love to see how you tackle this, provided that my concept's 
sound.

I picked the >> characters, since > is illegal in email addresses / domain 
names.  Originally, I selected the + character, but that can be in the 
user part of the email address.  >> is highly visible when scanning 
through config files, a single > wasn't as easy for me to spot.

So,I tested out modifying the setDKIMNPAddressesRE and 
setDKIMWLAddressesRE functions, from:
my $new=shift;
    $new||=$neverMatch; # regexp that never matches
    SetRE('DKIMWLAddressesRE',"(?:$new)\$",
          $regexMod,
          'DKIM whitelisted',$_[0]);

to:
my $new=shift;
    $new||=$neverMatch; # regexp that never matches
$new=~s/>>(.*)(\||$)/(\\\.|\\\@\)$1$2/go;
    SetRE('DKIMWLAddressesRE',"(?:$new)\$",
          $regexMod,
          'DKIM whitelisted',$_[0]);

If my hack coding is correct, this will take the existing string, which is 
already a regex compiled by ASSP based on the non-regex DKIMWL/NPAddresses 
entered by the user, look for

>>whatever| or >>whatever at the end of the string and change that to
(\@|\.)whever| or no | if it's the end of the string

In my rudimentary testing, that seems to work.   

What do you think?  

That would cut down my DKIMWLAddresses down by close to 50%, and make 
management much easier.



_______________________________________________
Assp-test mailing list
Assp-test@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/assp-test




DISCLAIMER:
*******************************************************
This email and any files transmitted with it may be confidential, legally 
privileged and protected in law and are intended solely for the use of the 

individual to whom it is addressed.
This email was multiple times scanned for viruses. There should be no 
known virus in this email!
*******************************************************


_______________________________________________
Assp-test mailing list
Assp-test@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/assp-test

Reply via email to