Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Jan 21, 2025
1 parent 35cad55 commit 904c202
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
6 changes: 3 additions & 3 deletions config/connection.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

[haproxy]
; Arrays: hosts that Haraka should enable the PROXY protocol from.
hosts_ipv4[]
hosts_ipv4[] =
; hosts_ipv4[] = 192.0.2.4/32
; hosts_ipv4[] = 192.0.2.5/32
hosts_ipv6[]
hosts_ipv6[] =
; hosts_ipv6[] = [2001:db8::1/64]
; hosts_ipv6[] = [2001:db8::2/64]

Expand Down Expand Up @@ -61,4 +61,4 @@ close=closing connection. Have a jolly good day.
banner_chars=6

; include N characters of the uuid (in brackets) at the start of each line of the deny message
deny_chars=6
deny_chars=0
4 changes: 2 additions & 2 deletions connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ class Connection {
});

const ha_list = net.isIPv6(self.remote.ip) ? cfg.haproxy.hosts_ipv6 : cfg.haproxy.hosts_ipv4;

if (ha_list.some((element, index, array) => {
if (!element) return
return ipaddr.parse(self.remote.ip).match(element[0], element[1]);
})) {
self.proxy.allowed = true;
Expand Down Expand Up @@ -1291,7 +1291,7 @@ class Connection {

let results;
try {
results = rfc1869.parse('mail', line, (!relaying && cfg.main.strict_rfc1869));
results = rfc1869.parse('mail', line, (!this.relaying && cfg.main.strict_rfc1869));
}
catch (err) {
this.errors++;
Expand Down
9 changes: 0 additions & 9 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ Server.load_smtp_ini = () => {
nodes: 1,
};

Server.cfg.headers.max_received = parseInt(Server.cfg.headers.max_received) || parseInt(Server.config.get('max_received_count')) || 100;
Server.cfg.headers.max_lines = parseInt(Server.cfg.headers.max_lines) || parseInt(Server.config.get('max_header_lines')) || 1000;

const strict_ext = Server.config.get('strict_rfc1869');
if (Server.cfg.main.strict_rfc1869 === false && strict_ext) {
Server.logwarn(`legacy config config/strict_rfc1869 is overriding smtp.ini`)
Server.cfg.main.strict_rfc1869 = strict_ext;
}

for (const key in defaults) {
if (Server.cfg.main[key] !== undefined) continue;
Server.cfg.main[key] = defaults[key];
Expand Down
2 changes: 1 addition & 1 deletion test/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const DSN = require('haraka-dsn')
const connection = require('../connection');
const Server = require('../server');

// huge hack here, but plugin tests need constants
// hack alert, but plugin tests need constants
constants.import(global);

const _set_up = (done) => {
Expand Down

0 comments on commit 904c202

Please sign in to comment.