My problem is that we have tons of subdomains and I would like to make a
rule like “Default inbound”.
The problem ist that policyd does not accept my subdomains.
The corresponding Group is “internal_domains” which looks like this:
Members:
@example.ch
@*.example.ch (BUT THIS DOES NOT MATCH THE SUBDOMAINS)
What can I do to include all subdomains of example.ch?
Hi,
Could you please try the attached patch which allows wildcards for
addresses and let us know if this helps?
eg. u...@*.example.org
us...@*.org
*...@*.example.org
- Robert
Index: cbp/policies.pm
===================================================================
--- cbp/policies.pm (revision 510)
+++ cbp/policies.pm (working copy)
@@ -525,8 +525,23 @@
my ($email_user,$email_domain) = ($email =~ /^(\S+)@(\S+)$/);
my ($template_user,$template_domain) = ($template =~ /^(\S*)@(\S+)$/);
- if (lc($email_domain) eq lc($template_domain) && (lc($email_user) eq lc($template_user) || $template_user eq "")) {
- $match = 1;
+ # Make sure its all lowercase
+ $template_user = lc($template_user);
+ $template_domain = lc($template_domain);
+
+ # Replace all .'s with \.'s
+ $template_user =~ s/\./\\./g;
+ $template_domain =~ s/\./\\./g;
+
+ # Change *'s into a proper regex expression
+ $template_user =~ s/\*/\\S*/g;
+ $template_domain =~ s/\*/\\S*/g;
+
+ # Check if we have a match
+ if ($email_domain =~ /^$template_domain$/) {
+ if (($email_user =~ $template_user) || $template_user =~ /^$/) {
+ $match = 1;
+ }
}
return $match;
_______________________________________________
Users mailing list
[email protected]
http://lists.policyd.org/mailman/listinfo/users