haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.08k stars 661 forks source link

outbound.js - Bounce reason empty sometimes on 5xx response codes - fix included #302

Closed rocketapi closed 11 years ago

rocketapi commented 11 years ago

I noticed that some bounces where not returning the response/reason from outbound.js.

The problem was Isolated to outbound.js line 846:

else {
   socket.send_command('QUIT');
   processing_mail = false;
   return self.bounce(response.join(' '));
}

The var response is apparently emptied by the socket.send_command('QUIT'), as tested here:

else {
   exports.loginfo('pre-QUIT Response: '+response.join(' '));
   socket.send_command('QUIT');
   exports.loginfo('post-QUIT Response: '+response.join(' '));
   processing_mail = false;
   return self.bounce(response.join(' '));
}

As expected the preQuit log entry contains the response/reason, while the postQuit entry contains an empty string, therefore the reason should be stored prior to sending the QUIT command:

else {
   var reason = response.join(' ');
   socket.send_command('QUIT');
   processing_mail = false;
   return self.bounce(reason);
}

I have been testing, playing around with haraka for about a week, and love how it was built around plugins, so great job. Thanks, John

baudehlo commented 11 years ago

Thanks. Fixed in 449b760.