Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #292 from mcav/apop
Browse files Browse the repository at this point in the history
Bug 983167 - [email/POP3] broken node-crypto.js shim causes auth failure...
  • Loading branch information
mcav committed Mar 19, 2014
2 parents 48b10aa + 6b129be commit 60a20a8
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/lib/node-crypto.js
Expand Up @@ -8,6 +8,7 @@ exports.createHash = function(algorithm) {
return {
update: function(addData) {
data += addData;
return this;
},
digest: function(encoding) {
switch (encoding) {
Expand Down
62 changes: 62 additions & 0 deletions test/unit/test_incoming_prober.js
Expand Up @@ -380,6 +380,68 @@ TD.commonCase('POP3 selects preferredAuthMethod', function(T, RT) {
});


/**
* Ensure that APOP authentication works properly.
*/
TD.commonCase('POP3 APOP', function(T, RT) {
if (RT.envOptions.type !== 'pop3') { return; }

$th_main.thunkConsoleForNonTestUniverse();
var eCheck = T.lazyLogger('check'),
prober = null;

var fireTimeout = thunkTimeouts(eCheck);
var cci = makeCredsAndConnInfo();

cci.connInfo.port = PORT;

T.action(eCheck, 'works with APOP', function() {
var precommands = [];
precommands.push({
match: /APOP/,
actions: [
{
cmd: 'fake-receive',
data: '+OK\r\n',
},
],
});
precommands.push({
match: /UIDL 1/,
actions: [
{
cmd: 'fake-receive',
data: '+OK\r\n',
},
],
});
precommands.push({
match: /TOP 1/,
actions: [
{
cmd: 'fake-receive',
data: '+OK\r\n.\r\n',
},
],
});
FawltySocketFactory.precommand(
HOST, PORT,
{
cmd: 'fake',
data: '+OK POP3 Ready <apop@apop>\r\n',
},
precommands);
eCheck.expect_namedValue('incoming:setTimeout', proberTimeout(RT));
prober = new (proberClass(RT))(cci.credentials, cci.connInfo, eCheck._logger);
prober.onresult = function(err, conn) {
eCheck.namedValue('authMethod', conn.authMethod);
};
eCheck.expect_event('incoming:clearTimeout');
eCheck.expect_namedValue('authMethod', 'apop');
});
});


/**
* Some servers (ex: aol.com) will hang-up on us on an auth error with a bad
* password.
Expand Down

0 comments on commit 60a20a8

Please sign in to comment.