Changeset 1760
- Timestamp:
- 12/27/10 20:25:04 (2 years ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 3 modified
-
fsdnsseckeeper.cc (modified) (10 diffs)
-
misc.hh (modified) (1 diff)
-
pdnssec.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/fsdnsseckeeper.cc
r1758 r1760 38 38 outputs_t outputs; 39 39 push_back(outputs)("Modulus", &d_context.N)("PublicExponent",&d_context.E) 40 ("Modulus", &d_context.N)41 ("PublicExponent",&d_context.E)42 40 ("PrivateExponent",&d_context.D) 43 41 ("Prime1",&d_context.P) … … 84 82 { 85 83 // cerr<<"Entry: '"<< dir_itr->leaf() <<"'"<<endl; 86 if(ends_with(dir_itr->leaf(),". isc")) {84 if(ends_with(dir_itr->leaf(),".private")) { 87 85 // cerr<<"Hit!"<<endl; 88 86 … … 119 117 ++dir_itr ) 120 118 { 121 if(ends_with(dir_itr->leaf(),". isc")) {119 if(ends_with(dir_itr->leaf(),".private")) { 122 120 maxID = max(maxID, (unsigned int)atoi(dir_itr->leaf().c_str())); 123 121 } … … 171 169 172 170 { 173 ofstream iscFile((iscName+". isc").c_str());171 ofstream iscFile((iscName+".private").c_str()); 174 172 iscFile << isc; 175 173 } 176 174 177 175 { 178 ofstream dnskeyFile((iscName+". dnskey").c_str());176 ofstream dnskeyFile((iscName+".key").c_str()); 179 177 dnskeyFile << toCanonic("", name) << " IN DNSKEY " << drc.getZoneRepresentation()<<endl; 180 178 } … … 183 181 184 182 185 static bool zskCompareByID(const DNSSECKeeper::keyset_t::value_type& a, const DNSSECKeeper::keyset_t::value_type& b) 186 { 187 return a.second.id < b.second.id; 183 static bool keyCompareByKindAndID(const DNSSECKeeper::keyset_t::value_type& a, const DNSSECKeeper::keyset_t::value_type& b) 184 { 185 return make_pair(!a.second.keyOrZone, a.second.id) < 186 make_pair(!b.second.keyOrZone, b.second.id); 188 187 } 189 188 190 189 void DNSSECKeeper::removeKey(const std::string& zname, unsigned int id) 191 190 { 192 // unlink((d_dirname +"/"+ zname +"/zsks/"+fname).c_str()); 193 abort(); 191 string fname = getKeyFilenameById(d_dirname+"/keys/", id); 192 if(unlink(fname.c_str()) < 0) 193 unixDie("removing key file '"+fname+"'"); 194 194 } 195 195 196 196 void DNSSECKeeper::deactivateKey(const std::string& zname, unsigned int id) 197 197 { 198 // unlink((d_dirname +"/"+ zname +"/zsks/"+fname).c_str());199 198 string fname = getKeyFilenameById(d_dirname+"/keys/", id); 200 199 string newname = boost::replace_last_copy(fname, ".active", ".passive"); … … 205 204 void DNSSECKeeper::activateKey(const std::string& zname, unsigned int id) 206 205 { 207 // unlink((d_dirname +"/"+ zname +"/zsks/"+fname).c_str()); 208 abort(); 206 string fname = getKeyFilenameById(d_dirname+"/keys/", id); 207 string newname = boost::replace_last_copy(fname, ".passive", ".active"); 208 if(rename(fname.c_str(), newname.c_str()) < 0) 209 unixDie("renaming file to deactivate key, from: '"+fname+"' to '"+newname+"'"); 209 210 } 210 211 … … 264 265 { 265 266 //cerr<<"Entry: '"<< dir_itr->leaf() <<"'"<<endl; 266 if(ends_with(dir_itr->leaf(),". isc")) {267 if(ends_with(dir_itr->leaf(),".private")) { 267 268 DNSSECPrivateKey dpk; 268 269 getRSAKeyFromISC(&dpk.d_key.getContext(), dir_itr->path().file_string().c_str()); … … 286 287 &ts1.tm_mon, &ts1.tm_mday, &ts1.tm_hour, &ts1.tm_min); 287 288 288 289 289 ts1.tm_year -= 1900; 290 291 290 ts1.tm_mon--; 292 291 … … 300 299 keyset.push_back(make_pair(dpk, kmd)); 301 300 } 302 sort(keyset.begin(), keyset.end(), zskCompareByID);301 sort(keyset.begin(), keyset.end(), keyCompareByKindAndID); 303 302 } 304 303 … … 343 342 344 343 { 345 ofstream iscFile((iscName+". isc").c_str());344 ofstream iscFile((iscName+".private").c_str()); 346 345 iscFile << isc; 347 346 } 348 347 349 348 { 350 ofstream dnskeyFile((iscName+". dnskey").c_str());349 ofstream dnskeyFile((iscName+".key").c_str()); 351 350 dnskeyFile << toCanonic("", name) << " IN DNSKEY " << drc.getZoneRepresentation()<<endl; 352 351 } -
trunk/pdns/pdns/misc.hh
r1714 r1760 7 7 as published by the Free Software Foundation 8 8 9 10 9 This program is distributed in the hope that it will be useful, 11 10 but WITHOUT ANY WARRANTY; without even the implied warranty of -
trunk/pdns/pdns/pdnssec.cc
r1757 r1760 273 273 const string& zone=cmds[1]; 274 274 275 DNSSECKeeper::keyset_t keyset=dk.getKeys(zone , boost::indeterminate);275 DNSSECKeeper::keyset_t keyset=dk.getKeys(zone); 276 276 277 277 if(keyset.empty()) {