Update all copyright messages to cover 1995 - 2009. Remove tab from exim_checkaccess.src
[exim.git] / src / src / lookups / testdb.c
1 /* $Cambridge: exim/src/src/lookups/testdb.c,v 1.5 2009/11/16 19:50:38 nm4 Exp $ */
2
3 /*************************************************
4 *     Exim - an Internet mail transport agent    *
5 *************************************************/
6
7 /* Copyright (c) University of Cambridge 1995 - 2009 */
8 /* See the file NOTICE for conditions of use and distribution. */
9
10 #include "../exim.h"
11 #include "lf_functions.h"
12 #include "testdb.h"
13
14
15 /* These are not real lookup functions; they are just a way of testing the
16 rest of Exim by providing an easy way of specifying particular yields from
17 the find function. */
18
19
20 /*************************************************
21 *              Open entry point                  *
22 *************************************************/
23
24 /* See local README for interface description. */
25
26 void *
27 testdb_open(uschar *filename, uschar **errmsg)
28 {
29 filename = filename;   /* Keep picky compilers happy */
30 errmsg = errmsg;
31 return (void *)(1);    /* Just return something non-null */
32 }
33
34
35
36 /*************************************************
37 *               Find entry point                 *
38 *************************************************/
39
40 /* See local README for interface description. */
41
42 int
43 testdb_find(void *handle, uschar *filename, uschar *query, int length,
44   uschar **result, uschar **errmsg, BOOL *do_cache)
45 {
46 handle = handle;          /* Keep picky compilers happy */
47 filename = filename;
48 length = length;
49
50 if (Ustrcmp(query, "fail") == 0)
51   {
52   *errmsg = US"testdb lookup forced FAIL";
53   DEBUG(D_lookup) debug_printf("%s\n", *errmsg);
54   return FAIL;
55   }
56 if (Ustrcmp(query, "defer") == 0)
57   {
58   *errmsg = US"testdb lookup forced DEFER";
59   DEBUG(D_lookup) debug_printf("%s\n", *errmsg);
60   return DEFER;
61   }
62
63 if (Ustrcmp(query, "nocache") == 0) *do_cache = FALSE;
64
65 *result = string_copy(query);
66 return OK;
67 }
68
69 /* End of lookups/testdb.c */