Changeset 1791
- Timestamp:
- 01/02/11 20:40:46 (2 years ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 6 modified
-
backends/gsql/gsqlbackend.cc (modified) (3 diffs)
-
backends/gsql/gsqlbackend.hh (modified) (2 diffs)
-
dbdnsseckeeper.cc (modified) (1 diff)
-
pdnssec.cc (modified) (3 diffs)
-
ueberbackend.cc (modified) (1 diff)
-
ueberbackend.hh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/backends/gsql/gsqlbackend.cc
r1790 r1791 102 102 SOAData sd; 103 103 if(!getSOA(domain,sd)) 104 L<<Logger::Notice<<"No serial for '"<<domain<<"' found - zone is missing?"<<endl;104 L<<Logger::Notice<<"No serial for '"<<domain<<"' found - zone is missing?"<<endl; 105 105 else 106 di.serial=sd.serial;106 di.serial=sd.serial; 107 107 } 108 108 catch(AhuException &ae){ … … 251 251 d_ClearDomainMetadataQuery = "delete from domainmetadata where domain_id=(select id from domains where name='%s') and domainmetadata.kind='%s'"; 252 252 d_SetDomainMetadataQuery = "insert into domainmetadata (domain_id, kind, content) select id, '%s', '%s' from domains where name='%s'"; 253 254 d_ActivateDomainKeyQuery = "update cryptokeys set active=1 where domain_id=(select id from domains where name='%s') and cryptokeys.id=%d"; 255 d_DeactivateDomainKeyQuery = "update cryptokeys set active=0 where domain_id=(select id from domains where name='%s') and cryptokeys.id=%d"; 256 d_RemoveDomainKeyQuery = "delete from cryptokeys where domain_id=(select id from domains where name='%s') and cryptokeys.id=%d"; 253 257 } 254 258 … … 327 331 return 1; // XXX FIXME, no idea how to get the id 328 332 } 333 334 bool GSQLBackend::activateDomainKey(const string& name, unsigned int id) 335 { 336 char output[1024]; 337 snprintf(output,sizeof(output)-1,d_ActivateDomainKeyQuery.c_str(), sqlEscape(name).c_str(), id); 338 339 try { 340 d_db->doCommand(output); 341 } 342 catch (SSqlException &e) { 343 throw AhuException("GSQLBackend unable to activate key: "+e.txtReason()); 344 } 345 return true; 346 } 347 348 bool GSQLBackend::deactivateDomainKey(const string& name, unsigned int id) 349 { 350 char output[1024]; 351 snprintf(output,sizeof(output)-1,d_DeactivateDomainKeyQuery.c_str(), sqlEscape(name).c_str(), id); 352 353 try { 354 d_db->doCommand(output); 355 } 356 catch (SSqlException &e) { 357 throw AhuException("GSQLBackend unable to deactivate key: "+e.txtReason()); 358 } 359 return true; 360 } 361 362 bool GSQLBackend::removeDomainKey(const string& name, unsigned int id) 363 { 364 char output[1024]; 365 snprintf(output,sizeof(output)-1,d_RemoveDomainKeyQuery.c_str(), sqlEscape(name).c_str(), id); 366 367 try { 368 d_db->doCommand(output); 369 } 370 catch (SSqlException &e) { 371 throw AhuException("GSQLBackend unable to remove key: "+e.txtReason()); 372 } 373 return true; 374 } 375 376 329 377 330 378 bool GSQLBackend::getDomainKeys(const string& name, unsigned int kind, std::vector<KeyData>& keys) -
trunk/pdns/pdns/backends/gsql/gsqlbackend.hh
r1790 r1791 48 48 bool getDomainMetadata(const string& name, const std::string& kind, std::vector<std::string>& meta); 49 49 bool setDomainMetadata(const string& name, const std::string& kind, const std::vector<std::string>& meta); 50 51 bool removeDomainKey(const string& name, unsigned int id); 52 bool activateDomainKey(const string& name, unsigned int id); 53 bool deactivateDomainKey(const string& name, unsigned int id); 54 50 55 private: 51 56 string d_qname; … … 87 92 string d_ClearDomainMetadataQuery; 88 93 string d_SetDomainMetadataQuery; 94 95 string d_RemoveDomainKeyQuery; 96 string d_ActivateDomainKeyQuery; 97 string d_DeactivateDomainKeyQuery; 89 98 protected: 90 99 bool d_dnssecQueries; -
trunk/pdns/pdns/dbdnsseckeeper.cc
r1790 r1791 89 89 void DNSSECKeeper::removeKey(const std::string& zname, unsigned int id) 90 90 { 91 // XXX 91 UeberBackend db; 92 db.removeDomainKey(zname, id); 92 93 } 93 94 94 95 void DNSSECKeeper::deactivateKey(const std::string& zname, unsigned int id) 95 96 { 96 // XX 97 UeberBackend db; 98 db.deactivateDomainKey(zname, id); 97 99 } 98 100 99 101 void DNSSECKeeper::activateKey(const std::string& zname, unsigned int id) 100 102 { 101 // XXX 103 UeberBackend db; 104 db.activateDomainKey(zname, id); 102 105 } 103 106 -
trunk/pdns/pdns/pdnssec.cc
r1788 r1791 24 24 return arg; 25 25 } 26 27 26 28 27 string humanTime(time_t t) … … 257 256 const string& zone=cmds[1]; 258 257 // need to get algorithm & ksk or zsk from commandline 258 cerr<<"Adding a ZSK"<<endl; 259 259 dk.addKey(zone, 1, 5, 0); 260 cerr<<"Not implemented"<<endl;261 260 } 262 261 else if(cmds[0] == "remove-zone-key") { … … 323 322 DNSSECPrivateKey dpk=dk.getKeyById(zone, id); 324 323 cout << dpk.d_key.convertToISC(dpk.d_algorithm) <<endl; 325 } 324 } 326 325 else if(cmds[0]=="import-zone-key") { 327 cerr<<"This isn't quite right yet!"<<endl; /// XXX FIXME 326 if(cmds.size()!=3) { 327 cerr<<"Syntax: pdnssec import-zone-key zone-name filename"<<endl; 328 exit(1); 329 } 328 330 string zone=cmds[1]; 329 331 string fname=cmds[2]; -
trunk/pdns/pdns/ueberbackend.cc
r1781 r1791 130 130 BOOST_FOREACH(DNSBackend* db, backends) { 131 131 if(db->setDomainMetadata(name, kind, meta)) 132 return true; 133 } 134 return false; 135 } 136 137 bool UeberBackend::activateDomainKey(const string& name, unsigned int id) 138 { 139 BOOST_FOREACH(DNSBackend* db, backends) { 140 if(db->activateDomainKey(name, id)) 141 return true; 142 } 143 return false; 144 } 145 146 bool UeberBackend::deactivateDomainKey(const string& name, unsigned int id) 147 { 148 BOOST_FOREACH(DNSBackend* db, backends) { 149 if(db->deactivateDomainKey(name, id)) 150 return true; 151 } 152 return false; 153 } 154 155 bool UeberBackend::removeDomainKey(const string& name, unsigned int id) 156 { 157 BOOST_FOREACH(DNSBackend* db, backends) { 158 if(db->removeDomainKey(name, id)) 132 159 return true; 133 160 } -
trunk/pdns/pdns/ueberbackend.hh
r1781 r1791 128 128 bool getDomainMetadata(const string& name, const std::string& kind, std::vector<std::string>& meta); 129 129 bool setDomainMetadata(const string& name, const std::string& kind, const std::vector<std::string>& meta); 130 131 bool removeDomainKey(const string& name, unsigned int id); 132 bool activateDomainKey(const string& name, unsigned int id); 133 bool deactivateDomainKey(const string& name, unsigned int id); 130 134 131 135 void alsoNotifies(const string &domain, set<string> *ips);