smtp-server
Advanced tools
Comparing version 3.6.0 to 3.7.0
module.exports = { | ||
printWidth: 160, | ||
tabWidth: 4, | ||
singleQuote: true | ||
singleQuote: true, | ||
endOfLine: 'lf', | ||
trailingComma: 'none', | ||
arrowParens: 'avoid' | ||
}; |
# Changelog | ||
## v3.7.0 2020-06-25 | ||
- Bump dependencies to latest | ||
## v3.6.0 2020-03-15 | ||
@@ -4,0 +8,0 @@ |
@@ -80,5 +80,3 @@ 'use strict'; | ||
let data = Buffer.from(token, 'base64') | ||
.toString() | ||
.split('\x00'); | ||
let data = Buffer.from(token, 'base64').toString().split('\x00'); | ||
@@ -358,5 +356,3 @@ if (data.length !== 3) { | ||
let tokenParts = Buffer.from(token, 'base64') | ||
.toString() | ||
.split(' '); | ||
let tokenParts = Buffer.from(token, 'base64').toString().split(' '); | ||
let username = tokenParts.shift(); | ||
@@ -371,8 +367,3 @@ let challengeResponse = (tokenParts.shift() || '').toLowerCase(); | ||
let hmac = crypto.createHmac('md5', password); | ||
return ( | ||
hmac | ||
.update(challenge) | ||
.digest('hex') | ||
.toLowerCase() === challengeResponse | ||
); | ||
return hmac.update(challenge).digest('hex').toLowerCase() === challengeResponse; | ||
} | ||
@@ -379,0 +370,0 @@ }, |
@@ -251,3 +251,3 @@ 'use strict'; | ||
if (code >= 400) { | ||
this.session.error = payload; | ||
this.session.error = payload; | ||
} | ||
@@ -354,3 +354,3 @@ | ||
err.remote = this.remoteAddress | ||
err.remote = this.remoteAddress; | ||
this._server.logger.error( | ||
@@ -384,7 +384,3 @@ { | ||
_onCommand(command, callback) { | ||
let commandName = (command || '') | ||
.toString() | ||
.split(' ') | ||
.shift() | ||
.toUpperCase(); | ||
let commandName = (command || '').toString().split(' ').shift().toUpperCase(); | ||
this._server.logger.debug( | ||
@@ -489,6 +485,3 @@ { | ||
_isSupported(command) { | ||
command = (command || '') | ||
.toString() | ||
.trim() | ||
.toUpperCase(); | ||
command = (command || '').toString().trim().toUpperCase(); | ||
return !this._server.options.disabledCommands.includes(command) && typeof this['handler_' + command] === 'function'; | ||
@@ -506,16 +499,7 @@ } | ||
command = (command || '').toString(); | ||
name = (name || '') | ||
.toString() | ||
.trim() | ||
.toUpperCase(); | ||
name = (name || '').toString().trim().toUpperCase(); | ||
let parts = command.split(':'); | ||
command = parts | ||
.shift() | ||
.trim() | ||
.toUpperCase(); | ||
parts = parts | ||
.join(':') | ||
.trim() | ||
.split(/\s+/); | ||
command = parts.shift().trim().toUpperCase(); | ||
parts = parts.join(':').trim().split(/\s+/); | ||
@@ -661,6 +645,3 @@ let address = parts.shift(); | ||
handler_EHLO(command, callback) { | ||
let parts = command | ||
.toString() | ||
.trim() | ||
.split(/\s+/); | ||
let parts = command.toString().trim().split(/\s+/); | ||
let hostname = parts[1] || ''; | ||
@@ -709,6 +690,3 @@ | ||
handler_HELO(command, callback) { | ||
let parts = command | ||
.toString() | ||
.trim() | ||
.split(/\s+/); | ||
let parts = command.toString().trim().split(/\s+/); | ||
let hostname = parts[1] || ''; | ||
@@ -792,6 +770,3 @@ | ||
let allowedKeys = ['NAME', 'ADDR', 'PORT', 'PROTO', 'HELO', 'LOGIN']; | ||
let parts = command | ||
.toString() | ||
.trim() | ||
.split(/\s+/); | ||
let parts = command.toString().trim().split(/\s+/); | ||
let key, value; | ||
@@ -988,6 +963,3 @@ let data = new Map(); | ||
let allowedKeys = ['NAME', 'ADDR', 'PORT', 'PROTO', 'HELO', 'IDENT', 'SOURCE']; | ||
let parts = command | ||
.toString() | ||
.trim() | ||
.split(/\s+/); | ||
let parts = command.toString().trim().split(/\s+/); | ||
let key, value; | ||
@@ -1141,6 +1113,3 @@ let data = new Map(); | ||
handler_AUTH(command, callback) { | ||
let args = command | ||
.toString() | ||
.trim() | ||
.split(/\s+/); | ||
let args = command.toString().trim().split(/\s+/); | ||
let method; | ||
@@ -1343,6 +1312,3 @@ let handler; | ||
handler_WIZ(command, callback) { | ||
let args = command | ||
.toString() | ||
.trim() | ||
.split(/\s+/); | ||
let args = command.toString().trim().split(/\s+/); | ||
let password; | ||
@@ -1349,0 +1315,0 @@ |
@@ -30,16 +30,6 @@ 'use strict'; | ||
// setup disabled commands list | ||
this.options.disabledCommands = [].concat(this.options.disabledCommands || []).map(command => | ||
(command || '') | ||
.toString() | ||
.toUpperCase() | ||
.trim() | ||
); | ||
this.options.disabledCommands = [].concat(this.options.disabledCommands || []).map(command => (command || '').toString().toUpperCase().trim()); | ||
// setup allowed auth methods | ||
this.options.authMethods = [].concat(this.options.authMethods || []).map(method => | ||
(method || '') | ||
.toString() | ||
.toUpperCase() | ||
.trim() | ||
); | ||
this.options.authMethods = [].concat(this.options.authMethods || []).map(method => (method || '').toString().toUpperCase().trim()); | ||
@@ -79,6 +69,3 @@ if (!this.options.authMethods.length) { | ||
if (this.options.secured) { | ||
return this.connect( | ||
socket, | ||
socketOptions | ||
); | ||
return this.connect(socket, socketOptions); | ||
} | ||
@@ -89,6 +76,3 @@ this._upgrade(socket, (err, tlsSocket) => { | ||
} | ||
this.connect( | ||
tlsSocket, | ||
socketOptions | ||
); | ||
this.connect(tlsSocket, socketOptions); | ||
}); | ||
@@ -103,6 +87,3 @@ }); | ||
} | ||
this.connect( | ||
socket, | ||
socketOptions | ||
); | ||
this.connect(socket, socketOptions); | ||
}) | ||
@@ -178,5 +159,5 @@ ); | ||
if (typeof callback === 'function') { | ||
const realCallback = callback; | ||
callback = null; | ||
return realCallback(); | ||
const realCallback = callback; | ||
callback = null; | ||
return realCallback(); | ||
} | ||
@@ -388,5 +369,3 @@ }, timeout); | ||
let header = Buffer.concat(chunks, chunklen) | ||
.toString() | ||
.trim(); | ||
let header = Buffer.concat(chunks, chunklen).toString().trim(); | ||
@@ -393,0 +372,0 @@ let params = (header || '').toString().split(' '); |
@@ -59,7 +59,3 @@ 'use strict'; | ||
requestOCSP: false, | ||
sessionIdContext: crypto | ||
.createHash('sha1') | ||
.update(process.argv.join(' ')) | ||
.digest('hex') | ||
.slice(0, 32) | ||
sessionIdContext: crypto.createHash('sha1').update(process.argv.join(' ')).digest('hex').slice(0, 32) | ||
}; | ||
@@ -66,0 +62,0 @@ |
{ | ||
"name": "smtp-server", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "Create custom SMTP servers on the fly", | ||
@@ -14,3 +14,3 @@ "main": "lib/smtp-server.js", | ||
"ipv6-normalize": "1.0.1", | ||
"nodemailer": "6.4.5" | ||
"nodemailer": "6.4.10" | ||
}, | ||
@@ -20,8 +20,8 @@ "devDependencies": { | ||
"eslint-config-nodemailer": "1.2.0", | ||
"eslint-config-prettier": "6.10.0", | ||
"grunt": "1.0.4", | ||
"eslint-config-prettier": "6.11.0", | ||
"grunt": "1.1.0", | ||
"grunt-cli": "1.3.2", | ||
"grunt-eslint": "22.0.0", | ||
"grunt-eslint": "23.0.0", | ||
"grunt-mocha-test": "0.13.3", | ||
"mocha": "7.1.0", | ||
"mocha": "8.0.1", | ||
"pem": "1.14.4" | ||
@@ -28,0 +28,0 @@ }, |
@@ -18,8 +18,8 @@ /* eslint no-unused-expressions:0, prefer-arrow-callback: 0 */ | ||
describe('SMTPServer', function() { | ||
describe('SMTPServer', function () { | ||
this.timeout(10 * 1000); // eslint-disable-line no-invalid-this | ||
describe('Unit tests', function() { | ||
describe('#_parseAddressCommand', function() { | ||
it('should parse MAIL FROM/RCPT TO', function() { | ||
describe('Unit tests', function () { | ||
describe('#_parseAddressCommand', function () { | ||
it('should parse MAIL FROM/RCPT TO', function () { | ||
let conn = new SMTPConnection( | ||
@@ -62,3 +62,3 @@ { | ||
describe('Plaintext server', function() { | ||
describe('Plaintext server', function () { | ||
let PORT = 1336; | ||
@@ -72,11 +72,11 @@ | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', done); | ||
}); | ||
afterEach(function(done) { | ||
afterEach(function (done) { | ||
server.close(done); | ||
}); | ||
it('should connect without TLS', function(done) { | ||
it('should connect without TLS', function (done) { | ||
let connection = new Client({ | ||
@@ -90,3 +90,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.quit(); | ||
@@ -96,3 +96,3 @@ }); | ||
it('should connect with TLS', function(done) { | ||
it('should connect with TLS', function (done) { | ||
let connection = new Client({ | ||
@@ -108,3 +108,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.quit(); | ||
@@ -114,3 +114,3 @@ }); | ||
it('open multiple connections', function(done) { | ||
it('open multiple connections', function (done) { | ||
let limit = 5; | ||
@@ -121,3 +121,3 @@ let disconnected = 0; | ||
let createConnection = function(callback) { | ||
let createConnection = function (callback) { | ||
let connection = new Client({ | ||
@@ -131,3 +131,3 @@ port: PORT, | ||
connection.on('error', function(err) { | ||
connection.on('error', function (err) { | ||
connected++; | ||
@@ -138,3 +138,3 @@ expect(err).to.not.exist; | ||
connection.on('end', function() { | ||
connection.on('end', function () { | ||
disconnected++; | ||
@@ -146,3 +146,3 @@ if (disconnected >= limit) { | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connected++; | ||
@@ -153,3 +153,3 @@ callback(null, connection); | ||
let connCb = function(err, conn) { | ||
let connCb = function (err, conn) { | ||
expect(err).to.not.exist; | ||
@@ -159,3 +159,3 @@ connections.push(conn); | ||
if (connected >= limit) { | ||
connections.forEach(function(connection) { | ||
connections.forEach(function (connection) { | ||
connection.close(); | ||
@@ -171,3 +171,3 @@ }); | ||
it('should reject too many connections', function(done) { | ||
it('should reject too many connections', function (done) { | ||
let limit = 7; | ||
@@ -179,3 +179,3 @@ let expectedErrors = 2; | ||
let createConnection = function(callback) { | ||
let createConnection = function (callback) { | ||
let connection = new Client({ | ||
@@ -189,3 +189,3 @@ port: PORT, | ||
connection.on('error', function(err) { | ||
connection.on('error', function (err) { | ||
connected++; | ||
@@ -200,3 +200,3 @@ if (!expectedErrors) { | ||
connection.on('end', function() { | ||
connection.on('end', function () { | ||
disconnected++; | ||
@@ -208,3 +208,3 @@ if (disconnected >= limit) { | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connected++; | ||
@@ -215,3 +215,3 @@ callback(null, connection); | ||
let connCb = function(err, conn) { | ||
let connCb = function (err, conn) { | ||
expect(err).to.not.exist; | ||
@@ -221,3 +221,3 @@ connections.push(conn); | ||
if (connected >= limit) { | ||
connections.forEach(function(connection) { | ||
connections.forEach(function (connection) { | ||
connection.close(); | ||
@@ -233,3 +233,3 @@ }); | ||
it('should close on timeout', function(done) { | ||
it('should close on timeout', function (done) { | ||
let connection = new Client({ | ||
@@ -241,3 +241,3 @@ port: PORT, | ||
connection.on('error', function(err) { | ||
connection.on('error', function (err) { | ||
expect(err).to.exist; | ||
@@ -248,3 +248,3 @@ }); | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
// do nothing, wait until timeout occurs | ||
@@ -254,3 +254,3 @@ }); | ||
it('should close on timeout using secure socket', function(done) { | ||
it('should close on timeout using secure socket', function (done) { | ||
let connection = new Client({ | ||
@@ -264,3 +264,3 @@ port: PORT, | ||
connection.on('error', function(err) { | ||
connection.on('error', function (err) { | ||
expect(err).to.exist; | ||
@@ -271,3 +271,3 @@ }); | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
// do nothing, wait until timeout occurs | ||
@@ -278,3 +278,3 @@ }); | ||
describe('Plaintext server with no connection limit', function() { | ||
describe('Plaintext server with no connection limit', function () { | ||
this.timeout(60 * 1000); // eslint-disable-line no-invalid-this | ||
@@ -290,7 +290,7 @@ | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', done); | ||
}); | ||
it('open multiple connections and close all at once', function(done) { | ||
it('open multiple connections and close all at once', function (done) { | ||
let limit = 100; | ||
@@ -303,3 +303,3 @@ let cleanClose = 4; | ||
let createConnection = function(callback) { | ||
let createConnection = function (callback) { | ||
let connection = new Client({ | ||
@@ -313,7 +313,7 @@ port: PORT, | ||
connection.on('error', function(err) { | ||
connection.on('error', function (err) { | ||
expect(err.responseCode).to.equal(421); // Server shutting down | ||
}); | ||
connection.on('end', function() { | ||
connection.on('end', function () { | ||
disconnected++; | ||
@@ -326,3 +326,3 @@ | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connected++; | ||
@@ -333,3 +333,3 @@ callback(null, connection); | ||
let connCb = function(err, conn) { | ||
let connCb = function (err, conn) { | ||
expect(err).to.not.exist; | ||
@@ -340,3 +340,3 @@ connections.push(conn); | ||
server.close(); | ||
setTimeout(function() { | ||
setTimeout(function () { | ||
for (let i = 0; i < cleanClose; i++) { | ||
@@ -355,3 +355,3 @@ connections[i].quit(); | ||
describe('Plaintext server with hidden STARTTLS', function() { | ||
describe('Plaintext server with hidden STARTTLS', function () { | ||
let PORT = 1336; | ||
@@ -366,11 +366,11 @@ | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', done); | ||
}); | ||
afterEach(function(done) { | ||
afterEach(function (done) { | ||
server.close(done); | ||
}); | ||
it('should connect without TLS', function(done) { | ||
it('should connect without TLS', function (done) { | ||
let connection = new Client({ | ||
@@ -383,3 +383,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
expect(connection.secure).to.be.false; | ||
@@ -390,3 +390,3 @@ connection.quit(); | ||
it('should connect with TLS', function(done) { | ||
it('should connect with TLS', function (done) { | ||
let connection = new Client({ | ||
@@ -403,3 +403,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
expect(connection.secure).to.be.true; | ||
@@ -411,3 +411,3 @@ connection.quit(); | ||
describe('Plaintext server with no STARTTLS', function() { | ||
describe('Plaintext server with no STARTTLS', function () { | ||
let PORT = 1336; | ||
@@ -434,11 +434,11 @@ | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', done); | ||
}); | ||
afterEach(function(done) { | ||
afterEach(function (done) { | ||
server.close(done); | ||
}); | ||
it('should connect without TLS', function(done) { | ||
it('should connect without TLS', function (done) { | ||
let connection = new Client({ | ||
@@ -451,3 +451,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
expect(connection.secure).to.be.false; | ||
@@ -458,3 +458,3 @@ connection.quit(); | ||
it('should not connect with TLS', function(done) { | ||
it('should not connect with TLS', function (done) { | ||
let connection = new Client({ | ||
@@ -471,7 +471,7 @@ port: PORT, | ||
connection.on('error', function(err) { | ||
connection.on('error', function (err) { | ||
error = err; | ||
}); | ||
connection.on('end', function() { | ||
connection.on('end', function () { | ||
expect(error).to.exist; | ||
@@ -481,3 +481,3 @@ done(); | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
// should not be called | ||
@@ -489,3 +489,3 @@ expect(false).to.be.true; | ||
it('should close after too many unauthenticated commands', function(done) { | ||
it('should close after too many unauthenticated commands', function (done) { | ||
let connection = new Client({ | ||
@@ -497,3 +497,3 @@ port: PORT, | ||
connection.on('error', function(err) { | ||
connection.on('error', function (err) { | ||
expect(err).to.exist; | ||
@@ -504,5 +504,5 @@ }); | ||
connection.connect(function() { | ||
let looper = function() { | ||
connection._currentAction = function() { | ||
connection.connect(function () { | ||
let looper = function () { | ||
connection._currentAction = function () { | ||
looper(); | ||
@@ -516,3 +516,3 @@ }; | ||
it('should close after too many unrecognized commands', function(done) { | ||
it('should close after too many unrecognized commands', function (done) { | ||
let connection = new Client({ | ||
@@ -524,3 +524,3 @@ port: PORT, | ||
connection.on('error', function(err) { | ||
connection.on('error', function (err) { | ||
expect(err).to.exist; | ||
@@ -531,3 +531,3 @@ }); | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -538,7 +538,7 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.not.exist; | ||
let looper = function() { | ||
connection._currentAction = function() { | ||
let looper = function () { | ||
connection._currentAction = function () { | ||
looper(); | ||
@@ -554,9 +554,9 @@ }; | ||
it('should reject early talker', function(done) { | ||
let socket = net.connect(PORT, '127.0.0.1', function() { | ||
it('should reject early talker', function (done) { | ||
let socket = net.connect(PORT, '127.0.0.1', function () { | ||
let buffers = []; | ||
socket.on('data', function(chunk) { | ||
socket.on('data', function (chunk) { | ||
buffers.push(chunk); | ||
}); | ||
socket.on('end', function() { | ||
socket.on('end', function () { | ||
let data = Buffer.concat(buffers).toString(); | ||
@@ -570,7 +570,7 @@ expect(/^421 /.test(data)).to.be.true; | ||
it('should reject HTTP requests', function(done) { | ||
let socket = net.connect(PORT, '127.0.0.1', function() { | ||
it('should reject HTTP requests', function (done) { | ||
let socket = net.connect(PORT, '127.0.0.1', function () { | ||
let buffers = []; | ||
let started = false; | ||
socket.on('data', function(chunk) { | ||
socket.on('data', function (chunk) { | ||
buffers.push(chunk); | ||
@@ -583,3 +583,3 @@ | ||
}); | ||
socket.on('end', function() { | ||
socket.on('end', function () { | ||
let data = Buffer.concat(buffers).toString(); | ||
@@ -593,3 +593,3 @@ expect(/^421 /m.test(data)).to.be.true; | ||
describe('Secure server', function() { | ||
describe('Secure server', function () { | ||
let PORT = 1336; | ||
@@ -602,8 +602,8 @@ | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', done); | ||
}); | ||
afterEach(function(done) { | ||
server.close(function() { | ||
afterEach(function (done) { | ||
server.close(function () { | ||
done(); | ||
@@ -613,3 +613,3 @@ }); | ||
it('should connect to secure server', function(done) { | ||
it('should connect to secure server', function (done) { | ||
let connection = new Client({ | ||
@@ -626,3 +626,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.quit(); | ||
@@ -633,3 +633,3 @@ }); | ||
describe('Secure server with upgrade', function() { | ||
describe('Secure server with upgrade', function () { | ||
let PORT = 1336; | ||
@@ -643,8 +643,8 @@ | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', done); | ||
}); | ||
afterEach(function(done) { | ||
server.close(function() { | ||
afterEach(function (done) { | ||
server.close(function () { | ||
done(); | ||
@@ -654,3 +654,3 @@ }); | ||
it('should connect to secure server', function(done) { | ||
it('should connect to secure server', function (done) { | ||
let connection = new Client({ | ||
@@ -667,3 +667,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.quit(); | ||
@@ -674,7 +674,7 @@ }); | ||
describe('Secure server with cert update', function() { | ||
describe('Secure server with cert update', function () { | ||
let PORT = 1336; | ||
let server; | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
pem.createCertificate({ days: 1, selfSigned: true }, (err, keys) => { | ||
@@ -697,4 +697,4 @@ if (err) { | ||
afterEach(function(done) { | ||
server.close(function() { | ||
afterEach(function (done) { | ||
server.close(function () { | ||
done(); | ||
@@ -704,3 +704,3 @@ }); | ||
it('should connect to secure server', function(done) { | ||
it('should connect to secure server', function (done) { | ||
let connection = new Client({ | ||
@@ -756,3 +756,3 @@ port: PORT, | ||
describe('Authentication tests', function() { | ||
describe('Authentication tests', function () { | ||
let PORT = 1336; | ||
@@ -793,12 +793,12 @@ | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', done); | ||
}); | ||
afterEach(function(done) { | ||
afterEach(function (done) { | ||
server.close(done); | ||
}); | ||
describe('PLAIN', function() { | ||
it('should authenticate', function(done) { | ||
describe('PLAIN', function () { | ||
it('should authenticate', function (done) { | ||
let connection = new Client({ | ||
@@ -814,3 +814,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -822,3 +822,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.not.exist; | ||
@@ -831,3 +831,3 @@ connection.quit(); | ||
it('should fail', function(done) { | ||
it('should fail', function (done) { | ||
let connection = new Client({ | ||
@@ -843,3 +843,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -851,3 +851,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.exist; | ||
@@ -861,4 +861,4 @@ connection.quit(); | ||
describe('LOGIN', function() { | ||
it('should authenticate', function(done) { | ||
describe('LOGIN', function () { | ||
it('should authenticate', function (done) { | ||
let connection = new Client({ | ||
@@ -875,3 +875,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -883,3 +883,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.not.exist; | ||
@@ -892,3 +892,3 @@ connection.quit(); | ||
it('should authenticate without STARTTLS', function(done) { | ||
it('should authenticate without STARTTLS', function (done) { | ||
let connection = new Client({ | ||
@@ -903,3 +903,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -911,3 +911,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.not.exist; | ||
@@ -920,3 +920,3 @@ connection.quit(); | ||
it('should fail', function(done) { | ||
it('should fail', function (done) { | ||
let connection = new Client({ | ||
@@ -932,3 +932,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -940,3 +940,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.exist; | ||
@@ -950,4 +950,4 @@ connection.quit(); | ||
describe('XOAUTH2', function() { | ||
it('should authenticate', function(done) { | ||
describe('XOAUTH2', function () { | ||
it('should authenticate', function (done) { | ||
let connection = new Client({ | ||
@@ -963,3 +963,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -978,3 +978,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.not.exist; | ||
@@ -987,3 +987,3 @@ connection.quit(); | ||
it('should fail', function(done) { | ||
it('should fail', function (done) { | ||
let connection = new Client({ | ||
@@ -999,3 +999,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -1014,3 +1014,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.exist; | ||
@@ -1024,4 +1024,4 @@ connection.quit(); | ||
describe('CRAM-MD5', function() { | ||
it('should authenticate', function(done) { | ||
describe('CRAM-MD5', function () { | ||
it('should authenticate', function (done) { | ||
let connection = new Client({ | ||
@@ -1037,3 +1037,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -1045,3 +1045,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.not.exist; | ||
@@ -1054,3 +1054,3 @@ connection.quit(); | ||
it('should fail', function(done) { | ||
it('should fail', function (done) { | ||
let connection = new Client({ | ||
@@ -1066,3 +1066,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -1074,3 +1074,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.exist; | ||
@@ -1085,3 +1085,3 @@ connection.quit(); | ||
describe('Mail tests', function() { | ||
describe('Mail tests', function () { | ||
let PORT = 1336; | ||
@@ -1098,3 +1098,3 @@ | ||
server.onAuth = function(auth, session, callback) { | ||
server.onAuth = function (auth, session, callback) { | ||
if (auth.username === 'testuser' && auth.password === 'testpass') { | ||
@@ -1111,3 +1111,3 @@ return callback(null, { | ||
server.onMailFrom = function(address, session, callback) { | ||
server.onMailFrom = function (address, session, callback) { | ||
if (/^deny/i.test(address.address)) { | ||
@@ -1119,3 +1119,3 @@ return callback(new Error('Not accepted')); | ||
server.onRcptTo = function(address, session, callback) { | ||
server.onRcptTo = function (address, session, callback) { | ||
if (/^deny/i.test(address.address)) { | ||
@@ -1127,3 +1127,3 @@ return callback(new Error('Not accepted')); | ||
server.onData = function(stream, session, callback) { | ||
server.onData = function (stream, session, callback) { | ||
let chunks = []; | ||
@@ -1153,4 +1153,4 @@ let chunklen = 0; | ||
beforeEach(function(done) { | ||
server.listen(PORT, '127.0.0.1', function() { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', function () { | ||
connection = new Client({ | ||
@@ -1164,3 +1164,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.login( | ||
@@ -1171,3 +1171,3 @@ { | ||
}, | ||
function(err) { | ||
function (err) { | ||
expect(err).to.not.exist; | ||
@@ -1181,4 +1181,4 @@ done(); | ||
afterEach(function(done) { | ||
connection.on('end', function() { | ||
afterEach(function (done) { | ||
connection.on('end', function () { | ||
server.close(done); | ||
@@ -1189,3 +1189,3 @@ }); | ||
it('should send', function(done) { | ||
it('should send', function (done) { | ||
connection.send( | ||
@@ -1197,3 +1197,3 @@ { | ||
'testmessage', | ||
function(err, status) { | ||
function (err, status) { | ||
expect(err).to.not.exist; | ||
@@ -1207,3 +1207,3 @@ expect(status.accepted.length).to.equal(1); | ||
it('should reject single recipient', function(done) { | ||
it('should reject single recipient', function (done) { | ||
connection.send( | ||
@@ -1215,3 +1215,3 @@ { | ||
'testmessage', | ||
function(err, status) { | ||
function (err, status) { | ||
expect(err).to.not.exist; | ||
@@ -1225,3 +1225,3 @@ expect(status.accepted.length).to.equal(1); | ||
it('should reject sender', function(done) { | ||
it('should reject sender', function (done) { | ||
connection.send( | ||
@@ -1233,3 +1233,3 @@ { | ||
'testmessage', | ||
function(err) { | ||
function (err) { | ||
expect(err).to.exist; | ||
@@ -1241,3 +1241,3 @@ done(); | ||
it('should reject recipients', function(done) { | ||
it('should reject recipients', function (done) { | ||
connection.send( | ||
@@ -1249,3 +1249,3 @@ { | ||
'testmessage', | ||
function(err) { | ||
function (err) { | ||
expect(err).to.exist; | ||
@@ -1257,3 +1257,3 @@ done(); | ||
it('should reject message', function(done) { | ||
it('should reject message', function (done) { | ||
connection.send( | ||
@@ -1265,3 +1265,3 @@ { | ||
'deny-testmessage', | ||
function(err) { | ||
function (err) { | ||
expect(err).to.exist; | ||
@@ -1273,3 +1273,3 @@ done(); | ||
it('should reject too big message', function(done) { | ||
it('should reject too big message', function (done) { | ||
connection.send( | ||
@@ -1281,3 +1281,3 @@ { | ||
new Array(1000).join('testmessage'), | ||
function(err) { | ||
function (err) { | ||
expect(err).to.exist; | ||
@@ -1289,3 +1289,3 @@ done(); | ||
it('should send multiple messages', function(done) { | ||
it('should send multiple messages', function (done) { | ||
connection.send( | ||
@@ -1297,3 +1297,3 @@ { | ||
'testmessage 1', | ||
function(err, status) { | ||
function (err, status) { | ||
expect(err).to.not.exist; | ||
@@ -1309,3 +1309,3 @@ expect(status.accepted.length).to.equal(1); | ||
'testmessage 2', | ||
function(err, status) { | ||
function (err, status) { | ||
expect(err).to.not.exist; | ||
@@ -1321,3 +1321,3 @@ expect(status.accepted.length).to.equal(1); | ||
'deny-testmessage', | ||
function(err) { | ||
function (err) { | ||
expect(err).to.exist; | ||
@@ -1331,3 +1331,3 @@ | ||
'testmessage 3', | ||
function(err, status) { | ||
function (err, status) { | ||
expect(err).to.not.exist; | ||
@@ -1348,4 +1348,4 @@ expect(status.accepted.length).to.equal(1); | ||
describe('SMTPUTF8', function() { | ||
it('should allow addresses with UTF-8 characters', function(done) { | ||
describe('SMTPUTF8', function () { | ||
it('should allow addresses with UTF-8 characters', function (done) { | ||
let utf8Address = 'δοκιμή@παράδειγμα.δοκιμή'; | ||
@@ -1361,3 +1361,3 @@ let PORT = 1336; | ||
server.onRcptTo = function(address, session, callback) { | ||
server.onRcptTo = function (address, session, callback) { | ||
expect(utf8Address).to.equal(address.address); | ||
@@ -1367,3 +1367,3 @@ callback(); | ||
server.listen(PORT, '127.0.0.1', function() { | ||
server.listen(PORT, '127.0.0.1', function () { | ||
connection = new Client({ | ||
@@ -1374,7 +1374,7 @@ port: PORT, | ||
connection.on('end', function() { | ||
connection.on('end', function () { | ||
server.close(done); | ||
}); | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.send( | ||
@@ -1386,3 +1386,3 @@ { | ||
'testmessage', | ||
function(err, status) { | ||
function (err, status) { | ||
expect(err).to.not.exist; | ||
@@ -1399,4 +1399,4 @@ expect(status.accepted.length).to.equal(1); | ||
describe('#onData', function() { | ||
it('should accept a prematurely called continue callback', function(done) { | ||
describe('#onData', function () { | ||
it('should accept a prematurely called continue callback', function (done) { | ||
let PORT = 1336; | ||
@@ -1411,3 +1411,3 @@ | ||
server.onData = function(stream, session, callback) { | ||
server.onData = function (stream, session, callback) { | ||
stream.pipe(fs.createWriteStream('/dev/null')); | ||
@@ -1417,3 +1417,3 @@ callback(); | ||
server.listen(PORT, '127.0.0.1', function() { | ||
server.listen(PORT, '127.0.0.1', function () { | ||
connection = new Client({ | ||
@@ -1424,7 +1424,7 @@ port: PORT, | ||
connection.on('end', function() { | ||
connection.on('end', function () { | ||
server.close(done); | ||
}); | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
connection.send( | ||
@@ -1436,3 +1436,3 @@ { | ||
new Array(1024 * 1024).join('#'), | ||
function(err) { | ||
function (err) { | ||
expect(err).to.not.exist; | ||
@@ -1447,3 +1447,3 @@ connection.quit(); | ||
describe('PROXY server', function() { | ||
describe('PROXY server', function () { | ||
let PORT = 1336; | ||
@@ -1465,11 +1465,11 @@ | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', done); | ||
}); | ||
afterEach(function(done) { | ||
afterEach(function (done) { | ||
server.close(done); | ||
}); | ||
it('should rewrite remote address value', function(done) { | ||
it('should rewrite remote address value', function (done) { | ||
let connection = new Client({ | ||
@@ -1483,6 +1483,6 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
let conn; | ||
// get first connection | ||
server.connections.forEach(function(val) { | ||
server.connections.forEach(function (val) { | ||
if (!conn) { | ||
@@ -1501,9 +1501,9 @@ conn = val; | ||
it('should block blacklisted connection', function(done) { | ||
let socket = net.connect(PORT, '127.0.0.1', function() { | ||
it('should block blacklisted connection', function (done) { | ||
let socket = net.connect(PORT, '127.0.0.1', function () { | ||
let buffers = []; | ||
socket.on('data', function(chunk) { | ||
socket.on('data', function (chunk) { | ||
buffers.push(chunk); | ||
}); | ||
socket.on('end', function() { | ||
socket.on('end', function () { | ||
let data = Buffer.concat(buffers).toString(); | ||
@@ -1519,3 +1519,3 @@ expect(data.indexOf('421 ')).to.equal(0); | ||
describe('Secure PROXY server', function() { | ||
describe('Secure PROXY server', function () { | ||
let PORT = 1336; | ||
@@ -1538,11 +1538,11 @@ | ||
beforeEach(function(done) { | ||
beforeEach(function (done) { | ||
server.listen(PORT, '127.0.0.1', done); | ||
}); | ||
afterEach(function(done) { | ||
afterEach(function (done) { | ||
server.close(done); | ||
}); | ||
it('should rewrite remote address value', function(done) { | ||
it('should rewrite remote address value', function (done) { | ||
let connection = new Client({ | ||
@@ -1558,6 +1558,6 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
let conn; | ||
// get first connection | ||
server.connections.forEach(function(val) { | ||
server.connections.forEach(function (val) { | ||
if (!conn) { | ||
@@ -1581,6 +1581,6 @@ conn = val; | ||
describe('onClose handler', function() { | ||
describe('onClose handler', function () { | ||
let PORT = 1336; | ||
it('should detect once a connection is closed', function(done) { | ||
it('should detect once a connection is closed', function (done) { | ||
let closed = 0; | ||
@@ -1599,4 +1599,4 @@ let total = 50; | ||
server.listen(PORT, '127.0.0.1', function() { | ||
let createConnection = function() { | ||
server.listen(PORT, '127.0.0.1', function () { | ||
let createConnection = function () { | ||
let connection = new Client({ | ||
@@ -1608,3 +1608,3 @@ port: PORT, | ||
connection.connect(function() { | ||
connection.connect(function () { | ||
setTimeout(() => connection.quit(), 100); | ||
@@ -1611,0 +1611,0 @@ }); |
@@ -11,4 +11,4 @@ /* eslint no-unused-expressions:0, prefer-arrow-callback: 0 */ | ||
describe('SMTPStream', function() { | ||
it('should emit commands', function(done) { | ||
describe('SMTPStream', function () { | ||
it('should emit commands', function (done) { | ||
let stream = new SMTPStream(); | ||
@@ -18,3 +18,3 @@ | ||
stream.oncommand = function(cmd, cb) { | ||
stream.oncommand = function (cmd, cb) { | ||
expect(cmd).to.deep.equal(expecting.shift()); | ||
@@ -31,3 +31,3 @@ if (cb) { | ||
it('should start data stream', function(done) { | ||
it('should start data stream', function (done) { | ||
let stream = new SMTPStream(); | ||
@@ -37,3 +37,3 @@ | ||
stream.oncommand = function(cmd, cb) { | ||
stream.oncommand = function (cmd, cb) { | ||
cmd = cmd.toString(); | ||
@@ -46,6 +46,6 @@ expect(cmd).to.deep.equal(expecting.shift()); | ||
datastream = stream.startDataMode(); | ||
datastream.on('data', function(chunk) { | ||
datastream.on('data', function (chunk) { | ||
output += chunk.toString(); | ||
}); | ||
datastream.on('end', function() { | ||
datastream.on('end', function () { | ||
expect(output).to.equal('test1\r\n.test2\r\n.test3\r\n'); | ||
@@ -52,0 +52,0 @@ stream.continue(); |
160203
3866
+ Addednodemailer@6.4.10(transitive)
- Removednodemailer@6.4.5(transitive)
Updatednodemailer@6.4.10