[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 expand.c
ph10 2006/11/13 12:29:30 GMT

  Modified files:
    exim-doc/doc-txt     ChangeLog 
    exim-src/src         expand.c 
  Log:
  Add timeout to connect() for Unix domain socket in ${readsocket.


  Revision  Changes    Path
  1.433     +3 -0      exim/exim-doc/doc-txt/ChangeLog
  1.71      +12 -1     exim/exim-src/src/expand.c


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.432
  retrieving revision 1.433
  diff -u -r1.432 -r1.433
  --- ChangeLog    13 Nov 2006 12:07:46 -0000    1.432
  +++ ChangeLog    13 Nov 2006 12:29:30 -0000    1.433
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.432 2006/11/13 12:07:46 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.433 2006/11/13 12:29:30 ph10 Exp $


   Change log file for Exim from version 4.21
   -------------------------------------------
  @@ -270,6 +270,9 @@
         $received_ip_address and $received_port, to make it clear that these
         values apply to message reception, and not to the outgoing interface when
         a message is delivered. (The old names remain recognized, of course.)
  +
  +PH/44 There was no timeout on the connect() call when using a Unix domain
  +      socket in the ${readsocket expansion. There now is.



Exim version 4.63

  Index: expand.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/expand.c,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- expand.c    13 Nov 2006 12:07:46 -0000    1.70
  +++ expand.c    13 Nov 2006 12:29:30 -0000    1.71
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/expand.c,v 1.70 2006/11/13 12:07:46 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/expand.c,v 1.71 2006/11/13 12:29:30 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -3914,6 +3914,7 @@


           else
             {
  +          int rc;
             if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1)
               {
               expand_string_message = string_sprintf("failed to create socket: %s",
  @@ -3924,10 +3925,20 @@
             sockun.sun_family = AF_UNIX;
             sprintf(sockun.sun_path, "%.*s", (int)(sizeof(sockun.sun_path)-1),
               sub_arg[0]);
  -          if(connect(fd, (struct sockaddr *)(&sockun), sizeof(sockun)) == -1)
  +
  +          sigalrm_seen = FALSE;
  +          alarm(timeout);
  +          rc = connect(fd, (struct sockaddr *)(&sockun), sizeof(sockun));
  +          alarm(0);
  +          if (rc < 0)
               {
               expand_string_message = string_sprintf("failed to connect to socket "
                 "%s: %s", sub_arg[0], strerror(errno));
  +            goto SOCK_FAIL;
  +            }
  +          if (sigalrm_seen)
  +            {
  +            expand_string_message = US "socket connect timed out";
               goto SOCK_FAIL;
               }
             }