BINDIR=/usr/bin/
CONFIGDIR="/etc/powerdns/"
OPTFLAGS?=-O3
-CXXFLAGS:= $(CXXFLAGS) -Wall $(OPTFLAGS) $(PROFILEFLAGS)
+CXXFLAGS:= $(CXXFLAGS) -Wall -DBOOST_SP_DISABLE_THREADS $(OPTFLAGS) $(PROFILEFLAGS)
CFLAGS:=$(CFLAGS) -Wall $(OPTFLAGS) $(PROFILEFLAGS)
LINKCC=$(CXX)
CC?=gcc
if(!s_first) {
return;
}
-
s_first=0;
s_state = shared_ptr<State>(new State);
loadConfig();
dl->registerFunc("BIND-LIST-REJECTS", &DLListRejectsHandler);
}
+Bind2Backend::~Bind2Backend()
+{
+ if(us==this) {
+ L<<Logger::Error<<"Main bind2backend instance being destructed"<<endl;
+ exit(1);
+ }
+}
+
void Bind2Backend::rediscover(string *status)
{
us->loadConfig(status);
vector<string> diff2;
set_difference(newnames.begin(), newnames.end(), oldnames.begin(), oldnames.end(), back_inserter(diff2));
newdomains=diff2.size();
-
- s_state = staging; // and boy do we hope this is a threadsafe operation!
+
+ s_state.swap(staging); // and boy do we hope this is a threadsafe operation!
// report
ostringstream msg;
using namespace std;
using namespace boost;
-
/** This struct is used within the Bind2Backend to store DNS information.
It is almost identical to a DNSResourceRecord, but then a bit smaller and with different sorting rules, which make sure that the SOA record comes up front.
*/
{
public:
Bind2Backend(const string &suffix=""); //!< Makes our connection to the database. Calls exit(1) if it fails.
+ ~Bind2Backend();
void getUnfreshSlaveInfos(vector<DomainInfo> *unfreshDomains);
void getUpdatedMasters(vector<DomainInfo> *changedDomains);
bool getDomainInfo(const string &domain, DomainInfo &di);
time_t getCtime(const string &fname);
-
void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1);
bool list(const string &target, int id);
typedef map<string, int> name_id_map_t;
typedef map<uint32_t, BB2DomainInfo> id_zone_map_t;
- struct State
+ struct State : public boost::noncopyable
{
name_id_map_t name_id_map; //!< convert a name to a domain id
id_zone_map_t id_zone_map;
};
extern const char *bind_directory;
+extern FILE *yyin;
class BindParser
{
public:
- BindParser() : d_dir("."), d_verbose(false)
+ BindParser() : d_dir("."), d_verbose(false)
{
+ yyin=0;
extern int include_stack_ptr;
include_stack_ptr=0;
bind_directory=d_dir.c_str();
}
+ ~BindParser()
+ {
+ if(yyin) {
+ fclose(yyin);
+ yyin=0;
+ }
+ }
void parse(const string &fname);
void commit(BindDomainInfo DI);
void setDirectory(const string &dir);