X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/0756eb3cb50d73a77b486e47528f7cb1bffdb299..0a49a7a4f1090b6f1ce1d0f9d969804c9226b53e:/src/src/routers/iplookup.c diff --git a/src/src/routers/iplookup.c b/src/src/routers/iplookup.c index 7d419efad..86012fe48 100644 --- a/src/src/routers/iplookup.c +++ b/src/src/routers/iplookup.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/routers/iplookup.c,v 1.1 2004/10/07 13:10:02 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/iplookup.c,v 1.11 2009/11/16 19:50:38 nm4 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2004 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -137,7 +137,7 @@ iplookup_router_entry( router_instance *rblock, /* data for this instantiation */ address_item *addr, /* address we are working on */ struct passwd *pw, /* passwd entry after check_local_user */ - BOOL verify, /* TRUE when verifying */ + int verify, /* v_none/v_recipient/v_sender/v_expn */ address_item **addr_local, /* add it to this if it's local */ address_item **addr_remote, /* add it to this if it's remote */ address_item **addr_new, /* put new addresses on here */ @@ -202,11 +202,11 @@ while ((hostname = string_nextinlist(&listptr, &sep, host_buffer, host->mx = MX_NONE; host->next = NULL; - if (string_is_ip_address(host->name, NULL)) + if (string_is_ip_address(host->name, NULL) != 0) host->address = host->name; else { - int rc = host_find_byname(host, NULL, NULL, TRUE); + int rc = host_find_byname(host, NULL, HOST_FIND_QUALIFY_SINGLE, NULL, TRUE); if (rc == HOST_FIND_FAILED || rc == HOST_FIND_AGAIN) continue; } @@ -240,6 +240,7 @@ while ((hostname = string_nextinlist(&listptr, &sep, host_buffer, if (ip_connect(query_socket, host_af, h->address,ob->port, ob->timeout) < 0) { + close(query_socket); DEBUG(D_route) debug_printf("connection to %s failed: %s\n", h->address, strerror(errno)); @@ -251,7 +252,7 @@ while ((hostname = string_nextinlist(&listptr, &sep, host_buffer, if (send(query_socket, query, query_len, 0) < 0) { DEBUG(D_route) debug_printf("send to %s failed\n", h->address); - close(query_socket); + (void)close(query_socket); continue; } @@ -259,7 +260,7 @@ while ((hostname = string_nextinlist(&listptr, &sep, host_buffer, next IP address. */ count = ip_recv(query_socket, reply, sizeof(reply) - 1, ob->timeout); - close(query_socket); + (void)close(query_socket); if (count <= 0) { DEBUG(D_route) debug_printf("%s from %s\n", (errno == ETIMEDOUT)? @@ -377,6 +378,9 @@ new_addr->parent = addr; copyflag(new_addr, addr, af_propagate); new_addr->p = addr->p; +if (addr->child_count == SHRT_MAX) + log_write(0, LOG_MAIN|LOG_PANIC_DIE, "%s router generated more than %d " + "child addresses for <%s>", rblock->name, SHRT_MAX, addr->address); addr->child_count++; new_addr->next = *addr_new; *addr_new = new_addr;