Skip to content

Commit

Permalink
Merge branch 'master' into dkim-as-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson authored Apr 11, 2024
2 parents 4b4c7e6 + 8b3a76e commit 8777eb7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#### Changed

- dkim: repackaged as NPM module #3311
- check for local_mx only when default route is used #3307
- test: add a connection.response test case with DSN #3305
- deps: bump all versions to latest #3303
- auth_base: enable disabling constrain_sender at runtime #3298
Expand Down
30 changes: 13 additions & 17 deletions outbound/hmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,10 @@ class HMailItem extends events.EventEmitter {

// if none of the above return codes, drop through to this...
mx_lookup.lookup_mx(this.todo.domain, (err, mxs) => {
this.found_mx(err, mxs);
});
if (mxs) mxs.forEach(m => { m.from_dns = true; });

this.found_mx (err, mxs)
})
}

found_mx (err, mxs) {
Expand Down Expand Up @@ -272,15 +274,11 @@ class HMailItem extends events.EventEmitter {
if (mxlist[mx].path) {
this.mxlist.push(mxlist[mx]);
}
else if (obc.cfg.ipv6_enabled) {
this.mxlist.push(
{ exchange: mxlist[mx].exchange, priority: mxlist[mx].priority, port: mxlist[mx].port, using_lmtp: mxlist[mx].using_lmtp, family: 'AAAA' },
{ exchange: mxlist[mx].exchange, priority: mxlist[mx].priority, port: mxlist[mx].port, using_lmtp: mxlist[mx].using_lmtp, family: 'A' }
);
}
else {
mxlist[mx].family = 'A';
this.mxlist.push(mxlist[mx]);
if (obc.cfg.ipv6_enabled) {
this.mxlist.push(Object.assign({}, mxlist[mx], { family: 'AAAA' }));
}
this.mxlist.push(Object.assign({}, mxlist[mx], { family: 'A' }));
}
}
this.try_deliver();
Expand All @@ -300,11 +298,9 @@ class HMailItem extends events.EventEmitter {
const mx = this.mxlist.shift();
const host = mx.exchange;

if (!obc.cfg.local_mx_ok) {
if (await net_utils.is_local_host(host)) {
this.loginfo(`MX ${host} is local, skipping since local_mx_ok=false`)
return this.try_deliver(); // try next MX
}
if (!obc.cfg.local_mx_ok && mx.from_dns && await net_utils.is_local_host(host)) {
this.loginfo(`MX ${host} is local, skipping since local_mx_ok=false`)
return this.try_deliver(); // try next MX
}

this.force_tls = this.todo.force_tls;
Expand Down Expand Up @@ -371,7 +367,7 @@ class HMailItem extends events.EventEmitter {
host = mx.path;
}

this.logdebug(`delivering from: ${mx.bind_helo} to: ${host}:${port}${mx.using_lmtp ? " using LMTP" : ""} (${delivery_queue.length()}) (${temp_fail_queue.length()})`)
this.logdebug(`delivering from: ${mx.bind_helo} to: ${host}:${port}${mx.using_lmtp ? " using LMTP" : ""}${mx.from_dns ? " (via DNS)" : ""} (${delivery_queue.length()}) (${temp_fail_queue.length()})`)
client_pool.get_client(port, host, mx.bind, !!mx.path, (err, socket) => {
if (err) {
if (/connection timed out|connect ECONNREFUSED/.test(err)) {
Expand Down Expand Up @@ -729,7 +725,7 @@ class HMailItem extends events.EventEmitter {
// The response is our challenge
return send_command(cram_md5_response(mx.auth_user, mx.auth_pass, resp));
default:
// This shouldn't happen...
// This shouldn't happen...
}
}
// Error
Expand Down

0 comments on commit 8777eb7

Please sign in to comment.