Skip to content
Browse files

Okay, removed allow_subdomain since we now have regex support. Again

I will have to do this for lookup_rdns to.
  • Loading branch information...
1 parent 59b2dcd commit 4ff2eea23157791f371aa4e73fc9bc910357c66f @godsflaw godsflaw committed
Showing with 13 additions and 32 deletions.
  1. +0 −1 config/host_list.ini
  2. +2 −1 config/host_list_regex
  3. +2 −10 docs/plugins/rcpt_to.in_host_list.md
  4. +9 −20 plugins/rcpt_to.in_host_list.js
View
1 config/host_list.ini
@@ -1 +0,0 @@
-allow_subdomains=1
View
3 config/host_list_regex
@@ -1 +1,2 @@
-# add regexes in here we want to accept mail for
+# Add regexes in here we want to accept mail for. Please try to anchor
+# your regexes to reduce the chance of false matches.
View
12 docs/plugins/rcpt_to.in_host_list.md
@@ -15,13 +15,5 @@ Configuration
* host_list_regex
- Specifies the list of regexes that are local to this server.
-
-* host_list.ini
-
- Specifies the following sub-configuration:
-
- * allow_subdomains=[1|0]
-
- Whether or not the hosts in `host_list` will match subdomains.
-
+ Specifies the list of regexes that are local to this server. Please
+ try to always anchor your regexes to reduce the chance of false matches.
View
29 plugins/rcpt_to.in_host_list.js
@@ -12,24 +12,17 @@ exports.hook_rcpt = function(next, connection, params) {
var domain = rcpt.host.toLowerCase();
var host_list = this.config.get('host_list', 'list');
var host_list_regex = this.config.get('host_list_regex', 'list');
- var allow_subdomain =
- this.config.get('host_list.ini', 'ini').main.allow_subdomains;
-
+
var i = 0;
for (i in host_list) {
- var tmp_domain = domain;
- while (tmp_domain.match(/\./)) {
- this.logdebug("checking " + tmp_domain + " against " +
- host_list[i]);
+ while (domain.match(/\./)) {
+ this.logdebug("checking " + domain + " against " + host_list[i]);
// normal matches
- if (host_list[i].toLowerCase() === tmp_domain) {
- this.logdebug("Allowing " + tmp_domain);
+ if (host_list[i].toLowerCase() === domain) {
+ this.logdebug("Allowing " + domain);
return next(OK);
}
- if (allow_subdomain) {
- tmp_domain = tmp_domain.replace(/^[^\.]*\./, '');
- }
else {
break;
}
@@ -37,21 +30,17 @@ exports.hook_rcpt = function(next, connection, params) {
}
for (i in host_list_regex) {
- var tmp_domain = domain;
- while (tmp_domain.match(/\./)) {
- this.logdebug("checking " + tmp_domain + " against " +
+ while (domain.match(/\./)) {
+ this.logdebug("checking " + domain + " against " +
host_list_regex[i]);
var regex = new RegExp (host_list_regex[i]);
// regex matches
- if (tmp_domain.match(regex)) {
- this.logdebug("Allowing " + tmp_domain);
+ if (domain.match(regex)) {
+ this.logdebug("Allowing " + domain);
return next(OK);
}
- if (allow_subdomain) {
- tmp_domain = tmp_domain.replace(/^[^\.]*\./, '');
- }
else {
break;
}

0 comments on commit 4ff2eea

Please sign in to comment.
Something went wrong with that request. Please try again.