This commit is contained in:
2025-05-27 14:06:22 +00:00
parent af408d38c9
commit 073c8378c7
10 changed files with 2927 additions and 746 deletions

View File

@@ -829,7 +829,16 @@ export class CommandHandler implements ICommandHandler {
this.sendResponse(socket, '334');
// Wait for credentials
credentials = await this.waitForAuthResponse(socket);
credentials = await new Promise<string>((resolve, reject) => {
const timeout = setTimeout(() => {
reject(new Error('Auth response timeout'));
}, 30000);
socket.once('data', (data: Buffer) => {
clearTimeout(timeout);
resolve(data.toString().trim());
});
});
}
// Decode PLAIN credentials (base64 encoded: authzid\0authcid\0password)
@@ -847,8 +856,7 @@ export class CommandHandler implements ICommandHandler {
// Authenticate using security handler
const authenticated = await this.smtpServer.getSecurityHandler().authenticate({
username,
password,
mechanism: 'PLAIN'
password
});
if (authenticated) {
@@ -929,8 +937,7 @@ export class CommandHandler implements ICommandHandler {
// Authenticate using security handler
const authenticated = await this.smtpServer.getSecurityHandler().authenticate({
username,
password,
mechanism: 'LOGIN'
password
});
if (authenticated) {