Return multi-values attributes from an LDAP lookup in parsable form (bug 660).
[exim.git] / src / src / lookups / dnsdb.c
index 89ad67d286bb39232568c89921fe0d9d021b7aa6..2862a5bc9f95890c03291eb0ba79a2eee8735341 100644 (file)
@@ -1,5 +1,3 @@
-/* $Cambridge: exim/src/src/lookups/dnsdb.c,v 1.20 2010/05/29 19:23:26 nm4 Exp $ */
-
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
@@ -9,7 +7,6 @@
 
 #include "../exim.h"
 #include "lf_functions.h"
-#include "dnsdb.h"
 
 
 
@@ -22,7 +19,7 @@ header files. */
 
 /* Table of recognized DNS record types and their integer values. */
 
-static char *type_names[] = {
+static const char *type_names[] = {
   "a",
 #if HAVE_IPV6
   "aaaa",
@@ -67,7 +64,7 @@ static int type_values[] = {
 
 /* See local README for interface description. */
 
-void *
+static void *
 dnsdb_open(uschar *filename, uschar **errmsg)
 {
 filename = filename;   /* Keep picky compilers happy */
@@ -108,7 +105,7 @@ default is "TXT".
 which may start with '<' in order to set a specific separator. The default
 separator, as always, is colon. */
 
-int
+static int
 dnsdb_find(void *handle, uschar *filename, uschar *keystring, int length,
   uschar **result, uschar **errmsg, BOOL *do_cache)
 {
@@ -430,4 +427,42 @@ yield[ptr] = 0;
 return OK;
 }
 
+
+
+/*************************************************
+*         Version reporting entry point          *
+*************************************************/
+
+/* See local README for interface description. */
+
+#include "../version.h"
+
+void
+dnsdb_version_report(FILE *f)
+{
+#ifdef DYNLOOKUP
+fprintf(f, "Library version: DNSDB: Exim version %s\n", EXIM_VERSION_STR);
+#endif
+}
+
+
+static lookup_info _lookup_info = {
+  US"dnsdb",                     /* lookup name */
+  lookup_querystyle,             /* query style */
+  dnsdb_open,                    /* open function */
+  NULL,                          /* check function */
+  dnsdb_find,                    /* find function */
+  NULL,                          /* no close function */
+  NULL,                          /* no tidy function */
+  NULL,                          /* no quoting function */
+  dnsdb_version_report           /* version reporting */
+};
+
+#ifdef DYNLOOKUP
+#define dnsdb_lookup_module_info _lookup_module_info
+#endif
+
+static lookup_info *_lookup_list[] = { &_lookup_info };
+lookup_module_info dnsdb_lookup_module_info = { LOOKUP_MODULE_INFO_MAGIC, _lookup_list, 1 };
+
 /* End of lookups/dnsdb.c */