Socket
Socket
Sign inDemoInstall

smtp-server

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smtp-server - npm Package Compare versions

Comparing version 3.8.0 to 3.9.0

5

CHANGELOG.md
# Changelog
## v3.9.0 2021-06-01
- Bumped dependencies
- Added extra log entries for 'close' events
## v3.8.0 2020-11-13

@@ -4,0 +9,0 @@

41

lib/smtp-connection.js

@@ -291,3 +291,3 @@ 'use strict';

_setListeners(callback) {
this._socket.on('close', () => this._onClose());
this._socket.on('close', hadError => this._onCloseEvent(hadError));
this._socket.on('error', err => this._onError(err));

@@ -302,2 +302,20 @@ this._socket.setTimeout(this._server.options.socketTimeout || SOCKET_TIMEOUT, () => this._onTimeout());

_onCloseEvent(hadError) {
this._server.logger.info(
{
tnx: 'close',
cid: this.id,
host: this.remoteAddress,
user: (this.session.user && this.session.user.username) || this.session.user,
hadError
},
'%s received "close" event from %s ' + (hadError ? ' after error' : ''),
this.id,
this.remoteAddress,
hadError
);
this._onClose();
}
/**

@@ -348,9 +366,2 @@ * Fired when the socket is closed

_onError(err) {
if ((err.code === 'ECONNRESET' || err.code === 'EPIPE') && (!this.session.envelope || !this.session.envelope.mailFrom)) {
// We got a connection error outside transaction. In most cases it means dirty
// connection ending by the other party, so we can just ignore it
this.close(); // mark connection as 'closing'
return;
}
err.remote = this.remoteAddress;

@@ -363,5 +374,15 @@ this._server.logger.error(

},
'%s',
'%s %s %s',
this.id,
this.remoteAddress,
err.message
);
if ((err.code === 'ECONNRESET' || err.code === 'EPIPE') && (!this.session.envelope || !this.session.envelope.mailFrom)) {
// We got a connection error outside transaction. In most cases it means dirty
// connection ending by the other party, so we can just ignore it
this.close(); // mark connection as 'closing'
return;
}
this.emit('error', err);

@@ -1392,3 +1413,3 @@ }

secureSocket.once('close', () => this._onClose());
secureSocket.once('close', hadError => this._onCloseEvent(hadError));
secureSocket.once('error', err => this._onError(err));

@@ -1395,0 +1416,0 @@ secureSocket.once('_tlsError', err => this._onError(err));

@@ -259,3 +259,3 @@ 'use strict';

this.options.SNICallback = (servername, cb) => {
cb(null, this.secureContext.get(this._normalizeHostname(servername)) || this.secureContext.get('*'));
cb(null, this.secureContext.get(servername));
};

@@ -449,3 +449,19 @@ }

server: this.server,
SNICallback: this.options.SNICallback
SNICallback: (servername, cb) => {
// eslint-disable-next-line new-cap
this.options.SNICallback(this._normalizeHostname(servername), (err, context) => {
if (err) {
this.logger.error(
{
tnx: 'sni',
servername,
err
},
'Failed to fetch SNI context for servername %s',
servername
);
}
return cb(null, context || this.secureContext.get('*'));
});
}
};

@@ -452,0 +468,0 @@

{
"name": "smtp-server",
"version": "3.8.0",
"version": "3.9.0",
"description": "Create custom SMTP servers on the fly",

@@ -14,13 +14,13 @@ "main": "lib/smtp-server.js",

"ipv6-normalize": "1.0.1",
"nodemailer": "6.4.16"
"nodemailer": "6.6.1"
},
"devDependencies": {
"chai": "4.2.0",
"chai": "4.3.4",
"eslint-config-nodemailer": "1.2.0",
"eslint-config-prettier": "6.15.0",
"grunt": "1.3.0",
"grunt-cli": "1.3.2",
"eslint-config-prettier": "8.3.0",
"grunt": "1.4.1",
"grunt-cli": "1.4.3",
"grunt-eslint": "23.0.0",
"grunt-mocha-test": "0.13.3",
"mocha": "8.2.1",
"mocha": "8.4.0",
"pem": "1.14.4"

@@ -27,0 +27,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc