Copyright year updates.
[exim.git] / src / src / lookups / dnsdb.c
index 89ad67d286bb39232568c89921fe0d9d021b7aa6..3fd9f981bb37dcc66609c52fc40b19323cef8f1a 100644 (file)
@@ -1,15 +1,12 @@
-/* $Cambridge: exim/src/src/lookups/dnsdb.c,v 1.20 2010/05/29 19:23:26 nm4 Exp $ */
-
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2009 */
+/* Copyright (c) University of Cambridge 1995 - 2012 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 #include "../exim.h"
 #include "lf_functions.h"
-#include "dnsdb.h"
 
 
 
@@ -20,9 +17,14 @@ header files. */
 #define T_TXT 16
 #endif
 
+/* Many systems do not have T_SPF. */
+#ifndef T_SPF
+#define T_SPF 99
+#endif
+
 /* Table of recognized DNS record types and their integer values. */
 
-static char *type_names[] = {
+static const char *type_names[] = {
   "a",
 #if HAVE_IPV6
   "aaaa",
@@ -36,6 +38,7 @@ static char *type_names[] = {
   "mxh",
   "ns",
   "ptr",
+  "spf",
   "srv",
   "txt",
   "zns"
@@ -55,6 +58,7 @@ static int type_values[] = {
   T_MXH,     /* Private type for "MX hostnames" */
   T_NS,
   T_PTR,
+  T_SPF,
   T_SRV,
   T_TXT,
   T_ZNS      /* Private type for "zone nameservers" */
@@ -67,7 +71,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 +112,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)
 {
@@ -319,7 +323,7 @@ while ((domain = string_nextinlist(&keystring, &sep, buffer, sizeof(buffer)))
 
     if (ptr != 0) yield = string_cat(yield, &size, &ptr, outsep, 1);
 
-    if (type == T_TXT)
+    if (type == T_TXT || type == T_SPF)
       {
       if (outsep2 == NULL)
         {
@@ -430,4 +434,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 */