Re: [Exim] warn with no log message?

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Philip Hazel
Datum:  
To: Giuliano Gavazzi
CC: exim-users
Betreff: Re: [Exim] warn with no log message?
On Fri, 4 Jul 2003, Giuliano Gavazzi wrote:

> Sorry to repeat myself, no comments on this? Have I got to read the
> fine manual more deeply?


It was probably a bug (not clear what I originally intended; I think I
changed my mind at some point). Patch below. Enjoy.

Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book




*** exim-4.20/src/acl.c     Mon May 12 14:39:17 2003
--- acl.c    Mon Jul  7 11:47:05 2003
***************
*** 1204,1221 ****


If there isn't a log message set, we make it the same as the user message. */

! if (rc == msgcond[verb])
    {
    uschar *expmessage;


! /* During the expansion of the user message, the value of an existing message
! (usually from some kind of verification failure) is in $acl_verify_message */

    if (user_message != NULL)
      {
!     acl_verify_message = *user_msgptr;
      expmessage = expand_string(user_message);
-     acl_verify_message = NULL;
      if (expmessage == NULL)
        {
        if (!expand_string_forcedfail)
--- 1234,1257 ----


If there isn't a log message set, we make it the same as the user message. */

! if (((rc == FAIL_DROP)? FAIL : rc) == msgcond[verb])
    {
    uschar *expmessage;


! /* If the verb is "warn", messages generated by conditions (verification or
! nested ACLs) are discarded. Only messages specified at this level are used.
! However, the value of an existing message is available in $acl_verify_message
! during expansions. */

+   uschar *old_user_msgptr = *user_msgptr;
+   uschar *old_log_msgptr = (*log_msgptr != NULL)? *log_msgptr : old_user_msgptr;
+
+   if (verb == ACL_WARN) *log_msgptr = *user_msgptr = NULL;
+
    if (user_message != NULL)
      {
!     acl_verify_message = old_user_msgptr;
      expmessage = expand_string(user_message);
      if (expmessage == NULL)
        {
        if (!expand_string_forcedfail)
***************
*** 1227,1232 ****
--- 1263,1269 ----


    if (log_message != NULL)
      {
+     acl_verify_message = old_log_msgptr;
      expmessage = expand_string(log_message);
      if (expmessage == NULL)
        {
***************
*** 1246,1251 ****
--- 1283,1289 ----
    if (*log_msgptr == NULL) *log_msgptr = *user_msgptr;
    }


+ acl_verify_message = NULL;
return rc;
}