Sometimes I want to go back to my logs to diagnose email delivery
problems, and in these cases I often have felt annoyed that I couldn't
see the exact ESMTP dialog that the sender was attempting.

The attached patch will cause this dialog to be logged as long as a
new ESMTP_LOG_DIALOG variable is set to '1'.

This only requires a few lines of C code, and the rest of the patch
consists of setting default values for these variables in the
esmptd{,-ssl,-msa}.dist.in files.  The initial value of this variable is
'0', which by default will provide the same non-logging of this dialog
as we have today.

What do you think of this patch?

*** courier/module.esmtp/courieresmtpd.c.orig	Fri Apr 23 08:00:30 2004
--- courier/module.esmtp/courieresmtpd.c	Fri Apr 23 08:19:46 2004
***************
*** 1032,1037 ****
--- 1032,1047 ----
  	char	*p;
  
  		input_line=line=iovreadline();
+ 
+ 		/* Optionally log the esmtp dialog */
+ 		if ((p=getenv("ESMTP_LOG_DIALOG")) && *p == '1')
+ 		{
+ 			clog_msg_start_info();
+ 			clog_msg_str(input_line);
+ 			clog_msg_str("\n");
+ 			clog_msg_send();
+ 		}
+ 
  		for (p=line; *p && *p != ':'; p++)
  		{
  			if (*p == ' ' && strncmp(line, "MAIL", 4) &&
*** courier/module.esmtp/esmtpd-msa.dist.in.orig	Fri Apr 23 08:11:14 2004
--- courier/module.esmtp/esmtpd-msa.dist.in	Fri Apr 23 08:16:11 2004
***************
*** 38,43 ****
--- 38,49 ----
  
  NOADDDATE=0
  
+ ##NAME: ESMTP_LOG_DIALOG:0
+ #
+ #  If set, log the esmtp dialog.
+ 
+ ESMTP_LOG_DIALOG=0
+ 
  ##NAME: AUTH_REQUIRED:0
  #
  # Set AUTH_REQUIRED to 1 in order to force the client to use ESMTP
*** courier/module.esmtp/esmtpd-ssl.dist.in.orig	Fri Apr 23 08:11:14 2004
--- courier/module.esmtp/esmtpd-ssl.dist.in	Fri Apr 23 08:14:48 2004
***************
*** 59,64 ****
--- 59,70 ----
  
  NOADDDATE=1
  
+ ##NAME: ESMTP_LOG_DIALOG:0
+ #
+ #  If set, log the esmtp dialog.
+ 
+ ESMTP_LOG_DIALOG=0
+ 
  ##NAME: AUTH_REQUIRED:0
  #
  # Set AUTH_REQUIRED to 1 in order to force the client to use ESMTP
*** courier/module.esmtp/esmtpd.dist.in.orig	Fri Apr 23 08:11:14 2004
--- courier/module.esmtp/esmtpd.dist.in	Fri Apr 23 08:15:09 2004
***************
*** 66,71 ****
--- 66,77 ----
  
  NOADDDATE=1
  
+ ##NAME: ESMTP_LOG_DIALOG:0
+ #
+ #  If set, log the esmtp dialog.
+ 
+ ESMTP_LOG_DIALOG=0
+ 
  ##NAME: AUTH_REQUIRED:0
  #
  # Set AUTH_REQUIRED to 1 in order to force the client to use ESMTP

-- 
 Lloyd Zusman
 [EMAIL PROTECTED]

Reply via email to