summaryrefslogtreecommitdiff
path: root/src/src/ip.c
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2016-02-14 18:10:20 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2016-02-15 13:51:49 +0000
commit61fd9a693285fe264aa67ffa0ef042a68c63c5cd (patch)
tree756a36b76deff71b2a91ddef4bd659971e495a50 /src/src/ip.c
parentd3d4f196a6b4eea022a1ae4b8efb94e9ae0b1252 (diff)
Expansions: shortcut hmac expansion during syntax-check phase
Diffstat (limited to 'src/src/ip.c')
-rw-r--r--src/src/ip.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/src/ip.c b/src/src/ip.c
index 1e3875aef..4960e3b29 100644
--- a/src/src/ip.c
+++ b/src/src/ip.c
@@ -292,9 +292,8 @@ namelen = Ustrlen(hostname);
if (hostname[0] == '[' &&
hostname[namelen - 1] == ']')
{
- uschar * host = string_copy(hostname);
- host[namelen - 1] = 0;
- host++;
+ uschar * host = string_copyn(hostname+1, namelen-2);
+debug_printf("%s: 1\n", __FUNCTION__);
if (string_is_ip_address(host, NULL) == 0)
{
*errstr = string_sprintf("malformed IP address \"%s\"", hostname);
@@ -306,13 +305,17 @@ if (hostname[0] == '[' &&
/* Otherwise check for an unadorned IP address */
else if (string_is_ip_address(hostname, NULL) != 0)
- shost.name = shost.address = string_copy(hostname);
+ {
+debug_printf("%s: 2\n", __FUNCTION__);
+ shost.name = shost.address = string_copyn(hostname, namelen);
+ }
/* Otherwise lookup IP address(es) from the name */
else
{
- shost.name = string_copy(hostname);
+debug_printf("%s: 3\n", __FUNCTION__);
+ shost.name = string_copyn(hostname, namelen);
if (host_find_byname(&shost, NULL, HOST_FIND_QUALIFY_SINGLE,
NULL, FALSE) != HOST_FOUND)
{
@@ -323,11 +326,12 @@ else
/* Try to connect to the server - test each IP till one works */
-for (h = &shost; h != NULL; h = h->next)
+for (h = &shost; h; h = h->next)
{
- fd = (Ustrchr(h->address, ':') != 0)
- ? (fd6 < 0) ? (fd6 = ip_socket(type, af = AF_INET6)) : fd6
- : (fd4 < 0) ? (fd4 = ip_socket(type, af = AF_INET )) : fd4;
+debug_printf("%s: 4 '%s'\n", __FUNCTION__, h->address);
+ fd = Ustrchr(h->address, ':') != 0
+ ? fd6 < 0 ? (fd6 = ip_socket(type, af = AF_INET6)) : fd6
+ : fd4 < 0 ? (fd4 = ip_socket(type, af = AF_INET )) : fd4;
if (fd < 0)
{