1 /* $Cambridge: exim/src/src/lookups/whoson.c,v 1.3 2006/02/07 11:19:01 ph10 Exp $ */
3 /*************************************************
4 * Exim - an Internet mail transport agent *
5 *************************************************/
7 /* Copyright (c) University of Cambridge 1995 - 2006 */
8 /* See the file NOTICE for conditions of use and distribution. */
10 /* This code originally came from Robert Wal. */
15 /* We can't just compile this code and allow the library mechanism to omit the
16 functions if they are not wanted, because we need to have the WHOSON headers
17 available for compiling. Therefore, compile these functions only if
18 LOOKUP_WHOSON is defined. However, some compilers don't like compiling empty
19 modules, so keep them happy with a dummy when skipping the rest. Make it
20 reference itself to stop picky compilers complaining that it is unused, and put
21 in a dummy argument to stop even pickier compilers complaining about infinite
25 static void dummy(int x) { dummy(x-1); }
29 #include <whoson.h> /* Public header */
30 #include "whoson.h" /* Local header */
33 /*************************************************
35 *************************************************/
37 /* See local README for interface description. */
40 whoson_open(uschar *filename, uschar **errmsg)
42 filename = filename; /* Keep picky compilers happy */
44 return (void *)(1); /* Just return something non-null */
48 /*************************************************
50 *************************************************/
52 /* See local README for interface description. */
55 whoson_find(void *handle, uschar *filename, uschar *query, int length,
56 uschar **result, uschar **errmsg, BOOL *do_cache)
59 handle = handle; /* Keep picky compilers happy */
65 switch (wso_query(query, CS buffer, sizeof(buffer)))
68 *result = string_copy(buffer); /* IP in database; return name of user */
72 return FAIL; /* IP not in database */
75 *errmsg = string_sprintf("WHOSON: failed to complete: %s", buffer);
80 #endif /* LOOKUP_WHOSON */
82 /* End of lookups/whoson.c */