X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Frouters%2Fiplookup.c;h=4412c625ec60a4885fd598ccc5b59245b42db151;hb=ccec2d82e2fda6d764f6cd1a9dd21c4f6285b614;hp=ff67af38dd8b512832ee8c1aca559829533e3379;hpb=aded22555eeb31bc032f9bc58a83762981a58391;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/routers/iplookup.c b/src/src/routers/iplookup.c index ff67af38d..4412c625e 100644 --- a/src/src/routers/iplookup.c +++ b/src/src/routers/iplookup.c @@ -3,6 +3,7 @@ *************************************************/ /* Copyright (c) University of Cambridge 1995 - 2018 */ +/* Copyright (c) The Exim Maintainers 2020 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -21,21 +22,21 @@ optionlist iplookup_router_options[] = { { "hosts", opt_stringptr, - (void *)(offsetof(iplookup_router_options_block, hosts)) }, + OPT_OFF(iplookup_router_options_block, hosts) }, { "optional", opt_bool, - (void *)(offsetof(iplookup_router_options_block, optional)) }, + OPT_OFF(iplookup_router_options_block, optional) }, { "port", opt_int, - (void *)(offsetof(iplookup_router_options_block, port)) }, + OPT_OFF(iplookup_router_options_block, port) }, { "protocol", opt_stringptr, - (void *)(offsetof(iplookup_router_options_block, protocol_name)) }, + OPT_OFF(iplookup_router_options_block, protocol_name) }, { "query", opt_stringptr, - (void *)(offsetof(iplookup_router_options_block, query)) }, + OPT_OFF(iplookup_router_options_block, query) }, { "reroute", opt_stringptr, - (void *)(offsetof(iplookup_router_options_block, reroute)) }, + OPT_OFF(iplookup_router_options_block, reroute) }, { "response_pattern", opt_stringptr, - (void *)(offsetof(iplookup_router_options_block, response_pattern)) }, + OPT_OFF(iplookup_router_options_block, response_pattern) }, { "timeout", opt_time, - (void *)(offsetof(iplookup_router_options_block, timeout)) } + OPT_OFF(iplookup_router_options_block, timeout) } }; /* Size of the options list. An extern variable has to be used so that its @@ -160,7 +161,7 @@ uschar *reply; uschar *hostname, *reroute, *domain; const uschar *listptr; uschar host_buffer[256]; -host_item *host = store_get(sizeof(host_item)); +host_item *host = store_get(sizeof(host_item), FALSE); address_item *new_addr; iplookup_router_options_block *ob = (iplookup_router_options_block *)(rblock->options_block); @@ -168,15 +169,10 @@ const pcre *re = ob->re_response_pattern; int count, query_len, rc; int sep = 0; -addr_local = addr_local; /* Keep picky compilers happy */ -addr_remote = addr_remote; -addr_succeed = addr_succeed; -pw = pw; - DEBUG(D_route) debug_printf("%s router called for %s: domain = %s\n", rblock->name, addr->address, addr->domain); -reply = store_get(256); +reply = store_get(256, TRUE); /* tainted data */ /* Build the query string to send. If not explicitly given, a default of "user@domain user@domain" is used. */ @@ -279,7 +275,7 @@ while ((hostname = string_nextinlist(&listptr, &sep, host_buffer, /* Read the response and close the socket. If the read fails, try the next IP address. */ - count = ip_recv(&query_cctx, reply, sizeof(reply) - 1, ob->timeout); + count = ip_recv(&query_cctx, reply, sizeof(reply) - 1, time(NULL) + ob->timeout); (void)close(query_cctx.sock); if (count <= 0) {