[-]
[+]
|
Deleted |
pdns-3.2-allow-axfr-from.patch
|
@@ -1,32 +0,0 @@
---- pdns/backends/gsql/gsqlbackend.cc 2013-05-03 10:28:03.153764623 +0200
-+++ pdns/backends/gsql/gsqlbackend.cc 2013-05-03 10:29:36.217221341 +0200
-@@ -284,6 +284,9 @@
- d_removeEmptyNonTerminalsFromZoneQuery = getArg("remove-empty-non-terminals-from-zone-query");
- d_insertEmptyNonTerminalQuery = getArg("insert-empty-non-terminal-query"+authswitch);
- d_deleteEmptyNonTerminalQuery = getArg("delete-empty-non-terminal-query");
-+
-+ // Define domainmetadata queries independent from dnssec functionality
-+ d_GetDomainMetadataQuery = getArg("get-domain-metadata-query");
-
- if (d_dnssecQueries)
- {
-@@ -299,7 +302,8 @@
- d_AddDomainKeyQuery = getArg("add-domain-key-query");
- d_ListDomainKeysQuery = getArg("list-domain-keys-query");
-
-- d_GetDomainMetadataQuery = getArg("get-domain-metadata-query");
-+ // Already defined outside of dnssec functionality
-+ // d_GetDomainMetadataQuery = getArg("get-domain-metadata-query");
- d_ClearDomainMetadataQuery = getArg("clear-domain-metadata-query");
- d_SetDomainMetadataQuery = getArg("set-domain-metadata-query");
-
-@@ -637,8 +641,8 @@
-
- bool GSQLBackend::getDomainMetadata(const string& name, const std::string& kind, std::vector<std::string>& meta)
- {
-- if(!d_dnssecQueries)
-- return false;
-+ /* if(!d_dnssecQueries)
-+ return false; */
- char output[1024];
- snprintf(output,sizeof(output)-1,d_GetDomainMetadataQuery.c_str(), sqlEscape(name).c_str(), sqlEscape(kind).c_str());
|
[-]
[+]
|
Deleted |
pdns-3.2-init.patch
^
|
@@ -1,128 +0,0 @@
-diff -ru pdns-3.2/pdns/pdns.in pdns-3.2.fresh/pdns/pdns.in
---- pdns/pdns.in.orig 2013-05-22 08:23:55.921220023 +0200
-+++ pdns/pdns.in 2013-05-22 08:23:36.721292790 +0200
-@@ -2,20 +2,33 @@
- # chkconfig: - 80 75
- # description: PDNS is a versatile high performance authoritative nameserver
-
--prefix=/usr
--exec_prefix=/usr
--BINARYPATH=/usr/bin
--SBINARYPATH=/usr/sbin
--SOCKETPATH=/var/run
--
-+### BEGIN INIT INFO
-+# Provides: pdns
-+# Required-Start: $remote_fs $network $syslog
-+# Required-Stop: $remote_fs $network $syslog
-+# Should-Start: $all
-+# Should-Stop:
-+# Default-Start: 2 3 4 5
-+# Default-Stop: 0 1 6
-+# Short-Description: Start/stop PowerDNS authoritative server
-+# Description: Start/stop PowerDNS authoritative server
-+### END INIT INFO
-+
-+set -e
-+
-+prefix=@prefix@
-+exec_prefix=@exec_prefix@
-+BINARYPATH=@bindir@
-+SBINARYPATH=@sbindir@
-+SOCKETPATH=@socketdir@
-
- [ -f "$SBINARYPATH/pdns_server" ] || exit 0
-
--cd $SOCKETPATH
--suffix=`basename $0 | awk -F- '{print $2}'`
--
-+[ -r /etc/default/pdns ] && . /etc/default/pdns
-
--if [ $suffix ]
-+cd $SOCKETPATH
-+suffix=$(basename $0 | cut -d- -f2- -s)
-+if [ -n "$suffix" ]
- then
- EXTRAOPTS=--config-name=$suffix
- PROGNAME=pdns-$suffix
-@@ -30,9 +43,8 @@
- ret=$($BINARYPATH/pdns_control $EXTRAOPTS $1 $2 2> /dev/null)
- }
-
--
--doPC ping
--NOTRUNNING=$?
-+NOTRUNNING=0
-+doPC ping || NOTRUNNING=$?
-
- case "$1" in
- status)
-@@ -42,6 +54,7 @@
- echo $ret
- else
- echo "not running"
-+ exit 3
- fi
- ;;
-
-@@ -50,7 +63,6 @@
- if test "$NOTRUNNING" = "0"
- then
- doPC quit
-- rm -f /var/lock/subsys/pdns
- echo $ret
- else
- echo "not running"
-@@ -61,7 +73,6 @@
- force-stop)
- echo -n "Stopping PowerDNS authoritative nameserver: "
- killall -v -9 pdns_server
-- rm -f /var/lock/subsys/pdns
- echo "killed"
- ;;
-
-@@ -71,21 +82,28 @@
- then
- echo "already running"
- else
-- $pdns_server --daemon --guardian=yes
-- if test "$?" = "0"
-+ if $pdns_server --daemon --guardian=yes
- then
-- touch /var/lock/subsys/pdns
- echo "started"
-+ else
-+ echo "starting failed"
-+ exit 1
- fi
- fi
- ;;
-
- force-reload | restart)
- echo -n "Restarting PowerDNS authoritative nameserver: "
-- echo -n stopping and waiting..
-- doPC quit
-- sleep 3
-- echo done
-+ if test "$NOTRUNNING" = "1"
-+ then
-+ echo "not running, starting"
-+ else
-+
-+ echo -n stopping and waiting..
-+ doPC quit
-+ sleep 3
-+ echo done
-+ fi
- $0 start
- ;;
-
-@@ -176,7 +194,7 @@
-
-
- *)
-- echo pdns [start\|stop\|force-reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
-+ echo pdns [start\|stop\|force-reload\|reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
-
- ;;
- esac
|
[-]
[+]
|
Deleted |
pdns-3.2-slavedb.patch
^
|
@@ -1,177 +0,0 @@
---- modules/gmysqlbackend/gmysqlbackend.cc 2013-01-17 10:16:53.000000000 +0100
-+++ modules/gmysqlbackend/gmysqlbackend.cc 2013-05-03 10:51:33.033534080 +0200
-@@ -31,6 +31,24 @@
- throw AhuException("Unable to launch "+mode+" connection: "+e.txtReason());
- }
- L<<Logger::Info<<mode<<" Connection successful"<<endl;
-+
-+ if(!getArg("slave-socket").empty() || !getArg("slave-host").empty()) {
-+ try {
-+ setDBReadonly(new SMySQL(getArg("slave-dbname"),
-+ getArg("slave-host"),
-+ getArgAsNum("slave-port"),
-+ getArg("slave-socket"),
-+ getArg("slave-user"),
-+ getArg("slave-password")));
-+ L<<Logger::Warning<<mode<<" Slave connection successful."<<endl;
-+ } catch(ArgException &e) {
-+ // Ignore exception, slave not
-+ L<<Logger::Warning<<mode<<" Slave configuration."<<endl;
-+ } catch(SSqlException &e) {
-+ // Ignore exception, slave not
-+ L<<Logger::Warning<<mode<<" Unable to connect to slave."<<endl;
-+ }
-+ }
- }
-
- class gMySQLFactory : public BackendFactory
-@@ -49,6 +67,13 @@
- declare(suffix,"group", "Pdns backend MySQL 'group' to connect as", "client");
- declare(suffix,"dnssec","Assume DNSSEC Schema is in place","no");
-
-+ declare(suffix,"slave-dbname","Pdns backend database name to connect to","");
-+ declare(suffix,"slave-user","Database backend user to connect as","");
-+ declare(suffix,"slave-host","Database backend host to connect to","");
-+ declare(suffix,"slave-port","Database backend port to connect to","0");
-+ declare(suffix,"slave-socket","Pdns backend socket to connect to","");
-+ declare(suffix,"slave-password","Pdns backend password to connect with","");
-+
- declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");
- declare(suffix,"id-query","Basic with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' and domain_id=%d");
- declare(suffix,"wildcard-query","Wildcard query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s'");
---- pdns/backends/gsql/gsqlbackend.cc 2013-01-17 10:16:52.000000000 +0100
-+++ pdns/backends/gsql/gsqlbackend.cc 2013-05-03 10:46:20.135360708 +0200
-@@ -78,7 +78,7 @@
- d_MasterOfDomainsZoneQuery.c_str(),
- sqlEscape(domain).c_str());
- try {
-- d_db->doQuery(output, d_result);
-+ getDBReadonly()->doQuery(output, d_result);
- }
- catch (SSqlException &e) {
- throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
-@@ -111,7 +111,7 @@
- snprintf(output,sizeof(output)-1,d_InfoOfDomainsZoneQuery.c_str(),
- sqlEscape(domain).c_str());
- try {
-- d_db->doQuery(output,d_result);
-+ getDBReadonly()->doQuery(output,d_result);
- }
- catch(SSqlException &e) {
- throw AhuException("GSQLBackend unable to retrieve information about a domain: "+e.txtReason());
-@@ -156,7 +156,7 @@
- /* list all domains that need refreshing for which we are slave, and insert into SlaveDomain:
- id,name,master IP,serial */
- try {
-- d_db->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
-+ getDBReadonly()->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
- }
- catch (SSqlException &e) {
- throw AhuException("GSQLBackend unable to retrieve list of slave domains: "+e.txtReason());
-@@ -192,7 +192,7 @@
- /* list all domains that need notifications for which we are master, and insert into updatedDomains
- id,name,master IP,serial */
- try {
-- d_db->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
-+ getDBReadonly()->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
- }
- catch(SSqlException &e) {
- throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
-@@ -243,6 +243,7 @@
- {
- setArgPrefix(mode+suffix);
- d_db=0;
-+ d_db_slave=NULL;
- d_logprefix="["+mode+"Backend"+suffix+"] ";
-
- try
-@@ -643,7 +644,7 @@
- snprintf(output,sizeof(output)-1,d_GetDomainMetadataQuery.c_str(), sqlEscape(name).c_str(), sqlEscape(kind).c_str());
-
- try {
-- d_db->doQuery(output);
-+ getDBReadonly()->doQuery(output);
- }
- catch (SSqlException &e) {
- throw AhuException("GSQLBackend unable to list metadata: "+e.txtReason());
-@@ -732,7 +733,7 @@
- }
-
- try {
-- d_db->doQuery(output);
-+ getDBReadonly()->doQuery(output);
- }
- catch(SSqlException &e) {
- throw AhuException(e.txtReason());
-@@ -750,7 +751,7 @@
- char output[1024];
- snprintf(output,sizeof(output)-1,d_listQuery.c_str(),domain_id);
- try {
-- d_db->doQuery(output);
-+ getDBReadonly()->doQuery(output);
- }
- catch(SSqlException &e) {
- throw AhuException("GSQLBackend list query: "+e.txtReason());
-@@ -770,7 +771,7 @@
- for(vector<DNSResourceRecord>::const_iterator i=nsset.begin();i!=nsset.end();++i) {
- try {
- snprintf(output,sizeof(output)-1,format.c_str(),sqlEscape(ip).c_str(),sqlEscape(i->content).c_str());
-- d_db->doQuery(output, d_result);
-+ getDBReadonly()->doQuery(output, d_result);
- }
- catch (SSqlException &e) {
- throw AhuException("GSQLBackend unable to search for a domain: "+e.txtReason());
-@@ -847,7 +848,7 @@
- {
- // L << "GSQLBackend get() was called for "<<qtype.getName() << " record: ";
- SSql::row_t row;
-- if(d_db->getRow(row)) {
-+ if(getDBReadonly()->getRow(row)) {
- r.content=row[0];
- if (row[1].empty())
- r.ttl = ::arg().asNum( "default-ttl" );
-@@ -955,7 +956,7 @@
- sd.domain_id);
-
- try {
-- d_db->doQuery(output, d_result);
-+ getDBReadonly()->doQuery(output, d_result);
- }
- catch (const SSqlException& e) {
- //DLOG(L<<"GSQLBackend unable to calculate SOA serial: " << e.txtReason()<<endl);
-diff -ru pdns-3.2/pdns/backends/gsql/gsqlbackend.hh pdns-3.2.new/pdns/backends/gsql/gsqlbackend.hh
---- pdns/backends/gsql/gsqlbackend.hh 2013-01-17 10:16:52.000000000 +0100
-+++ pdns/backends/gsql/gsqlbackend.hh 2013-05-03 10:46:20.135360708 +0200
-@@ -15,12 +15,24 @@
- {
- if(d_db)
- delete d_db;
-+ if(d_db_slave)
-+ delete d_db_slave;
- }
-
- void setDB(SSql *db)
- {
- d_db=db;
- }
-+
-+ void setDBReadonly(SSql *db)
-+ {
-+ d_db_slave=db;
-+ }
-+
-+ SSql *getDBReadonly()
-+ {
-+ return d_db_slave != NULL ? d_db_slave : d_db;
-+ }
-
- virtual string sqlEscape(const string &name);
- void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1);
-@@ -67,6 +79,7 @@
- QType d_qtype;
- int d_count;
- SSql *d_db;
-+ SSql *d_db_slave;
- SSql::result_t d_result;
-
- string d_wildCardNoIDQuery;
|
[-]
[+]
|
Added |
pdns-allow-axfr-from.patch
^
|
@@ -0,0 +1,32 @@
+--- pdns/backends/gsql/gsqlbackend.cc 2013-05-03 10:28:03.153764623 +0200
++++ pdns/backends/gsql/gsqlbackend.cc 2013-05-03 10:29:36.217221341 +0200
+@@ -284,6 +284,9 @@
+ d_removeEmptyNonTerminalsFromZoneQuery = getArg("remove-empty-non-terminals-from-zone-query");
+ d_insertEmptyNonTerminalQuery = getArg("insert-empty-non-terminal-query"+authswitch);
+ d_deleteEmptyNonTerminalQuery = getArg("delete-empty-non-terminal-query");
++
++ // Define domainmetadata queries independent from dnssec functionality
++ d_GetDomainMetadataQuery = getArg("get-domain-metadata-query");
+
+ if (d_dnssecQueries)
+ {
+@@ -299,7 +302,8 @@
+ d_AddDomainKeyQuery = getArg("add-domain-key-query");
+ d_ListDomainKeysQuery = getArg("list-domain-keys-query");
+
+- d_GetDomainMetadataQuery = getArg("get-domain-metadata-query");
++ // Already defined outside of dnssec functionality
++ // d_GetDomainMetadataQuery = getArg("get-domain-metadata-query");
+ d_ClearDomainMetadataQuery = getArg("clear-domain-metadata-query");
+ d_SetDomainMetadataQuery = getArg("set-domain-metadata-query");
+
+@@ -637,8 +641,8 @@
+
+ bool GSQLBackend::getDomainMetadata(const string& name, const std::string& kind, std::vector<std::string>& meta)
+ {
+- if(!d_dnssecQueries)
+- return false;
++ /* if(!d_dnssecQueries)
++ return false; */
+ char output[1024];
+ snprintf(output,sizeof(output)-1,d_GetDomainMetadataQuery.c_str(), sqlEscape(name).c_str(), sqlEscape(kind).c_str());
|
[-]
[+]
|
Added |
pdns-init.patch
^
|
@@ -0,0 +1,128 @@
+diff -ru pdns-3.2/pdns/pdns.in pdns-3.2.fresh/pdns/pdns.in
+--- pdns/pdns.in.orig 2013-05-22 08:23:55.921220023 +0200
++++ pdns/pdns.in 2013-05-22 08:23:36.721292790 +0200
+@@ -2,20 +2,33 @@
+ # chkconfig: - 80 75
+ # description: PDNS is a versatile high performance authoritative nameserver
+
+-prefix=/usr
+-exec_prefix=/usr
+-BINARYPATH=/usr/bin
+-SBINARYPATH=/usr/sbin
+-SOCKETPATH=/var/run
+-
++### BEGIN INIT INFO
++# Provides: pdns
++# Required-Start: $remote_fs $network $syslog
++# Required-Stop: $remote_fs $network $syslog
++# Should-Start: $all
++# Should-Stop:
++# Default-Start: 2 3 4 5
++# Default-Stop: 0 1 6
++# Short-Description: Start/stop PowerDNS authoritative server
++# Description: Start/stop PowerDNS authoritative server
++### END INIT INFO
++
++set -e
++
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++BINARYPATH=@bindir@
++SBINARYPATH=@sbindir@
++SOCKETPATH=@socketdir@
+
+ [ -f "$SBINARYPATH/pdns_server" ] || exit 0
+
+-cd $SOCKETPATH
+-suffix=`basename $0 | awk -F- '{print $2}'`
+-
++[ -r /etc/default/pdns ] && . /etc/default/pdns
+
+-if [ $suffix ]
++cd $SOCKETPATH
++suffix=$(basename $0 | cut -d- -f2- -s)
++if [ -n "$suffix" ]
+ then
+ EXTRAOPTS=--config-name=$suffix
+ PROGNAME=pdns-$suffix
+@@ -30,9 +43,8 @@
+ ret=$($BINARYPATH/pdns_control $EXTRAOPTS $1 $2 2> /dev/null)
+ }
+
+-
+-doPC ping
+-NOTRUNNING=$?
++NOTRUNNING=0
++doPC ping || NOTRUNNING=$?
+
+ case "$1" in
+ status)
+@@ -42,6 +54,7 @@
+ echo $ret
+ else
+ echo "not running"
++ exit 3
+ fi
+ ;;
+
+@@ -50,7 +63,6 @@
+ if test "$NOTRUNNING" = "0"
+ then
+ doPC quit
+- rm -f /var/lock/subsys/pdns
+ echo $ret
+ else
+ echo "not running"
+@@ -61,7 +73,6 @@
+ force-stop)
+ echo -n "Stopping PowerDNS authoritative nameserver: "
+ killall -v -9 pdns_server
+- rm -f /var/lock/subsys/pdns
+ echo "killed"
+ ;;
+
+@@ -71,21 +82,28 @@
+ then
+ echo "already running"
+ else
+- $pdns_server --daemon --guardian=yes
+- if test "$?" = "0"
++ if $pdns_server --daemon --guardian=yes
+ then
+- touch /var/lock/subsys/pdns
+ echo "started"
++ else
++ echo "starting failed"
++ exit 1
+ fi
+ fi
+ ;;
+
+ force-reload | restart)
+ echo -n "Restarting PowerDNS authoritative nameserver: "
+- echo -n stopping and waiting..
+- doPC quit
+- sleep 3
+- echo done
++ if test "$NOTRUNNING" = "1"
++ then
++ echo "not running, starting"
++ else
++
++ echo -n stopping and waiting..
++ doPC quit
++ sleep 3
++ echo done
++ fi
+ $0 start
+ ;;
+
+@@ -176,7 +194,7 @@
+
+
+ *)
+- echo pdns [start\|stop\|force-reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
++ echo pdns [start\|stop\|force-reload\|reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
+
+ ;;
+ esac
|
[-]
[+]
|
Added |
pdns-slavedb.patch
^
|
@@ -0,0 +1,177 @@
+--- modules/gmysqlbackend/gmysqlbackend.cc 2013-01-17 10:16:53.000000000 +0100
++++ modules/gmysqlbackend/gmysqlbackend.cc 2013-05-03 10:51:33.033534080 +0200
+@@ -31,6 +31,24 @@
+ throw AhuException("Unable to launch "+mode+" connection: "+e.txtReason());
+ }
+ L<<Logger::Info<<mode<<" Connection successful"<<endl;
++
++ if(!getArg("slave-socket").empty() || !getArg("slave-host").empty()) {
++ try {
++ setDBReadonly(new SMySQL(getArg("slave-dbname"),
++ getArg("slave-host"),
++ getArgAsNum("slave-port"),
++ getArg("slave-socket"),
++ getArg("slave-user"),
++ getArg("slave-password")));
++ L<<Logger::Warning<<mode<<" Slave connection successful."<<endl;
++ } catch(ArgException &e) {
++ // Ignore exception, slave not
++ L<<Logger::Warning<<mode<<" Slave configuration."<<endl;
++ } catch(SSqlException &e) {
++ // Ignore exception, slave not
++ L<<Logger::Warning<<mode<<" Unable to connect to slave."<<endl;
++ }
++ }
+ }
+
+ class gMySQLFactory : public BackendFactory
+@@ -49,6 +67,13 @@
+ declare(suffix,"group", "Pdns backend MySQL 'group' to connect as", "client");
+ declare(suffix,"dnssec","Assume DNSSEC Schema is in place","no");
+
++ declare(suffix,"slave-dbname","Pdns backend database name to connect to","");
++ declare(suffix,"slave-user","Database backend user to connect as","");
++ declare(suffix,"slave-host","Database backend host to connect to","");
++ declare(suffix,"slave-port","Database backend port to connect to","0");
++ declare(suffix,"slave-socket","Pdns backend socket to connect to","");
++ declare(suffix,"slave-password","Pdns backend password to connect with","");
++
+ declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");
+ declare(suffix,"id-query","Basic with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' and domain_id=%d");
+ declare(suffix,"wildcard-query","Wildcard query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s'");
+--- pdns/backends/gsql/gsqlbackend.cc 2013-01-17 10:16:52.000000000 +0100
++++ pdns/backends/gsql/gsqlbackend.cc 2013-05-03 10:46:20.135360708 +0200
+@@ -78,7 +78,7 @@
+ d_MasterOfDomainsZoneQuery.c_str(),
+ sqlEscape(domain).c_str());
+ try {
+- d_db->doQuery(output, d_result);
++ getDBReadonly()->doQuery(output, d_result);
+ }
+ catch (SSqlException &e) {
+ throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
+@@ -111,7 +111,7 @@
+ snprintf(output,sizeof(output)-1,d_InfoOfDomainsZoneQuery.c_str(),
+ sqlEscape(domain).c_str());
+ try {
+- d_db->doQuery(output,d_result);
++ getDBReadonly()->doQuery(output,d_result);
+ }
+ catch(SSqlException &e) {
+ throw AhuException("GSQLBackend unable to retrieve information about a domain: "+e.txtReason());
+@@ -156,7 +156,7 @@
+ /* list all domains that need refreshing for which we are slave, and insert into SlaveDomain:
+ id,name,master IP,serial */
+ try {
+- d_db->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
++ getDBReadonly()->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
+ }
+ catch (SSqlException &e) {
+ throw AhuException("GSQLBackend unable to retrieve list of slave domains: "+e.txtReason());
+@@ -192,7 +192,7 @@
+ /* list all domains that need notifications for which we are master, and insert into updatedDomains
+ id,name,master IP,serial */
+ try {
+- d_db->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
++ getDBReadonly()->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
+ }
+ catch(SSqlException &e) {
+ throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
+@@ -243,6 +243,7 @@
+ {
+ setArgPrefix(mode+suffix);
+ d_db=0;
++ d_db_slave=NULL;
+ d_logprefix="["+mode+"Backend"+suffix+"] ";
+
+ try
+@@ -643,7 +644,7 @@
+ snprintf(output,sizeof(output)-1,d_GetDomainMetadataQuery.c_str(), sqlEscape(name).c_str(), sqlEscape(kind).c_str());
+
+ try {
+- d_db->doQuery(output);
++ getDBReadonly()->doQuery(output);
+ }
+ catch (SSqlException &e) {
+ throw AhuException("GSQLBackend unable to list metadata: "+e.txtReason());
+@@ -732,7 +733,7 @@
+ }
+
+ try {
+- d_db->doQuery(output);
++ getDBReadonly()->doQuery(output);
+ }
+ catch(SSqlException &e) {
+ throw AhuException(e.txtReason());
+@@ -750,7 +751,7 @@
+ char output[1024];
+ snprintf(output,sizeof(output)-1,d_listQuery.c_str(),domain_id);
+ try {
+- d_db->doQuery(output);
++ getDBReadonly()->doQuery(output);
+ }
+ catch(SSqlException &e) {
+ throw AhuException("GSQLBackend list query: "+e.txtReason());
+@@ -770,7 +771,7 @@
+ for(vector<DNSResourceRecord>::const_iterator i=nsset.begin();i!=nsset.end();++i) {
+ try {
+ snprintf(output,sizeof(output)-1,format.c_str(),sqlEscape(ip).c_str(),sqlEscape(i->content).c_str());
+- d_db->doQuery(output, d_result);
++ getDBReadonly()->doQuery(output, d_result);
+ }
+ catch (SSqlException &e) {
+ throw AhuException("GSQLBackend unable to search for a domain: "+e.txtReason());
+@@ -847,7 +848,7 @@
+ {
+ // L << "GSQLBackend get() was called for "<<qtype.getName() << " record: ";
+ SSql::row_t row;
+- if(d_db->getRow(row)) {
++ if(getDBReadonly()->getRow(row)) {
+ r.content=row[0];
+ if (row[1].empty())
+ r.ttl = ::arg().asNum( "default-ttl" );
+@@ -955,7 +956,7 @@
+ sd.domain_id);
+
+ try {
+- d_db->doQuery(output, d_result);
++ getDBReadonly()->doQuery(output, d_result);
+ }
+ catch (const SSqlException& e) {
+ //DLOG(L<<"GSQLBackend unable to calculate SOA serial: " << e.txtReason()<<endl);
+diff -ru pdns-3.2/pdns/backends/gsql/gsqlbackend.hh pdns-3.2.new/pdns/backends/gsql/gsqlbackend.hh
+--- pdns/backends/gsql/gsqlbackend.hh 2013-01-17 10:16:52.000000000 +0100
++++ pdns/backends/gsql/gsqlbackend.hh 2013-05-03 10:46:20.135360708 +0200
+@@ -15,12 +15,24 @@
+ {
+ if(d_db)
+ delete d_db;
++ if(d_db_slave)
++ delete d_db_slave;
+ }
+
+ void setDB(SSql *db)
+ {
+ d_db=db;
+ }
++
++ void setDBReadonly(SSql *db)
++ {
++ d_db_slave=db;
++ }
++
++ SSql *getDBReadonly()
++ {
++ return d_db_slave != NULL ? d_db_slave : d_db;
++ }
+
+ virtual string sqlEscape(const string &name);
+ void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1);
+@@ -67,6 +79,7 @@
+ QType d_qtype;
+ int d_count;
+ SSql *d_db;
++ SSql *d_db_slave;
+ SSql::result_t d_result;
+
+ string d_wildCardNoIDQuery;
|