smtp-server
Advanced tools
Comparing version 1.9.1 to 1.10.0
# Changelog | ||
## v1.10.0 2016-07-06 | ||
* Added options `hidePIPELINING`, `hide8BITMIME` and `hideSMTPUTF8` | ||
## v1.9.1 2016-04-26 | ||
@@ -4,0 +8,0 @@ |
@@ -41,2 +41,4 @@ /* eslint no-console: 0 */ | ||
hidePIPELINING: true, | ||
// use logging of proxied client data. Only makes sense behind proxy | ||
@@ -43,0 +45,0 @@ useXForward: true, |
@@ -8,3 +8,3 @@ 'use strict'; | ||
eslint: { | ||
all: ['lib/*.js', 'test/*.js', 'examples/*.js', 'Gruntfile.js', '.eslintrc.js'] | ||
all: ['lib/*.js', 'test/*.js', 'examples/*.js', 'Gruntfile.js'] | ||
}, | ||
@@ -11,0 +11,0 @@ |
@@ -111,3 +111,2 @@ 'use strict'; | ||
this.send(421, this.name + ' Too many connected clients, try again in a moment'); | ||
return this.close(); | ||
} | ||
@@ -139,3 +138,2 @@ | ||
this.send(err.responseCode || 554, err.message); | ||
this.close(); | ||
} | ||
@@ -182,2 +180,6 @@ | ||
} | ||
if (code === 421) { | ||
this.close(); | ||
} | ||
}; | ||
@@ -261,4 +263,3 @@ | ||
SMTPConnection.prototype._onTimeout = function () { | ||
this.send(451, 'Timeout - closing connection'); | ||
this.close(); | ||
this.send(421, 'Timeout - closing connection'); | ||
}; | ||
@@ -297,3 +298,2 @@ | ||
this.send(421, this.name + ' You talk too soon'); | ||
return this.close(); | ||
} | ||
@@ -304,4 +304,3 @@ } | ||
if (/^(OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT) \/.* HTTP\/\d\.\d$/i.test(command)) { | ||
this.send(554, 'HTTP requests not allowed'); | ||
return this.close(); | ||
this.send(421, 'HTTP requests not allowed'); | ||
} | ||
@@ -332,4 +331,3 @@ | ||
if (this._unrecognizedCommands >= 10) { | ||
this.send(554, 'Error: too many unrecognized commands'); | ||
return this.close(); | ||
this.send(421, 'Error: too many unrecognized commands'); | ||
} | ||
@@ -345,4 +343,3 @@ | ||
if (this._unauthenticatedCommands >= 10) { | ||
this.send(554, 'Error: too many unauthenticated commands'); | ||
return this.close(); | ||
this.send(421, 'Error: too many unauthenticated commands'); | ||
} | ||
@@ -357,3 +354,3 @@ } | ||
// Check if authentication is required | ||
if (!this.session.user && this._isSupported('AUTH') && ['MAIL', 'RCPT', 'DATA'].indexOf(commandName) >= 0) { | ||
if (!this.session.user && this._isSupported('AUTH') && ['MAIL', 'RCPT', 'DATA'].indexOf(commandName) >= 0 && !this.server.options.authOptional) { | ||
this.send(530, 'Error: authentication Required'); | ||
@@ -482,3 +479,5 @@ return setImmediate(callback); | ||
var features = ['PIPELINING', '8BITMIME', 'SMTPUTF8']; | ||
var features = ['PIPELINING', '8BITMIME', 'SMTPUTF8'].filter(function (feature) { | ||
return !this._server.options['hide' + feature]; | ||
}.bind(this)); | ||
@@ -789,3 +788,3 @@ if (this._server.options.authMethods.length && this._isSupported('AUTH')) { | ||
if (this.secure) { | ||
this.send(554, 'Error: TLS already active'); | ||
this.send(503, 'Error: TLS already active'); | ||
return callback(); | ||
@@ -956,3 +955,3 @@ } | ||
if(!this._parser){ | ||
if (!this._parser) { | ||
return callback(); | ||
@@ -966,6 +965,8 @@ } | ||
this._dataStream.removeAllListeners(); | ||
if ((typeof this._dataStream === 'object') && (this._dataStream) && (this._dataStream.readable)) { | ||
this._dataStream.removeAllListeners(); | ||
} | ||
if (err) { | ||
this.send(err.responseCode || 554, err.message); | ||
this.send(err.responseCode || 450, err.message); | ||
} else { | ||
@@ -979,3 +980,6 @@ this.send(250, typeof message === 'string' ? message : 'OK: message queued'); | ||
this._resetSession(); // reset session state | ||
this._parser.continue(); | ||
if ((typeof this._parser === 'object') && (this._parser)) { | ||
this._parser.continue(); | ||
} | ||
}.bind(this); | ||
@@ -982,0 +986,0 @@ |
{ | ||
"name": "smtp-server", | ||
"version": "1.9.1", | ||
"version": "1.10.0", | ||
"description": "Create custom SMTP servers on the fly", | ||
@@ -5,0 +5,0 @@ "main": "lib/smtp-server.js", |
@@ -38,4 +38,8 @@ # smtp-server | ||
* **options.authMethods** optional array of allowed authentication methods, defaults to `['PLAIN', 'LOGIN']`. Only the methods listed in this array are allowed, so if you set it to `['XOAUTH2']` then PLAIN and LOGIN are not available. Use `['PLAIN', 'LOGIN', 'XOAUTH2']` to allow all three. Authentication is only allowed in secure mode (either the server is started with `secure: true` option or STARTTLS command is used) | ||
* **options.authOptional** allow authentication, but do not require it | ||
* **options.disabledCommands** optional array of disabled commands (see all supported commands [here](#commands)). For example if you want to disable authentication, use `['AUTH']` as this value. If you want to allow authentication in clear text, set it to `['STARTTLS']`. | ||
* **options.hideSTARTTLS** optional boolean, if set to true then allow using STARTTLS but do not advertise or require it. It only makes sense when creating integration test servers for testing the scenario where you want to try STARTTLS even when it is not advertised | ||
* **options.hidePIPELINING** optional boolean, if set to true then does not show PIPELINING in feature list | ||
* **options.hide8BITMIME** optional boolean, if set to true then does not show 8BITMIME in features list | ||
* **options.hideSMTPUTF8** optional boolean, if set to true then does not show SMTPUTF8 in features list | ||
* **options.allowInsecureAuth** optional boolean, if set to true allows authentication even if connection is not secured first | ||
@@ -42,0 +46,0 @@ * **options.sniOptions** optional [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) or an object of TLS options for SNI where servername is the key. Overrided by SNICallback. |
@@ -529,3 +529,3 @@ /* eslint no-unused-expressions:0 */ | ||
var data = Buffer.concat(buffers).toString(); | ||
expect(/^554 /m.test(data)).to.be.true; | ||
expect(/^421 /m.test(data)).to.be.true; | ||
done(); | ||
@@ -1127,3 +1127,5 @@ }); | ||
if (session.remoteAddress === '1.2.3.4') { | ||
return callback(new Error('Blacklisted IP')); | ||
var err = new Error('Blacklisted IP'); | ||
err.responseCode = 421; | ||
return callback(err); | ||
} | ||
@@ -1175,3 +1177,3 @@ callback(); | ||
var data = Buffer.concat(buffers).toString(); | ||
expect(data.indexOf('554 ')).to.equal(0); | ||
expect(data.indexOf('421 ')).to.equal(0); | ||
expect(data.indexOf('Blacklisted')).to.gte(4); | ||
@@ -1178,0 +1180,0 @@ done(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132960
2835
425