summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/doc-txt/ChangeLog5
-rw-r--r--src/src/expand.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 1ac335408..01ff8dc3c 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.432 2006/11/13 12:07:46 ph10 Exp $
+$Cambridge: 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
-------------------------------------------
@@ -271,6 +271,9 @@ PH/43 Renamed the variables $interface_address and $interface_port as
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
-----------------
diff --git a/src/src/expand.c b/src/src/expand.c
index d049466f1..234a33ff5 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.70 2006/11/13 12:07:46 ph10 Exp $ */
+/* $Cambridge: 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 @@ while (*s != 0)
else
{
+ int rc;
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1)
{
expand_string_message = string_sprintf("failed to create socket: %s",
@@ -3924,12 +3925,22 @@ while (*s != 0)
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;
+ }
}
DEBUG(D_expand) debug_printf("connected to socket %s\n", sub_arg[0]);