const string& domain=parts[1];
DomainInfo di;
- PacketHandler P;
- if(!P.getBackend()->getDomainInfo(domain, di))
+ UeberBackend B;
+ if(!B.getDomainInfo(domain, di))
return "Domain '"+domain+"' unknown";
if(di.masters.empty())
string DLRediscoverHandler(const vector<string>&parts, Utility::pid_t ppid)
{
- PacketHandler P;
+ UeberBackend B;
try {
L<<Logger::Error<<"Rediscovery was requested"<<endl;
string status="Ok";
- P.getBackend()->rediscover(&status);
+ B.rediscover(&status);
return status;
}
catch(PDNSException &ae) {
string DLReloadHandler(const vector<string>&parts, Utility::pid_t ppid)
{
- PacketHandler P;
- P.getBackend()->reload();
+ UeberBackend B;
+ B.reload();
L<<Logger::Error<<"Reload was requested"<<endl;
return "Ok";
}
bool CommunicatorClass::notifyDomain(const string &domain)
{
DomainInfo di;
- PacketHandler P;
- if(!P.getBackend()->getDomainInfo(domain, di)) {
+ UeberBackend B;
+ if(!B.getDomainInfo(domain, di)) {
L<<Logger::Error<<"No such domain '"<<domain<<"' in our database"<<endl;
return false;
}
- queueNotifyDomain(domain, P.getBackend());
+ queueNotifyDomain(domain, &B);
// call backend and tell them we sent out the notification - even though that is premature
di.backend->setNotified(di.id, di.serial);
void CommunicatorClass::suck(const string &domain,const string &remote)
{
L<<Logger::Error<<"Initiating transfer of '"<<domain<<"' from remote '"<<remote<<"'"<<endl;
- PacketHandler P; // fresh UeberBackend
+ UeberBackend B; // fresh UeberBackend
DomainInfo di;
di.backend=0;
bool transaction=false;
try {
- UeberBackend *B=P.getBackend(); // copy of the same UeberBackend
- DNSSECKeeper dk (B); // reuse our UeberBackend copy for DNSSECKeeper
+ DNSSECKeeper dk (&B); // reuse our UeberBackend copy for DNSSECKeeper
- if(!B->getDomainInfo(domain, di) || !di.backend) { // di.backend and B are mostly identical
+ if(!B.getDomainInfo(domain, di) || !di.backend) { // di.backend and B are mostly identical
L<<Logger::Error<<"Can't determine backend for domain '"<<domain<<"'"<<endl;
return;
}
string tsigkeyname, tsigalgorithm, tsigsecret;
if(dk.getTSIGForAccess(domain, remote, &tsigkeyname)) {
string tsigsecret64;
- if(B->getTSIGKey(tsigkeyname, &tsigalgorithm, &tsigsecret64)) {
+ if(B.getTSIGKey(tsigkeyname, &tsigalgorithm, &tsigsecret64)) {
B64Decode(tsigsecret64, tsigsecret);
} else {
L<<Logger::Error<<"TSIG key '"<<tsigkeyname<<"' for domain '"<<domain<<"' not found"<<endl;
scoped_ptr<AuthLua> pdl;
vector<string> scripts;
- if(B->getDomainMetadata(domain, "LUA-AXFR-SCRIPT", scripts) && !scripts.empty()) {
+ if(B.getDomainMetadata(domain, "LUA-AXFR-SCRIPT", scripts) && !scripts.empty()) {
try {
pdl.reset(new AuthLua(scripts[0]));
L<<Logger::Info<<"Loaded Lua script '"<<scripts[0]<<"' to edit the incoming AXFR of '"<<domain<<"'"<<endl;
vector<string> localaddr;
ComboAddress laddr;
- if(B->getDomainMetadata(domain, "AXFR-SOURCE", localaddr) && !localaddr.empty()) {
+ if(B.getDomainMetadata(domain, "AXFR-SOURCE", localaddr) && !localaddr.empty()) {
try {
laddr = ComboAddress(localaddr[0]);
L<<Logger::Info<<"AXFR source for domain '"<<domain<<"' set to "<<localaddr[0]<<endl;