From: Ruben d'Arco Date: Fri, 4 Jan 2013 23:13:47 +0000 (+0100) Subject: Add increase-serial to pdnssec X-Git-Tag: auth-3.3-rc1~29^2~10^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=04576eed1c8229a9f5cbb6b43b5517094ec624ae;p=thirdparty%2Fpdns.git Add increase-serial to pdnssec --- diff --git a/pdns/Makefile.am b/pdns/Makefile.am index d17abc5021..9d188ab549 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -109,7 +109,8 @@ pdnssec_SOURCES=pdnssec.cc dbdnsseckeeper.cc sstuff.hh dnsparser.cc dnsparser.hh signingpipe.cc dnslabeltext.cc ednssubnet.cc cachecleaner.hh \ aes/aescpp.h \ aes/aescrypt.c aes/aes.h aes/aeskey.c aes/aes_modes.c aes/aesopt.h \ - aes/aestab.c aes/aestab.h aes/brg_endian.h aes/brg_types.h aes/dns_random.cc json.cc + aes/aestab.c aes/aestab.h aes/brg_endian.h aes/brg_types.h aes/dns_random.cc json.cc \ + serialtweaker.cc pdnssec_LDFLAGS=@moduleobjects@ @modulelibs@ @DYNLINKFLAGS@ @LIBDL@ @THREADFLAGS@ $(BOOST_PROGRAM_OPTIONS_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS) diff --git a/pdns/pdnssec.cc b/pdns/pdnssec.cc index 796eb5c9cf..84b417193e 100644 --- a/pdns/pdnssec.cc +++ b/pdns/pdnssec.cc @@ -411,6 +411,49 @@ int checkAllZones(DNSSECKeeper &dk) return 0; } +int increaseSerial(const string& zone, DNSSECKeeper &dk) +{ + UeberBackend B("default"); + SOAData sd; + sd.db=(DNSBackend*)-1; + if(!B.getSOA(zone, sd)) { + cout<<"No SOA for zone '"<lookup(QType(QType::SOA), zone); + vector rrs; + DNSResourceRecord rr; + while (sd.db->get(rr)) { + if (rr.qtype.getCode() == QType::SOA) + rrs.push_back(rr); + } + + if (rrs.size() > 1) { + cerr<replaceRRSet(sd.domain_id, zone, rr.qtype, rrs)) { + cerr<<"Backend did not replace SOA record. Backend might not support this operation."<convertToISC() <