work on zone2sql
authorBert Hubert <bert.hubert@netherlabs.nl>
Sun, 2 Feb 2003 22:04:51 +0000 (22:04 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sun, 2 Feb 2003 22:04:51 +0000 (22:04 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@143 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/backends/bind/zone2sql.cc
pdns/docs/pdns.sgml

index cb9748aceef87b3362b2ee058a79c935a49af2a1..83335126c3b1b51c5ba3a602fb086137e5e78fea 100644 (file)
@@ -18,7 +18,7 @@
 */
 /* accepts a named.conf as parameter and outputs heaps of sql */
 
-// $Id: zone2sql.cc,v 1.4 2002/12/18 16:22:20 ahu Exp $ 
+// $Id: zone2sql.cc,v 1.5 2003/02/02 22:04:51 ahu Exp $ 
 #ifdef WIN32
 # pragma warning ( disable: 4786 )
 # include <unistd.h>
@@ -64,6 +64,7 @@ bool g_intransaction;
 
 static int num_records;
 static string lastsoa_qname;
+
 static void callback(unsigned int domain_id,const string &domain, const string &qtype, const string &content, int ttl, int prio)
 {
   static int lastsoa_domain_id=-1;
@@ -71,6 +72,7 @@ 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) {
       dirty_hack_num++;
       cerr<<"Second SOA in zone, raised domain_id"<<endl;
@@ -85,14 +87,14 @@ static void callback(unsigned int domain_id,const string &domain, const string &
        }
        
        if(mode==POSTGRES) {
-         cout<<"insert into domains (name,type) values ("<<sqlstr(domain)<<",'NATIVE');"<<endl;
+         cout<<"insert into domains (name,type) values ("<<toLower(sqlstr(ZoneParser::canonic(domain)))<<",'NATIVE');"<<endl;
        }
        else if(mode==ORACLE) {
          cout<<"insert into domains (id,name,type) values (domains_id_sequence.nextval,"<<toLower(sqlstr(domain))<<",'NATIVE');"<<endl;
        }
       }
     }
-    lastsoa_qname=domain;
+    lastsoa_qname=ZoneParser::canonic(domain);
   }
   
   lastsoa_domain_id=dirty_hack_num;
@@ -144,7 +146,7 @@ int main(int argc, char **argv)
 #if __GNUC__ >= 3
     ios_base::sync_with_stdio(false);
 #endif
-
+    lastsoa_qname=" ";
     arg().setSwitch("mysql","Output in format suitable for mysqlbackend")="yes";
     arg().setCmd("gpgsql","Output in format suitable for default gpgsqlbackend");
     arg().setCmd("gmysql","Output in format suitable for default gmysqlbackend");
@@ -253,12 +255,11 @@ int main(int argc, char **argv)
       cerr<<"\r100% done\033\133\113"<<endl;
     }
     else {
+      dirty_hack_num=-1; // trigger first SOA output
       ZoneParser ZP;
       ZP.setDirectory(".");
       ZP.setCallback(&callback);  
       ZP.parse(zonefile,arg()["zone-name"],0);
-      dirty_hack_num++;
-
     }
     cerr<<"Parsed "<<num_records<<" records"<<endl;
     
index 065d6248cdd083ae9446ad62f054279ba451dbe3..3d10ac3fa0392ae8e81b05db459762a751725ab3 100644 (file)
@@ -11,7 +11,7 @@
       </affiliation>
     </author>
     
-    <PubDate>v2.1 $Date: 2003/02/01 13:18:22 $</PubDate>
+    <PubDate>v2.1 $Date: 2003/02/02 22:04:51 $</PubDate>
     
     <Abstract>
        <para>  
@@ -4171,6 +4171,15 @@ local0.err                        /var/log/pdns.err
        master. If the <link linkend="soa-type">SOA</link> serial number there is higher, the domain is retrieved and inserted into the database. In 
        any case, after the check the domain is declared 'fresh', and will only be checked again after '<command>refresh</command>' seconds have passed.
       </para>
+      <para>
+       <warning>
+         <para>
+           Slave support is OFF by default, turn it on by adding <command>slave</command> to the configuration. The same 
+           holds for master operation. Both can be on simultaneously.
+         </para>
+       </warning>
+      </para>
+
       <para>
        PDNS also reacts to notifies by immediately checking if the zone has updated and if so, retransfering it.
       </para>
@@ -4207,6 +4216,16 @@ local0.err                        /var/log/pdns.err
        if the zone changed, and transferring its contents if it has. Notifications are a way to promptly propagate zone changes to slaves, as 
        described in RFC 1996.
       </para>
+      <para>
+      <para>
+       <warning>
+         <para>
+           Master support is OFF by default, turn it on by adding <command>master</command> to the configuration. The same 
+           holds for slave operation. Both can be on simultaneously.
+         </para>
+       </warning>
+      </para>
+
       <para>
        Left open by RFC 1996 is who is to be notified - which is harder to figure out than it sounds. All slaves for this domain must receive a notification
        but the nameserver only knows the names of the slaves - not the IP addresses, which is where the problem lies. The nameserver itself might
@@ -4997,6 +5016,15 @@ local0.err                        /var/log/pdns.err
              </para>
            </listitem>
          </varlistentry>
+         <varlistentry>
+           <term>Q: Master or Slave support is not working, PDNS is not picking up changes</term>
+           <listitem>
+             <para>
+               A: The Master/Slave apparatus is off by default. Turn it on by adding a <command>slave</command> and/or
+               <command>master</command> statement to the configuration file. Also, check that the configured backend is master or slave capable.
+             </para>
+           </listitem>
+         </varlistentry>
          <varlistentry>
            <term>Q: Can I use a MySQL database with the Windows version of PowerDNS?</term>
            <listitem>