{
rr.qname=qname+"."+bb2.d_name+".";
if(nsec3zone)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
+ hashed=toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname));
insert(stage, id, rr.qname, rr.qtype, rr.content, rr.ttl, rr.priority, hashed);
}
}
if(nsec3zone) {
if(rr.qtype.getCode() != QType::NSEC3 && rr.qtype.getCode() != QType::RRSIG)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
+ hashed=toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname));
else
hashed="";
}
if(nsec3zone) {
if(rr.qtype.getCode() != QType::NSEC3 && rr.qtype.getCode() != QType::RRSIG)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
+ hashed=toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname));
else
hashed="";
}
output = (boost::format(d_InsertEntQuery) % domain_id % toLower(sqlEscape(qname))).str();
} else {
ordername=toBase32Hex(hashQNameWithSalt(times, salt, qname));
- output = (boost::format(d_InsertEntOrderQuery) % domain_id % toLower(sqlEscape(qname)) % toLower(sqlEscape(ordername))).str();
+ output = (boost::format(d_InsertEntOrderQuery) % domain_id % toLower(sqlEscape(qname)) % sqlEscape(ordername)).str();
}
try {
/* convert a binary string to base32hex */
string toBase32Hex(const std::string& input)
{
- static const char base32hex[] = "0123456789ABCDEFGHIJKLMNOPQRSTUV=";
+ static const char base32hex[] = "0123456789abcdefghijklmnopqrstuv=";
string ret;
ret.reserve(4+ 8*input.length()/5); // optimization
// process input in groups of 5 8-bit chunks, emit 8 5-bit chunks
string nsec3Hash(const string &qname, const string &salt, unsigned int iters)
{
- return toLower(toBase32Hex(hashQNameWithSalt(iters, salt, qname)));
+ return toBase32Hex(hashQNameWithSalt(iters, salt, qname));
}
void proveOrDeny(const nsec3set &nsec3s, const string &qname, const string &salt, unsigned int iters, set<string> &proven, set<string> &denied)
// cerr<<toBase32Hex(r.d_nexthash)<<endl;
vector<string> parts;
boost::split(parts, i->first.d_label, boost::is_any_of("."));
- nsec3s.insert(make_pair(toLower(parts[0]), toLower(toBase32Hex(r.d_nexthash))));
+ nsec3s.insert(make_pair(toLower(parts[0]), toBase32Hex(r.d_nexthash)));
nsec3salt = r.d_salt;
nsec3iters = r.d_iterations;
}
void emitNSEC3(DNSBackend& B, const NSEC3PARAMRecordContent& ns3prc, const SOAData& sd, const std::string& unhashed, const std::string& begin, const std::string& end, const std::string& toNSEC3, DNSPacket *r, int mode)
{
-// cerr<<"We should emit NSEC3 '"<<toLower(toBase32Hex(begin))<<"' - ('"<<toNSEC3<<"') - '"<<toLower(toBase32Hex(end))<<"' (unhashed: '"<<unhashed<<"')"<<endl;
+// cerr<<"We should emit NSEC3 '"<<toBase32Hex(begin)<<"' - ('"<<toNSEC3<<"') - '"<<toBase32Hex(end)<<"' (unhashed: '"<<unhashed<<"')"<<endl;
NSEC3RecordContent n3rc;
n3rc.d_salt=ns3prc.d_salt;
n3rc.d_flags = ns3prc.d_flags;
n3rc.d_nexthash=end;
- rr.qname=dotConcat(toLower(toBase32Hex(begin)), sd.qname);
+ rr.qname=dotConcat(toBase32Hex(begin), sd.qname);
rr.ttl = sd.default_ttl;
rr.qtype=QType::NSEC3;
rr.content=n3rc.getZoneRepresentation();
before.clear();
else
before=' ';
- ret=db->getBeforeAndAfterNamesAbsolute(id, toLower(toBase32Hex(hashed)), unhashed, before, after);
+ ret=db->getBeforeAndAfterNamesAbsolute(id, toBase32Hex(hashed), unhashed, before, after);
before=fromBase32Hex(before);
after=fromBase32Hex(after);
}
// now get the NSEC3 and NSEC3PARAM
string hashed=hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, unhashed);
getNSEC3Hashes(narrow, sd.db, sd.domain_id, hashed, false, unhashed, before, after);
- unhashed=dotConcat(toLower(toBase32Hex(before)), sd.qname);
+ unhashed=dotConcat(toBase32Hex(before), sd.qname);
n3rc.d_set=nrc.d_set; // Copy d_set from NSEC
n3rc.d_algorithm=ns3pr.d_algorithm;
if(haveNSEC3)
{
if(!narrow) {
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, qname)));
+ hashed=toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, qname));
if(g_verbose)
cerr<<"'"<<qname<<"' -> '"<< hashed <<"'"<<endl;
sd.db->updateDNSSECOrderAndAuthAbsolute(sd.domain_id, qname, hashed, auth);
cerr<<"The '"<<zone<<"' zone uses narrow NSEC3, but calculating hash anyhow"<<endl;
}
- cout<<toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, record)))<<endl;
+ cout<<toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, record))<<endl;
}
else if(cmds[0]=="unset-nsec3") {
if(cmds.size() < 2) {
if(!d_string.empty())
d_string.append(1,' ');
- d_string.append(toBase32Hex(val));
+ d_string.append(toUpper(toBase32Hex(val)));
}
} while(chopOff(shorter));
if (! *narrow && (ddepth == 0 || (ddepth == 1 && nssets.count(qname)))) {
- hashed = toLower(toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, qname)));
+ hashed = toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, qname));
di->backend->updateDNSSECOrderAndAuthAbsolute(di->id, qname, hashed, (ddepth == 0));
if (nssets.count(qname)) {
if(*haveNSEC3) {
string hashed;
if(! *narrow)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, rrLabel)));
+ hashed=toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, rrLabel));
if (*narrow)
di->backend->nullifyDNSSECOrderNameAndUpdateAuth(di->id, rrLabel, auth);
{
string hashed;
if(! *narrow)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, rrLabel)));
+ hashed=toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, rrLabel));
if (*narrow)
di->backend->nullifyDNSSECOrderNameAndUpdateAuth(di->id, rrLabel, auth);
if(*haveNSEC3) {
string hashed;
if(! *narrow)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, *qname)));
+ hashed=toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, *qname));
if (*narrow)
di->backend->nullifyDNSSECOrderNameAndUpdateAuth(di->id, rrLabel, auth);
if(*haveNSEC3) {
string hashed;
if(! *narrow)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, *changeRec)));
+ hashed=toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, *changeRec));
di->backend->updateDNSSECOrderAndAuthAbsolute(di->id, *changeRec, hashed, true);
}
{
string hashed;
if(! *narrow)
- hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, *i)));
+ hashed=toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, *i));
di->backend->updateDNSSECOrderAndAuthAbsolute(di->id, *i, hashed, true);
}
}
else if (haveNSEC3) {
string hashed;
if (!narrow)
- hashed = toLower(toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, newRec.qname)));
+ hashed = toBase32Hex(hashQNameWithSalt(ns3pr->d_iterations, ns3pr->d_salt, newRec.qname));
di->backend->updateDNSSECOrderAndAuthAbsolute(di->id, newRec.qname, hashed, true);
}
if (dnssecZone && rr.qtype.getCode() != QType::RRSIG) {
if (haveNSEC3) {
// NSEC3
- ordername=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
+ ordername=toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname));
if(!narrow && (rr.auth || (rr.qtype.getCode() == QType::NS && (!gotOptOutFlag || secured.count(ordername))))) {
di.backend->feedRecord(rr, &ordername);
} else
inext = nsecxrepo.begin();
}
n3rc.d_nexthash = inext->first;
- rr.qname = dotConcat(toLower(toBase32Hex(iter->first)), sd.qname);
+ rr.qname = dotConcat(toBase32Hex(iter->first), sd.qname);
rr.ttl = sd.default_ttl;
rr.content = n3rc.getZoneRepresentation();
// RFC test vectors
cases_t cases = boost::assign::list_of
(case_t(std::string(""), std::string("")))
- (case_t(std::string("f"), std::string("CO======")))
- (case_t(std::string("fo"), std::string("CPNG====")))
- (case_t(std::string("foo"), std::string("CPNMU===")))
- (case_t(std::string("foob"), std::string("CPNMUOG=")))
- (case_t(std::string("fooba"), std::string("CPNMUOJ1")))
- (case_t(std::string("foobar"), std::string("CPNMUOJ1E8======")))
+ (case_t(std::string("f"), std::string("co======")))
+ (case_t(std::string("fo"), std::string("cpng====")))
+ (case_t(std::string("foo"), std::string("cpnmu===")))
+ (case_t(std::string("foob"), std::string("cpnmuog=")))
+ (case_t(std::string("fooba"), std::string("cpnmuoj1")))
+ (case_t(std::string("foobar"), std::string("cpnmuoj1e8======")))
;
BOOST_FOREACH(const case_t& val, cases) {