]> granicus.if.org Git - pdns/commitdiff
hmf, part of 2.9.14 is only committed now
authorBert Hubert <bert.hubert@netherlabs.nl>
Sat, 17 Jan 2004 13:18:22 +0000 (13:18 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sat, 17 Jan 2004 13:18:22 +0000 (13:18 +0000)
plus work on 2.9.15

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@217 d19b8d6e-7fed-0310-83ef-9ca221ded41b

20 files changed:
ChangeLog
build-scripts/rpm-build-instruction
configure.in
debian/changelog
debian/control
debian/pdns.postinst
debian/rules
modules/gpgsqlbackend/OBJECTLIBS
modules/gpgsqlbackend/spgsql.cc
modules/gpgsqlbackend/spgsql.hh
modules/ldapbackend/ldapbackend.cc
modules/ldapbackend/powerldap.hh
pdns.spec
pdns/Makefile.am
pdns/backends/bind/zone2sql.cc
pdns/backends/bind/zoneparser2.cc
pdns/common_startup.cc
pdns/docs/pdns.sgml
pdns/logger.cc
pdns/packethandler.cc

index 43944f9a6820b8c03e5d6dfaa9e0ec1160211b99..486bdcde36905cf8a0eb3c82056987ea66b35ee7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,34 @@
+changes since 2.9.14:
+       - you can now do this:
+               dig axfr ds9a.nl @213.244.168.210 |    \
+               /usr/bin/zone2sql --gmysql --zone=-  | \
+               mysql -u pdns pdns
+       - the '-' is new
+       - there is now better duplicate zone detection
+       - allow-recursion-override works but was on by default
+       - logging was off
+       - debian/rules forgot sqllite
+       - removed libpqpp from build-depends
+
+
 changes since 2.9.13:
-       - speed improvements (norbert)
        - logging to syslog can now be restricted (norbert)
        - SOA canonic
+       - zone2ldap cleanup
+       - LDAP:
+> A big patch for the ldapbackend:
+> - - Changes to support different lookup methods
+> - - Better exception handling
+> - - Better support for load distribution
+> - - Many cleanups
+       - errno compilation fixes in LDAP code (Norbert)
+       - pdns_recursor was too chatty with TCP (noticed by Mathew Walker)
+       - Generic SQL backend used doQuery where it meant doCommand on set notified (Georg Bauer)
+       - experimental feature 'recursion-check-nxdomain'
+       - 2^30 
+       - postgresql de-c++fiscation
+       - efficiency increases (chomp), reworking argumentparsing (spaces)
+       - loglevel fixes        
 
 changes since 2.9.12:
        - pdns_recursor can now survive being disconnected from the net for long
index 5d916796fb729557f349c86de53ee953ea452907..f1d0a65a1f2b617c5a20177af70dff6da02063ca 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
-LIBS="-lkrb5 -lkrb -lcrypto -lroken -lcom_err -lasn1 -lresolv" \./configure --with-modules="mysql gmysql gpgsql gsqlite pipe pdns xdb" \
+./configure --with-modules="mysql gmysql gpgsql gsqlite pipe pdns xdb" \
+               --with-pgsql-lib=/opt/postgresql/lib/ \
+               --with-pgsql-includes=/opt/postgresql/include/ \
        --with-dynmodules="" \
        --enable-static-binaries --enable-recursor \
        --prefix=/usr \
index 858ae6b27363f2967ff403edd4ed92c6e05d5bd3..6ec3b750e9d6bb2330a546e0c7a15513ed62a7da 100644 (file)
@@ -1,6 +1,6 @@
 dnl intro
 AC_INIT(pdns/receiver.cc)
-AM_INIT_AUTOMAKE(pdns, 2.9.13)
+AM_INIT_AUTOMAKE(pdns, 2.9.15)
 AC_CANONICAL_HOST
 AM_CONFIG_HEADER(config.h)
 AC_C_BIGENDIAN 
@@ -277,7 +277,7 @@ then
        PGSQL_libdir=
        for m in $PGSQL_lib_check; do
                if test -d "$m" && \
-                  (test -f "$m/libpq++.so" || test -f "$m/libpq++.a")
+                  (test -f "$m/libpq.a" || test -f "$m/libpq++.a")
                then
                        PGSQL_libdir=$m
                        break
@@ -299,7 +299,7 @@ then
                AC_MSG_CHECKING([for PgSQL include directory])
        PGSQL_incdir=
        for m in $PGSQL_inc_check; do
-               if test -d "$m" && test -f "$m/libpq++.h"
+               if test -d "$m" && test -f "$m/libpq-fe.h"
                then
                        PGSQL_incdir=$m
                        break
index 596b3c530d84e0792c6d358272716b7a37144d3b..f69b440a72165f491f8b04ba2ce7678418116f92 100644 (file)
@@ -1,15 +1,41 @@
+pdns (2.9.14-1) unstable; urgency=medium
+
+  * New upstream version. Postgres support rewritten to use the C interface
+    instead of the deprectaed libpqpp
+
+ -- Wichert Akkerman <wichert@wiggy.net>  Fri, 16 Jan 2004 23:23:33 +0100
+
+pdns (2.9.13-3) unstable; urgency=medium
+
+  * Fix pdns postinst so pdns is properly restart on upgrade
+
+ -- Wichert Akkerman <wichert@wiggy.net>  Sat, 10 Jan 2004 17:21:18 +0100
+
+pdns (2.9.13-2) unstable; urgency=critical
+
+  * Fix a bug in calculation of early timestamps: 1<<31-1 is not the
+    same as (1<<31)-1. This made all pdns servers consume all possible
+    CPU when UNIX time went through 2^30 two hours ago.
+
+ -- Wichert Akkerman <wichert@wiggy.net>  Sat, 10 Jan 2004 16:53:09 +0100
+
 pdns (2.9.13-1) unstable; urgency=low
 
   * New upstream release
+  * Stop using my debian.org email address
+  * Change init scripts to conform to Debian policy 
 
- -- Wichert Akkerman <wakkerma@debian.org>  Sun,  21 Sep 2003 14:59:46 +0200
+ -- Wichert Akkerman <wichert@wiggy.net>  Thu, 25 Dec 2003 13:33:40 +0100
 
 pdns (2.9.12-1) unstable; urgency=low
 
   * New upstream release
   * Fix dependency generation. Closes: Bug#210256
+  * Check if pdns is installed in init script. Closes: Bug#217402
+  * Create a SQLite backend package
+  * Add versioned dpkg-dev Build-Depends so ${dpkg:Version} works properly
 
- -- Wichert Akkerman <wakkerma@debian.org>  Sun,  21 Sep 2003 14:59:46 +0200
+ -- Wichert Akkerman <wakkerma@debian.org>  Mon, 27 Oct 2003 18:52:53 +0100
 
 pdns (2.9.11-2) unstable; urgency=low
 
index f4605a6d429e10fe7e4ccdc6c0fd7bd42e51bc40..762c0ae915008e55639409df453d54f53d40bdf7 100644 (file)
@@ -2,8 +2,8 @@ Source: pdns
 Section: net
 Priority: extra
 Standards-Version: 3.5.8
-Maintainer: Wichert Akkerman <wakkerma@debian.org>
-Build-Depends: autoconf, libtool, flex, bison, docbook-utils, libmysqlclient-dev, postgresql-dev, tdb-dev, libgdbm-dev, libpqpp-dev, libldap2-dev
+Maintainer: Wichert Akkerman <wichert@wiggy.net>
+Build-Depends: autoconf, libtool, flex, bison, docbook-utils, libmysqlclient-dev, postgresql-dev, tdb-dev, libgdbm-dev, libldap2-dev, libsqlite0-dev, dpkg-dev (> 1.10.17)
 
 Package: pdns
 Architecture: any
@@ -66,6 +66,13 @@ Description: Generic PostgreSQL backend for pDNS
  This package contains a generic PostgreSQL backend 
  for the PowerDNS nameserver. It has configurable SQL statements.
 
+Package: pdns-backend-sqlite
+Architecture: any
+Depends: pdns (= ${dpkg:Version}), ${shlibs:Depends}
+Provides: pdns-backend
+Description: SQLite backend for pDNS
+ This package contains a generic SQLite backend for SQLite.
+
 Package: pdns-backend-xdb
 Architecture: any
 Depends: pdns (= ${dpkg:Version}), ${shlibs:Depends}
index 5879a2a07750a8a4e999fc6b0ef6e1fda6b63085..0161f22f205ff532f0e847ad6d1cbee57ab50467 100755 (executable)
@@ -12,6 +12,8 @@ update_init() {
 update_pdns() {
        if [ -n "$2" ] ; then
                /etc/init.d/pdns start
+       else
+               /etc/init.d/pdns restart
        fi
 }
 
index 8eab5d430faa69a7e10ea37ca07acf68761c2d27..5bf7dd03b9f1690b34cb00892fb17deaf85ec7ce 100755 (executable)
@@ -3,7 +3,7 @@
 tmpdir         := $(shell pwd)/debian/tmp
 be_tmpdir      := $(shell pwd)/debian/tmp-backend
 backends       := ldap mysql pipe xdb gmysql gpgsql gsqlite
-debs           := ldap mysql pipe xdb pgsql
+debs           := ldap mysql pipe xdb pgsql sqlite
 
 binary-doc:
        -make -C pdns/docs html/index.html
@@ -42,8 +42,9 @@ binary-doc:
 
 
 build-static stamp-build-static:
-       LIBS="-lkrb5 -lkrb -lcrypto -lroken -lcom_err -lasn1 -lresolv" \
                ./configure \
+                --with-pgsql-lib=/opt/postgresql/lib/ \
+                --with-pgsql-includes=/opt/postgresql/include/ \
                --prefix=/usr \
                --libexecdir='$${prefix}/lib' \
                --libdir='$${prefix}/lib/powerdns' \
index 5798704bad11ea20216999fb6685d805dedb22c2..f77e7166e4f3d97ffd3531d5e98b38b4c46caa8a 100644 (file)
@@ -1,3 +1,3 @@
--lpq -lpq++ -lpq -lssl -lcrypto  -lcrypt -lresolv -lnsl  
+-lpq -lssl -lcrypto  -lcrypt -lresolv -lnsl  
 
 
index 5cade0611c3eb57c92770e34264c25870991f239..df3e6950b0f5041bced1e3c452a10641fbdcc757 100644 (file)
@@ -1,12 +1,13 @@
 /* Copyright 2003 Netherlabs BV, bert.hubert@netherlabs.nl. See LICENSE 
    for more information.
-   $Id: spgsql.cc,v 1.3 2003/10/11 19:57:19 ahu Exp $  */
+   $Id: spgsql.cc,v 1.4 2004/01/17 13:18:22 ahu Exp $  */
 #include <string>
 #include "spgsql.hh"
 
 #include <iostream>
 #include "pdns/logger.hh"
 #include "pdns/dns.hh"
+
 using namespace std;
 
 bool SPgSQL::s_dolog;
@@ -14,6 +15,7 @@ bool SPgSQL::s_dolog;
 SPgSQL::SPgSQL(const string &database, const string &host, const string &msocket, const string &user, 
               const string &password)
 {
+  d_db=0;
   string connectstr;
 
   connectstr="dbname=";
@@ -27,11 +29,17 @@ SPgSQL::SPgSQL(const string &database, const string &host, const string &msocket
   if(!password.empty())
     connectstr+=" password="+password;
 
-  d_db=new PgDatabase(connectstr.c_str());
-  //  L<<Logger::Error<<"Connectstr: "<<connectstr<<endl;
-  // Check to see that the backend connection was successfully made
-  if (d_db->ConnectionBad() ) {
-    throw sPerrorException("Unable to connect to database, connect string: "+connectstr);
+  d_db=PQconnectdb(connectstr.c_str());
+
+  if (!d_db || PQstatus(d_db)==CONNECTION_BAD) {
+    try {
+      throw sPerrorException("Unable to connect to database, connect string: "+connectstr);
+    }
+    catch(...) {
+      if(d_db)
+       PQfinish(d_db);
+      throw;
+    }
   }
 
 }
@@ -43,12 +51,12 @@ void SPgSQL::setLog(bool state)
 
 SPgSQL::~SPgSQL()
 {
-  delete d_db;
+  PQfinish(d_db);
 }
 
 SSqlException SPgSQL::sPerrorException(const string &reason)
 {
-  return SSqlException(reason+string(": ")+d_db->ErrorMessage());
+  return SSqlException(reason+string(": ")+(d_db ? PQerrorMessage(d_db) : "no connection"));
 }
 
 int SPgSQL::doCommand(const string &query)
@@ -56,10 +64,16 @@ int SPgSQL::doCommand(const string &query)
   if(s_dolog)
     L<<Logger::Warning<<"Command: "<<query<<endl;
 
-  if(!d_db->ExecCommandOk(query.c_str())) { 
-    throw sPerrorException("PostgreSQL failed to execute command");
+  if(!(d_result=PQexec(d_db,query.c_str())) || PQresultStatus(d_result)!=PGRES_COMMAND_OK) { 
+    string error("unknown reason");
+    if(d_result) {
+      error=PQresultErrorMessage(d_result);
+      PQclear(d_result);
+    }
+    throw SSqlException("PostgreSQL failed to execute command: "+error); 
   }
-
+  if(d_result)
+    PQclear(d_result);
   d_count=0;
   return 0;
 }
@@ -70,8 +84,13 @@ int SPgSQL::doQuery(const string &query)
   if(s_dolog)
     L<<Logger::Warning<<"Query: "<<query<<endl;
 
-  if(!d_db->ExecTuplesOk(query.c_str())) { // was Exec, without TuplesOk
-    throw sPerrorException("PostgreSQL failed to execute command");
+  if(!(d_result=PQexec(d_db,query.c_str())) || PQresultStatus(d_result)!=PGRES_TUPLES_OK) {
+    string error("unknown reason");
+    if(d_result) {
+      error=PQresultErrorMessage(d_result);
+      PQclear(d_result);
+    }
+    throw SSqlException("PostgreSQL failed to execute command: "+error); 
   }
 
   d_count=0;
@@ -84,8 +103,15 @@ int SPgSQL::doQuery(const string &query, result_t &result)
   if(s_dolog)
     L<<Logger::Warning<<"Query: "<<query<<endl;
 
-  if(!d_db->ExecTuplesOk(query.c_str()))
-    throw sPerrorException("gPgSQLBackend failed to execute command that expected results");
+  if(!(d_result=PQexec(d_db,query.c_str())) || PQresultStatus(d_result)!=PGRES_TUPLES_OK) {
+    string error("unknown reason");
+    if(d_result) {
+      error=PQresultErrorMessage(d_result);
+      PQclear(d_result);
+    }
+    throw SSqlException("PostgreSQL failed to execute command: "+error); 
+  }
+
   d_count=0;
 
   row_t row;
@@ -98,12 +124,14 @@ int SPgSQL::doQuery(const string &query, result_t &result)
 bool SPgSQL::getRow(row_t &row)
 {
   row.clear();
-  
-  if(d_count>=d_db->Tuples())
+
+  if(d_count>=PQntuples(d_result)) {
+    PQclear(d_result);
     return false;
+  }
   
-  for(int i=0;i<d_db->Fields();i++)
-    row.push_back(d_db->GetValue(d_count,i) ?: "");
+  for(int i=0;i<PQnfields(d_result);i++)
+    row.push_back(PQgetvalue(d_result,d_count,i) ?: "");
   d_count++;
   return true;
 }
index a6b5e85caeea0b106955493cb0dbc24161476d6f..0057725ba626d81428fb550bc9b15e7945d42683 100644 (file)
@@ -1,13 +1,12 @@
 /* Copyright 2001 Netherlabs BV, bert.hubert@netherlabs.nl. See LICENSE 
    for more information.
-   $Id: spgsql.hh,v 1.4 2003/10/11 19:57:19 ahu Exp $  */
+   $Id: spgsql.hh,v 1.5 2004/01/17 13:18:22 ahu Exp $  */
 #ifndef SPGSQL_HH
 #define SPGSQL_HH
 using namespace std;
-#include <pg_config.h>
-#include <libpq++.h>
 #include "pdns/backends/gsql/ssql.hh"
 
+#include <libpq-fe.h>
 class SPgSQL : public SSql
 {
 public:
@@ -25,7 +24,8 @@ public:
   string escape(const string &str);    
   void setLog(bool state);
 private:
-  PgDatabase *d_db; 
+  PGconn* d_db; 
+  PGresult* d_result;
   int d_count;
   static bool s_dolog;
 };
index aa15959a5a46b7e9272eceb7a4a579527e46b7c4..a5ba7efc1a01c8f952ee0a447126f959cc92e94a 100644 (file)
 
 LdapBackend::LdapBackend( const string &suffix )
 {
-       unsigned int i;
-       setArgPrefix( "ldap" + suffix );
-       string hosts = getArg( "host" );
+       string hoststr;
+       unsigned int i, idx;
+       string::size_type end, begin = 0;
+       vector<string> hosts;
 
-       m_msgid = 0;
-       m_qname = "";
-       m_default_ttl = arg().asNum( "default-ttl" );
-       m_pldap = NULL;
 
-       for( i = 0; i < hosts.length(); i++ )
+       try
        {
-               if( hosts[i] == ',' ) { hosts[i] = ' '; }
-       }
+               m_msgid = 0;
+               m_qname = "";
+               m_default_ttl = arg().asNum( "default-ttl" );
+               m_myname = "[LdapBackend]";
+               m_pldap = NULL;
 
-       L << Logger::Info << backendname << " LDAP servers = " << hosts << endl;
+               setArgPrefix( "ldap" + suffix );
+               hoststr = getArg( "host" );
 
-       try
-       {
-               m_pldap = new PowerLDAP( hosts.c_str(), atoi( getArg( "port" ).c_str() ), mustDo( "starttls" ) );
+               m_getdn = false;
+               m_list_fcnt = &LdapBackend::list_simple;
+               m_lookup_fcnt = &LdapBackend::lookup_simple;
+               m_prepare_fcnt = &LdapBackend::prepare_simple;
+
+               if( getArg( "method" ) == "tree" )
+               {
+                       m_lookup_fcnt = &LdapBackend::lookup_tree;
+               }
+
+               if( getArg( "method" ) == "strict" || mustDo( "disable-ptrrecord" ) )
+               {
+                       m_lookup_fcnt = &LdapBackend::lookup_strict;
+                       m_prepare_fcnt = &LdapBackend::prepare_strict;
+               }
+
+               while( ( end = hoststr.find_first_of( ", \t\n", begin ) ) != string::npos )
+               {
+                       hosts.push_back( hoststr.substr( begin, end - begin ) );
+                       begin = end + 1;
+               }
+               hosts.push_back( hoststr.substr( begin, hoststr.length() - begin ) );
+
+               idx = Utility::random() % hosts.size();
+               hoststr = hosts[idx];
+
+               for( i = 1; i < hosts.size(); i++ )
+               {
+                       hoststr += " " + hosts[ ( idx + i ) % hosts.size() ];
+               }
+
+               L << Logger::Info << m_myname << " LDAP servers = " << hoststr << endl;
+
+               m_pldap = new PowerLDAP( hoststr.c_str(), LDAP_PORT, mustDo( "starttls" ) );
                m_pldap->setOption( LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS );
                m_pldap->simpleBind( getArg( "binddn" ), getArg( "secret" ) );
        }
-       catch( LDAPException &e )
+       catch( LDAPException &le )
        {
-               L << Logger::Error << backendname << " Initialization failed: " << e.what() << endl;
                if( m_pldap != NULL ) { delete( m_pldap ); }
+               L << Logger::Error << m_myname << " Ldap connection to server failed: " << le.what() << endl;
+               throw( AhuException( "Unable to connect to ldap server" ) );
+       }
+       catch( exception &e )
+       {
+               L << Logger::Error << m_myname << " Caught STL exception: " << e.what() << endl;
                throw( AhuException( "Unable to connect to ldap server" ) );
        }
 
-       L << Logger::Notice << backendname << " Ldap connection succeeded" << endl;
+       L << Logger::Notice << m_myname << " Ldap connection succeeded" << endl;
 }
 
 
+
 LdapBackend::~LdapBackend()
 {
        delete( m_pldap );
-       L << Logger::Notice << backendname << " Ldap connection closed" << endl;
+       L << Logger::Notice << m_myname << " Ldap connection closed" << endl;
+}
+
+
+
+bool LdapBackend::list( const string& target, int domain_id )
+{
+       try
+       {
+               m_qname = target;
+               m_axfrqlen = target.length();
+               m_adomain = m_adomains.end();   // skip loops in get() first time
+
+               return (this->*m_list_fcnt)( target, domain_id );
+       }
+       catch( LDAPTimeout &lt )
+       {
+               L << Logger::Warning << m_myname << " Unable to get zone " + target + " from LDAP directory: " << lt.what() << endl;
+               throw( DBException( "LDAP server timeout" ) );
+       }
+       catch( LDAPException &le )
+       {
+               L << Logger::Error << m_myname << " Unable to get zone " + target + " from LDAP directory: " << le.what() << endl;
+               throw( AhuException( "LDAP server unreachable" ) );   // try to reconnect to another server
+       }
+       catch( exception &e )
+       {
+               L << Logger::Error << m_myname << " Caught STL exception for target " << target << ": " << e.what() << endl;
+               throw( DBException( "STL exception" ) );
+       }
+
+       return false;
 }
 
 
-bool LdapBackend::list( const string &target, int domain_id )
+
+inline bool LdapBackend::list_simple( const string& target, int domain_id )
 {
        string filter;
 
+       filter = "(|(associatedDomain=" + target + ")(associatedDomain=*." + target + "))";
+       m_msgid = m_pldap->search( getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, (const char**) ldap_attrany );
+
+       return true;
+}
+
+
 
+void LdapBackend::lookup( const QType &qtype, const string &qname, DNSPacket *dnspkt, int zoneid )
+{
        try
        {
-               m_qname = target;
-               m_axfrqlen = target.length();
+               m_axfrqlen = 0;
+               m_qtype = qtype;
+               m_qname = qname;
                m_adomain = m_adomains.end();   // skip loops in get() first time
 
-               filter = "(|(associatedDomain=" + target + ")(associatedDomain=*." + target + "))";
-               m_msgid = m_pldap->search( getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, (const char**) attrany );
+               (this->*m_lookup_fcnt)( qtype, qname, dnspkt, zoneid );
        }
        catch( LDAPTimeout &lt )
        {
-               L << Logger::Warning << backendname << " Unable to get zone " + target + " from LDAP directory: " << lt.what() << endl;
-               return false;
+               L << Logger::Warning << m_myname << " Unable to search LDAP directory: " << lt.what() << endl;
+               throw( DBException( "LDAP server timeout" ) );
        }
        catch( LDAPException &le )
        {
-               L << Logger::Error << backendname << " Unable to get zone " + target + " from LDAP directory: " << le.what() << endl;
+               L << Logger::Error << m_myname << " Unable to search LDAP directory: " << le.what() << endl;
                throw( AhuException( "LDAP server unreachable" ) );   // try to reconnect to another server
        }
        catch( exception &e )
        {
-               L << Logger::Error << backendname << " Caught STL exception for target " << target << ": " << e.what() << endl;
-               return false;
+               L << Logger::Error << m_myname << " Caught STL exception for qname " << qname << ": " << e.what() << endl;
+               throw( DBException( "STL exception" ) );
        }
-       catch( ... )
+}
+
+
+
+void LdapBackend::lookup_simple( const QType &qtype, const string &qname, DNSPacket *dnspkt, int zoneid )
+{
+       string filter, attr, qesc;
+       char** attributes = ldap_attrany + 1;   // skip associatedDomain
+       char* attronly[] = { NULL, "dNSTTL", NULL };
+
+
+       qesc = toLower( m_pldap->escape( qname ) );
+       filter = "(associatedDomain=" + qesc + ")";
+
+       if( qtype.getCode() != QType::ANY )
        {
-               L << Logger::Critical << backendname << " Caught unknown exception for target " << target << endl;
-               return false;
+               attr = qtype.getName() + "Record";
+               filter = "(&" + filter + "(" + attr + "=*))";
+               attronly[0] = (char*) attr.c_str();
+               attributes = attronly;
        }
 
-       return true;
+       DLOG( L << Logger::Debug << m_myname << " Search = basedn: " << getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
+       m_msgid = m_pldap->search( getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, (const char**) attributes );
 }
 
 
-void LdapBackend::lookup( const QType &qtype, const string &qname, DNSPacket *dnspkt, int zoneid )
+
+void LdapBackend::lookup_strict( const QType &qtype, const string &qname, DNSPacket *dnspkt, int zoneid )
 {
        int len;
        vector<string> parts;
        string filter, attr, qesc;
-       char** attributes = attrany + 1;   // skip associatedDomain
+       char** attributes = ldap_attrany + 1;   // skip associatedDomain
        char* attronly[] = { NULL, "dNSTTL", NULL };
 
 
-       try
-       {
-               m_axfrqlen = 0;
-               m_qtype = qtype;
-               m_qname = qname;
-               qesc = toLower( m_pldap->escape( qname ) );
+       qesc = toLower( m_pldap->escape( qname ) );
+       stringtok( parts, qesc, "." );
+       len = qesc.length();
 
-               if( mustDo( "disable-ptrrecord" ) )  // PTRRecords will be derived from aRecords or aAAARecords
+        if( parts.size() == 6 && len > 13 && qesc.substr( len - 13, 13 ) == ".in-addr.arpa" )   // IPv4 reverse lookups
+       {
+               filter = "(aRecord=" + ptr2ip4( parts ) + ")";
+               attronly[0] = "associatedDomain";
+               attributes = attronly;
+       }
+       else if( parts.size() == 34 && len > 9 && ( qesc.substr( len - 9, 9 ) == ".ip6.arpa" ) )   // IPv6 reverse lookups
+       {
+               filter = "(aAAARecord=" + ptr2ip6( parts ) + ")";
+               attronly[0] = "associatedDomain";
+               attributes = attronly;
+       }
+       else   // IPv4 and IPv6 lookups
+       {
+               filter = "(associatedDomain=" + qesc + ")";
+               if( qtype.getCode() != QType::ANY )
                {
-                       stringtok( parts, qesc, "." );
-                       len = qesc.length();
-
-                        if( parts.size() == 6 && len > 13 && qesc.substr( len - 13, 13 ) == ".in-addr.arpa" )   // IPv4 reverse lookups
-                       {
-                               filter = "(aRecord=" + ptr2ip4( parts ) + ")";
-                               attronly[0] = "associatedDomain";
-                               attributes = attronly;
-                       }
-                       else if( parts.size() == 34 && len > 9 && ( qesc.substr( len - 9, 9 ) == ".ip6.arpa" ) )   // IPv6 reverse lookups
-                       {
-                               filter = "(aAAARecord=" + ptr2ip6( parts ) + ")";
-                               attronly[0] = "associatedDomain";
-                               attributes = attronly;
-                       }
-                       else   // IPv4 and IPv6 lookups
-                       {
-                               filter = "(associatedDomain=" + qesc + ")";
-                               if( qtype.getCode() != QType::ANY )
-                               {
-                                       attr = qtype.getName() + "Record";
-                                       filter = "(&" + filter + "(" + attr + "=*))";
-                                       attronly[0] = (char*) attr.c_str();
-                                       attributes = attronly;
-                               }
-                       }
+                       attr = qtype.getName() + "Record";
+                       filter = "(&" + filter + "(" + attr + "=*))";
+                       attronly[0] = (char*) attr.c_str();
+                       attributes = attronly;
                }
-               else   // requires additional ldap objects for reverse lookups
+       }
+
+       DLOG( L << Logger::Debug << m_myname << " Search = basedn: " << getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
+       m_msgid = m_pldap->search( getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, (const char**) attributes );
+}
+
+
+
+void LdapBackend::lookup_tree( const QType &qtype, const string &qname, DNSPacket *dnspkt, int zoneid )
+{
+       string filter, attr, qesc, dn;
+       char** attributes = ldap_attrany + 1;   // skip associatedDomain
+       char* attronly[] = { NULL, "dNSTTL", NULL };
+       vector<string>::reverse_iterator i;
+       vector<string> parts;
+
+
+       qesc = toLower( m_pldap->escape( qname ) );
+       filter = "(associatedDomain=" + qesc + ")";
+
+       if( qtype.getCode() != QType::ANY )
+       {
+               attr = qtype.getName() + "Record";
+               filter = "(&" + filter + "(" + attr + "=*))";
+               attronly[0] = (char*) attr.c_str();
+               attributes = attronly;
+       }
+
+       stringtok( parts, qesc, "." );
+       for( i = parts.rbegin(); i != parts.rend(); i++ )
+       {
+               dn = "dc=" + *i + "," + dn;
+       }
+
+       DLOG( L << Logger::Debug << m_myname << " Search = basedn: " << dn + getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
+       m_msgid = m_pldap->search( dn + getArg("basedn"), LDAP_SCOPE_BASE, filter, (const char**) attributes );
+}
+
+
+
+inline bool LdapBackend::prepare()
+{
+       m_adomains.clear();
+       m_ttl = m_default_ttl;
+
+       if( m_result.count( "dNSTTL" ) && !m_result["dNSTTL"].empty() )
+       {
+               char* endptr;
+
+               m_ttl = (u_int32_t) strtol( m_result["dNSTTL"][0].c_str(), &endptr, 10 );
+               if( *endptr != '\0' )
                {
-                       filter = "(associatedDomain=" + qesc + ")";
-                       if( qtype.getCode() != QType::ANY )
-                       {
-                               attr = qtype.getName() + "Record";
-                               filter = "(&" + filter + "(" + attr + "=*))";
-                               attronly[0] = (char*) attr.c_str();
-                               attributes = attronly;
-                       }
+                       L << Logger::Warning << m_myname << " Invalid time to life for " << m_qname << ": " << m_result["dNSTTL"][0] << endl;
+                       m_ttl = m_default_ttl;
                }
+               m_result.erase( "dNSTTL" );
+       }
 
-               DLOG( L << Logger::Debug << backendname << " Search = basedn: " << getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl );
-
-               m_adomain = m_adomains.end();   // skip loops in get() first time
-               m_msgid = m_pldap->search( getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, (const char**) attributes );
+       if( !(this->*m_prepare_fcnt)() )
+       {
+               return false;
        }
-       catch( LDAPTimeout &lt )
+
+       m_adomain = m_adomains.begin();
+       m_attribute = m_result.begin();
+       m_value = m_attribute->second.begin();
+
+       return true;
+}
+
+
+
+inline bool LdapBackend::prepare_simple()
+{
+       if( !m_axfrqlen )   // request was a normal lookup()
        {
-               L << Logger::Warning << backendname << " Unable to search LDAP directory: " << lt.what() << endl;
-               return;
+               m_adomains.push_back( m_qname );
        }
-       catch( LDAPException &le )
+       else   // request was a list() for AXFR
        {
-               L << Logger::Error << backendname << " Unable to search LDAP directory: " << le.what() << endl;
-               throw( AhuException( "LDAP server unreachable" ) );   // try to reconnect to another server
+               if( m_result.count( "associatedDomain" ) )
+               {
+                       vector<string>::iterator i;
+                       for( i = m_result["associatedDomain"].begin(); i != m_result["associatedDomain"].end(); i++ ) {
+                               if( i->substr( i->length() - m_axfrqlen, m_axfrqlen ) == m_qname ) {
+                                       m_adomains.push_back( *i );
+                               }
+                       }
+                       m_result.erase( "associatedDomain" );
+               }
        }
-       catch( exception &e )
+
+       return true;
+}
+
+
+
+inline bool LdapBackend::prepare_strict()
+{
+       if( !m_axfrqlen )   // request was a normal lookup()
        {
-               L << Logger::Error << backendname << " Caught STL exception for qname " << qname << ": " << e.what() << endl;
-               return;
+               m_adomains.push_back( m_qname );
+               if( m_result.count( "associatedDomain" ) )
+               {
+                       m_result["PTRRecord"] = m_result["associatedDomain"];
+                       m_result.erase( "associatedDomain" );
+               }
        }
-       catch( ... )
+       else   // request was a list() for AXFR
        {
-               L << Logger::Critical << backendname << " Caught unknown exception for qname " << qname << endl;
-               return;
+               if( m_result.count( "associatedDomain" ) )
+               {
+                       vector<string>::iterator i;
+                       for( i = m_result["associatedDomain"].begin(); i != m_result["associatedDomain"].end(); i++ ) {
+                               if( i->substr( i->length() - m_axfrqlen, m_axfrqlen ) == m_qname ) {
+                                       m_adomains.push_back( *i );
+                               }
+                       }
+                       m_result.erase( "associatedDomain" );
+               }
        }
+
+       return true;
 }
 
 
+
 bool LdapBackend::get( DNSResourceRecord &rr )
 {
        QType qt;
@@ -224,7 +398,7 @@ bool LdapBackend::get( DNSResourceRecord &rr )
 
                                                        if( first == string::npos )
                                                        {
-                                                               L << Logger::Warning << backendname << " Invalid " << attrname << " without priority for " << m_qname << ": " << content << endl;
+                                                               L << Logger::Warning << m_myname << " Invalid " << attrname << " without priority for " << m_qname << ": " << content << endl;
                                                                m_value++;
                                                                continue;
                                                        }
@@ -232,7 +406,7 @@ bool LdapBackend::get( DNSResourceRecord &rr )
                                                        rr.priority = (u_int16_t) strtoul( (content.substr( 0, first )).c_str(), &endptr, 10 );
                                                        if( *endptr != '\0' )
                                                        {
-                                                               L << Logger::Warning << backendname << " Invalid " << attrname << " without priority for " << m_qname << ": " << content << endl;
+                                                               L << Logger::Warning << m_myname << " Invalid " << attrname << " without priority for " << m_qname << ": " << content << endl;
                                                                m_value++;
                                                                continue;
                                                        }
@@ -243,7 +417,7 @@ bool LdapBackend::get( DNSResourceRecord &rr )
                                                rr.content = content;
                                                m_value++;
 
-                                               DLOG( L << Logger::Debug << backendname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", priority: " << rr.priority << ", ttl: " << rr.ttl << ", content: " << rr.content << endl );
+                                               DLOG( L << Logger::Debug << m_myname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", priority: " << rr.priority << ", ttl: " << rr.ttl << ", content: " << rr.content << endl );
                                                return true;
                                        }
 
@@ -255,71 +429,30 @@ bool LdapBackend::get( DNSResourceRecord &rr )
                                m_value = m_attribute->second.begin();
                        }
                }
-               while( m_pldap->getSearchEntry( m_msgid, m_result, false ) && prepareEntry() );
+               while( m_pldap->getSearchEntry( m_msgid, m_result, m_getdn ) && prepare() );
 
        }
        catch( LDAPTimeout &lt )
        {
-               L << Logger::Warning << backendname << " Search failed: " << lt.what() << endl;
+               L << Logger::Warning << m_myname << " Search failed: " << lt.what() << endl;
+               throw( DBException( "LDAP server timeout" ) );
        }
        catch( LDAPException &le )
        {
-               L << Logger::Error << backendname << " Search failed: " << le.what() << endl;
+               L << Logger::Error << m_myname << " Search failed: " << le.what() << endl;
                throw( AhuException( "LDAP server unreachable" ) );   // try to reconnect to another server
        }
        catch( exception &e )
        {
-               L << Logger::Error << backendname << " Caught STL exception for attribute " << attrname << ": " << e.what() << endl;
-       }
-       catch( ... )
-       {
-               L << Logger::Critical << backendname << " Caught unknown exception for attribute " << attrname << endl;
+               L << Logger::Error << m_myname << " Caught STL exception for attribute " << attrname << ": " << e.what() << endl;
+               throw( DBException( "STL exception" ) );
        }
 
        return false;
 }
 
 
-inline bool LdapBackend::prepareEntry()
-{
-       m_adomains.clear();
-       m_ttl = m_default_ttl;
-
-       if( m_result.count( "dNSTTL" ) && !m_result["dNSTTL"].empty() )
-       {
-               m_ttl = (u_int32_t) strtol( m_result["dNSTTL"][0].c_str(), NULL, 10 );
-               m_result.erase( "dNSTTL" );
-       }
-
-       if( !m_axfrqlen )   // request was a normal lookup()
-       {
-               m_adomains.push_back( m_qname );
-               if( m_result.count( "associatedDomain" ) )
-               {
-                       m_result["PTRRecord"] = m_result["associatedDomain"];
-                       m_result.erase( "associatedDomain" );
-               }
-       }
-       else   // request was a list() for AXFR
-       {
-               if( m_result.count( "associatedDomain" ) )
-               {
-                       vector<string>::iterator i;
-                       for( i = m_result["associatedDomain"].begin(); i != m_result["associatedDomain"].end(); i++ ) {
-                               if( i->substr( i->length() - m_axfrqlen, m_axfrqlen ) == m_qname ) {
-                                       m_adomains.push_back( *i );
-                               }
-                       }
-                       m_result.erase( "associatedDomain" );
-               }
-       }
-
-       m_adomain = m_adomains.begin();
-       m_attribute = m_result.begin();
-       m_value = m_attribute->second.begin();
 
-       return true;
-}
 
 
 class LdapFactory : public BackendFactory
@@ -329,16 +462,16 @@ public:
 
        LdapFactory() : BackendFactory( "ldap" ) {}
 
+
        void declareArguments( const string &suffix="" )
        {
-               declare( suffix, "host", "one or more ldap server","localhost:389" );
-               declare( suffix, "port", "ldap server port (depricated, use ldap-host)","389" );
-               declare( suffix, "starttls", "use TLS to encrypt connection", "no" );
-               declare( suffix, "basedn", "search root in ldap tree (must be set)","" );
-               declare( suffix, "binddn", "user dn for non anonymous binds","" );
-               declare( suffix, "secret", "user password for non anonymous binds", "" );
-               declare( suffix, "disable-ptrrecord", "disable necessity for seperate PTR records", "no" );
-               declare( suffix, "default-ttl", "default ttl if DNSTTL is not set (depricated, use default-ttl)", "3600" );
+               declare( suffix, "host", "One or more ldap server","127.0.0.1:389" );
+               declare( suffix, "starttls", "Use TLS to encrypt connection", "no" );
+               declare( suffix, "basedn", "Search root in ldap tree (must be set)","" );
+               declare( suffix, "binddn", "User dn for non anonymous binds","" );
+               declare( suffix, "secret", "User password for non anonymous binds", "" );
+               declare( suffix, "method", "How to search entries (simple, strict or tree)", "list" );
+               declare( suffix, "disable-ptrrecord", "Depricated, use ldap-method=strict instead", "no" );
        }
 
 
@@ -351,17 +484,19 @@ public:
 
 
 
-class Loader
+
+class LdapLoader
 {
+       LdapFactory factory;
 
 public:
 
-       Loader()
+       LdapLoader()
        {
-               BackendMakers().report( new LdapFactory );
-               L << Logger::Info << backendname << " This is the ldap module version "VERSION" ("__DATE__", "__TIME__") reporting" << endl;
-  }
+               BackendMakers().report( &factory );
+               L << Logger::Info << " [LdapBackend] This is the ldap module version "VERSION" ("__DATE__", "__TIME__") reporting" << endl;
+       }
 };
 
 
-static Loader loader;
+static LdapLoader ldaploader;
index 8ed6e783ae2614004f32ca3eba90ca8ef0ac829e..f4b856aec40f625f3cacf9cb380adc2ae3cd3329 100644 (file)
@@ -1,23 +1,46 @@
+/*
+ *  PowerDNS LDAP Connector
+ *  By PowerDNS.COM BV
+ *  By Norbert Sendetzky <norbert@linuxnetworks.de>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+
 #include <map>
 #include <string>
 #include <vector>
 #include <exception>
 #include <stdexcept>
+#include <errno.h>
 #include <lber.h>
 #include <ldap.h>
 
 
+
 #ifndef POWERLDAP_HH
 #define POWERLDAP_HH
 
+
+
 using std::map;
 using std::string;
 using std::vector;
 
 
-extern int errno;
-
-
 
 class LDAPException : public std::runtime_error
 {
@@ -26,6 +49,7 @@ public:
 };
 
 
+
 class LDAPTimeout : public LDAPException
 {
 public:
@@ -33,6 +57,7 @@ public:
 };
 
 
+
 class PowerLDAP
 {
        LDAP* d_ld;
@@ -59,4 +84,6 @@ public:
        static const string escape( const string& tobe );
 };
 
+
+
 #endif
index d10c064638cc4c7653c3d174d887601e41993f19..5e688526b40ac9abdd774063b54694a87d282111 100644 (file)
--- a/pdns.spec
+++ b/pdns.spec
@@ -1,6 +1,6 @@
 Buildroot: /tmp/pdns
 Name: pdns-static
-Version: 2.9.13
+Version: 2.9.15
 Release: 1
 Summary: extremely powerful and versatile nameserver
 Copyright: see /usr/doc/pdns/copyright
index f431550347b3a0bbbc668498fd78880665684b1d..cd27947dd6b663fc38d5b3fa3dacd67560d1f945 100644 (file)
@@ -45,14 +45,14 @@ pdns_server_INCLUDES=
 #resolver_SOURCES=resolver.cc resolver.hh misc.cc unix_utility.cc qtype.cc \
 #logger.cc statbag.cc dnspacket.cc arguments.cc  tres.cc
 
-INCLUDES=-I/usr/include/mysql
+INCLUDES=-I/usr/include/mysql
 
 pdns_recursor_SOURCES=syncres.cc resolver.hh misc.cc unix_utility.cc qtype.cc \
 logger.cc statbag.cc dnspacket.cc arguments.cc  lwres.cc pdns_recursor.cc lwres.hh \
 mtasker.hh sillyrecords.cc syncres.hh recursor_cache.cc recursor_cache.hh \
 ../modules/gmysqlbackend/smysql.cc 
 
-pdns_recursor_LDFLAGS=-lmysqlclient
+pdns_recursor_LDFLAGS=
 pdns_recursor_LDADD=
 
 pdns_control_SOURCES=dynloader.cc dynmessenger.cc  arguments.cc logger.cc statbag.cc misc.cc unix_utility.cc
index 4ba92f3560f65d04037f9fd856b9757347ba9659..0318ae7c1811c3b6ea4169e8f5699c248e5f9f9a 100644 (file)
@@ -18,7 +18,7 @@
 */
 /* accepts a named.conf as parameter and outputs heaps of sql */
 
-// $Id: zone2sql.cc,v 1.7 2003/11/29 13:14:40 ahu Exp $ 
+// $Id: zone2sql.cc,v 1.8 2004/01/17 13:18:22 ahu Exp $ 
 #ifdef WIN32
 # pragma warning ( disable: 4786 )
 # include <unistd.h>
@@ -74,8 +74,8 @@ static void callback(unsigned int domain_id,const string &domain, const string &
   num_records++;
 
   if(qtype=="SOA") {
-    //    cout<<"Juh: "<<dirty_hack_num<<", "<<lastsoa_domain_id<<", "<<lastsoa_qname<<", "<<domain<<endl;
-    if(dirty_hack_num==lastsoa_domain_id && lastsoa_qname!=domain) {
+    //    cerr<<"Juh: "<<dirty_hack_num<<", "<<lastsoa_domain_id<<", "<<lastsoa_qname<<", "<<domain<<endl;
+    if(dirty_hack_num==lastsoa_domain_id && lastsoa_qname!=ZoneParser::canonic(domain)) {
       dirty_hack_num++;
       cerr<<"Second SOA in zone, raised domain_id"<<endl;
       if(mode==POSTGRES || mode==ORACLE) {
index 53d74d7944e03c8d1eb1a616884b1e39a7a61e19..045ebcb4c7a7a7ffe3642ed2f1aafc4f691ec27c 100644 (file)
@@ -50,8 +50,12 @@ void ZoneParser::setDirectory(const string &dir)
 void ZoneParser::parse(const string &fname, const string &origin, unsigned int domain_id)
 {      
   d_filename=fname.c_str();
-
-  FILE *zonein=fopen(fname.c_str(),"r");
+  
+  FILE *zonein;
+  if(fname!="-")
+    zonein=fopen(fname.c_str(),"r");
+  else
+    zonein=fdopen(STDIN_FILENO,"r");
 
   if(!zonein)
     throw AhuException("Unable to open zonefile '"+fname+"': "+stringerror());
index 6225d8afa368064a799020eb4a0f41b3d05d77af..c82fa92a50ffe615a7ede061e0c118dee65b3a98 100644 (file)
@@ -42,7 +42,7 @@ void declareArguments()
   arg().set("local-port","The port on which we listen")="53";
   arg().setSwitch("log-failed-updates","If PDNS should log failed update requests")="";
   arg().setSwitch("log-dns-details","If PDNS should log DNS non-erroneous details")="";
-  arg().setSwitch("allow-recursion-override","Set this so that local data fully overrides the recursor")="";
+  arg().setSwitch("allow-recursion-override","Set this so that local data fully overrides the recursor")="no";
   arg().set("urlredirector","Where we send hosts to that need to be url redirected")="127.0.0.1";
   arg().set("smtpredirector","Our smtpredir MX host")="a.misconfigured.powerdns.smtp.server";
   arg().set("local-address","Local IP addresses to which we bind")="0.0.0.0";
index b86cb54432ec9a1408fa3913897bc1e304704548..e6e9ccee0df0e0ab2d2ba198f6b6ace2bf1ba3b1 100644 (file)
@@ -11,7 +11,7 @@
       </affiliation>
     </author>
     
-    <PubDate>v2.1 $Date: 2004/01/16 22:18:12 $</PubDate>
+    <PubDate>v2.1 $Date: 2004/01/17 13:18:22 $</PubDate>
     
     <Abstract>
        <para>  
              <para>
                The Generic SQL backend could cause crashes on PostgreSQL when using pdns_control notify (Georg Bauer)
              </para>
+           </listitem>
+           <listitem>
+             <para>
+               Debian compatible init.d script (Wichert Akkerman)
+             </para>
+           </listitem>
            <listitem>
              <para>
                If using the master or slave features, pdns had the notion of eternity ending in 2038, except that due
            </listitem>
            <listitem>
              <para>
-               Parts of the SOA field were not connonicalized
+               Parts of the SOA field were not cannonicalized
              </para>
            </listitem>
            <listitem>
index 8963531e1b176f6cd0f72698f4e061027d6474c6..966639c7dabc964d9504484330ed3ac3464dd605 100644 (file)
@@ -41,25 +41,23 @@ void Logger::log(const string &msg, Urgency u)
     strftime(buffer,sizeof(buffer),"%b %d %H:%M:%S ", &tm);
     clog<<buffer;
     clog <<msg <<endl;
-
-   if( u <= d_loglevel )
-   {
-     extern StatBag S;
-     S.ringAccount("logmessages",msg);
-     syslog(u,"%s",msg.c_str());
-   }
   }
+  if( u <= d_loglevel ) {
+    extern StatBag S;
+    S.ringAccount("logmessages",msg);
+    syslog(u,"%s",msg.c_str());
+  }
+
 }
 
 void Logger::setLoglevel( Urgency u )
 {
-       d_loglevel = u;
+  d_loglevel = u;
 }
   
 
 void Logger::toConsole(Urgency u)
 {
-
   consoleUrgency=u;
 }
 
index 5ad97bea553c5444cac80127960ac4b7cc1d1583..88363ab7c93c605075ff71a83c7d99f7d010e376 100644 (file)
@@ -154,7 +154,7 @@ int PacketHandler::doDNSCheckRequest(DNSPacket *p, DNSPacket *r, string &target)
   DNSResourceRecord rr;
 
   if (p->qclass == 3 && p->qtype.getName() == "HINFO") {
-    rr.content = "PowerDNS $Id: packethandler.cc,v 1.21 2004/01/16 22:18:12 ahu Exp $";
+    rr.content = "PowerDNS $Id: packethandler.cc,v 1.22 2004/01/17 13:18:22 ahu Exp $";
     rr.ttl = 5;
     rr.qname=target;
     rr.qtype=13; // hinfo
@@ -170,7 +170,7 @@ int PacketHandler::doVersionRequest(DNSPacket *p, DNSPacket *r, string &target)
 {
   DNSResourceRecord rr;
   if(p->qtype.getCode()==QType::TXT && target=="version.bind") {// TXT
-    rr.content="Served by POWERDNS "VERSION" $Id: packethandler.cc,v 1.21 2004/01/16 22:18:12 ahu Exp $";
+    rr.content="Served by POWERDNS "VERSION" $Id: packethandler.cc,v 1.22 2004/01/17 13:18:22 ahu Exp $";
     rr.ttl=5;
     rr.qname=target;
     rr.qtype=QType::TXT; // TXT
@@ -647,6 +647,7 @@ DNSPacket *PacketHandler::question(DNSPacket *p)
     bool weAuth;
     int zoneId;
     zoneId=-1;
+    
     if(p->d.rd && d_doRecursion && arg().mustDo("allow-recursion-override"))
       weAuth=getAuth(p, &sd, target, &zoneId);
     else