1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2015 */
6 /* See the file NOTICE for conditions of use and distribution. */
9 #include "lf_functions.h"
12 /* These are not real lookup functions; they are just a way of testing the
13 rest of Exim by providing an easy way of specifying particular yields from
17 /*************************************************
19 *************************************************/
21 /* See local README for interface description. */
24 testdb_open(const uschar * filename, uschar ** errmsg)
26 filename = filename; /* Keep picky compilers happy */
28 return (void *)(1); /* Just return something non-null */
33 /*************************************************
35 *************************************************/
37 /* See local README for interface description. */
40 testdb_find(void * handle, const uschar * filename, const uschar * query,
41 int length, uschar ** result, uschar ** errmsg, uint * do_cache,
44 handle = handle; /* Keep picky compilers happy */
48 if (Ustrcmp(query, "fail") == 0)
50 *errmsg = US"testdb lookup forced FAIL";
51 DEBUG(D_lookup) debug_printf_indent("%s\n", *errmsg);
54 if (Ustrcmp(query, "defer") == 0)
56 *errmsg = US"testdb lookup forced DEFER";
57 DEBUG(D_lookup) debug_printf_indent("%s\n", *errmsg);
61 if (Ustrcmp(query, "nocache") == 0) *do_cache = 0;
63 *result = string_copy(query);
68 /*************************************************
69 * Version reporting entry point *
70 *************************************************/
72 /* See local README for interface description. */
74 #include "../version.h"
77 testdb_version_report(FILE *f)
80 fprintf(f, "Library version: TestDB: Exim version %s\n", EXIM_VERSION_STR);
85 static lookup_info _lookup_info = {
86 .name = US"testdb", /* lookup name */
87 .type = lookup_querystyle, /* query-style lookup */
88 .open = testdb_open, /* open function */
89 .check = NULL, /* check function */
90 .find = testdb_find, /* find function */
91 .close = NULL, /* no close function */
92 .tidy = NULL, /* no tidy function */
93 .quote = NULL, /* no quoting function */
94 .version_report = testdb_version_report /* version reporting */
98 #define testdb_lookup_module_info _lookup_module_info
101 static lookup_info *_lookup_list[] = { &_lookup_info };
102 lookup_module_info testdb_lookup_module_info = { LOOKUP_MODULE_INFO_MAGIC, _lookup_list, 1 };
104 /* End of lookups/testdb.c */