summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Finch <dot@dotat.at>2014-06-05 18:01:11 +0100
committerTony Finch <dot@dotat.at>2014-06-05 18:01:11 +0100
commita6d4c44ef48936ac169cd0da7ea149cbc81c9716 (patch)
tree233ec16117ce0d34c68d8c4d43e417633bba4581
parent315e209ab63a4d198d4592247cabf52b9401844d (diff)
Fix udpsend and ip_connectedsocket().exim-4_83_RC2
The ip_connectedsocket() function's socket type support and error reporting did not work properly.
-rw-r--r--doc/doc-txt/ChangeLog3
-rw-r--r--src/src/ip.c14
2 files changed, 13 insertions, 4 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 93c163cdc..606c8201f 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -132,6 +132,9 @@ JH/25 Expand the coverage of the delivery $host and $host_address to
JH/26 Port service names are now accepted for tls_on_connect_ports, to
align with daemon_smtp_ports. Bug 72.
+TF/03 Fix udpsend. The ip_connectedsocket() function's socket type
+ support and error reporting did not work properly.
+
Exim version 4.82
-----------------
diff --git a/src/src/ip.c b/src/src/ip.c
index 0211adc1e..1d4e368ec 100644
--- a/src/src/ip.c
+++ b/src/src/ip.c
@@ -248,8 +248,14 @@ return -1;
}
+
+/*************************************************
+* Create connected socket to remote host *
+*************************************************/
+
/* Create a socket and connect to host (name or number, ipv6 ok)
at one of port-range.
+
Arguments:
type SOCK_DGRAM or SOCK_STREAM
af AF_INET6 or AF_INET for the socket type
@@ -317,8 +323,8 @@ else
for (h = &shost; h != NULL; h = h->next)
{
fd = (Ustrchr(h->address, ':') != 0)
- ? (fd6 < 0) ? (fd6 = ip_socket(SOCK_STREAM, af = AF_INET6)) : fd6
- : (fd4 < 0) ? (fd4 = ip_socket(SOCK_STREAM, af = AF_INET )) : fd4;
+ ? (fd6 < 0) ? (fd6 = ip_socket(type, af = AF_INET6)) : fd6
+ : (fd4 < 0) ? (fd4 = ip_socket(type, af = AF_INET )) : fd4;
if (fd < 0)
{
@@ -340,8 +346,8 @@ for (h = &shost; h != NULL; h = h->next)
}
}
-*errstr = string_sprintf("failed to connect to "
- "%s: couldn't connect to any host", hostname, strerror(errno));
+*errstr = string_sprintf("failed to connect to %s: "
+ "couldn't connect to any host: %s", hostname, strerror(errno));
bad:
close(fd4); close(fd6); return -1;