Skip to content

Commit

Permalink
tls_socket: remove secureConnection (#3337)
Browse files Browse the repository at this point in the history
I tested this manually via sending (STARTTLS) and then client side via outbound and nothing blew up. What else should be tested?

Other changes in this pull request:

- logger: check Object.hasOwn to avoid circular deps
- .gitignore: add config/me and config/*.pem

Fixes #2743

Checklist:
- [x] [Changes](https://github.com/haraka/Haraka/blob/master/Changes.md)
updated
  • Loading branch information
msimerson authored Apr 29, 2024
1 parent a9e58a1 commit 2b78d50
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ bower_components
coverage
.nyc_output
.idea
config/me
config/dhparams.pem
config/tls_cert.pem
config/tls_key.pem
tests/node_modules
tests/queue/plain
tests/queue/multibyte
Expand Down
3 changes: 3 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- logger: don't load outbound (race condition). Instead, set name property #3322
- logger: extend add_log_methods to Classes (connection, plugins, hmail) #3322
- logger: when logging via `logger` methods, use short names #3322
- logger: check Object.hasOwn to avoid circular deps
- outbound: delete try_deliver_host. Use net_utils to resolve MX hosts to IPs #3322
- outbound: remove config setting ipv6_enabled #3322
- outbound: remove undocumented use of send_email with arity of 2. #3322
Expand All @@ -47,6 +48,8 @@
- remove last vestiges of header_hide_version (long ago renamed)
- server.js: use the local logger methods
- get Haraka version from utils.getVersion (which includes git id if running from repo)
- tls_socket: remove secureConnection. Fixes #2743
- .gitignore: add config/me and config/*.pem
- test: convert test runner to mocha

#### Fixed
Expand Down
6 changes: 4 additions & 2 deletions logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,12 @@ logger.add_log_methods = (object, logName) => {
const fnNames = [`log${level.toLowerCase()}`]

// logger also gets short names
if (object.name === 'logger') fnNames.push(level.toLowerCase())
if (Object.hasOwn(object, 'name') && object.name === 'logger') {
fnNames.push(level.toLowerCase())
}

for (const fnName of fnNames) {
if (object[fnName]) continue; // already added
if (Object.hasOwn(object, fnName)) continue; // already added
object[fnName] = logger.log_if_level(level, `LOG${level}`, logName);
}
}
Expand Down
8 changes: 1 addition & 7 deletions tls_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ class pluggableStream extends stream.Stream {
this.emit('secureConnect', a, b);
this.emit('secure', a, b);
});
this.targetsocket.on('secureConnection', (a, b) => {
// investigate this for removal, see #2743
this.emit('secureConnection', a, b);
this.emit('secure', a, b);
});
this.targetsocket.on('secure', (a, b) => {
this.emit('secureConnection', a, b);
this.emit('secure', a, b);
});
this.targetsocket.on('end', () => {
Expand Down Expand Up @@ -107,7 +101,7 @@ class pluggableStream extends stream.Stream {
}
clean (data) {
if (this.targetsocket?.removeAllListeners) {
for (const name of ['data', 'secure', 'secureConnect', 'secureConnection', 'end', 'close', 'error', 'drain']) {
for (const name of ['data', 'secure', 'secureConnect', 'end', 'close', 'error', 'drain']) {
this.targetsocket.removeAllListeners(name);
}
}
Expand Down

0 comments on commit 2b78d50

Please sign in to comment.