Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 847032 - add unit test for HELO bypass; expose console.log to logs

  • Loading branch information...
commit 3dc7eb7cf37d6d749258107ae39aa4e26fa0af96 1 parent 8459b88
@asutherland asutherland authored
Showing with 49 additions and 1 deletion.
  1. +1 −1  node-deps/simplesmtp
  2. +48 −0 test/unit/test_smtp_prober.js
2  node-deps/simplesmtp
@@ -1 +1 @@
-Subproject commit 30e688be5bdf60c369a02fef3be9f1f43d94b89b
+Subproject commit fb31cae0222c4ff7d3c7c639a9040c3f7f18bde6
View
48 test/unit/test_smtp_prober.js
@@ -52,6 +52,7 @@ function makeCredsAndConnInfo() {
}
TD.commonCase('timeout failure', function(T, RT) {
+ $th_imap.thunkConsoleForNonTestUniverse();
var eCheck = T.lazyLogger('check'),
prober = null;
@@ -74,6 +75,7 @@ TD.commonCase('timeout failure', function(T, RT) {
});
TD.commonCase('SSL failure', function(T, RT) {
+ $th_imap.thunkConsoleForNonTestUniverse();
var eCheck = T.lazyLogger('check'),
prober = null;
@@ -96,6 +98,7 @@ var SMTP_GREETING = '220 localhost ESMTP Fake\r\n';
var SMTP_EHLO_RESPONSE = '250 AUTH PLAIN\r\n';
TD.commonCase('STARTTLS unsupported', function(T, RT) {
+ $th_imap.thunkConsoleForNonTestUniverse();
var eCheck = T.lazyLogger('check'),
prober = null;
@@ -142,7 +145,52 @@ TD.commonCase('STARTTLS unsupported', function(T, RT) {
});
});
+/**
+ * Make sure that we fail if a server only supports HELO in a context where we
+ * want to perform a startTLS upgrade.
+ */
+TD.commonCase('EHLO unsupported does not bypass startTLS', function(T, RT) {
+ $th_imap.thunkConsoleForNonTestUniverse();
+ var eCheck = T.lazyLogger('check'),
+ prober = null;
+
+ var fireTimeout = thunkSmtpTimeouts(eCheck);
+ var cci = makeCredsAndConnInfo();
+
+ cci.connInfo.port = 25;
+ cci.connInfo.crypto = 'starttls';
+
+ T.action(eCheck, 'create prober, see STARTTLS error', function() {
+ FawltySocketFactory.precommand(
+ HOST, cci.connInfo.port,
+ {
+ cmd: 'fake',
+ data: SMTP_GREETING,
+ },
+ [
+ {
+ match: true,
+ actions: [
+ {
+ cmd: 'fake-receive',
+ data: '500 I hate EHLO\r\n',
+ },
+ ],
+ },
+ ]);
+ eCheck.expect_namedValue('smtp:setTimeout', $smtpprobe.CONNECT_TIMEOUT_MS);
+ prober = new $smtpprobe.SmtpProber(cci.credentials, cci.connInfo);
+ prober.onresult = function(err) {
+ eCheck.namedValue('probe result', err);
+ };
+ eCheck.expect_event('smtp:clearTimeout');
+ eCheck.expect_namedValue('probe result', 'bad-security');
+ });
+});
+
+
function cannedLoginTest(T, RT, opts) {
+ $th_imap.thunkConsoleForNonTestUniverse();
var eCheck = T.lazyLogger('check');
var fireTimeout = thunkSmtpTimeouts(eCheck),
Please sign in to comment.
Something went wrong with that request. Please try again.