From b266b0fc825cda772cf8e8b189ad5889bf33db59 Mon Sep 17 00:00:00 2001 From: David Gourdelier <vida@caudium.net> Date: Fri, 4 Jun 2004 19:13:03 +0200 Subject: [PATCH] Do not output our own error string behind the user's ones if he returned an array in his callback functions so that he can manage the output completely. Rev: lib/modules/Protocols.pmod/LMTP.pmod:1.11 Rev: lib/modules/Protocols.pmod/SMTP.pmod/module.pmod:1.44 --- lib/modules/Protocols.pmod/LMTP.pmod | 4 ++-- .../Protocols.pmod/SMTP.pmod/module.pmod | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/modules/Protocols.pmod/LMTP.pmod b/lib/modules/Protocols.pmod/LMTP.pmod index c6137567bc..8b15581d5b 100644 --- a/lib/modules/Protocols.pmod/LMTP.pmod +++ b/lib/modules/Protocols.pmod/LMTP.pmod @@ -1,5 +1,5 @@ // -// $Id: LMTP.pmod,v 1.10 2004/06/02 12:13:24 kiwi Exp $ +// $Id: LMTP.pmod,v 1.11 2004/06/04 17:13:03 vida Exp $ // #pike __REAL_VERSION__ @@ -51,7 +51,7 @@ class Connection { err = catch(check = cfg->cb_data(copy_value(message), mailfrom, recipient)); if(err) { - outcode(554, err[0]); + outcode(554, internal_error_name + err[0]); log(describe_backtrace(err)); continue; } diff --git a/lib/modules/Protocols.pmod/SMTP.pmod/module.pmod b/lib/modules/Protocols.pmod/SMTP.pmod/module.pmod index 2ad042e071..248413f514 100644 --- a/lib/modules/Protocols.pmod/SMTP.pmod/module.pmod +++ b/lib/modules/Protocols.pmod/SMTP.pmod/module.pmod @@ -1,5 +1,5 @@ // -// $Id: module.pmod,v 1.43 2004/06/02 12:13:24 kiwi Exp $ +// $Id: module.pmod,v 1.44 2004/06/04 17:13:03 vida Exp $ // #pike __REAL_VERSION__ @@ -269,6 +269,7 @@ class Connection { ]); constant protocol = "ESMTP"; + constant internal_error_name = ". Problem due to the internal error: "; // the fd of the socket static Stdio.File fd = Stdio.File(); @@ -340,9 +341,11 @@ class Connection { static void outcode(int code, void|string internal_error) { - string msg = sprintf("%d %s", code, replycodes[code]); + string msg = (string) code + " "; if(internal_error) - msg += ". Problem due to the internal error: " + internal_error; + msg += internal_error; + else + msg += replycodes[code]; msg += "\r\n"; fd->write(msg); #ifdef SMTP_DEBUG @@ -490,7 +493,7 @@ class Connection { err = catch(check = cfg->cb_mailfrom(email)); if(err) { - outcode(451, err[0]); + outcode(451, internal_error_name + err[0]); log(describe_backtrace(err)); return; } @@ -604,7 +607,7 @@ class Connection { mixed err = catch (message = MIME.Message(content, 0, 0, 1)); if(err) { - outcode(554, err[0]); + outcode(554, internal_error_name + err[0]); log(describe_backtrace(err)); return 0; } @@ -613,7 +616,7 @@ class Connection { }; if(err) { - outcode(554, err[0]); + outcode(554, internal_error_name + err[0]); log(describe_backtrace(err)); return 0; } @@ -639,7 +642,7 @@ class Connection { err = catch(check = cfg->cb_data(message, mailfrom, mailto)); if(err) { - outcode(554, err[0]); + outcode(554, internal_error_name + err[0]); log(describe_backtrace(err)); return; } @@ -706,7 +709,7 @@ class Connection { if(err) { log("error while executing command %O", _command); - outcode(554, err[0]); + outcode(554, internal_error_name + err[0]); } } } -- GitLab