1 /* $Cambridge: exim/src/src/lookups/whoson.c,v 1.5 2009/11/16 19:50:38 nm4 Exp $ */
3 /*************************************************
4 * Exim - an Internet mail transport agent *
5 *************************************************/
7 /* Copyright (c) University of Cambridge 1995 - 2009 */
8 /* See the file NOTICE for conditions of use and distribution. */
10 /* This code originally came from Robert Wal. */
15 #include <whoson.h> /* Public header */
18 /*************************************************
20 *************************************************/
22 /* See local README for interface description. */
25 whoson_open(uschar
*filename
, uschar
**errmsg
)
27 filename
= filename
; /* Keep picky compilers happy */
29 return (void *)(1); /* Just return something non-null */
33 /*************************************************
35 *************************************************/
37 /* See local README for interface description. */
40 whoson_find(void *handle
, uschar
*filename
, uschar
*query
, int length
,
41 uschar
**result
, uschar
**errmsg
, BOOL
*do_cache
)
44 handle
= handle
; /* Keep picky compilers happy */
50 switch (wso_query(query
, CS buffer
, sizeof(buffer
)))
53 *result
= string_copy(buffer
); /* IP in database; return name of user */
57 return FAIL
; /* IP not in database */
60 *errmsg
= string_sprintf("WHOSON: failed to complete: %s", buffer
);
65 static lookup_info _lookup_info
= {
66 US
"whoson", /* lookup name */
67 lookup_querystyle
, /* query-style lookup */
68 whoson_open
, /* open function */
69 NULL
, /* check function */
70 whoson_find
, /* find function */
71 NULL
, /* no close function */
72 NULL
, /* no tidy function */
73 NULL
/* no quoting function */
77 #define whoson_lookup_module_info _lookup_module_info
80 static lookup_info
*_lookup_list
[] = { &_lookup_info
};
81 lookup_module_info whoson_lookup_module_info
= { LOOKUP_MODULE_INFO_MAGIC
, _lookup_list
, 1 };
83 /* End of lookups/whoson.c */