Add "server=" feature to MySQL and PostgreSQL lookups.
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Thu, 23 Aug 2007 10:16:51 +0000 (10:16 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Thu, 23 Aug 2007 10:16:51 +0000 (10:16 +0000)
14 files changed:
doc/doc-txt/ChangeLog
doc/doc-txt/NewStuff
src/scripts/MakeLinks
src/src/lookups/Makefile
src/src/lookups/lf_functions.h
src/src/lookups/lf_sqlperform.c [new file with mode: 0644]
src/src/lookups/mysql.c
src/src/lookups/pgsql.c
test/scripts/9100-MySQL/9100
test/scripts/9200-PostgreSQL/9200
test/stderr/9100
test/stderr/9200
test/stdout/9100
test/stdout/9200

index 1e79291f35abaa46b94c7f260e6d4e2e2965ac69..9516dafbe4b9f953e7e48533b78139f5fc0ff9fa 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.525 2007/08/22 14:20:28 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.526 2007/08/23 10:16:51 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -92,6 +92,9 @@ PH/10 It seems that peer DN values may contain newlines (and other non-printing
       characters?) which causes problems in log lines. The DN values are now
       passed through string_printing() before being added to log lines.
 
       characters?) which causes problems in log lines. The DN values are now
       passed through string_printing() before being added to log lines.
 
+PH/11 Added the "servers=" facility to MySQL and PostgreSQL lookups. (Oracle
+      and InterBase are left for another time.)
+
 
 Exim version 4.67
 -----------------
 
 Exim version 4.67
 -----------------
index e3fddf3f796a1ee2231b20946c25c8b70664f7c6..f58687ddb585dffb7c36b3830eb5953bf3446ec8 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.155 2007/08/22 10:10:23 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.156 2007/08/23 10:16:51 ph10 Exp $
 
 New Features in Exim
 --------------------
 
 New Features in Exim
 --------------------
@@ -119,6 +119,38 @@ Version 4.68
     "drop" verb in another ACL, it is the message from the other ACL that is
     used.
 
     "drop" verb in another ACL, it is the message from the other ACL that is
     used.
 
+10. For MySQL and PostgreSQL lookups, it is now possible to specify a list of
+    servers with individual queries. This is done by starting the query with
+    "servers=x:y:z;", where each item in the list may take one of two forms:
+
+    (1) If it is just a host name, the appropriate global option (mysql_servers
+        or pgsql_servers) is searched for a host of the same name, and the
+        remaining parameters (database, user, password) are taken from there.
+
+    (2) If it contains any slashes, it is taken as a complete parameter set.
+
+    The list of servers is used in exactly the same was as the global list.
+    Once a connection to a server has happened and a query has been
+    successfully executed, processing of the lookup ceases.
+
+    This feature is intended for use in master/slave situations where updates
+    are occurring, and one wants to update a master rather than a slave. If the
+    masters are in the list for reading, you might have:
+
+      mysql_servers = slave1/db/name/pw:slave2/db/name/pw:master/db/name/pw
+
+    In an updating lookup, you could then write
+
+      ${lookup mysql{servers=master; UPDATE ...}
+
+    If, on the other hand, the master is not to be used for reading lookups:
+
+      pgsql_servers = slave1/db/name/pw:slave2/db/name/pw
+
+    you can still update the master by
+
+      ${lookup pgsql{servers=master/db/name/pw; UPDATE ...}
+
 
 Version 4.67
 ------------
 
 Version 4.67
 ------------
index ce125a8ddd6103c3df617ba33da2fc9873c991b8..c016e50c73f5f8e3920eda1d237e5fc59c7e2319 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/bin/sh
-# $Cambridge: exim/src/scripts/MakeLinks,v 1.11 2007/06/26 11:16:54 ph10 Exp $
+# $Cambridge: exim/src/scripts/MakeLinks,v 1.12 2007/08/23 10:16:51 ph10 Exp $
 
 # Script to build links for all the exim source files from the system-
 # specific build directory. It should be run from within that directory.
 
 # Script to build links for all the exim source files from the system-
 # specific build directory. It should be run from within that directory.
@@ -95,6 +95,7 @@ ln -s ../../src/lookups/whoson.c         whoson.c
 ln -s ../../src/lookups/lf_functions.h   lf_functions.h
 ln -s ../../src/lookups/lf_check_file.c  lf_check_file.c
 ln -s ../../src/lookups/lf_quote.c       lf_quote.c
 ln -s ../../src/lookups/lf_functions.h   lf_functions.h
 ln -s ../../src/lookups/lf_check_file.c  lf_check_file.c
 ln -s ../../src/lookups/lf_quote.c       lf_quote.c
+ln -s ../../src/lookups/lf_sqlperform.c  lf_sqlperform.c
 
 cd ..
 
 
 cd ..
 
index 59237263cbf1cce7095845334fe2ecd0513f7968..fce944589338932d0d2aafcc77173e76389aba01 100644 (file)
@@ -1,4 +1,4 @@
-# $Cambridge: exim/src/src/lookups/Makefile,v 1.5 2005/09/12 13:50:03 ph10 Exp $
+# $Cambridge: exim/src/src/lookups/Makefile,v 1.6 2007/08/23 10:16:51 ph10 Exp $
 
 # Make file for building a library containing all the available lookups and
 # calling it lookups.a. This is called from the main make file, after cd'ing
 
 # Make file for building a library containing all the available lookups and
 # calling it lookups.a. This is called from the main make file, after cd'ing
@@ -7,7 +7,7 @@
 
 OBJ = cdb.o dbmdb.o dnsdb.o dsearch.o ibase.o ldap.o lsearch.o mysql.o nis.o \
       nisplus.o oracle.o passwd.o pgsql.o spf.o sqlite.o testdb.o whoson.o \
 
 OBJ = cdb.o dbmdb.o dnsdb.o dsearch.o ibase.o ldap.o lsearch.o mysql.o nis.o \
       nisplus.o oracle.o passwd.o pgsql.o spf.o sqlite.o testdb.o whoson.o \
-      lf_check_file.o lf_quote.o
+      lf_check_file.o lf_quote.o lf_sqlperform.o
 
 lookups.a:       $(OBJ)
                 @$(RM_COMMAND) -f lookups.a
 
 lookups.a:       $(OBJ)
                 @$(RM_COMMAND) -f lookups.a
@@ -22,6 +22,7 @@ lookups.a:       $(OBJ)
 
 lf_check_file.o: $(HDRS) lf_check_file.c  lf_functions.h
 lf_quote.o:      $(HDRS) lf_quote.c       lf_functions.h
 
 lf_check_file.o: $(HDRS) lf_check_file.c  lf_functions.h
 lf_quote.o:      $(HDRS) lf_quote.c       lf_functions.h
+lf_sqlperform.o: $(HDRS) lf_sqlperform.c  lf_functions.h
 
 cdb.o:           $(HDRS) cdb.c       cdb.h
 dbmdb.o:         $(HDRS) dbmdb.c     dbmdb.h
 
 cdb.o:           $(HDRS) cdb.c       cdb.h
 dbmdb.o:         $(HDRS) dbmdb.c     dbmdb.h
index 0cf06a2d702acbd412949bf967693fb8f80384ac..7e9dec1dd1459603dc8aec61413154f6a2a28d0c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/lookups/lf_functions.h,v 1.4 2007/01/08 10:50:19 ph10 Exp $ */
+/* $Cambridge: exim/src/src/lookups/lf_functions.h,v 1.5 2007/08/23 10:16:51 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -12,5 +12,8 @@
 extern int     lf_check_file(int, uschar *, int, int, uid_t *, gid_t *, char *,
                  uschar **);
 extern uschar *lf_quote(uschar *, uschar *, int, uschar *, int *, int *);
 extern int     lf_check_file(int, uschar *, int, int, uid_t *, gid_t *, char *,
                  uschar **);
 extern uschar *lf_quote(uschar *, uschar *, int, uschar *, int *, int *);
+extern int     lf_sqlperform(uschar *, uschar *, uschar *, uschar *, uschar **,
+                 uschar **, BOOL *, int(*)(uschar *, uschar *, uschar **,
+                 uschar **, BOOL *, BOOL *));
 
 /* End of lf_functions.h */
 
 /* End of lf_functions.h */
diff --git a/src/src/lookups/lf_sqlperform.c b/src/src/lookups/lf_sqlperform.c
new file mode 100644 (file)
index 0000000..2d50f70
--- /dev/null
@@ -0,0 +1,139 @@
+/* $Cambridge: exim/src/src/lookups/lf_sqlperform.c,v 1.1 2007/08/23 10:16:51 ph10 Exp $ */
+
+/*************************************************
+*     Exim - an Internet mail transport agent    *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 1995 - 2007 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+
+#include "../exim.h"
+#include "lf_functions.h"
+
+
+
+/*************************************************
+*    Call SQL server(s) to run an actual query   *
+*************************************************/
+
+/* All the SQL lookups are of the same form, with a list of servers to try
+until one can be accessed. It is now also possible to provide the server data
+as part of the query. This function manages server selection and looping; each
+lookup has its own function for actually performing the lookup.
+
+Arguments:
+  name           the lookup name, e.g. "MySQL"
+  optionname     the name of the servers option, e.g. "mysql_servers"
+  optserverlist  the value of the servers option
+  query          the query
+  result         where to pass back the result
+  errmsg         where to pass back an error message
+  do_cache       to be set FALSE if data is changed
+  func           the lookup function to call
+
+Returns:         the return from the lookup function, or DEFER
+*/
+
+int
+lf_sqlperform(uschar *name, uschar *optionname, uschar *optserverlist,
+  uschar *query, uschar **result, uschar **errmsg, BOOL *do_cache,
+  int(*fn)(uschar *, uschar *, uschar **, uschar **, BOOL *, BOOL *))
+{
+int sep, rc;
+uschar *server;
+uschar *serverlist;
+uschar buffer[512];
+BOOL defer_break = FALSE;
+
+DEBUG(D_lookup) debug_printf("%s query: %s\n", name, query);
+
+/* Handle queries that do not have server information at the start. */
+
+if (Ustrncmp(query, "servers", 7) != 0)
+  {
+  sep = 0;
+  serverlist = optserverlist;
+  while ((server = string_nextinlist(&serverlist, &sep, buffer,
+          sizeof(buffer))) != NULL)
+    {
+    rc = (*fn)(query, server, result, errmsg, &defer_break, do_cache);
+    if (rc != DEFER || defer_break) return rc;
+    }
+  if (optserverlist == NULL)
+    *errmsg = string_sprintf("no %s servers defined (%s option)", name,
+      optionname);
+  }
+
+/* Handle queries that do have server information at the start. */
+
+else
+  {
+  int qsep;
+  uschar *s, *ss;
+  uschar *qserverlist;
+  uschar *qserver;
+  uschar qbuffer[512];
+
+  s = query + 7;
+  while (isspace(*s)) s++;
+  if (*s++ != '=')
+    {
+    *errmsg = string_sprintf("missing = after \"servers\" in %s lookup", name);
+    return DEFER;
+    }
+  while (isspace(*s)) s++;
+
+  ss = Ustrchr(s, ';');
+  if (ss == NULL)
+    {
+    *errmsg = string_sprintf("missing ; after \"servers=\" in %s lookup",
+      name);
+    return DEFER;
+    }
+
+  if (ss == s)
+    {
+    *errmsg = string_sprintf("\"servers=\" defines no servers in \"%s\"",
+      query);
+    return DEFER;
+    }
+
+  qserverlist = string_sprintf("%.*s", ss - s, s);
+  qsep = 0;
+
+  while ((qserver = string_nextinlist(&qserverlist, &qsep, qbuffer,
+           sizeof(qbuffer))) != NULL)
+    {
+    if (Ustrchr(qserver, '/') != NULL)
+      server = qserver;
+    else
+      {
+      int len = Ustrlen(qserver);
+
+      sep = 0;
+      serverlist = optserverlist;
+      while ((server = string_nextinlist(&serverlist, &sep, buffer,
+              sizeof(buffer))) != NULL)
+        {
+        if (Ustrncmp(server, qserver, len) == 0 && server[len] == '/')
+          break;
+        }
+
+      if (server == NULL)
+        {
+        *errmsg = string_sprintf("%s server \"%s\" not found in %s", name,
+          qserver, optionname);
+        return DEFER;
+        }
+      }
+
+    rc = (*fn)(ss+1, server, result, errmsg, &defer_break, do_cache);
+    if (rc != DEFER || defer_break) return rc;
+    }
+  }
+
+return DEFER;
+}
+
+/* End of lf_sqlperform.c */
index 56da5f95dafc903a86f5c6aa10b352f9c30c6b0f..781b09575b64709f3ca3ff6836039c2a6efb55cd 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/lookups/mysql.c,v 1.4 2007/01/08 10:50:19 ph10 Exp $ */
+/* $Cambridge: exim/src/src/lookups/mysql.c,v 1.5 2007/08/23 10:16:51 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -338,32 +338,16 @@ else
 *************************************************/
 
 /* See local README for interface description. The handle and filename
 *************************************************/
 
 /* See local README for interface description. The handle and filename
-arguments are not used. Loop through a list of servers while the query is
-deferred with a retryable error. */
+arguments are not used. The code to loop through a list of servers while the
+query is deferred with a retryable error is now in a separate function that is
+shared with other SQL lookups. */
 
 int
 mysql_find(void *handle, uschar *filename, uschar *query, int length,
   uschar **result, uschar **errmsg, BOOL *do_cache)
 {
 
 int
 mysql_find(void *handle, uschar *filename, uschar *query, int length,
   uschar **result, uschar **errmsg, BOOL *do_cache)
 {
-int sep = 0;
-uschar *server;
-uschar *list = mysql_servers;
-uschar buffer[512];
-
-DEBUG(D_lookup) debug_printf("MYSQL query: %s\n", query);
-
-while ((server = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL)
-  {
-  BOOL defer_break = FALSE;
-  int rc = perform_mysql_search(query, server, result, errmsg, &defer_break,
-    do_cache);
-  if (rc != DEFER || defer_break) return rc;
-  }
-
-if (mysql_servers == NULL)
-  *errmsg = US"no MYSQL servers defined (mysql_servers option)";
-
-return DEFER;
+return lf_sqlperform(US"MySQL", US"mysql_servers", mysql_servers, query,
+  result, errmsg, do_cache, perform_mysql_search);
 }
 
 
 }
 
 
index e6e8f70ba4e1a16fc55791b80a719d7092696964..eace0840d73ca9a0d016c4b26e2e161817097fd0 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/lookups/pgsql.c,v 1.9 2007/01/08 10:50:19 ph10 Exp $ */
+/* $Cambridge: exim/src/src/lookups/pgsql.c,v 1.10 2007/08/23 10:16:51 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -410,33 +410,16 @@ else
 *************************************************/
 
 /* See local README for interface description. The handle and filename
 *************************************************/
 
 /* See local README for interface description. The handle and filename
-arguments are not used. Loop through a list of servers while the query is
-deferred with a retryable error. */
+arguments are not used. The code to loop through a list of servers while the
+query is deferred with a retryable error is now in a separate function that is
+shared with other SQL lookups. */
 
 int
 pgsql_find(void *handle, uschar *filename, uschar *query, int length,
   uschar **result, uschar **errmsg, BOOL *do_cache)
 {
 
 int
 pgsql_find(void *handle, uschar *filename, uschar *query, int length,
   uschar **result, uschar **errmsg, BOOL *do_cache)
 {
-int sep = 0;
-uschar *server;
-uschar *list = pgsql_servers;
-uschar buffer[512];
-
-DEBUG(D_lookup) debug_printf("PGSQL query: %s\n", query);
-
-while ((server = string_nextinlist(&list, &sep, buffer, sizeof(buffer)))
-        != NULL)
-  {
-  BOOL defer_break = FALSE;
-  int rc = perform_pgsql_search(query, server, result, errmsg, &defer_break,
-    do_cache);
-  if (rc != DEFER || defer_break) return rc;
-  }
-
-if (pgsql_servers == NULL)
-  *errmsg = US"no PGSQL servers defined (pgsql_servers option)";
-
-return DEFER;
+return lf_sqlperform(US"PostgreSQL", US"pgsql_servers", pgsql_servers, query,
+  result, errmsg, do_cache, perform_pgsql_search);
 }
 
 
 }
 
 
index 3121ca950a925e79288bceed8d7e52c4c926fff1..fdf2caf9a23d9efd211dbeeb38e1c192d13da5d3 100644 (file)
@@ -10,6 +10,10 @@ ${lookup mysql {select * from them where id='quote';}}
 ${lookup mysql {select * from them where id='filter';}}
 ${lookup mysql {select * from them where id='quote2';}}
 ${lookup mysql {select * from them where id='nlonly';}}
 ${lookup mysql {select * from them where id='filter';}}
 ${lookup mysql {select * from them where id='quote2';}}
 ${lookup mysql {select * from them where id='nlonly';}}
+${lookup mysql {servers=x:localhost; select name from them where id='ph10';}}
+${lookup mysql {servers=localhost:x; select name from them where id='ph10';}}
+${lookup mysql {servers=localhost/test/root/:x; select name from them where id='ph10';}}
+${lookup mysql {servers=HOST_IPV4/test/root/:localhost; select name from them where id='ph10';}}
 ****
 exim -d -bh 10.0.0.0
 mail from:<a@b>
 ****
 exim -d -bh 10.0.0.0
 mail from:<a@b>
index c4440a89edc72b203e406f5dccd82a2307439496..2dfb15b950b06c5f5d7c1f5778341adfcd5e363a 100644 (file)
@@ -10,6 +10,10 @@ ${lookup pgsql {select * from them where id='quote2';}}
 ${lookup pgsql {select * from them where id='newline';}}
 ${lookup pgsql {select * from them where id='tab';}}
 ${lookup pgsql {select * from them where name='${quote_pgsql:'stquot}';}}
 ${lookup pgsql {select * from them where id='newline';}}
 ${lookup pgsql {select * from them where id='tab';}}
 ${lookup pgsql {select * from them where name='${quote_pgsql:'stquot}';}}
+${lookup pgsql {servers=x:localhost; select name from them where id='ph10';}}
+${lookup pgsql {servers=localhost:x; select name from them where id='ph10';}}
+${lookup pgsql {servers=localhost/test/CALLER/:x; select name from them where id='ph10';}}
+${lookup pgsql {servers=(/tmp/.s.PGSQL.5432)/test/ph10/:x; select name from them where id='ph10';}}
 ****
 exim -d -bh 10.0.0.0
 mail from:<a@b>
 ****
 exim -d -bh 10.0.0.0
 mail from:<a@b>
index 984484f1fbdcdc5e739753f4f7c21774e7510258..60c63ba08b4af4830cd052c219fa4f22ada4e217 100644 (file)
@@ -8,7 +8,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select name from them where id='CALLER';"
 database lookup required for select name from them where id='CALLER';
 internal_search_find: file="NULL"
   type=mysql key="select name from them where id='CALLER';"
 database lookup required for select name from them where id='CALLER';
-MYSQL query: select name from them where id='CALLER';
+MySQL query: select name from them where id='CALLER';
 MYSQL new connection: host=localhost port=0 socket=NULL database=test user=root
 lookup yielded: Philip Hazel
 search_open: mysql "NULL"
 MYSQL new connection: host=localhost port=0 socket=NULL database=test user=root
 lookup yielded: Philip Hazel
 search_open: mysql "NULL"
@@ -28,7 +28,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select name from them where id='xxxx';"
 database lookup required for select name from them where id='xxxx';
 internal_search_find: file="NULL"
   type=mysql key="select name from them where id='xxxx';"
 database lookup required for select name from them where id='xxxx';
-MYSQL query: select name from them where id='xxxx';
+MySQL query: select name from them where id='xxxx';
 MYSQL using cached connection for localhost/test/root
 MYSQL: no data found
 lookup failed
 MYSQL using cached connection for localhost/test/root
 MYSQL: no data found
 lookup failed
@@ -40,7 +40,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select name from them where id='nothing';"
 database lookup required for select name from them where id='nothing';
 internal_search_find: file="NULL"
   type=mysql key="select name from them where id='nothing';"
 database lookup required for select name from them where id='nothing';
-MYSQL query: select name from them where id='nothing';
+MySQL query: select name from them where id='nothing';
 MYSQL using cached connection for localhost/test/root
 MYSQL: no data found
 lookup failed
 MYSQL using cached connection for localhost/test/root
 MYSQL: no data found
 lookup failed
@@ -52,7 +52,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select id,name from them where id='nothing';"
 database lookup required for select id,name from them where id='nothing';
 internal_search_find: file="NULL"
   type=mysql key="select id,name from them where id='nothing';"
 database lookup required for select id,name from them where id='nothing';
-MYSQL query: select id,name from them where id='nothing';
+MySQL query: select id,name from them where id='nothing';
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=nothing name="" 
 search_open: mysql "NULL"
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=nothing name="" 
 search_open: mysql "NULL"
@@ -63,7 +63,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="delete from them where id='nonexist';"
 database lookup required for delete from them where id='nonexist';
 internal_search_find: file="NULL"
   type=mysql key="delete from them where id='nonexist';"
 database lookup required for delete from them where id='nonexist';
-MYSQL query: delete from them where id='nonexist';
+MySQL query: delete from them where id='nonexist';
 MYSQL using cached connection for localhost/test/root
 MYSQL: query was not one that returns data
 lookup forced cache cleanup
 MYSQL using cached connection for localhost/test/root
 MYSQL: query was not one that returns data
 lookup forced cache cleanup
@@ -76,7 +76,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='quote';"
 database lookup required for select * from them where id='quote';
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='quote';"
 database lookup required for select * from them where id='quote';
-MYSQL query: select * from them where id='quote';
+MySQL query: select * from them where id='quote';
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=quote name="\"Q\" Oted" home=/home/quoted mail=quoted@xxx 
 search_open: mysql "NULL"
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=quote name="\"Q\" Oted" home=/home/quoted mail=quoted@xxx 
 search_open: mysql "NULL"
@@ -87,7 +87,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='filter';"
 database lookup required for select * from them where id='filter';
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='filter';"
 database lookup required for select * from them where id='filter';
-MYSQL query: select * from them where id='filter';
+MySQL query: select * from them where id='filter';
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=filter name=filter home=filter mail="#Exim filter
 deliver postmaster" 
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=filter name=filter home=filter mail="#Exim filter
 deliver postmaster" 
@@ -99,7 +99,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='quote2';"
 database lookup required for select * from them where id='quote2';
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='quote2';"
 database lookup required for select * from them where id='quote2';
-MYSQL query: select * from them where id='quote2';
+MySQL query: select * from them where id='quote2';
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=quote2 name="\"qnosp" home=/home/q2 mail="" 
 search_open: mysql "NULL"
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=quote2 name="\"qnosp" home=/home/q2 mail="" 
 search_open: mysql "NULL"
@@ -110,10 +110,55 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='nlonly';"
 database lookup required for select * from them where id='nlonly';
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='nlonly';"
 database lookup required for select * from them where id='nlonly';
-MYSQL query: select * from them where id='nlonly';
+MySQL query: select * from them where id='nlonly';
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=nlonly name=filter home=filter mail="Before
 After" 
 MYSQL using cached connection for localhost/test/root
 lookup yielded: id=nlonly name=filter home=filter mail="Before
 After" 
+search_open: mysql "NULL"
+  cached open
+search_find: file="NULL"
+  key="servers=x:localhost; select name from them where id='CALLER';" partial=-1 affix=NULL starflags=0
+LRU list:
+internal_search_find: file="NULL"
+  type=mysql key="servers=x:localhost; select name from them where id='CALLER';"
+database lookup required for servers=x:localhost; select name from them where id='CALLER';
+MySQL query: servers=x:localhost; select name from them where id='CALLER';
+lookup deferred: MySQL server "x" not found in mysql_servers
+search_open: mysql "NULL"
+  cached open
+search_find: file="NULL"
+  key="servers=localhost:x; select name from them where id='CALLER';" partial=-1 affix=NULL starflags=0
+LRU list:
+internal_search_find: file="NULL"
+  type=mysql key="servers=localhost:x; select name from them where id='CALLER';"
+database lookup required for servers=localhost:x; select name from them where id='CALLER';
+MySQL query: servers=localhost:x; select name from them where id='CALLER';
+MYSQL using cached connection for localhost/test/root
+lookup yielded: Philip Hazel
+search_open: mysql "NULL"
+  cached open
+search_find: file="NULL"
+  key="servers=localhost/test/root/:x; select name from them where id='CALLER';" partial=-1 affix=NULL starflags=0
+LRU list:
+internal_search_find: file="NULL"
+  type=mysql key="servers=localhost/test/root/:x; select name from them where id='CALLER';"
+database lookup required for servers=localhost/test/root/:x; select name from them where id='CALLER';
+MySQL query: servers=localhost/test/root/:x; select name from them where id='CALLER';
+MYSQL using cached connection for localhost/test/root
+lookup yielded: Philip Hazel
+search_open: mysql "NULL"
+  cached open
+search_find: file="NULL"
+  key="servers=HOST_IPV4/test/root/:localhost; select name from them where id='CALLER';" partial=-1 affix=NULL starflags=0
+LRU list:
+internal_search_find: file="NULL"
+  type=mysql key="servers=HOST_IPV4/test/root/:localhost; select name from them where id='CALLER';"
+database lookup required for servers=HOST_IPV4/test/root/:localhost; select name from them where id='CALLER';
+MySQL query: servers=HOST_IPV4/test/root/:localhost; select name from them where id='CALLER';
+MYSQL new connection: host=HOST_IPV4 port=0 socket=NULL database=test user=root
+MYSQL connection failed: Unknown MySQL server host 'HOST_IPV4' (1)
+MYSQL using cached connection for localhost/test/root
+lookup yielded: Philip Hazel
 search_tidyup called
 close MYSQL connection: localhost/test/root
 >>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
 search_tidyup called
 close MYSQL connection: localhost/test/root
 >>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
@@ -161,7 +206,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='10.0.0.0'"
 database lookup required for select * from them where id='10.0.0.0'
 internal_search_find: file="NULL"
   type=mysql key="select * from them where id='10.0.0.0'"
 database lookup required for select * from them where id='10.0.0.0'
-MYSQL query: select * from them where id='10.0.0.0'
+MySQL query: select * from them where id='10.0.0.0'
 MYSQL new connection: host=localhost port=0 socket=NULL database=test user=root
 MYSQL: no data found
 lookup failed
 MYSQL new connection: host=localhost port=0 socket=NULL database=test user=root
 MYSQL: no data found
 lookup failed
@@ -266,7 +311,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select name from them where id='CALLER'"
 database lookup required for select name from them where id='CALLER'
 internal_search_find: file="NULL"
   type=mysql key="select name from them where id='CALLER'"
 database lookup required for select name from them where id='CALLER'
-MYSQL query: select name from them where id='CALLER'
+MySQL query: select name from them where id='CALLER'
 MYSQL new connection: host=localhost port=0 socket=NULL database=test user=root
 lookup yielded: Philip Hazel
 calling r1 router
 MYSQL new connection: host=localhost port=0 socket=NULL database=test user=root
 lookup yielded: Philip Hazel
 calling r1 router
@@ -309,7 +354,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=mysql key="select id from them where id='CALLER'"
 database lookup required for select id from them where id='CALLER'
 internal_search_find: file="NULL"
   type=mysql key="select id from them where id='CALLER'"
 database lookup required for select id from them where id='CALLER'
-MYSQL query: select id from them where id='CALLER'
+MySQL query: select id from them where id='CALLER'
 MYSQL new connection: host=localhost port=0 socket=NULL database=test user=root
 lookup yielded: CALLER
 appendfile: mode=600 notify_comsat=0 quota=0 warning=0
 MYSQL new connection: host=localhost port=0 socket=NULL database=test user=root
 lookup yielded: CALLER
 appendfile: mode=600 notify_comsat=0 quota=0 warning=0
index 55143b46c69590b4022249d8da4780c223444668..2fff471a35eb502fa20c50885649b6f7ee168159 100644 (file)
@@ -8,7 +8,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='CALLER';"
 database lookup required for select name from them where id='CALLER';
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='CALLER';"
 database lookup required for select name from them where id='CALLER';
-PGSQL query: select name from them where id='CALLER';
+PostgreSQL query: select name from them where id='CALLER';
 PGSQL new connection: host=localhost port= database=test user=CALLER
 lookup yielded: Philip Hazel
 search_open: pgsql "NULL"
 PGSQL new connection: host=localhost port= database=test user=CALLER
 lookup yielded: Philip Hazel
 search_open: pgsql "NULL"
@@ -28,7 +28,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='xxxx';"
 database lookup required for select name from them where id='xxxx';
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='xxxx';"
 database lookup required for select name from them where id='xxxx';
-PGSQL query: select name from them where id='xxxx';
+PostgreSQL query: select name from them where id='xxxx';
 PGSQL using cached connection for localhost/test/CALLER
 PGSQL: no data found
 lookup failed
 PGSQL using cached connection for localhost/test/CALLER
 PGSQL: no data found
 lookup failed
@@ -40,7 +40,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='nothing';"
 database lookup required for select name from them where id='nothing';
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='nothing';"
 database lookup required for select name from them where id='nothing';
-PGSQL query: select name from them where id='nothing';
+PostgreSQL query: select name from them where id='nothing';
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: 
 search_open: pgsql "NULL"
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: 
 search_open: pgsql "NULL"
@@ -51,7 +51,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select id,name from them where id='nothing';"
 database lookup required for select id,name from them where id='nothing';
 internal_search_find: file="NULL"
   type=pgsql key="select id,name from them where id='nothing';"
 database lookup required for select id,name from them where id='nothing';
-PGSQL query: select id,name from them where id='nothing';
+PostgreSQL query: select id,name from them where id='nothing';
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: id=nothing name="" 
 search_open: pgsql "NULL"
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: id=nothing name="" 
 search_open: pgsql "NULL"
@@ -62,7 +62,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="delete from them where id='nonexist';"
 database lookup required for delete from them where id='nonexist';
 internal_search_find: file="NULL"
   type=pgsql key="delete from them where id='nonexist';"
 database lookup required for delete from them where id='nonexist';
-PGSQL query: delete from them where id='nonexist';
+PostgreSQL query: delete from them where id='nonexist';
 PGSQL using cached connection for localhost/test/CALLER
 PGSQL: command does not return any data but was successful. Rows affected: 0
 lookup forced cache cleanup
 PGSQL using cached connection for localhost/test/CALLER
 PGSQL: command does not return any data but was successful. Rows affected: 0
 lookup forced cache cleanup
@@ -75,7 +75,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where id='quote2';"
 database lookup required for select * from them where id='quote2';
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where id='quote2';"
 database lookup required for select * from them where id='quote2';
-PGSQL query: select * from them where id='quote2';
+PostgreSQL query: select * from them where id='quote2';
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: name="\"stquot" id=quote2 
 search_open: pgsql "NULL"
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: name="\"stquot" id=quote2 
 search_open: pgsql "NULL"
@@ -86,7 +86,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where id='newline';"
 database lookup required for select * from them where id='newline';
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where id='newline';"
 database lookup required for select * from them where id='newline';
-PGSQL query: select * from them where id='newline';
+PostgreSQL query: select * from them where id='newline';
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: name="before
 after" id=newline 
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: name="before
 after" id=newline 
@@ -98,7 +98,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where id='tab';"
 database lookup required for select * from them where id='tab';
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where id='tab';"
 database lookup required for select * from them where id='tab';
-PGSQL query: select * from them where id='tab';
+PostgreSQL query: select * from them where id='tab';
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: name="x        x" id=tab 
 search_open: pgsql "NULL"
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: name="x        x" id=tab 
 search_open: pgsql "NULL"
@@ -109,10 +109,54 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where name='''stquot';"
 database lookup required for select * from them where name='''stquot';
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where name='''stquot';"
 database lookup required for select * from them where name='''stquot';
-PGSQL query: select * from them where name='''stquot';
+PostgreSQL query: select * from them where name='''stquot';
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: name='stquot id=quote1 
 PGSQL using cached connection for localhost/test/CALLER
 lookup yielded: name='stquot id=quote1 
+search_open: pgsql "NULL"
+  cached open
+search_find: file="NULL"
+  key="servers=x:localhost; select name from them where id='CALLER';" partial=-1 affix=NULL starflags=0
+LRU list:
+internal_search_find: file="NULL"
+  type=pgsql key="servers=x:localhost; select name from them where id='CALLER';"
+database lookup required for servers=x:localhost; select name from them where id='CALLER';
+PostgreSQL query: servers=x:localhost; select name from them where id='CALLER';
+lookup deferred: PostgreSQL server "x" not found in pgsql_servers
+search_open: pgsql "NULL"
+  cached open
+search_find: file="NULL"
+  key="servers=localhost:x; select name from them where id='CALLER';" partial=-1 affix=NULL starflags=0
+LRU list:
+internal_search_find: file="NULL"
+  type=pgsql key="servers=localhost:x; select name from them where id='CALLER';"
+database lookup required for servers=localhost:x; select name from them where id='CALLER';
+PostgreSQL query: servers=localhost:x; select name from them where id='CALLER';
+PGSQL using cached connection for localhost/test/CALLER
+lookup yielded: Philip Hazel
+search_open: pgsql "NULL"
+  cached open
+search_find: file="NULL"
+  key="servers=localhost/test/CALLER/:x; select name from them where id='CALLER';" partial=-1 affix=NULL starflags=0
+LRU list:
+internal_search_find: file="NULL"
+  type=pgsql key="servers=localhost/test/CALLER/:x; select name from them where id='CALLER';"
+database lookup required for servers=localhost/test/CALLER/:x; select name from them where id='CALLER';
+PostgreSQL query: servers=localhost/test/CALLER/:x; select name from them where id='CALLER';
+PGSQL using cached connection for localhost/test/CALLER
+lookup yielded: Philip Hazel
+search_open: pgsql "NULL"
+  cached open
+search_find: file="NULL"
+  key="servers=(/tmp/.s.PGSQL.5432)/test/CALLER/:x; select name from them where id='CALLER';" partial=-1 affix=NULL starflags=0
+LRU list:
+internal_search_find: file="NULL"
+  type=pgsql key="servers=(/tmp/.s.PGSQL.5432)/test/CALLER/:x; select name from them where id='CALLER';"
+database lookup required for servers=(/tmp/.s.PGSQL.5432)/test/CALLER/:x; select name from them where id='CALLER';
+PostgreSQL query: servers=(/tmp/.s.PGSQL.5432)/test/CALLER/:x; select name from them where id='CALLER';
+PGSQL new connection: socket=/tmp/.s.PGSQL.5432 database=test user=CALLER
+lookup yielded: Philip Hazel
 search_tidyup called
 search_tidyup called
+close PGSQL connection: (/tmp/.s.PGSQL.5432)/test/CALLER
 close PGSQL connection: localhost/test/CALLER
 >>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
 Exim version x.yz ....
 close PGSQL connection: localhost/test/CALLER
 >>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
 Exim version x.yz ....
@@ -159,7 +203,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where id='10.0.0.0'"
 database lookup required for select * from them where id='10.0.0.0'
 internal_search_find: file="NULL"
   type=pgsql key="select * from them where id='10.0.0.0'"
 database lookup required for select * from them where id='10.0.0.0'
-PGSQL query: select * from them where id='10.0.0.0'
+PostgreSQL query: select * from them where id='10.0.0.0'
 PGSQL new connection: host=localhost port= database=test user=CALLER
 PGSQL: no data found
 lookup failed
 PGSQL new connection: host=localhost port= database=test user=CALLER
 PGSQL: no data found
 lookup failed
@@ -290,7 +334,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='CALLER'"
 database lookup required for select name from them where id='CALLER'
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='CALLER'"
 database lookup required for select name from them where id='CALLER'
-PGSQL query: select name from them where id='CALLER'
+PostgreSQL query: select name from them where id='CALLER'
 PGSQL new connection: host=localhost port= database=test user=CALLER
 lookup yielded: Philip Hazel
 calling r1 router
 PGSQL new connection: host=localhost port= database=test user=CALLER
 lookup yielded: Philip Hazel
 calling r1 router
@@ -333,7 +377,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select id from them where id='CALLER'"
 database lookup required for select id from them where id='CALLER'
 internal_search_find: file="NULL"
   type=pgsql key="select id from them where id='CALLER'"
 database lookup required for select id from them where id='CALLER'
-PGSQL query: select id from them where id='CALLER'
+PostgreSQL query: select id from them where id='CALLER'
 PGSQL new connection: host=localhost port= database=test user=CALLER
 lookup yielded: CALLER
 appendfile: mode=600 notify_comsat=0 quota=0 warning=0
 PGSQL new connection: host=localhost port= database=test user=CALLER
 lookup yielded: CALLER
 appendfile: mode=600 notify_comsat=0 quota=0 warning=0
@@ -387,7 +431,7 @@ LRU list:
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='CALLER';"
 database lookup required for select name from them where id='CALLER';
 internal_search_find: file="NULL"
   type=pgsql key="select name from them where id='CALLER';"
 database lookup required for select name from them where id='CALLER';
-PGSQL query: select name from them where id='CALLER';
+PostgreSQL query: select name from them where id='CALLER';
 PGSQL new connection: socket=/tmp/.s.PGSQL.5432 database=test user=CALLER
 lookup yielded: Philip Hazel
 search_tidyup called
 PGSQL new connection: socket=/tmp/.s.PGSQL.5432 database=test user=CALLER
 lookup yielded: Philip Hazel
 search_tidyup called
index 8ef63f6fecda180856254302f882de21f8abaa83..460d7671405de9f662945572c101fcf0cae3cc8b 100644 (file)
@@ -10,6 +10,10 @@ deliver postmaster"
 > id=quote2 name="\"qnosp" home=/home/q2 mail="" 
 > id=nlonly name=filter home=filter mail="Before
 After" 
 > id=quote2 name="\"qnosp" home=/home/q2 mail="" 
 > id=nlonly name=filter home=filter mail="Before
 After" 
+> Failed: lookup of "servers=x:localhost; select name from them where id='CALLER';" gave DEFER: MySQL server "x" not found in mysql_servers
+> Philip Hazel
+> Philip Hazel
+> Philip Hazel
 > 
 
 **** SMTP testing session as if from host 10.0.0.0
 > 
 
 **** SMTP testing session as if from host 10.0.0.0
index 4b97f9f711d113b96544cffe38df5f58dfeee035..d2ec96f9d725b53f2ff1f9db2ef5dc5021c272b9 100644 (file)
@@ -9,6 +9,10 @@
 after" id=newline 
 > name="x      x" id=tab 
 > name='stquot id=quote1 
 after" id=newline 
 > name="x      x" id=tab 
 > name='stquot id=quote1 
+> Failed: lookup of "servers=x:localhost; select name from them where id='CALLER';" gave DEFER: PostgreSQL server "x" not found in pgsql_servers
+> Philip Hazel
+> Philip Hazel
+> Philip Hazel
 > 
 
 **** SMTP testing session as if from host 10.0.0.0
 > 
 
 **** SMTP testing session as if from host 10.0.0.0