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.4.6 to 3.4.7

.prettierrc.js

63

lib/sasl.js

@@ -431,3 +431,66 @@ 'use strict';

);
},
// this is not a real auth but a username validation initiated by SMTP proxy
SASL_XCLIENT(args, callback) {
const username = ((args && args[0]) || '').toString().trim();
this._server.onAuth(
{
method: 'XCLIENT',
username,
password: null
},
this.session,
(err, response) => {
if (err) {
this._server.logger.info(
{
err,
tnx: 'autherror',
cid: this.id,
method: 'XCLIENT',
user: username
},
'Authentication error for %s using %s. %s',
username,
'XCLIENT',
err.message
);
return callback(err);
}
if (!response.user) {
this._server.logger.info(
{
tnx: 'authfail',
cid: this.id,
method: 'XCLIENT',
user: username
},
'Authentication failed for %s using %s',
username,
'XCLIENT'
);
return callback(new Error('Authentication credentials invalid'));
}
this._server.logger.info(
{
tnx: 'auth',
cid: this.id,
method: 'XCLIENT',
user: username
},
'%s authenticated using %s',
username,
'XCLIENT'
);
this.session.user = response.user;
this.session.transmissionType = this._transmissionType();
callback();
}
);
}
});

110

lib/smtp-connection.js

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

cid: this.id,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -311,3 +311,3 @@ 'S:',

host: this.remoteAddress,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -338,3 +338,3 @@ 'Connection closed to %s',

tnx: 'error',
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -373,3 +373,3 @@ '%s',

command: commandName,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -544,3 +544,3 @@ 'C:',

cid: this.id,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -654,3 +654,3 @@ 'Failed to process punycode domain "%s". error=%s',

if (this._server.options.authMethods.length && this._isSupported('AUTH')) {
if (this._server.options.authMethods.length && this._isSupported('AUTH') && !this.session.user) {
features.push(['AUTH'].concat(this._server.options.authMethods).join(' '));

@@ -782,2 +782,4 @@ }

let loginValue = false;
// parse and validate arguments

@@ -808,32 +810,5 @@ for (let i = 0, len = parts.length; i < len; i++) {

switch (key) {
// handled outside the switch
case 'LOGIN':
if (!value) {
if (this.session.user) {
this._server.logger.info(
{
tnx: 'deauth',
cid: this.id,
user: this.session.user && this.session.user.username
},
'User deauthenticated using %s',
'XCLIENT'
);
this.session.user = false;
}
} else {
this._server.logger.info(
{
tnx: 'auth',
cid: this.id,
user: value
},
'%s authenticated using %s',
value,
'XCLIENT'
);
this.session.user = {
username: value
};
}
loginValue = value;
break;

@@ -859,3 +834,3 @@ case 'ADDR':

xclient: value,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -884,3 +859,3 @@ 'XCLIENT from %s through %s',

xclient: value,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -906,3 +881,3 @@ 'XCLIENT hostname resolved as "%s"',

xclient: value,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -926,2 +901,31 @@ 'XCLIENT remote port resolved as "%s"',

let checkLogin = done => {
if (typeof loginValue !== 'string') {
return done();
}
if (!loginValue) {
// clear authentication session?
this._server.logger.info(
{
tnx: 'deauth',
cid: this.id,
user: (this.session.user && this.session.user.username) || this.session.user
},
'User deauthenticated using %s',
'XCLIENT'
);
this.session.user = false;
return done();
}
let method = 'SASL_XCLIENT';
sasl[method].call(this, [loginValue], err => {
if (err) {
this.send(550, err.message);
this.close();
return;
}
done();
});
};
// Use [ADDR] if NAME was empty

@@ -936,8 +940,10 @@ if (this.remoteAddress && !this.clientHostname) {

// success
this.send(
220,
this.name + ' ' + (this._server.options.lmtp ? 'LMTP' : 'ESMTP') + (this._server.options.banner ? ' ' + this._server.options.banner : '')
);
callback();
checkLogin(() => {
// success
this.send(
220,
this.name + ' ' + (this._server.options.lmtp ? 'LMTP' : 'ESMTP') + (this._server.options.banner ? ' ' + this._server.options.banner : '')
);
callback();
});
}

@@ -1022,3 +1028,3 @@

xforward: value,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -1047,3 +1053,3 @@ 'XFORWARD from %s through %s',

xforward: value,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -1063,3 +1069,3 @@ 'XFORWARD hostname resolved as "%s"',

xforward: value,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -1079,3 +1085,3 @@ 'XFORWARD port resolved as "%s"',

xforward: value,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -1253,3 +1259,3 @@ 'XFORWARD HELO name resolved as "%s"',

bytes: this._parser.dataBytes,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -1353,3 +1359,3 @@ 'C: <%s bytes of DATA>',

cid: this.id,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -1376,3 +1382,3 @@ 'Client tried to invoke SHELL'

cid: this.id,
user: this.session.user && this.session.user.username
user: (this.session.user && this.session.user.username) || this.session.user
},

@@ -1432,3 +1438,3 @@ 'Client tried to invoke KILL'

cid: this.id,
user: this.session.user && this.session.user.username,
user: (this.session.user && this.session.user.username) || this.session.user,
cipher

@@ -1435,0 +1441,0 @@ },

@@ -78,3 +78,6 @@ 'use strict';

if (this.options.secured) {
return this.connect(socket, socketOptions);
return this.connect(
socket,
socketOptions
);
}

@@ -85,3 +88,6 @@ this._upgrade(socket, (err, tlsSocket) => {

}
this.connect(tlsSocket, socketOptions);
this.connect(
tlsSocket,
socketOptions
);
});

@@ -96,3 +102,6 @@ });

}
this.connect(socket, socketOptions);
this.connect(
socket,
socketOptions
);
})

@@ -187,2 +196,6 @@ );

if (auth.method === 'XCLIENT') {
return callback(); // pass through
}
return callback(null, {

@@ -189,0 +202,0 @@ message: 'Authentication not implemented'

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

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

"ipv6-normalize": "1.0.1",
"nodemailer": "4.6.7"
"nodemailer": "4.6.8"
},
"devDependencies": {
"chai": "^4.1.2",
"eslint-config-nodemailer": "^1.2.0",
"grunt": "^1.0.3",
"grunt-cli": "^1.2.0",
"grunt-eslint": "^20.2.0",
"grunt-mocha-test": "^0.13.3",
"mocha": "^5.2.0",
"pem": "^1.12.5"
"chai": "4.1.2",
"eslint-config-nodemailer": "1.2.0",
"eslint-config-prettier": "3.0.1",
"grunt": "1.0.3",
"grunt-cli": "1.3.1",
"grunt-eslint": "21.0.0",
"grunt-mocha-test": "0.13.3",
"mocha": "5.2.0",
"pem": "1.12.5"
},

@@ -34,3 +35,5 @@ "repository": {

},
"keywords": ["SMTP"],
"keywords": [
"SMTP"
],
"engines": {

@@ -37,0 +40,0 @@ "node": ">=6.0.0"

Sorry, the diff of this file is not supported yet

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