Bug 8188 - dns_block_rule does not accept underscore in domain
Summary: dns_block_rule does not accept underscore in domain
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: 4.0.0
Hardware: PC Linux
: P2 minor
Target Milestone: 4.0.1
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-24 10:30 UTC by jaroslav
Modified: 2023-11-24 09:23 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description jaroslav 2023-09-24 10:30:04 UTC
Configuration validation (lint) fails if the domain name contains underscore character in dns_block_rule setting - for example:

dns_block_rule PROVIDER_BLOCKED _myuniquekey.service.provider.com

This patch adds underscore to the list of allowed characters:

--- /usr/share/perl5/Mail/SpamAssassin/Conf.pm.old      2023-09-24 12:17:56.804596750 +0200
+++ /usr/share/perl5/Mail/SpamAssassin/Conf.pm  2023-09-24 12:18:06.140635207 +0200
@@ -2077,7 +2077,7 @@
       my $rule = $1;
       foreach my $domain (split(/\s+/, lc($2))) {
         $domain =~ s/^\.//; $domain =~ s/\.\z//;  # strip dots
-        if ($domain !~ /^[a-z0-9.-]+$/) {
+        if ($domain !~ /^[a-z0-9.-_]+$/) {
           return $INVALID_VALUE;
         }
         # will end up in filename, do not allow / etc in above regex!

(Underscore should be an acceptable character in filename on every relevant operating system I know of.)
Comment 1 Henrik Krohns 2023-09-24 12:20:24 UTC
Thanks, though there was a bug in your patch (".-_" means all chars between . and _). :-)

Sending        trunk/lib/Mail/SpamAssassin/Conf.pm
Transmitting file data .done
Committing transaction...
Committed revision 1912526.