]> granicus.if.org Git - pdns/commitdiff
Fix gsql query-logging not always working
authorChristian Hofstaedtler <christian@hofstaedtler.name>
Mon, 3 Feb 2014 20:46:17 +0000 (21:46 +0100)
committerChristian Hofstaedtler <christian@hofstaedtler.name>
Mon, 3 Feb 2014 21:21:26 +0000 (22:21 +0100)
query-logging would only be taken into account after the first direct
(DNS) query; getAllDomains and other calls before the first query would
not get the logging. Problematic when the backend instances are
short-lived.

pdns/backends/gsql/gsqlbackend.cc
pdns/backends/gsql/gsqlbackend.hh

index 2c84899e27252fc1fa9aab9fe0a156b8f0f8d4e4..8f8f816ca5ccb8e71f0157fa4b695326abc5888e 100644 (file)
@@ -786,8 +786,6 @@ void GSQLBackend::lookup(const QType &qtype,const string &qname, DNSPacket *pkt_
   string format;
   char output[1024];
 
-  d_db->setLog(::arg().mustDo("query-logging"));
-
   string lcqname=toLower(qname);
   
   // lcqname=labelReverse(makeRelative(lcqname, "net"));
index 7b2da843df0629553a864dc31aab4eb4e54fe505..efc417512672d873bbbee0fd633894b84372882a 100644 (file)
@@ -1,6 +1,7 @@
 #include <string>
 #include <map>
 #include "ssql.hh"
+#include "pdns/arguments.hh"
 
 #include "../../namespaces.hh"
 
@@ -20,6 +21,9 @@ public:
   void setDB(SSql *db)
   {
     d_db=db;
+    if (d_db) {
+      d_db->setLog(::arg().mustDo("query-logging"));
+    }
   }
   
   virtual string sqlEscape(const string &name);