[exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim…

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: exim-cvs
Subject: [exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim/exim-src/src acl.c functions.h string.c exim/exim-test/confs 0555 exim/exim-test/log 0555 exim/exim-test/scripts/0000-Basic 0555 exim/exi
ph10 2007/02/07 11:24:57 GMT

  Modified files:
    exim-doc/doc-txt     ChangeLog 
    exim-src/src         acl.c functions.h string.c 
    exim-test/stdout     4000 
  Added files:
    exim-test/confs      0555 
    exim-test/log        0555 
    exim-test/scripts/0000-Basic 0555 
    exim-test/stdout     0555 
  Log:
  Split long fakereject and fakedefer messages.


  Revision  Changes    Path
  1.474     +4 -0      exim/exim-doc/doc-txt/ChangeLog
  1.73      +3 -42     exim/exim-src/src/acl.c
  1.36      +1 -0      exim/exim-src/src/functions.h
  1.12      +61 -0     exim/exim-src/src/string.c
  1.1       +28 -0     exim/exim-test/confs/0555 (new)
  1.1       +2 -0      exim/exim-test/log/0555 (new)
  1.1       +20 -0     exim/exim-test/scripts/0000-Basic/0555 (new)
  1.1       +15 -0     exim/exim-test/stdout/0555 (new)
  1.2       +4 -2      exim/exim-test/stdout/4000


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.473
  retrieving revision 1.474
  diff -u -r1.473 -r1.474
  --- ChangeLog    6 Feb 2007 14:49:13 -0000    1.473
  +++ ChangeLog    7 Feb 2007 11:24:56 -0000    1.474
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.473 2007/02/06 14:49:13 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.474 2007/02/07 11:24:56 ph10 Exp $


   Change log file for Exim from version 4.21
   -------------------------------------------
  @@ -86,6 +86,10 @@
         fixed.


   PH/20 Added hosts_avoid_pipelining to the smtp transport.
  +
  +PH/21 Long custom messages for fakedefer and fakereject are now split up
  +      into multiline reponses in the same way that messages for "deny" and
  +      other ACL rejections are.



Exim version 4.66

  Index: acl.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/acl.c,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- acl.c    6 Feb 2007 12:19:27 -0000    1.72
  +++ acl.c    7 Feb 2007 11:24:56 -0000    1.73
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/acl.c,v 1.72 2007/02/06 12:19:27 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/acl.c,v 1.73 2007/02/07 11:24:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -3647,48 +3647,9 @@
   /* Before giving a response, take a look at the length of any user message, and
   split it up into multiple lines if possible. */


  -if (*user_msgptr != NULL && Ustrlen(*user_msgptr) > 75)
  -  {
  -  uschar *s = *user_msgptr = string_copy(*user_msgptr);
  -  uschar *ss = s;
  -
  -  for (;;)
  -    {
  -    int i = 0;
  -    while (i < 75 && *ss != 0 && *ss != '\n') ss++, i++;
  -    if (*ss == 0) break;
  -    if (*ss == '\n')
  -      s = ++ss;
  -    else
  -      {
  -      uschar *t = ss + 1;
  -      uschar *tt = NULL;
  -      while (--t > s + 35)
  -        {
  -        if (*t == ' ')
  -          {
  -          if (t[-1] == ':') { tt = t; break; }
  -          if (tt == NULL) tt = t;
  -          }
  -        }
  -
  -      if (tt == NULL)          /* Can't split behind - try ahead */
  -        {
  -        t = ss + 1;
  -        while (*t != 0)
  -          {
  -          if (*t == ' ' || *t == '\n')
  -            { tt = t; break; }
  -          t++;
  -          }
  -        }
  -
  -      if (tt == NULL) break;   /* Can't find anywhere to split */
  -      *tt = '\n';
  -      s = ss = tt+1;
  -      }
  -    }
  -  }
  +*user_msgptr = string_split_message(*user_msgptr);
  +if (fake_response != OK)
  +  fake_response_text = string_split_message(fake_response_text);


return rc;
}

  Index: functions.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/functions.h,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- functions.h    6 Feb 2007 11:11:40 -0000    1.35
  +++ functions.h    7 Feb 2007 11:24:56 -0000    1.36
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/functions.h,v 1.35 2007/02/06 11:11:40 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/functions.h,v 1.36 2007/02/07 11:24:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -310,6 +310,7 @@
   extern uschar *string_nextinlist(uschar **, int *, uschar *, int);
   extern uschar *string_open_failed(int, char *, ...);
   extern uschar *string_printing2(uschar *, BOOL);
  +extern uschar *string_split_message(uschar *);
   extern BOOL    string_vformat(uschar *, int, char *, va_list);
   extern int     strcmpic(uschar *, uschar *);
   extern int     strncmpic(uschar *, uschar *, int);


  Index: string.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/string.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- string.c    8 Jan 2007 10:50:18 -0000    1.11
  +++ string.c    7 Feb 2007 11:24:56 -0000    1.12
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/string.c,v 1.11 2007/01/08 10:50:18 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/string.c,v 1.12 2007/02/07 11:24:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -445,6 +445,67 @@
   while (n-- > 0) *p++ = tolower(*s++);
   *p = 0;
   return ss;
  +}
  +
  +
  +
  +/*************************************************
  +*    Copy string if long, inserting newlines     *
  +*************************************************/
  +
  +/* If the given string is longer than 75 characters, it is copied, and within
  +the copy, certain space characters are converted into newlines.
  +
  +Argument:  pointer to the string
  +Returns:   pointer to the possibly altered string
  +*/
  +
  +uschar *
  +string_split_message(uschar *msg)
  +{
  +uschar *s, *ss;
  +
  +if (msg == NULL || Ustrlen(msg) <= 75) return msg;
  +s = ss = msg = string_copy(msg);
  +
  +for (;;)
  +  {
  +  int i = 0;
  +  while (i < 75 && *ss != 0 && *ss != '\n') ss++, i++;
  +  if (*ss == 0) break;
  +  if (*ss == '\n')
  +    s = ++ss;
  +  else
  +    {
  +    uschar *t = ss + 1;
  +    uschar *tt = NULL;
  +    while (--t > s + 35)
  +      {
  +      if (*t == ' ')
  +        {
  +        if (t[-1] == ':') { tt = t; break; }
  +        if (tt == NULL) tt = t;
  +        }
  +      }
  +
  +    if (tt == NULL)          /* Can't split behind - try ahead */
  +      {
  +      t = ss + 1;
  +      while (*t != 0)
  +        {
  +        if (*t == ' ' || *t == '\n')
  +          { tt = t; break; }
  +        t++;
  +        }
  +      }
  +
  +    if (tt == NULL) break;   /* Can't find anywhere to split */
  +    *tt = '\n';
  +    s = ss = tt+1;
  +    }
  +  }
  +
  +return msg;
   }




Index: 0555
====================================================================
# Exim test configuration 0555

FAKE=fakereject

exim_path = EXIM_PATH
host_lookup_order = bydns
primary_hostname = myhost.test.ex
rfc1413_query_timeout = 0s
spool_directory = DIR/spool
log_file_path = DIR/spool/log/%slog
gecos_pattern = ""
gecos_name = CALLER_NAME

# ----- Main settings -----

acl_smtp_rcpt = check_rcpt
queue_only


# ----- ACLs -----

begin acl

  check_rcpt:
    accept  control = FAKE



# End

Index: 0555
====================================================================
1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local-smtp S=sss
1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@??? U=CALLER P=local-smtp S=sss

  Index: 0555
  ====================================================================
  # Long lines for fakedefer/fakereject
  exim -bs
  mail from:<>
  rcpt to:<userx@???>
  data
  Message 1
  .
  quit
  ****
  exim -bs -DFAKE='fakedefer/This is a rather long customised message that \
                   should get automatically split up into more than one \
                   response line.' 
  mail from:<>
  rcpt to:<userx@???>
  data
  Message 2
  .
  quit
  ****
  no_msglog_check


Index: 0555
====================================================================
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
550-Your message has been rejected but is being kept for evaluation.
550-If it was a legitimate message, it may still be delivered to the target
550 recipient(s).
221 myhost.test.ex closing connection
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
450-This is a rather long customised message that should get automatically
450 split up into more than one response line.
221 myhost.test.ex closing connection

  Index: 4000
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/stdout/4000,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 4000    7 Feb 2006 10:47:37 -0000    1.1
  +++ 4000    7 Feb 2007 11:24:57 -0000    1.2
  @@ -37,7 +37,8 @@
   250 Accepted
   354 Enter message, ending with "." on a line by itself
   550-Your message has been rejected but is being kept for evaluation.
  -550 If it was a legitimate message, it may still be delivered to the target recipient(s).
  +550-If it was a legitimate message, it may still be delivered to the target
  +550 recipient(s).
   221 myhost.test.ex closing connection
   220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
   250-myhost.test.ex Hello CALLER at test.ex
  @@ -58,7 +59,8 @@
   250 Accepted
   354 Enter message, ending with "." on a line by itself
   450-Your message has been rejected but is being kept for evaluation.
  -450 If it was a legitimate message, it may still be delivered to the target recipient(s).
  +450-If it was a legitimate message, it may still be delivered to the target
  +450 recipient(s).
   221 myhost.test.ex closing connection
   220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
   250 OK