]> git.netwichtig.de Git - user/henk/code/exim.git/blobdiff - src/src/lookups/pgsql.c
DSN: fix null deref when bounce is due to conn-timeout. Bug 1630
[user/henk/code/exim.git] / src / src / lookups / pgsql.c
index 5bd96275fd08599d1ea44c07893497188a4f1442..c86ac23ed8a4a778038d571babcc5a79f2884bf8 100644 (file)
@@ -1,10 +1,8 @@
-/* $Cambridge: exim/src/src/lookups/pgsql.c,v 1.11 2009/11/16 19:50:38 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 Petr Cech for contributing the original code for these
@@ -120,7 +118,7 @@ Returns:       OK, FAIL, or DEFER
 */
 
 static int
-perform_pgsql_search(uschar *query, uschar *server, uschar **resultptr,
+perform_pgsql_search(const uschar *query, uschar *server, uschar **resultptr,
   uschar **errmsg, BOOL *defer_break, BOOL *do_cache)
 {
 PGconn *pg_conn = NULL;
@@ -400,7 +398,7 @@ query is deferred with a retryable error is now in a separate function that is
 shared with other SQL lookups. */
 
 static int
-pgsql_find(void *handle, uschar *filename, uschar *query, int length,
+pgsql_find(void *handle, uschar *filename, const uschar *query, int length,
   uschar **result, uschar **errmsg, BOOL *do_cache)
 {
 return lf_sqlperform(US"PostgreSQL", US"pgsql_servers", pgsql_servers, query,
@@ -486,6 +484,30 @@ while ((c = *s++) != 0)
 return quoted;
 }
 
+
+/*************************************************
+*         Version reporting entry point          *
+*************************************************/
+
+/* See local README for interface description. */
+
+#include "../version.h"
+
+void
+pgsql_version_report(FILE *f)
+{
+#ifdef DYNLOOKUP
+fprintf(f, "Library version: PostgreSQL: Exim version %s\n", EXIM_VERSION_STR);
+#endif
+
+/* Version reporting: there appears to be no available information about
+the client library in libpq-fe.h; once you have a connection object, you
+can access the server version and the chosen protocol version, but those
+aren't really what we want.  It might make sense to debug_printf those
+when the connection is established though? */
+}
+
+
 static lookup_info _lookup_info = {
   US"pgsql",                     /* lookup name */
   lookup_querystyle,             /* query-style lookup */
@@ -494,7 +516,8 @@ static lookup_info _lookup_info = {
   pgsql_find,                    /* find function */
   NULL,                          /* no close function */
   pgsql_tidy,                    /* tidy function */
-  pgsql_quote                    /* quoting function */
+  pgsql_quote,                   /* quoting function */
+  pgsql_version_report           /* version reporting */
 };
 
 #ifdef DYNLOOKUP