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
-// $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>
{
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;
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
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";
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";
pthread_t qtid;
StatWebServer sws;
- if(arg()["webserver"]!="no")
+ if(arg().mustDo("webserver"))
sws.go();
if(arg().mustDo("slave") || arg().mustDo("master"))
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 */
</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>
</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>.
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))
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)
{
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);
Semaphore *TCPNameserver::d_connectionroom_sem;
PacketHandler *TCPNameserver::s_P;
int TCPNameserver::s_timeout;
+NetmaskGroup TCPNameserver::d_ng;
int TCPNameserver::sendDelPacket(DNSPacket *p, int outsock)
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
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
#define PDNS_TCPRECEIVER_HH
#include "dns.hh"
+#include "iputils.hh"
#include "dnsbackend.hh"
#include "packethandler.hh"
#include <vector>\r
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);
static PacketHandler *s_P;
pthread_t d_tid;
static Semaphore *d_connectionroom_sem;
+ static NetmaskGroup d_ng;
vector<int>d_sockets;
int d_highfd;