ditesh / node-poplib

POP3 client library for Node.js
MIT License
128 stars 44 forks source link

Login command returns a false positive if IMAP host is used #23

Open HardlyMirage opened 8 years ago

HardlyMirage commented 8 years ago

Summary: If I mistakenly connect to an IMAP server instead of a POP3 one, the client connects me successfully and the login status returns true even if my credentials are incorrect.

Code:

var transport = new POP3Client(993, 'imap.google.com', { enabletls: true });
transport.on('connect', () => {
    console.log('Connection established!');
    transport.login('validaccount@gmail.com', 'invalidpassword')
});
transport.on('login', (status, response) => {
    console.log('Status:', status);
    console.log('Response:', response);
});

Output:

Connection established!
Status: true
Response: 'PASS BAD Unknown command g67mb393707070wme\r\n'

Expectation: Status needs to be false since my email address / password is incorrect, or I shouldn't be able to connect successfully at all since I'm connecting to an imap server.