Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

helo: use valid_regexes from utils

  • Loading branch information...
commit e849eb173a450df5d67526414d8cce7e60c2a06e 1 parent 7f8d742
@msimerson msimerson authored
Showing with 2 additions and 17 deletions.
  1. +2 −17 plugins/helo.checks.js
View
19 plugins/helo.checks.js
@@ -1,6 +1,7 @@
// Check various bits of the HELO string
var dns = require('dns');
var net_utils = require('./net_utils');
+var utils = require('./utils');
var checks = [
'init', // config loading, multiplicity detection
@@ -70,7 +71,7 @@ exports.register = function () {
load_config();
var load_re_file = function () {
- var regex_list = plugin.valid_regexes(plugin.config.get('helo.checks.regexps', 'list', load_re_file));
+ var regex_list = utils.valid_regexes(plugin.config.get('helo.checks.regexps', 'list', load_re_file));
// pre-compile the regexes
plugin.cfg.list_re = new RegExp('^(' + regex_list.join('|') + ')$', 'i');
};
@@ -504,19 +505,3 @@ exports.get_a_records = function (host, cb) {
return cb(null, ips);
});
};
-
-exports.valid_regexes = function (list, file) {
- // accepts an array of regexes and a file name
- var valid = [];
- for (var i=0; i<list.length; i++) {
- try {
- new RegExp(list[i]);
- }
- catch (e) {
- this.logerror(this, "invalid regex in " + file + ", " + list[i]);
- continue;
- }
- valid.push(list[i]);
- }
- return valid; // returns a list of valid regexes
-};
Please sign in to comment.
Something went wrong with that request. Please try again.