]> git.netwichtig.de Git - user/henk/code/exim.git/blobdiff - src/src/lookups/mysql.c
DSN: fix null deref when bounce is due to conn-timeout. Bug 1630
[user/henk/code/exim.git] / src / src / lookups / mysql.c
index 97b9c11390b1d093a86e01fedc8d0ac2d8e0bdfb..8dff86ad18b10d926ff0b1c7037a2213776265c3 100644 (file)
@@ -1,10 +1,8 @@
-/* $Cambridge: exim/src/src/lookups/mysql.c,v 1.7 2010/03/05 15:59:29 nm4 Exp $ */
-
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2009 */
+/* Copyright (c) University of Cambridge 1995 - 2015 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Thanks to Paul Kelly for contributing the original code for these
@@ -86,7 +84,7 @@ Returns:       OK, FAIL, or DEFER
 */
 
 static int
-perform_mysql_search(uschar *query, uschar *server, uschar **resultptr,
+perform_mysql_search(const uschar *query, uschar *server, uschar **resultptr,
   uschar **errmsg, BOOL *defer_break, BOOL *do_cache)
 {
 MYSQL *mysql_handle = NULL;        /* Keep compilers happy */
@@ -342,7 +340,7 @@ query is deferred with a retryable error is now in a separate function that is
 shared with other SQL lookups. */
 
 static int
-mysql_find(void *handle, uschar *filename, uschar *query, int length,
+mysql_find(void *handle, uschar *filename, const uschar *query, int length,
   uschar **result, uschar **errmsg, BOOL *do_cache)
 {
 return lf_sqlperform(US"MySQL", US"mysql_servers", mysql_servers, query,
@@ -413,6 +411,27 @@ while ((c = *s++) != 0)
 return quoted;
 }
 
+
+/*************************************************
+*         Version reporting entry point          *
+*************************************************/
+
+/* See local README for interface description. */
+
+#include "../version.h"
+
+void
+mysql_version_report(FILE *f)
+{
+fprintf(f, "Library version: MySQL: Compile: %s [%s]\n"
+           "                        Runtime: %s\n",
+        MYSQL_SERVER_VERSION, MYSQL_COMPILATION_COMMENT,
+        mysql_get_client_info());
+#ifdef DYNLOOKUP
+fprintf(f, "                        Exim version %s\n", EXIM_VERSION_STR);
+#endif
+}
+
 /* These are the lookup_info blocks for this driver */
 
 static lookup_info mysql_lookup_info = {
@@ -423,7 +442,8 @@ static lookup_info mysql_lookup_info = {
   mysql_find,                    /* find function */
   NULL,                          /* no close function */
   mysql_tidy,                    /* tidy function */
-  mysql_quote                    /* quoting function */
+  mysql_quote,                   /* quoting function */
+  mysql_version_report           /* version reporting */
 };
 
 #ifdef DYNLOOKUP