When a single-key or absfilequery lookup file is opened, the handle returned by
the xxx_open() function is saved, along with the file name and lookup type, in
-a tree. The xxx_close() function is not called when the first lookup is
-completed. If there are subsequent lookups of the same type that quote the same
-file name, xxx_open() isn't called; instead the cached handle is re-used.
+a tree. Traditionally, lookup_querystyle does not use this (just returning a
+dummy value, and doing the "open" work in the xxx_find() routine); but this is
+not enforced by the framework.
+
+The xxx_close() function is not called when the first lookup is completed. If
+there are subsequent lookups of the same type that quote the same file name,
+xxx_open() isn't called; instead the cached handle is re-used.
Exim calls the function search_tidyup() at strategic points in its processing
(e.g. after all routing and directing has been done) and this function walks
does NOT use the POOL_SEARCH store, because it's usually never called from any
lookup code.
-xxx_report_version()
+xxx_version_report()
--------------------
This is called to report diagnostic information to a file stream.
lookup_info cdb_lookup_info = {
- US"cdb", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- cdb_open, /* open function */
- cdb_check, /* check function */
- cdb_find, /* find function */
- cdb_close, /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- cdb_version_report /* version reporting */
+ .name = US"cdb", /* lookup name */
+ .type = lookup_absfile, /* absolute file name */
+ .open = cdb_open, /* open function */
+ .check = cdb_check, /* check function */
+ .find = cdb_find, /* find function */
+ .close = cdb_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = cdb_version_report /* version reporting */
};
#ifdef DYNLOOKUP
lookup_info dbm_lookup_info = {
- US"dbm", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- dbmdb_open, /* open function */
- dbmdb_check, /* check function */
- dbmdb_find, /* find function */
- dbmdb_close, /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- dbm_version_report /* version reporting */
+ .name = US"dbm", /* lookup name */
+ .type = lookup_absfile, /* uses absolute file name */
+ .open = dbmdb_open, /* open function */
+ .check = dbmdb_check, /* check function */
+ .find = dbmdb_find, /* find function */
+ .close = dbmdb_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = dbm_version_report /* version reporting */
};
lookup_info dbmz_lookup_info = {
- US"dbmnz", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- dbmdb_open, /* sic */ /* open function */
- dbmdb_check, /* sic */ /* check function */
- dbmnz_find, /* find function */
- dbmdb_close, /* sic */ /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- NULL /* no version reporting (redundant) */
+ .name = US"dbmnz", /* lookup name */
+ .type = lookup_absfile, /* uses absolute file name */
+ .open = dbmdb_open, /* sic */ /* open function */
+ .check = dbmdb_check, /* sic */ /* check function */
+ .find = dbmnz_find, /* find function */
+ .close = dbmdb_close, /* sic */ /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = NULL /* no version reporting (redundant) */
};
lookup_info dbmjz_lookup_info = {
- US"dbmjz", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- dbmdb_open, /* sic */ /* open function */
- dbmdb_check, /* sic */ /* check function */
- dbmjz_find, /* find function */
- dbmdb_close, /* sic */ /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- NULL /* no version reporting (redundant) */
+ .name = US"dbmjz", /* lookup name */
+ .type = lookup_absfile, /* uses absolute file name */
+ .open = dbmdb_open, /* sic */ /* open function */
+ .check = dbmdb_check, /* sic */ /* check function */
+ .find = dbmjz_find, /* find function */
+ .close = dbmdb_close, /* sic */ /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = NULL /* no version reporting (redundant) */
};
#ifdef DYNLOOKUP
static lookup_info _lookup_info = {
- US"dnsdb", /* lookup name */
- lookup_querystyle, /* query style */
- dnsdb_open, /* open function */
- NULL, /* check function */
- dnsdb_find, /* find function */
- NULL, /* no close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- dnsdb_version_report /* version reporting */
+ .name = US"dnsdb", /* lookup name */
+ .type = lookup_querystyle, /* query style */
+ .open = dnsdb_open, /* open function */
+ .check = NULL, /* check function */
+ .find = dnsdb_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = dnsdb_version_report /* version reporting */
};
#ifdef DYNLOOKUP
static lookup_info _lookup_info = {
- US"dsearch", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- dsearch_open, /* open function */
- dsearch_check, /* check function */
- dsearch_find, /* find function */
- dsearch_close, /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- dsearch_version_report /* version reporting */
+ .name = US"dsearch", /* lookup name */
+ .type = lookup_absfile, /* uses absolute file name */
+ .open = dsearch_open, /* open function */
+ .check = dsearch_check, /* check function */
+ .find = dsearch_find, /* find function */
+ .close = dsearch_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = dsearch_version_report /* version reporting */
};
#ifdef DYNLOOKUP
static lookup_info _lookup_info = {
- US"ibase", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- ibase_open, /* open function */
- NULL, /* no check function */
- ibase_find, /* find function */
- NULL, /* no close function */
- ibase_tidy, /* tidy function */
- ibase_quote, /* quoting function */
- ibase_version_report /* version reporting */
+ .name = US"ibase", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = ibase_open, /* open function */
+ .check NULL, /* no check function */
+ .find = ibase_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = ibase_tidy, /* tidy function */
+ .quote = ibase_quote, /* quoting function */
+ .version_report = ibase_version_report /* version reporting */
};
#ifdef DYNLOOKUP
static lookup_info json_lookup_info = {
- US"json", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- json_open, /* open function */
- json_check, /* check function */
- json_find, /* find function */
- json_close, /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- json_version_report /* version reporting */
+ .name = US"json", /* lookup name */
+ .type = lookup_absfile, /* uses absolute file name */
+ .open = json_open, /* open function */
+ .check = json_check, /* check function */
+ .find = json_find, /* find function */
+ .close = json_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = json_version_report /* version reporting */
};
static lookup_info ldap_lookup_info = {
- US"ldap", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- eldap_open, /* open function */
- NULL, /* check function */
- eldap_find, /* find function */
- NULL, /* no close function */
- eldap_tidy, /* tidy function */
- eldap_quote, /* quoting function */
- ldap_version_report /* version reporting */
+ .name = US"ldap", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = eldap_open, /* open function */
+ .check = NULL, /* check function */
+ .find = eldap_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = eldap_tidy, /* tidy function */
+ .quote = eldap_quote, /* quoting function */
+ .version_report = ldap_version_report /* version reporting */
};
static lookup_info ldapdn_lookup_info = {
- US"ldapdn", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- eldap_open, /* sic */ /* open function */
- NULL, /* check function */
- eldapdn_find, /* find function */
- NULL, /* no close function */
- eldap_tidy, /* sic */ /* tidy function */
- eldap_quote, /* sic */ /* quoting function */
- NULL /* no version reporting (redundant) */
+ .name = US"ldapdn", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = eldap_open, /* sic */ /* open function */
+ .check = NULL, /* check function */
+ .find = eldapdn_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = eldap_tidy, /* sic */ /* tidy function */
+ .quote = eldap_quote, /* sic */ /* quoting function */
+ .version_report = NULL /* no version reporting (redundant) */
};
static lookup_info ldapm_lookup_info = {
- US"ldapm", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- eldap_open, /* sic */ /* open function */
- NULL, /* check function */
- eldapm_find, /* find function */
- NULL, /* no close function */
- eldap_tidy, /* sic */ /* tidy function */
- eldap_quote, /* sic */ /* quoting function */
- NULL /* no version reporting (redundant) */
+ .name = US"ldapm", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = eldap_open, /* sic */ /* open function */
+ .check = NULL, /* check function */
+ .find = eldapm_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = eldap_tidy, /* sic */ /* tidy function */
+ .quote = eldap_quote, /* sic */ /* quoting function */
+ .version_report = NULL /* no version reporting (redundant) */
};
#ifdef DYNLOOKUP
}
static lookup_info lmdb_lookup_info = {
- US"lmdb", /* lookup name */
- lookup_absfile, /* query-style lookup */
- lmdb_open, /* open function */
- NULL, /* no check function */
- lmdb_find, /* find function */
- lmdb_close, /* close function */
- NULL, /* tidy function */
- NULL, /* quoting function */
- lmdb_version_report /* version reporting */
+ .name = US"lmdb", /* lookup name */
+ .type = lookup_absfile, /* query-style lookup */
+ .open = lmdb_open, /* open function */
+ .check = NULL, /* no check function */
+ .find = lmdb_find, /* find function */
+ .close = lmdb_close, /* close function */
+ .tidy = NULL, /* tidy function */
+ .quote = NULL, /* quoting function */
+ .version_report = lmdb_version_report /* version reporting */
};
#ifdef DYNLOOKUP
static lookup_info iplsearch_lookup_info = {
- US"iplsearch", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- lsearch_open, /* open function */
- lsearch_check, /* check function */
- iplsearch_find, /* find function */
- lsearch_close, /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- NULL /* no version reporting (redundant) */
+ .name = US"iplsearch", /* lookup name */
+ .type = lookup_absfile, /* uses absolute file name */
+ .open = lsearch_open, /* open function */
+ .check = lsearch_check, /* check function */
+ .find = iplsearch_find, /* find function */
+ .close = lsearch_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = NULL /* no version reporting (redundant) */
};
static lookup_info lsearch_lookup_info = {
- US"lsearch", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- lsearch_open, /* open function */
- lsearch_check, /* check function */
- lsearch_find, /* find function */
- lsearch_close, /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- lsearch_version_report /* version reporting */
+ .name = US"lsearch", /* lookup name */
+ .type = lookup_absfile, /* uses absolute file name */
+ .open = lsearch_open, /* open function */
+ .check = lsearch_check, /* check function */
+ .find = lsearch_find, /* find function */
+ .close = lsearch_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = lsearch_version_report /* version reporting */
};
static lookup_info nwildlsearch_lookup_info = {
- US"nwildlsearch", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- lsearch_open, /* open function */
- lsearch_check, /* check function */
- nwildlsearch_find, /* find function */
- lsearch_close, /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- NULL /* no version reporting (redundant) */
+ .name = US"nwildlsearch", /* lookup name */
+ .type = lookup_absfile, /* uses absolute file name */
+ .open = lsearch_open, /* open function */
+ .check = lsearch_check, /* check function */
+ .find = nwildlsearch_find, /* find function */
+ .close = lsearch_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = NULL /* no version reporting (redundant) */
};
static lookup_info wildlsearch_lookup_info = {
- US"wildlsearch", /* lookup name */
- lookup_absfile, /* uses absolute file name */
- lsearch_open, /* open function */
- lsearch_check, /* check function */
- wildlsearch_find, /* find function */
- lsearch_close, /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- NULL /* no version reporting (redundant) */
+ .name = US"wildlsearch", /* lookup name */
+ .type = lookup_absfile, /* uses absolute file name */
+ .open = lsearch_open, /* open function */
+ .check = lsearch_check, /* check function */
+ .find = wildlsearch_find, /* find function */
+ .close = lsearch_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = NULL /* no version reporting (redundant) */
};
#ifdef DYNLOOKUP
/* These are the lookup_info blocks for this driver */
static lookup_info mysql_lookup_info = {
- US"mysql", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- mysql_open, /* open function */
- NULL, /* no check function */
- mysql_find, /* find function */
- NULL, /* no close function */
- mysql_tidy, /* tidy function */
- mysql_quote, /* quoting function */
- mysql_version_report /* version reporting */
+ .name = US"mysql", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = mysql_open, /* open function */
+ .check = NULL, /* no check function */
+ .find = mysql_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = mysql_tidy, /* tidy function */
+ .quote = mysql_quote, /* quoting function */
+ .version_report = mysql_version_report /* version reporting */
};
#ifdef DYNLOOKUP
static lookup_info nis_lookup_info = {
- US"nis", /* lookup name */
- 0, /* not abs file, not query style*/
- nis_open, /* open function */
- NULL, /* check function */
- nis_find, /* find function */
- NULL, /* no close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- nis_version_report /* version reporting */
+ .name = US"nis", /* lookup name */
+ .type = 0, /* not abs file, not query style*/
+ .open = nis_open, /* open function */
+ .check = NULL, /* check function */
+ .find = nis_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = nis_version_report /* version reporting */
};
static lookup_info nis0_lookup_info = {
- US"nis0", /* lookup name */
- 0, /* not absfile, not query style */
- nis_open, /* sic */ /* open function */
- NULL, /* check function */
- nis0_find, /* find function */
- NULL, /* no close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- NULL /* no version reporting (redundant) */
+ .name = US"nis0", /* lookup name */
+ .type = 0, /* not absfile, not query style */
+ .open = nis_open, /* sic */ /* open function */
+ .check = NULL, /* check function */
+ .find = nis0_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = NULL /* no version reporting (redundant) */
};
#ifdef DYNLOOKUP
static lookup_info _lookup_info = {
- US"nisplus", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- nisplus_open, /* open function */
- NULL, /* check function */
- nisplus_find, /* find function */
- NULL, /* no close function */
- NULL, /* no tidy function */
- nisplus_quote, /* quoting function */
- nisplus_version_report /* version reporting */
+ .name = US"nisplus", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = nisplus_open, /* open function */
+ .check = NULL, /* check function */
+ .find = nisplus_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = nisplus_quote, /* quoting function */
+ .version_report = nisplus_version_report /* version reporting */
};
#ifdef DYNLOOKUP
static lookup_info _lookup_info = {
- US"oracle", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- oracle_open, /* open function */
- NULL, /* check function */
- oracle_find, /* find function */
- NULL, /* no close function */
- oracle_tidy, /* tidy function */
- oracle_quote, /* quoting function */
- oracle_version_report /* version reporting */
+ .name = US"oracle", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = oracle_open, /* open function */
+ .check = NULL, /* check function */
+ .find = oracle_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = oracle_tidy, /* tidy function */
+ .quote = oracle_quote, /* quoting function */
+ .version_report = oracle_version_report /* version reporting */
};
#ifdef DYNLOOKUP
}
static lookup_info _lookup_info = {
- US"passwd", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- passwd_open, /* open function */
- NULL, /* no check function */
- passwd_find, /* find function */
- NULL, /* no close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- passwd_version_report /* version reporting */
+ .name = US"passwd", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = passwd_open, /* open function */
+ .check = NULL, /* no check function */
+ .find = passwd_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = passwd_version_report /* version reporting */
};
#ifdef DYNLOOKUP
static lookup_info _lookup_info = {
- US"pgsql", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- pgsql_open, /* open function */
- NULL, /* no check function */
- pgsql_find, /* find function */
- NULL, /* no close function */
- pgsql_tidy, /* tidy function */
- pgsql_quote, /* quoting function */
- pgsql_version_report /* version reporting */
+ .name = US"pgsql", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = pgsql_open, /* open function */
+ .check = NULL, /* no check function */
+ .find = pgsql_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = pgsql_tidy, /* tidy function */
+ .quote = pgsql_quote, /* quoting function */
+ .version_report = pgsql_version_report /* version reporting */
};
#ifdef DYNLOOKUP
/* These are the lookup_info blocks for this driver */
static lookup_info redis_lookup_info = {
- US"redis", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- redis_open, /* open function */
- NULL, /* no check function */
- redis_find, /* find function */
- NULL, /* no close function */
- redis_tidy, /* tidy function */
- redis_quote, /* quoting function */
- redis_version_report /* version reporting */
+ .name = US"redis", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = redis_open, /* open function */
+ .check = NULL, /* no check function */
+ .find = redis_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = redis_tidy, /* tidy function */
+ .quote = redis_quote, /* quoting function */
+ .version_report = redis_version_report /* version reporting */
};
#ifdef DYNLOOKUP
static lookup_info _lookup_info = {
- US"spf", /* lookup name */
- 0, /* not absfile, not query style */
- spf_open, /* open function */
- NULL, /* no check function */
- spf_find, /* find function */
- spf_close, /* close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- spf_version_report /* version reporting */
+ .name = US"spf", /* lookup name */
+ .type = 0, /* not absfile, not query style */
+ .open = spf_open, /* open function */
+ .check = NULL, /* no check function */
+ .find = spf_find, /* find function */
+ .close = spf_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = spf_version_report /* version reporting */
};
#ifdef DYNLOOKUP
}
static lookup_info _lookup_info = {
- US"sqlite", /* lookup name */
- lookup_absfilequery, /* query-style lookup, starts with file name */
- sqlite_open, /* open function */
- NULL, /* no check function */
- sqlite_find, /* find function */
- sqlite_close, /* close function */
- NULL, /* no tidy function */
- sqlite_quote, /* quoting function */
- sqlite_version_report /* version reporting */
+ .name = US"sqlite", /* lookup name */
+ .type = lookup_absfilequery, /* query-style lookup, starts with file name */
+ .open = sqlite_open, /* open function */
+ .check = NULL, /* no check function */
+ .find = sqlite_find, /* find function */
+ .close = sqlite_close, /* close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = sqlite_quote, /* quoting function */
+ .version_report = sqlite_version_report /* version reporting */
};
#ifdef DYNLOOKUP
static lookup_info _lookup_info = {
- US"testdb", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- testdb_open, /* open function */
- NULL, /* check function */
- testdb_find, /* find function */
- NULL, /* no close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- testdb_version_report /* version reporting */
+ .name = US"testdb", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = testdb_open, /* open function */
+ .check = NULL, /* check function */
+ .find = testdb_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = testdb_version_report /* version reporting */
};
#ifdef DYNLOOKUP
}
static lookup_info _lookup_info = {
- US"whoson", /* lookup name */
- lookup_querystyle, /* query-style lookup */
- whoson_open, /* open function */
- NULL, /* check function */
- whoson_find, /* find function */
- NULL, /* no close function */
- NULL, /* no tidy function */
- NULL, /* no quoting function */
- whoson_version_report /* version reporting */
+ .name = US"whoson", /* lookup name */
+ .type = lookup_querystyle, /* query-style lookup */
+ .open = whoson_open, /* open function */
+ .check = NULL, /* check function */
+ .find = whoson_find, /* find function */
+ .close = NULL, /* no close function */
+ .tidy = NULL, /* no tidy function */
+ .quote = NULL, /* no quoting function */
+ .version_report = whoson_version_report /* version reporting */
};
#ifdef DYNLOOKUP