Hi, I've been playing with zone2sql a lot lately, and I'm trying<br>to mess with 1000s of old zonefiles and convert them from bind to<br>powerdns.<br> <br>I do not have control over the older zonefiles, so everytime I was doing
<br>some test conversions, I had to deal with all the lowercase "ns", "a",<br>"soa" and convert them with perl pies, and that meant copying all of them<br>first. In other words, it was a hassle.
<br> <br>Is this something that you all can change so that it can deal with<br>lowercase types? it takes a lot of the sting out of converting<br>zonefiles for me. So I thought I would ask.<br> <br>I added a quick patch with a tiny functor to deal with this directly in
<br>QType::chartocode, qtype.cc It's only a few lines, and you all might<br>want it in a different style, but the functionality is all I'm looking<br>for. <br><br>--- qtype.orig 2007-04-26 14:08:52.000000000 -0500
<br>+++ qtype.cc 2007-04-26 14:08:43.000000000 -0500<br>@@ -85,12 +85,27 @@<br> return *this;<br> }<br> <br>+<br>+// Functor for calling std::toupper.<br>+// <br>+struct ToUpper {<br>+ int operator() ( int c )<br>+ {
<br>+ return std::toupper ( c );<br>+ }<br>+};<br>+<br> int QType::chartocode(const char *p)<br> {<br>+<br>+ std::string codestr(p);<br>+ std::transform(codestr.begin(), codestr.end(), codestr.begin(), ToUpper());<br>
+<br> static QType qt;<br> vector<namenum>::iterator pos;<br> for(pos=names.begin();pos<names.end();++pos)<br>- if(pos->first==p)<br>+ if(pos->first==codestr.c_str()) // Do compare with converted string
<br> return pos->second;<br> <br> return 0;<br><br>=======================================<br><br>I'm not sure of any ill effects this could have, but chartocode is<br>only called from 8 or 9 places in pdns, and it's not updating any
<br>input, so it seems pretty safe, but you all will know better than<br>I.<br>Also, I'm aware that you all might have built this functionality into<br>another part of the code, and you could add that behavior much more
<br>elegantly, but I just wanted to submit a prototype to see if it's<br>something that you are all interested in or if I should just keep<br>it for myself own use.<br><br>Thanks,<br><br>Pete<br><br><br>