unset-presigned *ZONE*
: Disables presigned operation for *ZONE*.
+## DEBUGGING TOOLS
+
+backend-cmd *BACKEND* *CMD* [*CMD..*]
+: Send a text command to a backend for execution. GSQL backends will take SQL
+ commands, other backends may take different things. Be careful!
+
# SEE ALSO
pdns_server (1), pdns_control (1)
* `activate-zone-key ZONE KEY-ID`: Activate a key with id KEY-ID within a zone called ZONE.
* `add-zone-key ZONE [ksk|zsk] [bits] [rsasha1|rsasha256|rsasha512|gost|ecdsa256|ecdsa384]`: Create a new key for zone ZONE, and make it a KSK or a ZSK, with the specified algorithm.
+* `backend-cmd BACKEND CMD [CMD..]`: Send a text command to a backend for execution. GSQL backends will take SQL commands, other backends may take different things. Be careful!
* `check-zone ZONE`: Check a zone for DNSSEC correctness. Main goals is to check if the auth flag is set correctly.
* `check-all-zones`: Check all zones for DNSSEC correctness. Added in 3.1.
* `deactivate-zone-key ZONE KEY-ID`: Deactivate a key with id KEY-ID within a zone called ZONE.
return true;
}
+string GSQLBackend::directBackendCmd(const string &query)
+{
+ try {
+ ostringstream out;
+
+ unique_ptr<SSqlStatement> stmt(d_db->prepare(query,0));
+
+ stmt->execute();
+
+ SSqlStatement::row_t row;
+
+ while(stmt->hasNextRow()) {
+ stmt->nextRow(row);
+ for(const auto &col: row)
+ out<<"\'"<<col<<"\'\t";
+ out<<endl;
+ }
+
+ return out.str();
+ }
+ catch (SSqlException &e) {
+ throw PDNSException("GSQLBackend unable to execute query: "+e.txtReason());
+ }
+}
+
+
SSqlStatement::~SSqlStatement() {
// make sure vtable won't break
}
bool getComment(Comment& comment);
void feedComment(const Comment& comment);
bool replaceComments(const uint32_t domain_id, const DNSName& qname, const QType& qt, const vector<Comment>& comments);
+ bool replaceComments(const uint32_t domain_id, const string& qname, const QType& qt, const vector<Comment>& comments);
+ string directBackendCmd(const string &query);
private:
DNSName d_qname;
return false;
}
+ virtual string directBackendCmd(const string &query)
+ {
+ return "directBackendCmd not supported for this backend\n";
+ }
+
const string& getPrefix() { return d_prefix; };
protected:
bool mustDo(const string &key);
using boost::lexical_cast;
using boost::tie;
using std::shared_ptr;
+using std::unique_ptr;
using boost::shared_array;
using boost::scoped_array;
using boost::tuple;
cerr<<"add-zone-key ZONE zsk|ksk [bits] [active|passive]"<<endl;
cerr<<" [rsasha1|rsasha256|rsasha512|gost|ecdsa256|ecdsa384]"<<endl;
cerr<<" Add a ZSK or KSK to zone and specify algo&bits"<<endl;
+ cerr<<"backend-cmd BACKEND CMD [CMD..] Perform one or more backend commands"<<endl;
cerr<<"b2b-migrate old new Move all data from one backend to another"<<endl;
cerr<<"bench-db [filename] Bench database backend with queries, one domain per line"<<endl;
cerr<<"check-zone ZONE Check a zone for correctness"<<endl;
cout<<"Remember to drop the old backend and run rectify-all-zones"<<endl;
+ return 0;
+ } else if (cmds[0] == "backend-cmd") {
+ if (cmds.size() < 3) {
+ cerr<<"Usage: backend-cmd BACKEND CMD [CMD..]"<<endl;
+ return 1;
+ }
+
+ DNSBackend *db;
+ db = NULL;
+
+ for(DNSBackend *b : BackendMakers().all()) {
+ if (b->getPrefix() == cmds[1]) db = b;
+ }
+
+ if (!db) {
+ cerr<<"Unknown backend '"<<cmds[1]<<"'"<<endl;
+ return 1;
+ }
+
+ for(auto i=next(begin(cmds),2); i != end(cmds); ++i) {
+ cerr<<"== "<<*i<<endl;
+ cout<<db->directBackendCmd(*i);
+ }
+
return 0;
} else {
cerr<<"Unknown command '"<<cmds[0] <<"'"<< endl;