LDAP: Fix debug messages
[exim.git] / src / src / lookups / dnsdb.c
CommitLineData
0756eb3c
PH
1/*************************************************
2* Exim - an Internet mail transport agent *
3*************************************************/
4
3386088d 5/* Copyright (c) University of Cambridge 1995 - 2015 */
0756eb3c
PH
6/* See the file NOTICE for conditions of use and distribution. */
7
8#include "../exim.h"
9#include "lf_functions.h"
0756eb3c
PH
10
11
12
13/* Ancient systems (e.g. SunOS4) don't appear to have T_TXT defined in their
14header files. */
15
16#ifndef T_TXT
17#define T_TXT 16
18#endif
19
eae0036b
PP
20/* Many systems do not have T_SPF. */
21#ifndef T_SPF
22#define T_SPF 99
23#endif
24
1e06383a
TL
25/* New TLSA record for DANE */
26#ifndef T_TLSA
27#define T_TLSA 52
28#endif
29
0756eb3c
PH
30/* Table of recognized DNS record types and their integer values. */
31
1ba28e2b 32static const char *type_names[] = {
0756eb3c
PH
33 "a",
34#if HAVE_IPV6
3a796370 35 "a+",
0756eb3c 36 "aaaa",
0756eb3c
PH
37#endif
38 "cname",
e5a9dba6 39 "csa",
0756eb3c 40 "mx",
ea3bc19b 41 "mxh",
0756eb3c
PH
42 "ns",
43 "ptr",
d2a2c69b 44 "soa",
eae0036b 45 "spf",
0756eb3c 46 "srv",
1e06383a 47 "tlsa",
33397d19 48 "txt",
8e669ac1 49 "zns"
33397d19 50};
0756eb3c
PH
51
52static int type_values[] = {
53 T_A,
54#if HAVE_IPV6
66be95e0 55 T_ADDRESSES, /* Private type for AAAA + A */
0756eb3c 56 T_AAAA,
0756eb3c
PH
57#endif
58 T_CNAME,
e5a9dba6 59 T_CSA, /* Private type for "Client SMTP Authorization". */
0756eb3c 60 T_MX,
ea3bc19b 61 T_MXH, /* Private type for "MX hostnames" */
0756eb3c
PH
62 T_NS,
63 T_PTR,
d2a2c69b 64 T_SOA,
eae0036b 65 T_SPF,
0756eb3c 66 T_SRV,
1e06383a 67 T_TLSA,
33397d19
PH
68 T_TXT,
69 T_ZNS /* Private type for "zone nameservers" */
70};
0756eb3c
PH
71
72
73/*************************************************
74* Open entry point *
75*************************************************/
76
77/* See local README for interface description. */
78
e6d225ae 79static void *
0756eb3c
PH
80dnsdb_open(uschar *filename, uschar **errmsg)
81{
82filename = filename; /* Keep picky compilers happy */
83errmsg = errmsg; /* Ditto */
84return (void *)(-1); /* Any non-0 value */
85}
86
87
88
89/*************************************************
90* Find entry point for dnsdb *
91*************************************************/
92
7bb56e1f
PH
93/* See local README for interface description. The query in the "keystring" may
94consist of a number of parts.
95
8e669ac1
PH
96(a) If the first significant character is '>' then the next character is the
97separator character that is used when multiple records are found. The default
7bb56e1f
PH
98separator is newline.
99
0d0c6357
NM
100(b) If the next character is ',' then the next character is the separator
101character used for multiple items of text in "TXT" records. Alternatively,
102if the next character is ';' then these multiple items are concatenated with
103no separator. With neither of these options specified, only the first item
8ee4b30e
PP
104is output. Similarly for "SPF" records, but the default for joining multiple
105items in one SPF record is the empty string, for direct concatenation.
0d0c6357 106
fd7f7910
JH
107(c) Options, all comma-terminated, in any order. Any unrecognised option
108terminates option processing. Recognised options are:
109
110- 'defer_FOO': set the defer behaviour to FOO. The possible behaviours are:
111'strict', where any defer causes the whole lookup to defer; 'lax', where a defer
112causes the whole lookup to defer only if none of the DNS queries succeeds; and
113'never', where all defers are as if the lookup failed. The default is 'lax'.
114
115- 'dnssec_FOO', with 'strict', 'lax' and 'never' (default). The meanings are
fd3b6a4a
JH
116require, try and don't-try dnssec respectively.
117
fd7f7910
JH
118- 'retrans_VAL', set the timeout value. VAL is an Exim time specification
119(eg "5s"). The default is set by the main configuration option 'dns_retrans'.
120
121- 'retry_VAL', set the retry count on timeouts. VAL is an integer. The
122default is set by the main configuration option "dns_retry".
123
124(d) If the next sequence of characters is a sequence of letters and digits
8e669ac1 125followed by '=', it is interpreted as the name of the DNS record type. The
ff4dbb19 126default is "TXT".
7bb56e1f 127
fd7f7910 128(e) Then there follows list of domain names. This is a generalized Exim list,
8e669ac1 129which may start with '<' in order to set a specific separator. The default
7bb56e1f 130separator, as always, is colon. */
0756eb3c 131
e6d225ae 132static int
55414b25 133dnsdb_find(void *handle, uschar *filename, const uschar *keystring, int length,
14b3c5bc 134 uschar **result, uschar **errmsg, uint *do_cache)
0756eb3c
PH
135{
136int rc;
137int size = 256;
138int ptr = 0;
7bb56e1f 139int sep = 0;
ff4dbb19 140int defer_mode = PASS;
fd3b6a4a 141int dnssec_mode = OK;
fd7f7910
JH
142int save_retrans = dns_retrans;
143int save_retry = dns_retry;
542bc632 144int type;
c38d6da9 145int failrc = FAIL;
55414b25
JH
146const uschar *outsep = CUS"\n";
147const uschar *outsep2 = NULL;
e5a9dba6 148uschar *equals, *domain, *found;
0756eb3c
PH
149
150/* Because we're the working in the search pool, we try to reclaim as much
151store as possible later, so we preallocate the result here */
152
153uschar *yield = store_get(size);
154
155dns_record *rr;
156dns_answer dnsa;
157dns_scan dnss;
158
159handle = handle; /* Keep picky compilers happy */
160filename = filename;
161length = length;
162do_cache = do_cache;
163
0d0c6357
NM
164/* If the string starts with '>' we change the output separator.
165If it's followed by ';' or ',' we set the TXT output separator. */
0756eb3c 166
7bb56e1f
PH
167while (isspace(*keystring)) keystring++;
168if (*keystring == '>')
0756eb3c 169 {
7bb56e1f 170 outsep = keystring + 1;
8e669ac1 171 keystring += 2;
0d0c6357
NM
172 if (*keystring == ',')
173 {
174 outsep2 = keystring + 1;
175 keystring += 2;
176 }
177 else if (*keystring == ';')
178 {
179 outsep2 = US"";
180 keystring++;
181 }
7bb56e1f 182 while (isspace(*keystring)) keystring++;
8e669ac1 183 }
7bb56e1f 184
fd3b6a4a 185/* Check for a modifier keyword. */
ff4dbb19 186
fd7f7910 187for (;;)
ff4dbb19 188 {
fd3b6a4a 189 if (strncmpic(keystring, US"defer_", 6) == 0)
ff4dbb19 190 {
ff4dbb19 191 keystring += 6;
fd3b6a4a 192 if (strncmpic(keystring, US"strict", 6) == 0)
fd7f7910 193 { defer_mode = DEFER; keystring += 6; }
fd3b6a4a 194 else if (strncmpic(keystring, US"lax", 3) == 0)
fd7f7910 195 { defer_mode = PASS; keystring += 3; }
fd3b6a4a 196 else if (strncmpic(keystring, US"never", 5) == 0)
fd7f7910 197 { defer_mode = OK; keystring += 5; }
fd3b6a4a
JH
198 else
199 {
200 *errmsg = US"unsupported dnsdb defer behaviour";
201 return DEFER;
202 }
ff4dbb19 203 }
fd7f7910 204 else if (strncmpic(keystring, US"dnssec_", 7) == 0)
ff4dbb19 205 {
fd3b6a4a
JH
206 keystring += 7;
207 if (strncmpic(keystring, US"strict", 6) == 0)
fd7f7910 208 { dnssec_mode = DEFER; keystring += 6; }
fd3b6a4a 209 else if (strncmpic(keystring, US"lax", 3) == 0)
fd7f7910
JH
210 { dnssec_mode = PASS; keystring += 3; }
211 else if (strncmpic(keystring, US"never", 5) == 0)
212 { dnssec_mode = OK; keystring += 5; }
213 else
fd3b6a4a 214 {
fd7f7910
JH
215 *errmsg = US"unsupported dnsdb dnssec behaviour";
216 return DEFER;
fd3b6a4a 217 }
fd7f7910
JH
218 }
219 else if (strncmpic(keystring, US"retrans_", 8) == 0)
220 {
221 int timeout_sec;
222 if ((timeout_sec = readconf_readtime(keystring += 8, ',', FALSE)) <= 0)
fd3b6a4a 223 {
fd7f7910
JH
224 *errmsg = US"unsupported dnsdb timeout value";
225 return DEFER;
fd3b6a4a 226 }
fd7f7910
JH
227 dns_retrans = timeout_sec;
228 while (*keystring != ',') keystring++;
229 }
230 else if (strncmpic(keystring, US"retry_", 6) == 0)
231 {
232 int retries;
fc362fc5 233 if ((retries = (int)strtol(CCS keystring + 6, CSS &keystring, 0)) < 0)
fd3b6a4a 234 {
fd7f7910 235 *errmsg = US"unsupported dnsdb retry count";
fd3b6a4a
JH
236 return DEFER;
237 }
fd7f7910 238 dns_retry = retries;
ff4dbb19 239 }
fd7f7910
JH
240 else
241 break;
242
ff4dbb19
PH
243 while (isspace(*keystring)) keystring++;
244 if (*keystring++ != ',')
245 {
fd3b6a4a 246 *errmsg = US"dnsdb modifier syntax error";
ff4dbb19
PH
247 return DEFER;
248 }
249 while (isspace(*keystring)) keystring++;
250 }
251
542bc632
PP
252/* Figure out the "type" value if it is not T_TXT.
253If the keystring contains an = this must be preceded by a valid type name. */
7bb56e1f 254
542bc632 255type = T_TXT;
7bb56e1f
PH
256if ((equals = Ustrchr(keystring, '=')) != NULL)
257 {
258 int i, len;
259 uschar *tend = equals;
8e669ac1
PH
260
261 while (tend > keystring && isspace(tend[-1])) tend--;
262 len = tend - keystring;
263
0756eb3c
PH
264 for (i = 0; i < sizeof(type_names)/sizeof(uschar *); i++)
265 {
266 if (len == Ustrlen(type_names[i]) &&
267 strncmpic(keystring, US type_names[i], len) == 0)
268 {
269 type = type_values[i];
270 break;
271 }
272 }
8e669ac1 273
0756eb3c
PH
274 if (i >= sizeof(type_names)/sizeof(uschar *))
275 {
276 *errmsg = US"unsupported DNS record type";
277 return DEFER;
278 }
8e669ac1 279
7bb56e1f
PH
280 keystring = equals + 1;
281 while (isspace(*keystring)) keystring++;
0756eb3c 282 }
8e669ac1 283
7bb56e1f 284/* Initialize the resolver in case this is the first time it has been used. */
0756eb3c 285
fd3b6a4a 286dns_init(FALSE, FALSE, dnssec_mode != OK);
0756eb3c 287
8e669ac1
PH
288/* The remainder of the string must be a list of domains. As long as the lookup
289for at least one of them succeeds, we return success. Failure means that none
290of them were found.
0756eb3c 291
8e669ac1
PH
292The original implementation did not support a list of domains. Adding the list
293feature is compatible, except in one case: when PTR records are being looked up
294for a single IPv6 address. Fortunately, we can hack in a compatibility feature
295here: If the type is PTR and no list separator is specified, and the entire
296remaining string is valid as an IP address, set an impossible separator so that
7bb56e1f 297it is treated as one item. */
33397d19 298
7bb56e1f 299if (type == T_PTR && keystring[0] != '<' &&
7e66e54d 300 string_is_ip_address(keystring, NULL) != 0)
7bb56e1f 301 sep = -1;
0756eb3c 302
542bc632
PP
303/* SPF strings should be concatenated without a separator, thus make
304it the default if not defined (see RFC 4408 section 3.1.3).
305Multiple SPF records are forbidden (section 3.1.2) but are currently
be36e572
JH
306not handled specially, thus they are concatenated with \n by default.
307MX priority and value are space-separated by default.
308SRV and TLSA record parts are space-separated by default. */
542bc632 309
be36e572
JH
310if (!outsep2) switch(type)
311 {
312 case T_SPF: outsep2 = US""; break;
313 case T_SRV: case T_MX: case T_TLSA: outsep2 = US" "; break;
314 }
542bc632 315
7bb56e1f 316/* Now scan the list and do a lookup for each item */
0756eb3c 317
fd7f7910 318while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
8e669ac1 319 {
7bb56e1f 320 uschar rbuffer[256];
e5a9dba6
PH
321 int searchtype = (type == T_CSA)? T_SRV : /* record type we want */
322 (type == T_MXH)? T_MX :
323 (type == T_ZNS)? T_NS : type;
324
325 /* If the type is PTR or CSA, we have to construct the relevant magic lookup
326 key if the original is an IP address (some experimental protocols are using
327 PTR records for different purposes where the key string is a host name, and
328 Exim's extended CSA can be keyed by domains or IP addresses). This code for
329 doing the reversal is now in a separate function. */
330
331 if ((type == T_PTR || type == T_CSA) &&
7e66e54d 332 string_is_ip_address(domain, NULL) != 0)
0756eb3c 333 {
7bb56e1f
PH
334 dns_build_reverse(domain, rbuffer);
335 domain = rbuffer;
0756eb3c 336 }
8e669ac1 337
3a796370 338 do
c38d6da9 339 {
3a796370
JH
340 DEBUG(D_lookup) debug_printf("dnsdb key: %s\n", domain);
341
342 /* Do the lookup and sort out the result. There are four special types that
66be95e0 343 are handled specially: T_CSA, T_ZNS, T_ADDRESSES and T_MXH.
3a796370 344 The first two are handled in a special lookup function so that the facility
66be95e0 345 could be used from other parts of the Exim code. T_ADDRESSES is handled by looping
3a796370
JH
346 over the types of A lookup. T_MXH affects only what happens later on in
347 this function, but for tidiness it is handled by the "special". If the
348 lookup fails, continue with the next domain. In the case of DEFER, adjust
349 the final "nothing found" result, but carry on to the next domain. */
350
351 found = domain;
6abc190a 352#if HAVE_IPV6
66be95e0 353 if (type == T_ADDRESSES) /* NB cannot happen unless HAVE_IPV6 */
3a796370 354 {
cc00f4af 355 if (searchtype == T_ADDRESSES) searchtype = T_AAAA;
3a796370 356 else if (searchtype == T_AAAA) searchtype = T_A;
55414b25 357 rc = dns_special_lookup(&dnsa, domain, searchtype, CUSS &found);
3a796370
JH
358 }
359 else
6abc190a 360#endif
55414b25 361 rc = dns_special_lookup(&dnsa, domain, type, CUSS &found);
ea3bc19b 362
4e0983dc
JH
363 lookup_dnssec_authenticated = dnssec_mode==OK ? NULL
364 : dns_is_secure(&dnsa) ? US"yes" : US"no";
365
3a796370 366 if (rc == DNS_NOMATCH || rc == DNS_NODATA) continue;
91f40ccd 367 if ( rc != DNS_SUCCEED
9852336a 368 || (dnssec_mode == DEFER && !dns_is_secure(&dnsa))
91f40ccd 369 )
3a796370 370 {
fd3b6a4a
JH
371 if (defer_mode == DEFER)
372 {
fd7f7910
JH
373 dns_retrans = save_retrans;
374 dns_retry = save_retry;
9d9c3746 375 dns_init(FALSE, FALSE, FALSE); /* clr dnssec bit */
fd3b6a4a
JH
376 return DEFER; /* always defer */
377 }
3a796370
JH
378 if (defer_mode == PASS) failrc = DEFER; /* defer only if all do */
379 continue; /* treat defer as fail */
380 }
fd3b6a4a 381
8e669ac1 382
3a796370 383 /* Search the returned records */
8e669ac1 384
3a796370
JH
385 for (rr = dns_next_rr(&dnsa, &dnss, RESET_ANSWERS);
386 rr != NULL;
387 rr = dns_next_rr(&dnsa, &dnss, RESET_NEXT))
0756eb3c 388 {
3a796370
JH
389 if (rr->type != searchtype) continue;
390
14b3c5bc
JH
391 if (*do_cache > rr->ttl)
392 *do_cache = rr->ttl;
393
cc00f4af 394 if (type == T_A || type == T_AAAA || type == T_ADDRESSES)
7bb56e1f 395 {
3a796370 396 dns_address *da;
e1a3f32f 397 for (da = dns_address_from_rr(&dnsa, rr); da; da = da->next)
3a796370
JH
398 {
399 if (ptr != 0) yield = string_cat(yield, &size, &ptr, outsep, 1);
400 yield = string_cat(yield, &size, &ptr, da->address,
401 Ustrlen(da->address));
402 }
403 continue;
7bb56e1f 404 }
8e669ac1 405
3a796370
JH
406 /* Other kinds of record just have one piece of data each, but there may be
407 several of them, of course. */
8e669ac1 408
3a796370 409 if (ptr != 0) yield = string_cat(yield, &size, &ptr, outsep, 1);
8e669ac1 410
3a796370 411 if (type == T_TXT || type == T_SPF)
80a47a2c 412 {
3a796370 413 if (outsep2 == NULL)
0d0c6357 414 {
3a796370
JH
415 /* output only the first item of data */
416 yield = string_cat(yield, &size, &ptr, (uschar *)(rr->data+1),
417 (rr->data)[0]);
418 }
419 else
420 {
421 /* output all items */
422 int data_offset = 0;
423 while (data_offset < rr->size)
424 {
425 uschar chunk_len = (rr->data)[data_offset++];
426 if (outsep2[0] != '\0' && data_offset != 1)
427 yield = string_cat(yield, &size, &ptr, outsep2, 1);
428 yield = string_cat(yield, &size, &ptr,
0d0c6357 429 (uschar *)((rr->data)+data_offset), chunk_len);
3a796370
JH
430 data_offset += chunk_len;
431 }
0d0c6357 432 }
80a47a2c 433 }
1e06383a
TL
434 else if (type == T_TLSA)
435 {
436 uint8_t usage, selector, matching_type;
437 uint16_t i, payload_length;
438 uschar s[MAX_TLSA_EXPANDED_SIZE];
439 uschar * sp = s;
d2a2c69b 440 uschar * p = US rr->data;
1e06383a
TL
441
442 usage = *p++;
443 selector = *p++;
444 matching_type = *p++;
445 /* What's left after removing the first 3 bytes above */
446 payload_length = rr->size - 3;
be36e572
JH
447 sp += sprintf(CS s, "%d%c%d%c%d%c", usage, *outsep2,
448 selector, *outsep2, matching_type, *outsep2);
1e06383a
TL
449 /* Now append the cert/identifier, one hex char at a time */
450 for (i=0;
451 i < payload_length && sp-s < (MAX_TLSA_EXPANDED_SIZE - 4);
452 i++)
1e06383a 453 sp += sprintf(CS sp, "%02x", (unsigned char)p[i]);
d2a2c69b 454
1e06383a
TL
455 yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
456 }
d2a2c69b 457 else /* T_CNAME, T_CSA, T_MX, T_MXH, T_NS, T_PTR, T_SOA, T_SRV */
e5a9dba6 458 {
3a796370
JH
459 int priority, weight, port;
460 uschar s[264];
d2a2c69b
JH
461 uschar * p = US rr->data;
462
463 switch (type)
464 {
465 case T_MXH:
466 /* mxh ignores the priority number and includes only the hostnames */
467 GETSHORT(priority, p);
468 break;
469
470 case T_MX:
471 GETSHORT(priority, p);
472 sprintf(CS s, "%d%c", priority, *outsep2);
473 yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
474 break;
475
476 case T_SRV:
477 GETSHORT(priority, p);
478 GETSHORT(weight, p);
479 GETSHORT(port, p);
480 sprintf(CS s, "%d%c%d%c%d%c", priority, *outsep2,
481 weight, *outsep2, port, *outsep2);
482 yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
483 break;
484
485 case T_CSA:
486 /* See acl_verify_csa() for more comments about CSA. */
487 GETSHORT(priority, p);
488 GETSHORT(weight, p);
489 GETSHORT(port, p);
490
491 if (priority != 1) continue; /* CSA version must be 1 */
492
493 /* If the CSA record we found is not the one we asked for, analyse
494 the subdomain assertions in the port field, else analyse the direct
495 authorization status in the weight field. */
496
497 if (Ustrcmp(found, domain) != 0)
498 {
499 if (port & 1) *s = 'X'; /* explicit authorization required */
500 else *s = '?'; /* no subdomain assertions here */
501 }
502 else
503 {
504 if (weight < 2) *s = 'N'; /* not authorized */
505 else if (weight == 2) *s = 'Y'; /* authorized */
506 else if (weight == 3) *s = '?'; /* unauthorizable */
507 else continue; /* invalid */
508 }
509
510 s[1] = ' ';
511 yield = string_cat(yield, &size, &ptr, s, 2);
512 break;
513
514 default:
515 break;
516 }
e5a9dba6 517
3a796370 518 /* GETSHORT() has advanced the pointer to the target domain. */
8e669ac1 519
3a796370 520 rc = dn_expand(dnsa.answer, dnsa.answer + dnsa.answerlen, p,
d2a2c69b 521 (DN_EXPAND_ARG4_TYPE)s, sizeof(s));
8e669ac1 522
3a796370
JH
523 /* If an overlong response was received, the data will have been
524 truncated and dn_expand may fail. */
8e669ac1 525
3a796370
JH
526 if (rc < 0)
527 {
528 log_write(0, LOG_MAIN, "host name alias list truncated: type=%s "
529 "domain=%s", dns_text_type(type), domain);
530 break;
531 }
532 else yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
d2a2c69b
JH
533
534 if (type == T_SOA && outsep2 != NULL)
535 {
536 unsigned long serial, refresh, retry, expire, minimum;
537
538 p += rc;
539 yield = string_cat(yield, &size, &ptr, outsep2, 1);
540
541 rc = dn_expand(dnsa.answer, dnsa.answer + dnsa.answerlen, p,
542 (DN_EXPAND_ARG4_TYPE)s, sizeof(s));
543 if (rc < 0)
544 {
545 log_write(0, LOG_MAIN, "responsible-mailbox truncated: type=%s "
546 "domain=%s", dns_text_type(type), domain);
547 break;
548 }
549 else yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
550
551 p += rc;
552 GETLONG(serial, p); GETLONG(refresh, p);
553 GETLONG(retry, p); GETLONG(expire, p); GETLONG(minimum, p);
fc362fc5 554 sprintf(CS s, "%c%lu%c%lu%c%lu%c%lu%c%lu",
d2a2c69b
JH
555 *outsep2, serial, *outsep2, refresh,
556 *outsep2, retry, *outsep2, expire, *outsep2, minimum);
557 yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
558 }
7bb56e1f 559 }
3a796370
JH
560 } /* Loop for list of returned records */
561
562 /* Loop for set of A-lookupu types */
66be95e0 563 } while (type == T_ADDRESSES && searchtype != T_A);
3a796370
JH
564
565 } /* Loop for list of domains */
7bb56e1f
PH
566
567/* Reclaim unused memory */
0756eb3c 568
7bb56e1f
PH
569store_reset(yield + ptr + 1);
570
8e669ac1 571/* If ptr == 0 we have not found anything. Otherwise, insert the terminating
7bb56e1f
PH
572zero and return the result. */
573
fd7f7910
JH
574dns_retrans = save_retrans;
575dns_retry = save_retry;
fd3b6a4a
JH
576dns_init(FALSE, FALSE, FALSE); /* clear the dnssec bit for getaddrbyname */
577
c38d6da9 578if (ptr == 0) return failrc;
0756eb3c 579yield[ptr] = 0;
0756eb3c 580*result = yield;
0756eb3c
PH
581return OK;
582}
583
6545de78
PP
584
585
586/*************************************************
587* Version reporting entry point *
588*************************************************/
589
590/* See local README for interface description. */
591
592#include "../version.h"
593
594void
595dnsdb_version_report(FILE *f)
596{
597#ifdef DYNLOOKUP
598fprintf(f, "Library version: DNSDB: Exim version %s\n", EXIM_VERSION_STR);
599#endif
600}
601
602
e6d225ae
DW
603static lookup_info _lookup_info = {
604 US"dnsdb", /* lookup name */
605 lookup_querystyle, /* query style */
606 dnsdb_open, /* open function */
607 NULL, /* check function */
608 dnsdb_find, /* find function */
609 NULL, /* no close function */
610 NULL, /* no tidy function */
6545de78
PP
611 NULL, /* no quoting function */
612 dnsdb_version_report /* version reporting */
e6d225ae
DW
613};
614
615#ifdef DYNLOOKUP
616#define dnsdb_lookup_module_info _lookup_module_info
617#endif
618
619static lookup_info *_lookup_list[] = { &_lookup_info };
620lookup_module_info dnsdb_lookup_module_info = { LOOKUP_MODULE_INFO_MAGIC, _lookup_list, 1 };
621
fd3b6a4a
JH
622/* vi: aw ai sw=2
623*/
0756eb3c 624/* End of lookups/dnsdb.c */