From 14b3c5bc64a16df07583fe4b5ef2e0129d063893 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Thu, 17 Sep 2015 13:35:16 +0100 Subject: [PATCH] DNS: time-limit cached returns, using TTL. Bug 1395 This can matter for fast-changing data such as DNSBLs. --- doc/doc-docbook/spec.xfpt | 19 ++++++- doc/doc-txt/ChangeLog | 3 ++ src/src/dns.c | 3 +- src/src/lookupapi.h | 7 +-- src/src/lookups/README | 7 ++- src/src/lookups/cdb.c | 2 +- src/src/lookups/dbmdb.c | 6 +-- src/src/lookups/dnsdb.c | 5 +- src/src/lookups/dsearch.c | 2 +- src/src/lookups/ibase.c | 2 +- src/src/lookups/ldap.c | 8 +-- src/src/lookups/lf_functions.h | 4 +- src/src/lookups/lf_sqlperform.c | 6 +-- src/src/lookups/lsearch.c | 8 +-- src/src/lookups/mysql.c | 10 ++-- src/src/lookups/nis.c | 4 +- src/src/lookups/nisplus.c | 2 +- src/src/lookups/oracle.c | 2 +- src/src/lookups/passwd.c | 2 +- src/src/lookups/pgsql.c | 8 +-- src/src/lookups/redis.c | 8 +-- src/src/lookups/spf.c | 14 +++-- src/src/lookups/sqlite.c | 4 +- src/src/lookups/testdb.c | 4 +- src/src/lookups/whoson.c | 2 +- src/src/search.c | 73 +++++++++++++------------ src/src/structs.h | 11 ++++ src/src/verify.c | 41 ++++++++------ test/confs/2200 | 17 ++++++ test/confs/2201 | 37 +++++++++++++ test/dnszones-src/db.test.ex | 6 ++- test/log/2200 | 1 + test/log/2201 | 7 +++ test/scripts/2200-dnsdb/2200 | 13 +++++ test/scripts/2200-dnsdb/2201 | 18 +++++++ test/src/fakens.c | 17 +++++- test/stderr/2200 | 52 ++++++++++++++++++ test/stderr/2201 | 95 +++++++++++++++++++++++++++++++++ test/stdout/2200 | 3 ++ 39 files changed, 427 insertions(+), 106 deletions(-) create mode 100644 test/log/2200 create mode 100644 test/log/2201 create mode 100644 test/stderr/2200 diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 34fbed88f..ed3533a0c 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -6993,6 +6993,15 @@ Retries for the dnsdb lookup can be controlled by a retry modifier. The form if &"retry_VAL"& where VAL is an integer. The default count is set by the main configuration option &%dns_retry%&. +.new +.cindex cacheing "of dns lookup" +.cindex TTL "of dns lookup" +.cindex DNS TTL +Dnsdb lookup results are cached within a single process (and its children). +The cache entry lifetime is limited to the smallest time-to-live (TTL) +value of the set of returned DNS records. +.wen + .section "Pseudo dnsdb record types" "SECID66" .cindex "MX record" "in &(dnsdb)& lookup" @@ -29208,9 +29217,15 @@ deny dnslists = blackholes.mail-abuse.org warn message = X-Warn: sending host is on dialups list dnslists = dialups.mail-abuse.org .endd -DNS list lookups are cached by Exim for the duration of the SMTP session, +.cindex cacheing "of dns lookup" +.cindex DNS TTL +DNS list lookups are cached by Exim for the duration of the SMTP session +.new +(but limited by the DNS return TTL value), +.wen so a lookup based on the IP address is done at most once for any incoming -connection. Exim does not share information between multiple incoming +connection (assuming long-enough TTL). +Exim does not share information between multiple incoming connections (but your local name server cache should be active). diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 969f1e3a7..37d66617e 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -46,6 +46,9 @@ JH/05 Downgrade message for a TLS-certificate-based authentication fail from HS/02 Add the Exim version string to the process info. This way exiwhat gives some more detail about the running daemon. +JH/06 Bug 1395: time-limit cacheing of DNS lookups, to the TTL value. This may + matter for fast-change records such as DNSBLs. + Exim version 4.86 ----------------- diff --git a/src/src/dns.c b/src/src/dns.c index a239bec30..f99b470b2 100644 --- a/src/src/dns.c +++ b/src/src/dns.c @@ -388,7 +388,8 @@ from the following bytes. */ dnss->aptr += namelen; GETSHORT(dnss->srr.type, dnss->aptr); /* Record type */ -dnss->aptr += 6; /* Don't want class or TTL */ +dnss->aptr += 2; /* Don't want class */ +GETLONG(dnss->srr.ttl, dnss->aptr); /* TTL */ GETSHORT(dnss->srr.size, dnss->aptr); /* Size of data portion */ dnss->srr.data = dnss->aptr; /* The record's data follows */ dnss->aptr += dnss->srr.size; /* Advance to next RR */ diff --git a/src/src/lookupapi.h b/src/src/lookupapi.h index cdd1c85bf..03de8f675 100644 --- a/src/src/lookupapi.h +++ b/src/src/lookupapi.h @@ -34,7 +34,7 @@ typedef struct lookup_info { int, /* length of key or query */ uschar **, /* for returning answer */ uschar **, /* for error message */ - BOOL *); /* to request cache cleanup */ + uint *); /* cache TTL, sconds */ void (*close)( /* close function */ void *); /* handle */ void (*tidy)(void); /* tidy function */ @@ -46,9 +46,10 @@ typedef struct lookup_info { } lookup_info; /* This magic number is used by the following lookup_module_info structure - for checking API compatibility. It's equivalent to the string"LMM2" */ -#define LOOKUP_MODULE_INFO_MAGIC 0x4c4d4d32 + for checking API compatibility. It used to be equivalent to the string"LMM3" */ +#define LOOKUP_MODULE_INFO_MAGIC 0x4c4d4933 /* Version 2 adds: version_report */ +/* Version 3 change: non/cache becomes TTL in seconds */ typedef struct lookup_module_info { uint magic; diff --git a/src/src/lookups/README b/src/src/lookups/README index 98905dc5c..31fea6448 100644 --- a/src/src/lookups/README +++ b/src/src/lookups/README @@ -122,12 +122,15 @@ DEFER. The arguments are: uschar **errmsg where to put an error message on failure; this is initially set to "", and should be left as that for a standard "entry not found" error - BOOL *do_cache the lookup should set this to FALSE when it changes data. - This is TRUE by default. When set to FALSE the cache tree + uint *do_cache the lookup should set this to 0 when it changes data. + This is MAXINT by default. When set to 0 the cache tree of the current search handle will be cleaned and the current result will NOT be cached. Currently the mysql and pgsql lookups use this when UPDATE/INSERT queries are executed. + If set to a nonzero number of seconds, the cached value + becomes unusable after this time. Currently the dnsdb + lookup uses this to support the TTL value. Even though the key is zero-terminated, the length is passed because in the common case it has been computed already and is often needed. diff --git a/src/src/lookups/cdb.c b/src/src/lookups/cdb.c index ea017def1..ba925dc12 100644 --- a/src/src/lookups/cdb.c +++ b/src/src/lookups/cdb.c @@ -279,7 +279,7 @@ cdb_find(void *handle, int key_len, uschar **result, uschar **errmsg, - BOOL *do_cache) + uint *do_cache) { struct cdb_state * cdbp = handle; uint32 item_key_len, diff --git a/src/src/lookups/dbmdb.c b/src/src/lookups/dbmdb.c index 03248e490..b8c42d596 100644 --- a/src/src/lookups/dbmdb.c +++ b/src/src/lookups/dbmdb.c @@ -87,7 +87,7 @@ the keylength in order to include the terminating zero. */ static int dbmdb_find(void *handle, uschar *filename, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { EXIM_DB *d = (EXIM_DB *)handle; EXIM_DATUM key, data; @@ -120,7 +120,7 @@ return FAIL; int static dbmnz_find(void *handle, uschar *filename, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { return dbmdb_find(handle, filename, keystring, length-1, result, errmsg, do_cache); @@ -140,7 +140,7 @@ return dbmdb_find(handle, filename, keystring, length-1, result, errmsg, static int dbmjz_find(void *handle, uschar *filename, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { uschar *key_item, *key_buffer, *key_p; const uschar *key_elems = keystring; diff --git a/src/src/lookups/dnsdb.c b/src/src/lookups/dnsdb.c index e3de279e2..70e6c8c63 100644 --- a/src/src/lookups/dnsdb.c +++ b/src/src/lookups/dnsdb.c @@ -131,7 +131,7 @@ separator, as always, is colon. */ static int dnsdb_find(void *handle, uschar *filename, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { int rc; int size = 256; @@ -388,6 +388,9 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0))) { if (rr->type != searchtype) continue; + if (*do_cache > rr->ttl) + *do_cache = rr->ttl; + if (type == T_A || type == T_AAAA || type == T_ADDRESSES) { dns_address *da; diff --git a/src/src/lookups/dsearch.c b/src/src/lookups/dsearch.c index f8c592adb..9f7dd8da0 100644 --- a/src/src/lookups/dsearch.c +++ b/src/src/lookups/dsearch.c @@ -67,7 +67,7 @@ for us. */ int static dsearch_find(void *handle, uschar *dirname, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { struct stat statbuf; int save_errno; diff --git a/src/src/lookups/ibase.c b/src/src/lookups/ibase.c index 23e1dea60..7fd53d011 100644 --- a/src/src/lookups/ibase.c +++ b/src/src/lookups/ibase.c @@ -451,7 +451,7 @@ deferred with a retryable error. */ static int ibase_find(void *handle, uschar * filename, uschar * query, int length, - uschar ** result, uschar ** errmsg, BOOL *do_cache) + uschar ** result, uschar ** errmsg, uint *do_cache) { int sep = 0; uschar *server; diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c index a56eff326..b870df147 100644 --- a/src/src/lookups/ldap.c +++ b/src/src/lookups/ldap.c @@ -1339,7 +1339,7 @@ The handle and filename arguments are not used. */ static int eldap_find(void *handle, uschar *filename, const uschar *ldap_url, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { /* Keep picky compilers happy */ do_cache = do_cache; @@ -1348,7 +1348,7 @@ return(control_ldap_search(ldap_url, SEARCH_LDAP_SINGLE, result, errmsg)); static int eldapm_find(void *handle, uschar *filename, const uschar *ldap_url, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { /* Keep picky compilers happy */ do_cache = do_cache; @@ -1357,7 +1357,7 @@ return(control_ldap_search(ldap_url, SEARCH_LDAP_MULTIPLE, result, errmsg)); static int eldapdn_find(void *handle, uschar *filename, const uschar *ldap_url, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { /* Keep picky compilers happy */ do_cache = do_cache; @@ -1366,7 +1366,7 @@ return(control_ldap_search(ldap_url, SEARCH_LDAP_DN, result, errmsg)); int eldapauth_find(void *handle, uschar *filename, const uschar *ldap_url, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { /* Keep picky compilers happy */ do_cache = do_cache; diff --git a/src/src/lookups/lf_functions.h b/src/src/lookups/lf_functions.h index 73e93037e..d2487d362 100644 --- a/src/src/lookups/lf_functions.h +++ b/src/src/lookups/lf_functions.h @@ -12,7 +12,7 @@ extern int lf_check_file(int, uschar *, int, int, uid_t *, gid_t *, extern uschar *lf_quote(uschar *, uschar *, int, uschar *, int *, int *); extern int lf_sqlperform(const uschar *, const uschar *, const uschar *, const uschar *, uschar **, - uschar **, BOOL *, int(*)(const uschar *, uschar *, uschar **, - uschar **, BOOL *, BOOL *)); + uschar **, uint *, int(*)(const uschar *, uschar *, uschar **, + uschar **, BOOL *, uint *)); /* End of lf_functions.h */ diff --git a/src/src/lookups/lf_sqlperform.c b/src/src/lookups/lf_sqlperform.c index 2d7f32684..6d4f7a798 100644 --- a/src/src/lookups/lf_sqlperform.c +++ b/src/src/lookups/lf_sqlperform.c @@ -27,7 +27,7 @@ Arguments: query the query result where to pass back the result errmsg where to pass back an error message - do_cache to be set FALSE if data is changed + do_cache to be set zero if data is changed func the lookup function to call Returns: the return from the lookup function, or DEFER @@ -36,8 +36,8 @@ Returns: the return from the lookup function, or DEFER int lf_sqlperform(const uschar *name, const uschar *optionname, const uschar *optserverlist, const uschar *query, - uschar **result, uschar **errmsg, BOOL *do_cache, - int(*fn)(const uschar *, uschar *, uschar **, uschar **, BOOL *, BOOL *)) + uschar **result, uschar **errmsg, uint *do_cache, + int(*fn)(const uschar *, uschar *, uschar **, uschar **, BOOL *, uint *)) { int sep, rc; uschar *server; diff --git a/src/src/lookups/lsearch.c b/src/src/lookups/lsearch.c index 3883d4ba0..eb70a45fa 100644 --- a/src/src/lookups/lsearch.c +++ b/src/src/lookups/lsearch.c @@ -323,7 +323,7 @@ return FAIL; static int lsearch_find(void *handle, uschar *filename, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { do_cache = do_cache; /* Keep picky compilers happy */ return internal_lsearch_find(handle, filename, keystring, length, result, @@ -340,7 +340,7 @@ return internal_lsearch_find(handle, filename, keystring, length, result, static int wildlsearch_find(void *handle, uschar *filename, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { do_cache = do_cache; /* Keep picky compilers happy */ return internal_lsearch_find(handle, filename, keystring, length, result, @@ -357,7 +357,7 @@ return internal_lsearch_find(handle, filename, keystring, length, result, static int nwildlsearch_find(void *handle, uschar *filename, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { do_cache = do_cache; /* Keep picky compilers happy */ return internal_lsearch_find(handle, filename, keystring, length, result, @@ -375,7 +375,7 @@ return internal_lsearch_find(handle, filename, keystring, length, result, static int iplsearch_find(void *handle, uschar *filename, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { do_cache = do_cache; /* Keep picky compilers happy */ if ((length == 1 && keystring[0] == '*') || diff --git a/src/src/lookups/mysql.c b/src/src/lookups/mysql.c index 8dff86ad1..1ce8831e8 100644 --- a/src/src/lookups/mysql.c +++ b/src/src/lookups/mysql.c @@ -74,7 +74,7 @@ Arguments: resultptr where to store the result errmsg where to point an error message defer_break TRUE if no more servers are to be tried after DEFER - do_cache set false if data is changed + do_cache set zero if data is changed The server string is of the form "host/dbname/user/password". The host can be host:port. This string is in a nextinlist temporary buffer, so can be @@ -85,7 +85,7 @@ Returns: OK, FAIL, or DEFER static int perform_mysql_search(const uschar *query, uschar *server, uschar **resultptr, - uschar **errmsg, BOOL *defer_break, BOOL *do_cache) + uschar **errmsg, BOOL *defer_break, uint *do_cache) { MYSQL *mysql_handle = NULL; /* Keep compilers happy */ MYSQL_RES *mysql_result = NULL; @@ -225,7 +225,7 @@ can be detected by calling mysql_field_count(). If its result is zero, no data was expected (this is all explained clearly in the MySQL manual). In this case, we return the number of rows affected by the command. In this event, we do NOT want to cache the result; also the whole cache for the handle must be cleaned -up. Setting do_cache FALSE requests this. */ +up. Setting do_cache zero requests this. */ if ((mysql_result = mysql_use_result(mysql_handle)) == NULL) { @@ -233,7 +233,7 @@ if ((mysql_result = mysql_use_result(mysql_handle)) == NULL) { DEBUG(D_lookup) debug_printf("MYSQL: query was not one that returns data\n"); result = string_sprintf("%d", mysql_affected_rows(mysql_handle)); - *do_cache = FALSE; + *do_cache = 0; goto MYSQL_EXIT; } *errmsg = string_sprintf("MYSQL: lookup result failed: %s\n", @@ -341,7 +341,7 @@ shared with other SQL lookups. */ static int mysql_find(void *handle, uschar *filename, const uschar *query, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { return lf_sqlperform(US"MySQL", US"mysql_servers", mysql_servers, query, result, errmsg, do_cache, perform_mysql_search); diff --git a/src/src/lookups/nis.c b/src/src/lookups/nis.c index 7b012b14c..1faa884a1 100644 --- a/src/src/lookups/nis.c +++ b/src/src/lookups/nis.c @@ -42,7 +42,7 @@ code. */ static int nis_find(void *handle, uschar *filename, uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { int rc; uschar *nis_data; @@ -68,7 +68,7 @@ return (rc == YPERR_KEY || rc == YPERR_MAP)? FAIL : DEFER; static int nis0_find(void *handle, uschar *filename, uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { int rc; uschar *nis_data; diff --git a/src/src/lookups/nisplus.c b/src/src/lookups/nisplus.c index 8895ceeec..a4a7a2d5b 100644 --- a/src/src/lookups/nisplus.c +++ b/src/src/lookups/nisplus.c @@ -43,7 +43,7 @@ equals sign. */ static int nisplus_find(void *handle, uschar *filename, uschar *query, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { int i; int ssize = 0; diff --git a/src/src/lookups/oracle.c b/src/src/lookups/oracle.c index 1f2520ac0..adb17b4da 100644 --- a/src/src/lookups/oracle.c +++ b/src/src/lookups/oracle.c @@ -517,7 +517,7 @@ deferred with a retryable error. */ static int oracle_find(void *handle, uschar *filename, uschar *query, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { int sep = 0; uschar *server; diff --git a/src/src/lookups/passwd.c b/src/src/lookups/passwd.c index e726f3e8e..315677ffa 100644 --- a/src/src/lookups/passwd.c +++ b/src/src/lookups/passwd.c @@ -34,7 +34,7 @@ return (void *)(-1); /* Just return something non-null */ static int passwd_find(void *handle, uschar *filename, const uschar *keystring, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { struct passwd *pw; diff --git a/src/src/lookups/pgsql.c b/src/src/lookups/pgsql.c index c86ac23ed..4be3d98f1 100644 --- a/src/src/lookups/pgsql.c +++ b/src/src/lookups/pgsql.c @@ -119,7 +119,7 @@ Returns: OK, FAIL, or DEFER static int perform_pgsql_search(const uschar *query, uschar *server, uschar **resultptr, - uschar **errmsg, BOOL *defer_break, BOOL *do_cache) + uschar **errmsg, BOOL *defer_break, uint *do_cache) { PGconn *pg_conn = NULL; PGresult *pg_result = NULL; @@ -290,10 +290,10 @@ else /* The command was successful but did not return any data since it was * not SELECT but either an INSERT, UPDATE or DELETE statement. Tell the * high level code to not cache this query, and clean the current cache for - * this handle by setting *do_cache FALSE. */ + * this handle by setting *do_cache zero. */ result = string_copy(US PQcmdTuples(pg_result)); offset = Ustrlen(result); - *do_cache = FALSE; + *do_cache = 0; DEBUG(D_lookup) debug_printf("PGSQL: command does not return any data " "but was successful. Rows affected: %s\n", result); @@ -399,7 +399,7 @@ shared with other SQL lookups. */ static int pgsql_find(void *handle, uschar *filename, const uschar *query, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { return lf_sqlperform(US"PostgreSQL", US"pgsql_servers", pgsql_servers, query, result, errmsg, do_cache, perform_pgsql_search); diff --git a/src/src/lookups/redis.c b/src/src/lookups/redis.c index ac4d0ec30..18cd3a0af 100644 --- a/src/src/lookups/redis.c +++ b/src/src/lookups/redis.c @@ -65,7 +65,7 @@ redis_tidy(void) */ static int perform_redis_search(uschar *command, uschar *server, uschar **resultptr, - uschar **errmsg, BOOL *defer_break, BOOL *do_cache) + uschar **errmsg, BOOL *defer_break, uint *do_cache) { redisContext *redis_handle = NULL; /* Keep compilers happy */ redisReply *redis_reply = NULL; @@ -197,7 +197,7 @@ perform_redis_search(uschar *command, uschar *server, uschar **resultptr, case REDIS_REPLY_ERROR: *errmsg = string_sprintf("REDIS: lookup result failed: %s\n", redis_reply->str); *defer_break = FALSE; - *do_cache = FALSE; + *do_cache = 0; goto REDIS_EXIT; /* NOTREACHED */ @@ -205,7 +205,7 @@ perform_redis_search(uschar *command, uschar *server, uschar **resultptr, case REDIS_REPLY_NIL: DEBUG(D_lookup) debug_printf("REDIS: query was not one that returned any data\n"); result = string_sprintf(""); - *do_cache = FALSE; + *do_cache = 0; goto REDIS_EXIT; /* NOTREACHED */ @@ -304,7 +304,7 @@ perform_redis_search(uschar *command, uschar *server, uschar **resultptr, static int redis_find(void *handle __attribute__((unused)), uschar *filename __attribute__((unused)), - uschar *command, int length, uschar **result, uschar **errmsg, BOOL *do_cache) + uschar *command, int length, uschar **result, uschar **errmsg, uint *do_cache) { return lf_sqlperform(US"Redis", US"redis_servers", redis_servers, command, result, errmsg, do_cache, perform_redis_search); diff --git a/src/src/lookups/spf.c b/src/src/lookups/spf.c index 23ad2addd..2671fc9c4 100644 --- a/src/src/lookups/spf.c +++ b/src/src/lookups/spf.c @@ -31,7 +31,9 @@ static void dummy(int x) { dummy2(x-1); } #include #include -static void *spf_open(uschar *filename, uschar **errmsg) { +static void * +spf_open(uschar *filename, uschar **errmsg) +{ SPF_server_t *spf_server = NULL; spf_server = SPF_server_new(SPF_DNS_CACHE, 0); if (spf_server == NULL) { @@ -41,13 +43,17 @@ static void *spf_open(uschar *filename, uschar **errmsg) { return (void *) spf_server; } -static void spf_close(void *handle) { +static void +spf_close(void *handle) +{ SPF_server_t *spf_server = handle; if (spf_server) SPF_server_free(spf_server); } -static int spf_find(void *handle, uschar *filename, uschar *keystring, int key_len, - uschar **result, uschar **errmsg, BOOL *do_cache) { +static int +spf_find(void *handle, uschar *filename, uschar *keystring, int key_len, + uschar **result, uschar **errmsg, uint *do_cache) +{ SPF_server_t *spf_server = handle; SPF_request_t *spf_request = NULL; SPF_response_t *spf_response = NULL; diff --git a/src/src/lookups/sqlite.c b/src/src/lookups/sqlite.c index bb92c8c18..e2330f920 100644 --- a/src/src/lookups/sqlite.c +++ b/src/src/lookups/sqlite.c @@ -81,7 +81,7 @@ return 0; static int sqlite_find(void *handle, uschar *filename, const uschar *query, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { int ret; struct strbuf res = { NULL, 0, 0 }; @@ -93,7 +93,7 @@ if (ret != SQLITE_OK) return FAIL; } -if (res.string == NULL) *do_cache = FALSE; +if (res.string == NULL) *do_cache = 0; *result = res.string; return OK; diff --git a/src/src/lookups/testdb.c b/src/src/lookups/testdb.c index c82fa7f3e..401f7c8bf 100644 --- a/src/src/lookups/testdb.c +++ b/src/src/lookups/testdb.c @@ -38,7 +38,7 @@ return (void *)(1); /* Just return something non-null */ static int testdb_find(void *handle, uschar *filename, const uschar *query, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { handle = handle; /* Keep picky compilers happy */ filename = filename; @@ -57,7 +57,7 @@ if (Ustrcmp(query, "defer") == 0) return DEFER; } -if (Ustrcmp(query, "nocache") == 0) *do_cache = FALSE; +if (Ustrcmp(query, "nocache") == 0) *do_cache = 0; *result = string_copy(query); return OK; diff --git a/src/src/lookups/whoson.c b/src/src/lookups/whoson.c index 4166089bd..9ac5a3a43 100644 --- a/src/src/lookups/whoson.c +++ b/src/src/lookups/whoson.c @@ -36,7 +36,7 @@ return (void *)(1); /* Just return something non-null */ static int whoson_find(void *handle, uschar *filename, uschar *query, int length, - uschar **result, uschar **errmsg, BOOL *do_cache) + uschar **result, uschar **errmsg, uint *do_cache) { uschar buffer[80]; handle = handle; /* Keep picky compilers happy */ diff --git a/src/src/search.c b/src/src/search.c index a05529196..cd522dae8 100644 --- a/src/src/search.c +++ b/src/src/search.c @@ -466,6 +466,7 @@ internal_search_find(void *handle, uschar *filename, uschar *keystring) { tree_node *t = (tree_node *)handle; search_cache *c = (search_cache *)(t->data.ptr); +expiring_data *e; uschar *data = NULL; int search_type = t->name[0] - '0'; int old_pool = store_pool; @@ -491,18 +492,27 @@ store_pool = POOL_SEARCH; /* Look up the data for the key, unless it is already in the cache for this file. No need to check c->item_cache for NULL, tree_search will do so. */ -if ((t = tree_search(c->item_cache, keystring)) == NULL) +if ( (t = tree_search(c->item_cache, keystring)) + && (!(e = t->data.ptr)->expiry || e->expiry > time(NULL)) + ) + { /* Data was in the cache already; set the pointer from the tree node */ + data = e->ptr; + DEBUG(D_lookup) debug_printf("cached data used for lookup of %s%s%s\n", + keystring, + filename ? US"\n in " : US"", filename ? filename : US""); + } +else { - BOOL do_cache = TRUE; + uint do_cache = UINT_MAX; int keylength = Ustrlen(keystring); DEBUG(D_lookup) { - if (filename != NULL) - debug_printf("file lookup required for %s\n in %s\n", - keystring, filename); - else - debug_printf("database lookup required for %s\n", keystring); + if (t) debug_printf("cached data found but past valid time; "); + debug_printf("%s lookup required for %s%s%s\n", + filename ? US"file" : US"database", + keystring, + filename ? US"\n in " : US"", filename ? filename : US""); } /* Call the code for the different kinds of search. DEFER is handled @@ -511,9 +521,7 @@ if ((t = tree_search(c->item_cache, keystring)) == NULL) if (lookup_list[search_type]->find(c->handle, filename, keystring, keylength, &data, &search_error_message, &do_cache) == DEFER) - { search_find_defer = TRUE; - } /* A record that has been found is now in data, which is either NULL or points to a bit of dynamic store. Cache the result of the lookup if @@ -524,10 +532,22 @@ if ((t = tree_search(c->item_cache, keystring)) == NULL) else if (do_cache) { int len = keylength + 1; - t = store_get(sizeof(tree_node) + len); - memcpy(t->name, keystring, len); - t->data.ptr = data; - tree_insertnode(&c->item_cache, t); + + if (t) /* Previous, out-of-date cache entry. Update with the */ + { /* new result and forget the old one */ + e->expiry = do_cache == UINT_MAX ? 0 : time(NULL)+do_cache; + e->ptr = data; + } + else + { + t = store_get(sizeof(tree_node) + len + sizeof(expiring_data)); + e = (expiring_data *)((char *)t + sizeof(tree_node) + len); + e->expiry = do_cache == UINT_MAX ? 0 : time(NULL)+do_cache; + e->ptr = data; + memcpy(t->name, keystring, len); + t->data.ptr = e; + tree_insertnode(&c->item_cache, t); + } } /* If caching was disabled, empty the cache tree. We just set the cache @@ -540,34 +560,19 @@ if ((t = tree_search(c->item_cache, keystring)) == NULL) } } -/* Data was in the cache already; set the pointer from the tree node */ - -else - { - data = US t->data.ptr; - DEBUG(D_lookup) debug_printf("cached data used for lookup of %s%s%s\n", - keystring, - (filename == NULL)? US"" : US"\n in ", - (filename == NULL)? US"" : filename); - } - -/* Debug: output the answer */ - DEBUG(D_lookup) { - if (data == NULL) - { - if (search_find_defer) debug_printf("lookup deferred: %s\n", - search_error_message); - else debug_printf("lookup failed\n"); - } - else debug_printf("lookup yielded: %s\n", data); + if (data) + debug_printf("lookup yielded: %s\n", data); + else if (search_find_defer) + debug_printf("lookup deferred: %s\n", search_error_message); + else debug_printf("lookup failed\n"); } /* Return it in new dynamic store in the regular pool */ store_pool = old_pool; -return (data == NULL)? NULL : string_copy(data); +return data ? string_copy(data) : NULL; } diff --git a/src/src/structs.h b/src/src/structs.h index db9e843ac..c36d08ca7 100644 --- a/src/src/structs.h +++ b/src/src/structs.h @@ -662,6 +662,16 @@ typedef struct tree_node { uschar name[1]; /* node name - variable length */ } tree_node; +/* Structure for holding time-limited data such as DNS returns. +We use this rather than extending tree_node to avoid wasting +space for most tree use (variables...) at the cost of complexity +for the lookups cache */ + +typedef struct expiring_data { + time_t expiry; /* if nonzero, data invalid after this time */ + void *ptr; /* pointer to data */ +} expiring_data; + /* Structure for holding the handle and the cached last lookup for searches. This block is pointed to by the tree entry for the file. The file can get closed if too many are opened at once. There is a LRU chain for deciding which @@ -681,6 +691,7 @@ uncompressed, but the data pointer is into the raw data. */ typedef struct { uschar name[DNS_MAXNAME]; /* domain name */ int type; /* record type */ + unsigned short ttl; /* time-to-live, seconds */ int size; /* size of data */ uschar *data; /* pointer to data */ } dns_record; diff --git a/src/src/verify.c b/src/src/verify.c index 7992d58fc..dc9c58224 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -21,6 +21,7 @@ uschar ctbuffer[8192]; /* Structure for caching DNSBL lookups */ typedef struct dnsbl_cache_block { + time_t expiry; dns_address *rhs; uschar *text; int rc; @@ -3584,21 +3585,37 @@ if (!string_format(query, sizeof(query), "%s.%s", prepend, domain)) /* Look for this query in the cache. */ -t = tree_search(dnsbl_cache, query); +if ( (t = tree_search(dnsbl_cache, query)) + && (cb = t->data.ptr)->expiry > time(NULL) + ) + +/* Previous lookup was cached */ + + { + HDEBUG(D_dnsbl) debug_printf("using result of previous DNS lookup\n"); + } /* If not cached from a previous lookup, we must do a DNS lookup, and cache the result in permanent memory. */ -if (t == NULL) +else { + uint ttl = UINT_MAX; + store_pool = POOL_PERM; - /* Set up a tree entry to cache the lookup */ + if (t) + { + HDEBUG(D_dnsbl) debug_printf("cached data found but past valid time; "); + } - t = store_get(sizeof(tree_node) + Ustrlen(query)); - Ustrcpy(t->name, query); - t->data.ptr = cb = store_get(sizeof(dnsbl_cache_block)); - (void)tree_insertnode(&dnsbl_cache, t); + else + { /* Set up a tree entry to cache the lookup */ + t = store_get(sizeof(tree_node) + Ustrlen(query)); + Ustrcpy(t->name, query); + t->data.ptr = cb = store_get(sizeof(dnsbl_cache_block)); + (void)tree_insertnode(&dnsbl_cache, t); + } /* Do the DNS loopup . */ @@ -3634,6 +3651,7 @@ if (t == NULL) *addrp = da; while (da->next != NULL) da = da->next; addrp = &(da->next); + if (ttl > rr->ttl) ttl = rr->ttl; } } } @@ -3645,17 +3663,10 @@ if (t == NULL) if (cb->rhs == NULL) cb->rc = DNS_NODATA; } + cb->expiry = time(NULL)+ttl; store_pool = old_pool; } -/* Previous lookup was cached */ - -else - { - HDEBUG(D_dnsbl) debug_printf("using result of previous DNS lookup\n"); - cb = t->data.ptr; - } - /* We now have the result of the DNS lookup, either newly done, or cached from a previous call. If the lookup succeeded, check against the address list if there is one. This may be a positive equality list (introduced by diff --git a/test/confs/2200 b/test/confs/2200 index 3bef13363..ae5988cee 100644 --- a/test/confs/2200 +++ b/test/confs/2200 @@ -1,4 +1,5 @@ # Exim test configuration 2200 +# Check for dnsdb cache TTL handling exim_path = EXIM_PATH host_lookup_order = bydns @@ -8,4 +9,20 @@ log_file_path = DIR/spool/log/%slog gecos_pattern = "" gecos_name = CALLER_NAME +# ----- Main settings ----- + +acl_not_smtp = check_rcpt +queue_only + +begin acl + +check_rcpt: + warn + set acl_m1 = ${map {<,$recipients} \ + {${lookup dnsdb{a=${domain:$item}}{$value}fail}}} + delay = 4s + set acl_m1 = ${map {<,$recipients} \ + {${lookup dnsdb{a=${domain:$item}}{$value}fail}}} + accept + # End diff --git a/test/confs/2201 b/test/confs/2201 index ae17b7cb4..7b257cce3 100644 --- a/test/confs/2201 +++ b/test/confs/2201 @@ -12,11 +12,43 @@ gecos_name = CALLER_NAME trusted_users = CALLER +acl_smtp_rcpt = check_rcpt +acl_not_smtp = check_sndr +queue_only + +# - ACL -- +begin acl + +check_rcpt: + # Do not care about result, looking at debug output + # expect an original lookup, a cached lookup avoidance + # then a TTL-required repeat lookup + warn dnslists = rbl.test.ex/V4NET.11.12.14 + dnslists = rbl.test.ex/V4NET.11.12.14 + delay = 4s + dnslists = rbl.test.ex/V4NET.11.12.14 + accept + +check_sndr: + # Do not care about result, looking at debug output + # expect an original lookup, a cached lookup avoidance + # then a TTL-required repeat lookup + warn sender_domains = dnsdb;a=$sender_address_domain + sender_domains = dnsdb;a=$sender_address_domain + delay = 4s + sender_domains = dnsdb;a=$sender_address_domain + accept + # ----- Routers ----- begin routers +r0: + driver = accept + senders = a@shorthost.test.ex + transport = remote_delivery + r1: driver = accept domains = dnsdb;$domain @@ -41,6 +73,11 @@ local_delivery: file = DIR/test-mail/$local_part user = CALLER +remote_delivery: + driver = smtp + hosts = 127.0.0.1 + allow_localhost + port = PORT_D # ----- Retry ----- diff --git a/test/dnszones-src/db.test.ex b/test/dnszones-src/db.test.ex index 4cbf0f251..61f274eb0 100644 --- a/test/dnszones-src/db.test.ex +++ b/test/dnszones-src/db.test.ex @@ -51,6 +51,10 @@ mx.xn--1xa A V4NET.255.255.255 thishost A 127.0.0.1 localhost4 A 127.0.0.1 +; A localhost with short TTL + +TTL=2 shorthost A 127.0.0.1 + ; Something that gives both the IP and the loopback @@ -170,7 +174,7 @@ cname4 CNAME thishost 13.12.11.V4NET.rbl A 127.0.0.2 TXT "This is a test blacklisting message" -14.12.11.V4NET.rbl A 127.0.0.2 +TTL=2 14.12.11.V4NET.rbl A 127.0.0.2 TXT "This is a test blacklisting message" 15.12.11.V4NET.rbl A 127.0.0.2 TXT "This is a very long blacklisting message, continuing for ages and ages and certainly being longer than 128 characters which was a previous limit on the length that Exim was prepared to handle." diff --git a/test/log/2200 b/test/log/2200 new file mode 100644 index 000000000..f59faf8b9 --- /dev/null +++ b/test/log/2200 @@ -0,0 +1 @@ +1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss diff --git a/test/log/2201 b/test/log/2201 new file mode 100644 index 000000000..d413ddaf3 --- /dev/null +++ b/test/log/2201 @@ -0,0 +1,7 @@ +1999-03-02 09:44:33 10HmaX-0005vi-00 <= a@shorthost.test.ex U=CALLER P=local S=sss +1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225 +1999-03-02 09:44:33 Start queue run: pid=pppp +1999-03-02 09:44:33 10HmaY-0005vi-00 <= a@shorthost.test.ex H=localhost (myhost.test.ex) [127.0.0.1] P=esmtp S=sss id=E10HmaX-0005vi-00@myhost.test.ex +1999-03-02 09:44:33 10HmaX-0005vi-00 => t@test.ex R=r0 T=remote_delivery H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmaY-0005vi-00" +1999-03-02 09:44:33 10HmaX-0005vi-00 Completed +1999-03-02 09:44:33 End queue run: pid=pppp diff --git a/test/scripts/2200-dnsdb/2200 b/test/scripts/2200-dnsdb/2200 index 40837dbd0..9f6262524 100644 --- a/test/scripts/2200-dnsdb/2200 +++ b/test/scripts/2200-dnsdb/2200 @@ -49,3 +49,16 @@ defer_strict:ten-1 ${lookup dnsdb{defer_strict,a=test.again.dns:ten-1.te delay1500 ${lookup dnsdb{retrans_1s,retry_2,a=delay1500.test.ex}} **** +# +# Cacheability +exim -d-all+lookup -be +a=localhost.test.ex ${lookup dnsdb{a=localhost.test.ex}{$value}fail} +a=localhost.test.ex ${lookup dnsdb{a=localhost.test.ex}{$value}fail} +**** +# +# TTL-limited noncacheability +exim -d-all+lookup -odq user@shorthost.test.ex +**** +# +no_msglog_check +# diff --git a/test/scripts/2200-dnsdb/2201 b/test/scripts/2200-dnsdb/2201 index 600298793..d432ca187 100644 --- a/test/scripts/2200-dnsdb/2201 +++ b/test/scripts/2200-dnsdb/2201 @@ -1,6 +1,24 @@ # query-style lookup in domains, local_parts, senders +munge debug_pid exim -d -bt test.ex@test.ex unknown@test.ex **** 2 exim -f a@b.c -bt test.ex@test.ex unknown@test.ex **** +# +# +# lookup non/cacheability, lookup done as a list item +exim -d-all+lookup -odq -f a@shorthost.test.ex t@test.ex +**** +# +# +# lookup non/cacheability, lookup done for a dnslists= ACL condition +exim -DSERVER=server -d-all+dnsbl -bd -oX PORT_D +**** +exim -q +**** +# +killdaemon +millisleep 500 +no_msglog_check +# diff --git a/test/src/fakens.c b/test/src/fakens.c index a03f94a07..7e93979ec 100644 --- a/test/src/fakens.c +++ b/test/src/fakens.c @@ -61,6 +61,9 @@ Any DNS record line in a zone file can be prefixed with "AA " if all the records found by a lookup are marked as such then the response will have the "AA" bit set. +Any DNS record line in a zone file can be prefixed with "TTL=" and +a number of seconds (followed by one space). + */ #include @@ -105,6 +108,8 @@ typedef struct tlist { int value; } tlist; +#define DEFAULT_TTL 3600U + /* On some (older?) operating systems, the standard ns_t_xxx definitions are not available, and only the older T_xxx ones exist in nameser.h. If ns_t_a is not defined, assume we are in this state. A really old system might not even @@ -347,6 +352,7 @@ while (fgets(CS buffer, sizeof(buffer), f) != NULL) BOOL rr_sec = FALSE; BOOL rr_aa = FALSE; int delay = 0; + uint ttl = DEFAULT_TTL; p = buffer; while (isspace(*p)) p++; @@ -380,6 +386,12 @@ while (fgets(CS buffer, sizeof(buffer), f) != NULL) for (p += 6; *p >= '0' && *p <= '9'; p++) delay = delay*10 + *p - '0'; if (isspace(*p)) p++; } + else if (Ustrncmp(p, US"TTL=", 4) == 0) /* TTL for record */ + { + ttl = 0; + for (p += 4; *p >= '0' && *p <= '9'; p++) ttl = ttl*10 + *p - '0'; + if (isspace(*p)) p++; + } else break; } @@ -459,7 +471,10 @@ while (fgets(CS buffer, sizeof(buffer), f) != NULL) *pk++ = 0; *pk++ = 1; /* class = IN */ - pk += 4; /* TTL field; don't care */ + *pk++ = (ttl >>24) & 255; + *pk++ = (ttl >>16) & 255; + *pk++ = (ttl >> 8) & 255; + *pk++ = ttl & 255; rdlptr = pk; /* remember rdlength field */ pk += 2; diff --git a/test/stderr/2200 b/test/stderr/2200 new file mode 100644 index 000000000..4fec895ea --- /dev/null +++ b/test/stderr/2200 @@ -0,0 +1,52 @@ +Exim version x.yz .... +configuration file is TESTSUITE/test-config +admin user +search_open: dnsdb "NULL" +search_find: file="NULL" + key="a=localhost.test.ex" partial=-1 affix=NULL starflags=0 +LRU list: +internal_search_find: file="NULL" + type=dnsdb key="a=localhost.test.ex" +database lookup required for a=localhost.test.ex +dnsdb key: localhost.test.ex +lookup yielded: 127.0.0.1 +search_open: dnsdb "NULL" + cached open +search_find: file="NULL" + key="a=localhost.test.ex" partial=-1 affix=NULL starflags=0 +LRU list: +internal_search_find: file="NULL" + type=dnsdb key="a=localhost.test.ex" +cached data used for lookup of a=localhost.test.ex +lookup yielded: 127.0.0.1 +search_tidyup called +>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>> +Exim version x.yz .... +configuration file is TESTSUITE/test-config +admin user +search_tidyup called +search_tidyup called +search_open: dnsdb "NULL" +search_find: file="NULL" + key="a=shorthost.test.ex" partial=-1 affix=NULL starflags=0 +LRU list: +internal_search_find: file="NULL" + type=dnsdb key="a=shorthost.test.ex" +database lookup required for a=shorthost.test.ex +dnsdb key: shorthost.test.ex +lookup yielded: 127.0.0.1 +search_open: dnsdb "NULL" + cached open +search_find: file="NULL" + key="a=shorthost.test.ex" partial=-1 affix=NULL starflags=0 +LRU list: +internal_search_find: file="NULL" + type=dnsdb key="a=shorthost.test.ex" +cached data found but past valid time; database lookup required for a=shorthost.test.ex +dnsdb key: shorthost.test.ex +lookup yielded: 127.0.0.1 +LOG: MAIN + <= CALLER@myhost.test.ex U=CALLER P=local S=sss +created log directory TESTSUITE/spool/log +search_tidyup called +>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>> diff --git a/test/stderr/2201 b/test/stderr/2201 index 925d3c6f7..523ae4395 100644 --- a/test/stderr/2201 +++ b/test/stderr/2201 @@ -3,9 +3,11 @@ changed uid/gid: forcing real = effective uid=uuuu gid=CALLER_GID pid=pppp seeking password data for user "CALLER": cache not available getpwnam() succeeded uid=CALLER_UID gid=CALLER_GID +tls_validate_require_cipher child ppppp ended: status=0x0 configuration file is TESTSUITE/test-config trusted user admin user +DSN: r0 propagating DSN DSN: r1 propagating DSN DSN: r2 propagating DSN seeking password data for user "CALLER": using cached result @@ -19,6 +21,12 @@ Testing test.ex@test.ex Considering test.ex@test.ex >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> routing test.ex@test.ex +--------> r0 router <-------- +local_part=test.ex domain=test.ex +checking senders +address match test: subject=CALLER@myhost.test.ex pattern=a@shorthost.test.ex +CALLER@myhost.test.ex in "a@shorthost.test.ex"? no (end of list) +r0 router skipped: senders mismatch --------> r1 router <-------- local_part=test.ex domain=test.ex checking domains @@ -62,6 +70,12 @@ Testing unknown@test.ex Considering unknown@test.ex >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> routing unknown@test.ex +--------> r0 router <-------- +local_part=unknown domain=test.ex +checking senders +address match test: subject=CALLER@myhost.test.ex pattern=a@shorthost.test.ex +CALLER@myhost.test.ex in "a@shorthost.test.ex"? no (end of list) +r0 router skipped: senders mismatch --------> r1 router <-------- local_part=unknown domain=test.ex checking domains @@ -132,3 +146,84 @@ routed by r2 router transport: local_delivery search_tidyup called >>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>> +Exim version x.yz .... +configuration file is TESTSUITE/test-config +trusted user +admin user +search_tidyup called +search_tidyup called +search_open: dnsdb "NULL" +search_find: file="NULL" + key="a=shorthost.test.ex" partial=-1 affix=NULL starflags=0 +LRU list: +internal_search_find: file="NULL" + type=dnsdb key="a=shorthost.test.ex" +database lookup required for a=shorthost.test.ex +dnsdb key: shorthost.test.ex +lookup yielded: 127.0.0.1 +search_open: dnsdb "NULL" + cached open +search_find: file="NULL" + key="a=shorthost.test.ex" partial=-1 affix=NULL starflags=0 +LRU list: +internal_search_find: file="NULL" + type=dnsdb key="a=shorthost.test.ex" +cached data used for lookup of a=shorthost.test.ex +lookup yielded: 127.0.0.1 +search_open: dnsdb "NULL" + cached open +search_find: file="NULL" + key="a=shorthost.test.ex" partial=-1 affix=NULL starflags=0 +LRU list: +internal_search_find: file="NULL" + type=dnsdb key="a=shorthost.test.ex" +cached data found but past valid time; database lookup required for a=shorthost.test.ex +dnsdb key: shorthost.test.ex +lookup yielded: 127.0.0.1 +LOG: MAIN + <= a@shorthost.test.ex U=CALLER P=local S=sss +created log directory TESTSUITE/spool/log +search_tidyup called +>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>> + +******** SERVER ******** +Exim version x.yz .... +configuration file is TESTSUITE/test-config +trusted user +admin user +ppppp daemon_smtp_port overridden by -oX: +ppppp <: 1225 +ppppp listening on all interfaces (IPv6) port 1225 +ppppp listening on all interfaces (IPv4) port 1225 +ppppp pid written to TESTSUITE/spool/exim-daemon.pid +ppppp LOG: MAIN +ppppp exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225 +ppppp daemon running with uid=EXIM_UID gid=EXIM_GID euid=EXIM_UID egid=EXIM_GID +ppppp Listening... +ppppp Connection request from 127.0.0.1 port sssss +ppppp 1 SMTP accept process running +ppppp Listening... +ppppp Process ppppp is handling incoming connection from [127.0.0.1] +ppppp Process ppppp is ready for new message +ppppp DNS list check: rbl.test.ex/V4NET.11.12.14 +ppppp new DNS lookup for 14.12.11.V4NET.rbl.test.ex +ppppp DNS lookup for 14.12.11.V4NET.rbl.test.ex succeeded (yielding 127.0.0.2) +ppppp => that means V4NET.11.12.14 is listed at rbl.test.ex +ppppp DNS list check: rbl.test.ex/V4NET.11.12.14 +ppppp using result of previous DNS lookup +ppppp DNS lookup for 14.12.11.V4NET.rbl.test.ex succeeded (yielding 127.0.0.2) +ppppp => that means V4NET.11.12.14 is listed at rbl.test.ex +ppppp DNS list check: rbl.test.ex/V4NET.11.12.14 +ppppp cached data found but past valid time; new DNS lookup for 14.12.11.V4NET.rbl.test.ex +ppppp DNS lookup for 14.12.11.V4NET.rbl.test.ex succeeded (yielding 127.0.0.2) +ppppp => that means V4NET.11.12.14 is listed at rbl.test.ex +PDKIM >> Hashed body data, canonicalized >>>>>>>>>>>>>>>>>>>>>>>>>>>>> +ppppp LOG: MAIN +ppppp <= a@shorthost.test.ex H=localhost (myhost.test.ex) [127.0.0.1] P=esmtp S=sss id=E10HmaX-0005vi-00@myhost.test.ex +ppppp Process ppppp is ready for new message +ppppp LOG: smtp_connection MAIN +ppppp SMTP connection from localhost (myhost.test.ex) [127.0.0.1] closed by QUIT +ppppp child ppppp ended: status=0x0 +ppppp normal exit, 0 +ppppp 0 SMTP accept processes now running +ppppp Listening... diff --git a/test/stdout/2200 b/test/stdout/2200 index b77594803..71ff12017 100644 --- a/test/stdout/2200 +++ b/test/stdout/2200 @@ -51,3 +51,6 @@ ten-2.test.ex > > delay1500 ip4.ip4.ip4.ip4 > +> a=localhost.test.ex 127.0.0.1 +> a=localhost.test.ex 127.0.0.1 +> -- 2.30.2