Changeset 180

Show
Ignore:
Timestamp:
08/22/03 15:33:31 (10 years ago)
Author:
ahu
Message:

lots of fixes, axfp ldap support, ldap ttl support, spurious debugging
output removed

Location:
trunk/pdns
Files:
31 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/ChangeLog

    r178 r180  
    11changes since 2.9.10: 
    22        - pdns_recursor now cleans its cache 
     3        - pdns_recursor writes its pid to disk now (FreeBSD port maintainer) 
    34        - disable-axfr check was reversed (oops) 
    4         - LDAP now has infrastructure for AXFR (Norbert Sendetzky) 
     5        - LDAP now supports AXFR and a default TTL 
     6        - some debugging output messed up the working of pdns_control (Mark Bergsma) 
     7        - updates to axfr --help output (Norbert Sendetzky) 
    58         
    69Changes since 2.9.8: 
  • trunk/pdns/debian/changelog

    r178 r180  
    11pdns (2.9.11-1) unstable; urgency=low 
    22 
    3   * fill in the blanks 
     3  * New upstream release 
     4  * Do not include zone2ldap in pdns package. Closes: Bug#198613 
     5  * The gdbm-dev seems to have changed its name, update Build-Depends 
     6    accordingly. Closes: Bug#199595 
    47 
    5  -- Wichert Akkerman <wakkerma@debian.org>  Sat, 5 Jul 2003 20:16:16 +0100 
    6  
    7 pdns (2.9.10-1) unstable; urgency=low 
    8  
    9   * fill in the blanks 
    10  
    11  -- Wichert Akkerman <wakkerma@debian.org>  Thu, 3 Jul 2003 20:16:16 +0100 
    12  
    13 pdns (2.9.9-1) unstable; urgency=low 
    14  
    15   * fill in the blanks 
    16  
    17  -- Wichert Akkerman <wakkerma@debian.org>  Thu, 27 May 2003 20:16:16 +0100 
    18  
     8 -- Wichert Akkerman <wakkerma@debian.org>  Mon, 14 Jul 2003 13:52:47 +0200 
    199 
    2010pdns (2.9.8-1) unstable; urgency=low 
    2111 
    22   * fill in the blanks 
     12  * New upstream release. Closes: Bug#187781 
    2313 
    24  -- Wichert Akkerman <wakkerma@debian.org>  Thu, 30 Apr 2003 20:16:16 +0100 
     14 -- Wichert Akkerman <wakkerma@debian.org>  Mon,  5 May 2003 13:43:16 +0200 
    2515 
    2616pdns (2.9.7-1) unstable; urgency=low 
    2717 
    28   * fill in the blanks 
     18  * New upstream release. Closes: Bug#185730 
    2919 
    30  -- Wichert Akkerman <wakkerma@debian.org>  Thu, 14 Mar 2003 20:16:16 +0100 
     20 -- Wichert Akkerman <wakkerma@debian.org>  Fri, 21 Mar 2003 12:53:00 +0100 
     21 
     22pdns (2.9.6-2) unstable; urgency=low 
     23 
     24  * Enable the recursing nameserver 
     25  * Change order of things in clean target so debian/files is properly 
     26    removed. Closes: Bug#181994 
     27 
     28 -- Wichert Akkerman <wakkerma@debian.org>  Sun, 23 Feb 2003 12:34:57 +0100 
    3129 
    3230pdns (2.9.6-1) unstable; urgency=low 
    3331 
    34   * fill in the blanks 
     32  * New upstream release, adding a new LDAP backend 
    3533 
    36  -- Wichert Akkerman <wakkerma@debian.org>  Fri, 14 Feb 2003 20:16:16 +0100 
     34 -- Wichert Akkerman <wakkerma@debian.org>  Sun, 16 Feb 2003 14:49:08 +0100 
     35 
    3736 
    3837pdns (2.9.5-1) unstable; urgency=low 
     
    8988 
    9089 -- Wichert Akkerman <wakkerma@debian.org>  Sun,  1 Dec 2002 15:04:52 +0100 
     90 
  • trunk/pdns/debian/control

    r153 r180  
    44Standards-Version: 3.5.8 
    55Maintainer: Wichert Akkerman <wakkerma@debian.org> 
    6 Build-Depends: automake1.5, autoconf, libtool, flex, bison, docbook-utils, libmysqlclient10-dev, postgresql-dev, tdb-dev, libgdbmg1-dev, libpqpp-dev, libldap2-dev 
     6Build-Depends: automake1.5, autoconf, libtool, flex, bison, docbook-utils, libmysqlclient10-dev, postgresql-dev, tdb-dev, libgdbm-dev, libpqpp-dev, libldap2-dev 
    77 
    88Package: pdns 
  • trunk/pdns/debian/rules

    r175 r180  
    8484        rm -f "$(tmpdir)"/usr/bin/binpatch 
    8585        rm -f "$(tmpdir)"/usr/bin/xdb-fill 
     86        rm -f "$(tmpdir)"/usr/bin/zone2ldap 
    8687        rm -rf "$(tmpdir)"/usr/lib 
    8788 
  • trunk/pdns/modules/ldapbackend/ldapbackend.cc

    r176 r180  
    3636        setArgPrefix( "ldap" + suffix ); 
    3737 
    38         L << Logger::Notice << backendname << " LDAP Server = " << getArg( "host" ) << ":" << getArg( "port" ) << endl; 
     38 
     39        m_default_ttl = (u_int32_t) strtol( getArg( "default-ttl" ).c_str(), NULL, 10 ); 
    3940 
    4041        try 
    4142        { 
     43                L << Logger::Info << backendname << " LDAP Server = " << getArg( "host" ) << ":" << getArg( "port" ) << endl; 
    4244                m_pldap = new PowerLDAP( getArg( "host" ), (u_int16_t) atoi( getArg( "port" ).c_str() ) ); 
    4345                m_pldap->simpleBind( getArg( "binddn" ), getArg( "secret" ) ); 
     
    5052        } 
    5153 
    52         L << Logger::Notice << backendname << " Ldap connection succeeded" << endl; 
     54        L << Logger::Info << backendname << " Ldap connection succeeded" << endl; 
    5355} 
    5456 
     
    6163 
    6264 
    63 bool LdapBackend::list( int domain_id ) 
    64 { 
    65         L << Logger::Warning << backendname << " AXFR is not supported" << endl; 
    66         return false; 
     65bool LdapBackend::list( const string &target, int domain_id ) 
     66{ 
     67        string filter, dn; 
     68        char* attributes[] = { "associatedDomain", NULL }; 
     69 
     70 
     71        try 
     72        { 
     73                L << Logger::Notice << backendname << " AXFR request for " << target << endl; 
     74 
     75                // search for DN of SOA record which is SOA for target zone 
     76 
     77                filter = "(&(associatedDomain=" + target + ")(SOARecord=*))"; 
     78                m_msgid = m_pldap->search( getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, (const char**) attributes ); 
     79 
     80                if( m_pldap->getSearchEntry( m_msgid, m_result, true ) == false ) 
     81                { 
     82                        L << Logger::Error << backendname << " Unable to get SOA record for " << target << endl; 
     83                        return false; 
     84                } 
     85 
     86                if( m_result.empty() ) 
     87                { 
     88                        L << Logger::Error << backendname << " No SOA record for " << target << endl; 
     89                        return false; 
     90                } 
     91 
     92                if( m_result.find( "dn" ) == m_result.end() ) 
     93                { 
     94                        L << Logger::Error << backendname << " LDAP error while searching SOA record for " << target << endl; 
     95                        return false; 
     96                } 
     97 
     98                if( m_result["dn"].empty() ) 
     99                { 
     100                        L << Logger::Error << backendname << " LDAP error while getting SOA record for " << target << endl; 
     101                        return false; 
     102                } 
     103 
     104                dn = m_result["dn"].front(); 
     105                m_result.clear(); 
     106 
     107                // list all records one level below but not entries containing SOA records (these are seperate zones) 
     108 
     109                m_qname = ""; 
     110                m_adomain = m_adomains.end();   // skip loops in get() first time 
     111                filter = "(&(associatedDomain=*)(!(SOARecord=*)))"; 
     112                m_msgid = m_pldap->search( dn, LDAP_SCOPE_ONELEVEL, filter, (const char**) attrany ); 
     113        } 
     114        catch( LDAPException &le ) 
     115        { 
     116                L << Logger::Error << backendname << " Unable to get zone " + target + " from LDAP directory: " << le.what() << endl; 
     117                return false; 
     118        } 
     119        catch( exception &e ) 
     120        { 
     121                L << Logger::Error << backendname << " Caught STL exception: " << e.what() << endl; 
     122                return false; 
     123        } 
     124        catch( ... ) 
     125        { 
     126                L << Logger::Critical << backendname << " Caught unknown exception" << endl; 
     127                return false; 
     128        } 
     129 
     130        return true; 
    67131} 
    68132 
     
    73137        vector<string> parts; 
    74138        string filter, attr, qesc; 
    75         char** attributes = attrany; 
     139        char** attributes = attrany + 1;   // skip associatedDomain 
    76140        char* attronly[] = { NULL, "dNSTTL", NULL }; 
    77141 
     
    88152                        stringtok( parts, qesc, "." ); 
    89153 
    90                         if( len > 9 && ( qesc.substr( len - 9, 9 ) == ".ip6.arpa" || qesc.substr( len - 8, 8 ) == ".ip6.int" ) )   // IPv6 reverse lookups 
     154                         if( len > 13 && qesc.substr( len - 13, 13 ) == ".in-addr.arpa" )   // IPv4 reverse lookups 
     155                        { 
     156                                parts.pop_back(); 
     157                                parts.pop_back(); 
     158 
     159                                filter = "(aRecord=" + parts.back(); 
     160                                parts.pop_back(); 
     161                                while( !parts.empty() ) 
     162                                { 
     163                                        filter += "." + parts.back(); 
     164                                        parts.pop_back(); 
     165                                } 
     166                                filter += ")"; 
     167 
     168                                attronly[0] = "associatedDomain"; 
     169                                attributes = attronly; 
     170                        } 
     171                        else if( len > 9 && ( qesc.substr( len - 8, 8 ) == ".ip6.int" || qesc.substr( len - 9, 9 ) == ".ip6.arpa" ) )   // IPv6 reverse lookups 
    91172                        { 
    92173                                parts.pop_back(); 
     
    98179                                { 
    99180                                        filter += ":" + parts.back(); 
    100                                         parts.pop_back(); 
    101                                 } 
    102                                 filter += ")"; 
    103  
    104                                 attronly[0] = "associatedDomain"; 
    105                                 attributes = attronly; 
    106                         } 
    107                         else if( len > 13 && qesc.substr( len - 13, 13 ) == ".in-addr.arpa" )   // IPv4 reverse lookups 
    108                         { 
    109                                 parts.pop_back(); 
    110                                 parts.pop_back(); 
    111  
    112                                 filter = "(aRecord=" + parts.back(); 
    113                                 parts.pop_back(); 
    114                                 while( !parts.empty() ) 
    115                                 { 
    116                                         filter += "." + parts.back(); 
    117181                                        parts.pop_back(); 
    118182                                } 
     
    146210                } 
    147211 
     212                m_adomain = m_adomains.end();   // skip loops in get() first time 
    148213                L << Logger::Info << backendname << " Search = basedn: " << getArg( "basedn" ) << ", filter: " << filter << ", qtype: " << qtype.getName() << endl; 
    149214                m_msgid = m_pldap->search( getArg("basedn"), LDAP_SCOPE_SUBTREE, filter, (const char**) attributes ); 
    150215        } 
    151         catch( LDAPException &e ) 
    152         { 
    153                 L << Logger::Warning << backendname << " Unable to search LDAP directory: " << e.what() << endl; 
     216        catch( LDAPException &le ) 
     217        { 
     218                L << Logger::Warning << backendname << " Unable to search LDAP directory: " << le.what() << endl; 
     219                return; 
     220        } 
     221        catch( exception &e ) 
     222        { 
     223                L << Logger::Error << backendname << " Caught STL exception: " << e.what() << endl; 
    154224                return; 
    155225        } 
     
    166236        QType qt; 
    167237        vector<string> parts; 
    168         vector<string> values; 
    169238        string attrname, content, qstr; 
    170         PowerLDAP::sentry_t::iterator attribute; 
    171239 
    172240 
    173241        try 
    174242        { 
    175  
    176 Redo: 
    177  
    178                 while( !m_result.empty() ) 
    179                 { 
    180                         attribute = m_result.begin(); 
    181                         if( attribute != m_result.end() && !attribute->second.empty() ) 
    182                         { 
    183                                 attrname = attribute->first; 
    184                                 qstr = attrname.substr( 0, attrname.length() - 6 );   // extract qtype string from ldap attribute name 
    185                                 transform( qstr.begin(), qstr.end(), qstr.begin(), &Toupper ); 
    186                                 qt = QType( const_cast<char*>(qstr.c_str()) ); 
    187  
    188                                 if( m_qtype.getCode() == QType::ANY ||  m_qtype.getCode() == qt.getCode() ) 
     243                do 
     244                { 
     245                        do 
     246                        { 
     247                                while( m_adomain != m_adomains.end() ) 
    189248                                { 
    190                                         content = attribute->second.back(); 
    191                                         attribute->second.pop_back(); 
    192  
    193                                         rr.qtype = qt; 
    194                                         rr.qname = m_qname; 
    195                                         rr.priority = 0; 
    196                                         rr.ttl = m_ttl; 
    197  
    198                                         if( qt.getCode() == QType::MX )   // MX Record, e.g. 10 smtp.example.com 
     249                                        while( m_attribute != m_result.end() ) 
    199250                                        { 
    200                                                 parts.clear(); 
    201                                                 stringtok( parts, content, " " ); 
    202  
    203                                                 if( parts.size() != 2) 
     251                                                attrname = m_attribute->first; 
     252                                                qstr = attrname.substr( 0, attrname.length() - 6 );   // extract qtype string from ldap attribute name 
     253                                                transform( qstr.begin(), qstr.end(), qstr.begin(), &Toupper ); 
     254                                                qt = QType( const_cast<char*>(qstr.c_str()) ); 
     255 
     256                                                while( m_value != m_attribute->second.end() ) 
    204257                                                { 
    205                                                         L << Logger::Warning << backendname << " Invalid MX record without priority: " << content << endl; 
    206                                                         goto Redo; 
     258                                                        content = *m_value; 
     259 
     260                                                        rr.qtype = qt; 
     261                                                        rr.qname = *m_adomain; 
     262                                                        rr.priority = 0; 
     263                                                        rr.ttl = m_ttl; 
     264 
     265                                                        if( qt.getCode() == QType::MX )   // MX Record, e.g. 10 smtp.example.com 
     266                                                        { 
     267                                                                parts.clear(); 
     268                                                                stringtok( parts, content, " " ); 
     269 
     270                                                                if( parts.size() != 2) 
     271                                                                { 
     272                                                                        L << Logger::Warning << backendname << " Invalid MX record without priority: " << content << endl; 
     273                                                                        continue; 
     274                                                                } 
     275 
     276                                                                rr.priority = (u_int16_t) strtol( parts[0].c_str(), NULL, 10 ); 
     277                                                                content = parts[1]; 
     278                                                        } 
     279 
     280                                                        rr.content = content; 
     281                                                        m_value++; 
     282 
     283                                                        L << Logger::Info << backendname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", priority: " << rr.priority << ", content: " << rr.content << endl; 
     284                                                        return true; 
    207285                                                } 
    208286 
    209                                                 rr.priority = (u_int16_t) strtol( parts[0].c_str(), NULL, 10 ); 
    210                                                 content = parts[1]; 
     287                                                m_attribute++; 
     288                                                m_value = m_attribute->second.begin(); 
    211289                                        } 
    212                                         rr.content = content; 
    213  
    214                                         L << Logger::Info << backendname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", priority: " << rr.priority << ", content: " << rr.content << endl; 
    215                                         return true; 
     290                                        m_adomain++; 
     291                                        m_attribute = m_result.begin(); 
     292                                        m_value = m_attribute->second.begin(); 
    216293                                } 
    217294                        } 
    218                         m_result.erase( attribute ); 
    219                 } 
    220  
    221                 if( m_pldap->getSearchEntry( m_msgid, m_result ) == true ) 
    222                 { 
    223                                 if( m_result.find( "dNSTTL" ) != m_result.end() && m_result["dNSTTL"].size() > 0 ) 
    224                                 { 
    225                                         m_ttl = (u_int32_t) strtol( m_result["dNSTTL"][0].c_str(), NULL, 10 ); 
    226                                         m_result.erase( "dNSTTL" ); 
    227                                 } 
    228                                 else 
    229                                 { 
    230                                         m_ttl = (u_int32_t) strtol( getArg( "default-ttl" ).c_str(), NULL, 10 ); 
    231                                 } 
    232  
    233                                 if( m_result.find( "associatedDomain" ) != m_result.end() ) 
    234                                 { 
    235                                         m_result["PTRRecord"] = m_result["associatedDomain"]; 
    236                                         m_result.erase( "associatedDomain" ); 
    237                                 } 
    238  
    239                                 goto Redo; 
    240                 } 
    241         } 
    242         catch( LDAPException &e ) 
    243         { 
    244                 L << Logger::Warning << backendname << " Search failed: " << e.what() << endl; 
     295                        while( !m_adomains.empty() && m_qname.empty() && mustDo( "disable-ptrrecord" ) && makePtrRecords() );   // make PTR records from associatedDomain entries 
     296 
     297                        m_result.clear(); 
     298                } 
     299                while( m_pldap->getSearchEntry( m_msgid, m_result, false ) && prepSearchEntry() ); 
     300 
     301        } 
     302        catch( LDAPException &le ) 
     303        { 
     304                L << Logger::Warning << backendname << " Search failed: " << le.what() << endl; 
     305        } 
     306        catch( exception &e ) 
     307        { 
     308                L << Logger::Error << backendname << " Caught STL exception: " << e.what() << endl; 
    245309        } 
    246310        catch( ... ) 
     
    250314 
    251315        return false; 
     316} 
     317 
     318 
     319inline bool LdapBackend::prepSearchEntry() 
     320{ 
     321        m_adomains.clear(); 
     322        m_ttl = m_default_ttl; 
     323 
     324        if( m_result.find( "dNSTTL" ) != m_result.end() && !m_result["dNSTTL"].empty() ) 
     325        { 
     326                m_ttl = (u_int32_t) strtol( m_result["dNSTTL"][0].c_str(), NULL, 10 ); 
     327                m_result.erase( "dNSTTL" ); 
     328        } 
     329 
     330        if( !m_qname.empty() )   // request was a normal lookup() 
     331        { 
     332                m_adomains.push_back( m_qname ); 
     333                if( m_result.find( "associatedDomain" ) != m_result.end() ) 
     334                { 
     335                        m_result["PTRRecord"] = m_result["associatedDomain"]; 
     336                        m_result.erase( "associatedDomain" ); 
     337                } 
     338        } 
     339        else   // request was a list() for AXFR 
     340        { 
     341                if( m_result.find( "associatedDomain" ) != m_result.end() ) 
     342                { 
     343                        m_adomains = m_result["associatedDomain"]; 
     344                        m_result.erase( "associatedDomain" ); 
     345                } 
     346        } 
     347 
     348        m_adomain = m_adomains.begin(); 
     349        m_attribute = m_result.begin(); 
     350        m_value = m_attribute->second.begin(); 
     351 
     352        return true; 
     353} 
     354 
     355 
     356inline bool LdapBackend::makePtrRecords() 
     357{ 
     358        unsigned int i = 0; 
     359        string ptrsrc; 
     360        vector<string> parts, tmp; 
     361        vector<string>::iterator record; 
     362        char* attr[] = { "aRecord", "aAAARecord", NULL }; 
     363        char* suffix[] = { ".in-addr.arpa", ".ip6.int", NULL }; 
     364        char* seperator[] = { ".", ":", NULL }; 
     365 
     366 
     367        tmp = m_adomains; 
     368        m_adomains.clear(); 
     369 
     370        while( attr[i] != NULL && m_result.find( attr[i] ) != m_result.end() ) 
     371        { 
     372                for( record = m_result[attr[i]].begin(); record != m_result[attr[i]].end(); record++ ) 
     373                { 
     374                        parts.clear(); 
     375                        stringtok( parts, *record, seperator[i] ); 
     376 
     377                        ptrsrc = parts.back(); 
     378                        parts.pop_back(); 
     379                        while( !parts.empty() ) 
     380                        { 
     381                                ptrsrc += "." + parts.back(); 
     382                                parts.pop_back(); 
     383                        } 
     384                        ptrsrc += suffix[i]; 
     385 
     386                        m_adomains.push_back( ptrsrc ); 
     387                } 
     388 
     389                i++; 
     390        } 
     391 
     392        if( m_adomains.empty() ) 
     393        { 
     394                return false; 
     395        } 
     396 
     397        m_result.clear(); 
     398        m_result["PTRRecord"] = tmp; 
     399        m_adomain = m_adomains.begin(); 
     400        m_attribute = m_result.begin(); 
     401        m_value = m_attribute->second.begin(); 
     402 
     403        return true; 
    252404} 
    253405 
  • trunk/pdns/modules/ldapbackend/ldapbackend.hh

    r175 r180  
    4949 
    5050static char* attrany[] = { 
     51        "associatedDomain", 
    5152        "dNSTTL", 
    5253        "aRecord", 
     
    7374        int m_msgid; 
    7475        u_int32_t m_ttl; 
     76        u_int32_t m_default_ttl; 
    7577        QType m_qtype; 
    7678        string m_qname; 
    7779        PowerLDAP* m_pldap; 
    7880        PowerLDAP::sentry_t m_result; 
     81        PowerLDAP::sentry_t::iterator m_attribute; 
     82        vector<string>::iterator m_value, m_adomain; 
     83        vector<string> m_adomains; 
     84 
     85        bool prepSearchEntry(); 
     86        bool makePtrRecords(); 
    7987 
    8088public: 
     
    8492 
    8593        void lookup( const QType &qtype, const string &qdomain, DNSPacket *p=0, int zoneid=-1 ); 
    86         bool list( int domain_id ); 
     94        bool list( const string &target, int domain_id ); 
    8795        bool get( DNSResourceRecord &rr ); 
    8896}; 
  • trunk/pdns/modules/mysqlbackend/mysqlcbackend.cc

    r118 r180  
    1 // $Id: mysqlcbackend.cc,v 1.3 2003/01/06 16:13:59 ahu Exp $  
     1// $Id: mysqlcbackend.cc,v 1.4 2003/08/22 13:33:31 ahu Exp $  
    22#include <string> 
    33#include <map> 
     
    104104} 
    105105 
    106 bool MySQLBackend::list(int domain_id ) 
     106bool MySQLBackend::list(const string &target, int domain_id ) 
    107107{ 
    108108  DLOG(L<<backendName<<" MySQLBackend constructing handle for list of domain id '"<<domain_id<<"'"<<endl); 
  • trunk/pdns/modules/mysqlbackend/mysqlcbackend.hh

    r18 r180  
    2323   
    2424  void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1); 
    25   bool list(int domain_id); 
     25  bool list(const string &target, int domain_id); 
    2626  bool get(DNSResourceRecord &r); 
    2727     
  • trunk/pdns/modules/oraclebackend/oraclebackend.cc

    r10 r180  
    1 // $Id: oraclebackend.cc,v 1.1 2002/11/27 15:35:52 ahu Exp $ 
     1// $Id: oraclebackend.cc,v 1.2 2003/08/22 13:33:31 ahu Exp $ 
    22 
    33#include <string> 
     
    376376} 
    377377 
    378 bool OracleBackend::list(int domain_id) 
     378bool OracleBackend::list(const string &target, int domain_id) 
    379379{ 
    380380   mQueryId = domain_id; 
  • trunk/pdns/modules/oraclebackend/oraclebackend.hh

    r10 r180  
    1 // $Id: oraclebackend.hh,v 1.1 2002/11/27 15:35:52 ahu Exp $ 
     1// $Id: oraclebackend.hh,v 1.2 2003/08/22 13:33:31 ahu Exp $ 
    22 
    33#include <string> 
     
    7373       
    7474      void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1); 
    75       bool list(int domain_id); 
     75      bool list(const string &target, int domain_id); 
    7676      bool get(DNSResourceRecord &r); 
    7777       
  • trunk/pdns/modules/pdnsbackend/pdnsbackend.cc

    r160 r180  
    1 // $Id: pdnsbackend.cc,v 1.5 2003/03/13 12:45:30 ahu Exp $  
     1// $Id: pdnsbackend.cc,v 1.6 2003/08/22 13:33:31 ahu Exp $  
    22 
    33#include <string> 
     
    129129} 
    130130 
    131 bool PdnsBackend::list(int inZoneId) 
     131bool PdnsBackend::list(const string &target, int inZoneId) 
    132132{ 
    133133   //cout << "PdnsBackend::list" << endl; 
  • trunk/pdns/modules/pdnsbackend/pdnsbackend.hh

    r160 r180  
    1 // $Id: pdnsbackend.hh,v 1.4 2003/03/13 12:45:30 ahu Exp $ 
     1// $Id: pdnsbackend.hh,v 1.5 2003/08/22 13:33:31 ahu Exp $ 
    22 
    33#ifndef PDNSBACKEND_HH 
     
    1919 
    2020      void lookup(const QType &, const string &qdomain, DNSPacket *p = 0, int zoneId = -1); 
    21       bool list(int inZoneId); 
     21      bool list(const string &target, int inZoneId); 
    2222      bool get(DNSResourceRecord& outRecord); 
    2323      bool getSOA(const string &name, SOAData &soadata); 
  • trunk/pdns/modules/pipebackend/pipebackend.cc

    r77 r180  
    11// -*- sateh-c -*-  
    22// File    : pdnsbackend.cc 
    3 // Version : $Id: pipebackend.cc,v 1.4 2002/12/16 13:04:27 ahu Exp $  
     3// Version : $Id: pipebackend.cc,v 1.5 2003/08/22 13:33:31 ahu Exp $  
    44// 
    55 
     
    119119} 
    120120 
    121 bool PipeBackend::list(int inZoneId) 
     121bool PipeBackend::list(const string &target, int inZoneId) 
    122122{ 
    123123   try { 
  • trunk/pdns/modules/pipebackend/pipebackend.hh

    r8 r180  
    11// 
    22// File    : pdnsbackend.hh 
    3 // Version : $Id: pipebackend.hh,v 1.1 2002/11/27 15:31:59 ahu Exp $ 
     3// Version : $Id: pipebackend.hh,v 1.2 2003/08/22 13:33:31 ahu Exp $ 
    44// 
    55 
     
    6060  ~PipeBackend(); 
    6161  void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1); 
    62   bool list(int domain_id); 
     62  bool list(const string &target, int domain_id); 
    6363  bool get(DNSResourceRecord &r); 
    6464   
  • trunk/pdns/modules/xdbbackend/xdbbackend.cc

    r13 r180  
    3131  } 
    3232 
    33   bool list(int id) { 
     33  bool list(const string &target, int id) { 
    3434    return false; // we don't support AXFR (go away) 
    3535  } 
  • trunk/pdns/pdns/backends/bind/bindbackend.cc

    r148 r180  
    1616    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717*/ 
    18 // $Id: bindbackend.cc,v 1.15 2003/02/10 11:09:09 ahu Exp $  
     18// $Id: bindbackend.cc,v 1.16 2003/08/22 13:33:31 ahu Exp $  
    1919#include <errno.h> 
    2020#include <string> 
     
    757757} 
    758758 
    759 bool BindBackend::list(int id) 
     759bool BindBackend::list(const string &target, int id) 
    760760{ 
    761761  if(!d_zone_id_map.count(id)) 
  • trunk/pdns/pdns/backends/bind/bindbackend.hh

    r146 r180  
    178178 
    179179  void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1); 
    180   bool list(int id); 
     180  bool list(const string &target, int id); 
    181181  bool get(DNSResourceRecord &); 
    182182 
  • trunk/pdns/pdns/backends/bind/bindbackend2.cc

    r164 r180  
    1616    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717*/ 
    18 // $Id: bindbackend2.cc,v 1.3 2003/03/20 13:29:29 ahu Exp $  
     18// $Id: bindbackend2.cc,v 1.4 2003/08/22 13:33:31 ahu Exp $  
    1919#include <errno.h> 
    2020#include <string> 
     
    727727} 
    728728 
    729 bool Bind2Backend::list(int id) 
    730 { 
    731   cout<<"List of id "<<id<<" requested"<<endl; 
     729bool Bind2Backend::list(const string &target, int id) 
     730{ 
     731  // cout<<"List of id "<<id<<" requested"<<endl; 
    732732  if(!s_id_zone_map.count(id)) 
    733733    return false; 
  • trunk/pdns/pdns/backends/bind/bindbackend2.hh

    r158 r180  
    179179 
    180180  void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1); 
    181   bool list(int id); 
     181  bool list(const string &target, int id); 
    182182  bool get(DNSResourceRecord &); 
    183183 
  • trunk/pdns/pdns/backends/gsql/gsqlbackend.cc

    r174 r180  
    1 // $Id: gsqlbackend.cc,v 1.8 2003/06/21 09:59:08 ahu Exp $  
     1// $Id: gsqlbackend.cc,v 1.9 2003/08/22 13:33:31 ahu Exp $  
    22#include <string> 
    33#include <map> 
     
    134134    sd.id=atol(d_result[n][0].c_str()); 
    135135    sd.zone=d_result[n][1]; 
    136     cout<<"master='"<<d_result[n][2]<<"'"<<endl; 
    137136    sd.master=d_result[n][2]; 
    138137    sd.last_check=atol(d_result[n][3].c_str()); 
     
    301300  d_count=0; 
    302301} 
    303 bool GSQLBackend::list(int domain_id ) 
     302bool GSQLBackend::list(const string &target, int domain_id ) 
    304303{ 
    305304  DLOG(L<<"GSQLBackend constructing handle for list of domain id'"<<domain_id<<"'"<<endl); 
  • trunk/pdns/pdns/backends/gsql/gsqlbackend.hh

    r108 r180  
    2424  string sqlEscape(const string &name); 
    2525  void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1); 
    26   bool list(int domain_id); 
     26  bool list(const string &target, int domain_id); 
    2727  bool get(DNSResourceRecord &r); 
    2828  bool isMaster(const string &domain, const string &ip); 
  • trunk/pdns/pdns/common_startup.cc

    r159 r180  
    7676  arg().set("launch","Which backends to launch and order to query them in")=""; 
    7777  arg().setSwitch("disable-axfr","Disable zonetransfers but do allow TCP queries")="no"; 
    78   arg().set("allow-axfr-ips","If disabled, DO allow zonetransfers from these IP addresses")=""; 
     78  arg().set("allow-axfr-ips","Allow zonetransfers only from these IP addresses")=""; 
    7979  arg().set("slave-cycle-interval","Reschedule failed SOA serial checks once every .. seconds")="60"; 
    8080   
  • trunk/pdns/pdns/dnsbackend.cc

    r128 r180  
    240240    time_t newest=0; 
    241241 
    242     if(!(this->list(sd.domain_id)))  
     242    if(!(this->list(domain, sd.domain_id)))  
    243243      throw AhuException("Backend error trying to determine magic serial number of zone '"+domain+"'"); 
    244244   
  • trunk/pdns/pdns/dnsbackend.hh

    r104 r180  
    1717    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818*/ 
    19 // $Id: dnsbackend.hh,v 1.5 2002/12/30 21:00:56 ahu Exp $ 
     19// $Id: dnsbackend.hh,v 1.6 2003/08/22 13:33:31 ahu Exp $ 
    2020/* (C) 2002 POWERDNS.COM BV  */ 
    2121    
     
    8181      \param domain_id ID of which a list is requested 
    8282  */ 
    83   virtual bool list(int domain_id)=0;   
     83  virtual bool list(const string &target, int domain_id)=0;   
    8484 
    8585  virtual ~DNSBackend(){}; 
  • trunk/pdns/pdns/packethandler.hh

    r159 r180  
    3131 
    3232using namespace std; 
     33 
     34// silly Solaris people define PC 
     35#undef PC 
    3336 
    3437/** Central DNS logic according to RFC1034. Ask this class a question in the form of a DNSPacket 
  • trunk/pdns/pdns/pdns_recursor.cc

    r178 r180  
    3636#include "arguments.hh" 
    3737#include "syncres.hh" 
     38#include <fcntl.h> 
     39#include <fstream> 
     40 
     41string s_programname="pdns_recursor"; 
    3842 
    3943#ifndef WIN32 
     
    161165 
    162166 
     167static void writePid(void) 
     168{ 
     169  string fname=arg()["socket-dir"]+"/"+s_programname+".pid"; 
     170  ofstream of(fname.c_str()); 
     171  if(of) 
     172    of<<getpid()<<endl; 
     173  else 
     174    L<<Logger::Error<<"Requested to write pid for "<<getpid()<<" to "<<fname<<"failed: "<<strerror(errno)<<endl; 
     175} 
     176 
    163177void init(void) 
    164178{ 
     
    432446    arg().set("quiet","Suppress logging of questions and answers")="off"; 
    433447    arg().set("config-dir","Location of configuration directory (recursor.conf)")=SYSCONFDIR; 
     448    arg().set("socket-dir","Where the controlsocket will live")=LOCALSTATEDIR; 
    434449    arg().setCmd("help","Provide a helpful message"); 
    435450    L.toConsole(Logger::Warning); 
     
    471486    } 
    472487    signal(SIGUSR1,usr1Handler); 
     488 
     489    writePid(); 
    473490#endif 
    474491 
  • trunk/pdns/pdns/randombackend.cc

    r2 r180  
    3535  } 
    3636 
    37   bool list(int id) { 
     37  bool list(const string &target, int id) { 
    3838    return false; // we don't support AXFR 
    3939  } 
  • trunk/pdns/pdns/receiver.cc

    r157 r180  
    1717    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818*/ 
    19 // $Id: receiver.cc,v 1.8 2003/03/06 16:59:11 ahu Exp $ 
     19// $Id: receiver.cc,v 1.9 2003/08/22 13:33:31 ahu Exp $ 
    2020#include <cstdio> 
    2121#include <signal.h> 
     
    156156{ 
    157157  kill(cpid,SIGKILL); // why? 
     158  kill(cpid,SIGKILL); // why? 
     159   
     160  sleep(1); 
    158161  return "ok"; 
    159162} 
  • trunk/pdns/pdns/tcpreceiver.cc

    r178 r180  
    331331 
    332332  // now list zone 
    333   if(!(B->list(sd.domain_id))) {   
     333  if(!(B->list(target, sd.domain_id))) {   
    334334    L<<Logger::Error<<"Backend signals error condition"<<endl; 
    335335    outpacket->setRcode(2); // 'SERVFAIL' 
  • trunk/pdns/pdns/ueberbackend.cc

    r148 r180  
    1717    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818*/ 
    19 // $Id: ueberbackend.cc,v 1.10 2003/02/10 11:09:09 ahu Exp $  
     19// $Id: ueberbackend.cc,v 1.11 2003/08/22 13:33:31 ahu Exp $  
    2020/* (C) Copyright 2002 PowerDNS.COM BV */ 
    2121#include "utility.hh" 
     
    372372} 
    373373 
    374 bool UeberBackend::list(int domain_id) 
     374bool UeberBackend::list(const string &target, int domain_id) 
    375375{ 
    376376  L<<Logger::Error<<"UeberBackend::list called, should NEVER EVER HAPPEN"<<endl; 
  • trunk/pdns/pdns/ueberbackend.hh

    r104 r180  
    116116 
    117117  bool getSOA(const string &domain, SOAData &sd); 
    118   bool list(int domain_id); 
     118  bool list(const string &target, int domain_id); 
    119119  bool get(DNSResourceRecord &r); 
    120120