]> granicus.if.org Git - pdns/commitdiff
cosmetic fixes
authorBert Hubert <bert.hubert@netherlabs.nl>
Sat, 30 Aug 2003 14:34:04 +0000 (14:34 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sat, 30 Aug 2003 14:34:04 +0000 (14:34 +0000)
0.0.0.0/0 support
SRV support

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

ChangeLog
modules/gpgsqlbackend/gpgsqlbackend.cc
pdns/backends/bind/zoneparser2.cc
pdns/common_startup.cc
pdns/dnsproxy.cc
pdns/docs/pdns.sgml
pdns/iputils.hh
pdns/misc.cc
pdns/misc.hh
pdns/tcpreceiver.cc
pdns/tcpreceiver.hh

index 524d9c67b7b74f6dcb812da5fedd1e4310f03ee5..56d051103cbd9580c5e04f11e2e77ed73f401db6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 changes since 2.9.11:
        - ldap updates
                no longer sends entire reverse zone with AXFR
+       - SRV fixes for zonefiles (Christof Meerwald)
+       - gpgsql no longer reports as gmysql (Sherwin Daganoto)
+       - we now understand 0.0.0.0/0
 
 changes since 2.9.10:
        - pdns_recursor now cleans its cache
index d85ad45fccb973247f31a1044f9b876d16898a55..257e43f8dbba9b445e5757e6c67a6ee03ba3a47b 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: gpgsqlbackend.cc,v 1.2 2003/01/02 15:43:00 ahu Exp $ 
+// $Id: gpgsqlbackend.cc,v 1.3 2003/08/30 14:34:04 ahu Exp $ 
 #include <string>
 #include <map>
 
@@ -95,7 +95,7 @@ public:
   {
     BackendMakers().report(new gPgSQLFactory("gpgsql"));
     BackendMakers().report(new gPgSQLFactory("gpgsql2"));
-    L<<Logger::Warning<<"This is module gmysqlbackend.so reporting"<<endl;
+    L<<Logger::Warning<<"This is module gpgsqlbackend.so reporting"<<endl;
   }
 };
 static gPgSQLLoader gpgsqlloader;
index 07bac2b9039e0b6ff24e56b4da0f4a6484988170..9404f2429b43c918194183dcda4e8d6944e0ad7e 100644 (file)
@@ -529,9 +529,13 @@ bool ZoneParser::parseLine(const vector<string>&words, vector<Record>&rec)
   int left=words.size()-cpos;
   string content;
 
-  if(qtype=="MX" && left==2) {
-    int prio=atoi(words[cpos++].c_str());
-    content=words[cpos];
+   if((qtype=="MX" && left==2) || (qtype=="SRV" && left==4)){
+     int prio=atoi(words[cpos++].c_str());left--;
+     content=words[cpos++];left--;
+     
+     while(left--)
+       content+=" "+words[cpos++];
+     
     if(content=="@")
       content=d_origin;
     else
index d9f1ed64ee2813ab00279c3a71791e912ab98f94..165b09933e9a998f1ea6c25a6d0da9212861f310 100644 (file)
@@ -65,7 +65,7 @@ void declareArguments()
   arg().set("queue-limit","Maximum number of milliseconds to queue a query")="1500"; 
   arg().set("recursor","If recursion is desired, IP address of a recursing nameserver")="no"; 
   arg().set("lazy-recursion","Only recurse if question cannot be answered locally")="yes";
-  arg().set("allow-recursion","List of netmasks that are allowed to recurse")=""; 
+  arg().set("allow-recursion","List of subnets that are allowed to recurse")="0.0.0.0/0";
   
   arg().set("disable-tcp","Do not listen to TCP queries")="no";
   arg().set("disable-axfr","Do not allow zone transfers")="no";
@@ -75,7 +75,7 @@ void declareArguments()
   arg().set("load-modules","Load this module - supply absolute or relative path")="";
   arg().set("launch","Which backends to launch and order to query them in")="";
   arg().setSwitch("disable-axfr","Disable zonetransfers but do allow TCP queries")="no";
-  arg().set("allow-axfr-ips","Allow zonetransfers only from these IP addresses")="";
+  arg().set("allow-axfr-ips","Allow zonetransfers only to these subnets")="0.0.0.0/0";
   arg().set("slave-cycle-interval","Reschedule failed SOA serial checks once every .. seconds")="60";
   
   arg().setSwitch("slave","Act as a slave")="no";
@@ -257,7 +257,7 @@ void mainthread()
   pthread_t qtid;
   StatWebServer sws;
 
-  if(arg()["webserver"]!="no") 
+  if(arg().mustDo("webserver"))
     sws.go();
   
   if(arg().mustDo("slave") || arg().mustDo("master"))
index 3366374da23d162fe32aa412588158a4e02d907d..675c299e36f3f1048e60db0240e74b2a3d5e1497 100644 (file)
@@ -94,7 +94,7 @@ void DNSProxy::onlyFrom(const string &ips)
 
 bool DNSProxy::recurseFor(DNSPacket* p)
 {
-  return d_ng.empty() || d_ng.match((struct sockaddr_in *)&p->remote);
+  return d_ng.match((struct sockaddr_in *)&p->remote);
 }
 
 /** returns false if p->remote is not allowed to recurse via us */
index 05e7a8cc67842278ea168cca0d33cd5d2b910e12..91cf483faea392077cb1f42b52b3680790bc0bbb 100644 (file)
@@ -11,7 +11,7 @@
       </affiliation>
     </author>
     
-    <PubDate>v2.1 $Date: 2003/07/05 14:13:18 $</PubDate>
+    <PubDate>v2.1 $Date: 2003/08/30 14:34:04 $</PubDate>
     
     <Abstract>
        <para>  
@@ -6933,7 +6933,7 @@ GRANT ALL ON records_id_seq TO pdns;
               </listitem>
             </varlistentry>
             <varlistentry>
-              <term>gmysql-host (only for MySQL!)</term>
+              <term>gmysql-socket (only for MySQL!)</term>
               <listitem>
                 <para>
                  Filename where the MySQL connection socket resides. Often <filename>/tmp/mysql.sock</filename> or <filename>/var/run/mysqld/mysqld.sock</filename>. 
index 674c907f369762de8e84fab1b8a1267c31c503ee..cf505bb4b416b367089b0ee58fb64b77cba48972 100644 (file)
@@ -55,7 +55,7 @@ public:
     if((p=strchr(mask.c_str(),'/')))
       bits=atoi(p+1);
 
-    d_mask=~((1<<(32-bits))-1);     // 1<<16 0000 0000  0000 0000  0000 0000  0000 0000
+    d_mask=~(0xFFFFFFFF>>bits);
 
     struct in_addr a;
     if(!Utility::inet_aton(mask.substr(0,p-mask.c_str()).c_str(), &a))
index a1bfafb7fac881f41af419034edb7f1ce4ea6b5c..3d50ca46adfc2c856cc828c9c755e57dfcaa9393 100644 (file)
@@ -145,41 +145,6 @@ void parseService(const string &descr, ServiceTuple &st)
     st.port=atoi(parts[1].c_str());
 }
 
-int matchNetmask(const char *address, const char *omask)
-{
-  struct in_addr a,m;
-  int bits=32;
-  char *sep;
-
-  char *mask=strdup(omask);
-  sep=strchr(mask,'/');
-
-  if(sep) {
-    bits=atoi(sep+1);
-    *sep=0;
-  }
-
-  if(!Utility::inet_aton(address, &a) || !Utility::inet_aton(mask, &m))
-  {
-    free(mask);
-    return -1;
-  }
-
-  free(mask);
-
-  // bits==32 -> 0xffffffff
-  // bits==16 -> 0xffff0000
-  // bits==0 ->  0x00000000
-  unsigned int bmask=~((1<<(32-bits))-1);     // 1<<16 0000 0000  0000 0000  0000 0000  0000 0000
-
-  /*
-  fprintf(stderr,"%x\n",bmask);
-  fprintf(stderr,"%x\n",(htonl((unsigned int)a.s_addr) & bmask));
-  fprintf(stderr,"%x\n",(htonl((unsigned int)m.s_addr) & bmask));
-  */
-
-  return ((htonl((unsigned int)a.s_addr) & bmask) == (htonl((unsigned int)m.s_addr) & bmask));
-}
 
 int waitForData(int fd, int seconds)
 {
index 708bc2ec5678d382fef792c15e4573167698e012..8207cf8036b4987f1649184b7ebd41a2d63f9548 100644 (file)
@@ -45,7 +45,6 @@ bool chopOff(string &domain);
 bool endsOn(const string &domain, const string &suffix);
 string nowTime();
 const string unquotify(const string &item);
-int matchNetmask(const char *address, const char *omask);
 string humanDuration(time_t passed);
 void chomp(string &line, const string &delim);
 bool stripDomainSuffix(string *qname, const string &domain);
index 34f70e427c1f78269bb973d7e603bdb95c91e718..1e040d4e9e88b0745582f90ac3842e75c6a3f769 100644 (file)
@@ -53,6 +53,7 @@ pthread_mutex_t TCPNameserver::s_plock = PTHREAD_MUTEX_INITIALIZER;
 Semaphore *TCPNameserver::d_connectionroom_sem;
 PacketHandler *TCPNameserver::s_P; 
 int TCPNameserver::s_timeout;
+NetmaskGroup TCPNameserver::d_ng;
 
 
 int TCPNameserver::sendDelPacket(DNSPacket *p, int outsock)
@@ -244,22 +245,14 @@ void *TCPNameserver::doConnection(void *data)
   return 0;
 }
 
-static bool canDoAXFR(DNSPacket *q)
+bool TCPNameserver::canDoAXFR(DNSPacket *q)
 {
   if(arg().mustDo("disable-axfr"))
     return false;
 
-  if(arg()["allow-axfr-ips"].empty())
+  if( arg()["allow-axfr-ips"].empty() || d_ng.match( (struct sockaddr_in *) &q->remote ) )
     return true;
 
-
-  vector<string>parts;
-  stringtok(parts,arg()["allow-axfr-ips"],", "); // is this IP on the guestlist?
-  for(vector<string>::const_iterator i=parts.begin();i!=parts.end();++i) {
-    if(matchNetmask(q->getRemote().c_str(),i->c_str())==1)
-      return true;
-  }
-
   extern CommunicatorClass Communicator;
 
   if(Communicator.justNotified(q->qdomain, q->getRemote())) { // we just notified this ip 
@@ -408,6 +401,12 @@ TCPNameserver::TCPNameserver()
 
   d_highfd=0;
 
+  vector<string> parts;
+  stringtok( parts, arg()["allow-axfr-ips"], ", \t" ); // is this IP on the guestlist?
+  for( vector<string>::const_iterator i = parts.begin(); i != parts.end(); ++i ) {
+    d_ng.addMask( *i );
+  }
+
 #ifndef WIN32
   signal(SIGPIPE,SIG_IGN);
 #endif // WIN32
index 60684bb3afe760b25e376998f06abf053e78175a..af6e172e799a73e8a8e3029c6e285b6a92eb5d89 100644 (file)
@@ -20,6 +20,7 @@
 #define PDNS_TCPRECEIVER_HH
 
 #include "dns.hh"
+#include "iputils.hh"
 #include "dnsbackend.hh"
 #include "packethandler.hh"
 #include <vector>\r
@@ -50,6 +51,7 @@ private:
   static int readLength(int fd, struct sockaddr_in *remote);
   static void getQuestion(int fd, char *mesg, int pktlen, const struct sockaddr_in &remote);
   static int doAXFR(const string &target, DNSPacket *q, int outsock);
+  static bool canDoAXFR(DNSPacket *q);
   static void *doConnection(void *data);
   static void *launcher(void *data);
   void thread(void);
@@ -57,6 +59,7 @@ private:
   static PacketHandler *s_P;
   pthread_t d_tid;
   static Semaphore *d_connectionroom_sem;
+  static NetmaskGroup d_ng;
 
   vector<int>d_sockets;
   int d_highfd;