]> granicus.if.org Git - pdns/commitdiff
make importing keys a bit more resilient against whitespace, plus fix up setting...
authorBert Hubert <bert.hubert@netherlabs.nl>
Thu, 6 Jan 2011 21:14:41 +0000 (21:14 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Thu, 6 Jan 2011 21:14:41 +0000 (21:14 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1824 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/dnssecinfra.cc
pdns/pdnssec.cc

index 33e0acf5563ad02175bd13883d81bca4898dce5e..eec44bfa0f1ca81fd1ab85573fcc584205ceb176 100644 (file)
@@ -90,7 +90,9 @@ DNSKEYRecordContent getRSAKeyFromISC(rsa_context* rsa, const char* fname)
   while(stringfgets(fp, sline)) {
     tie(key,value)=splitField(sline, ':');
     trim(value);
-
+    trim(key);
+    if(key.empty())
+      continue;
     if(places.count(key)) {
       if(places[key]) {
 
@@ -110,7 +112,7 @@ DNSKEYRecordContent getRSAKeyFromISC(rsa_context* rsa, const char* fname)
     }
     else {
       if(key != "Private-key-format" && key != "Algorithm") 
-       cerr<<"Unknown field '"<<key<<"'\n";
+        cerr<<"Unknown field '"<<key<<"'\n";
     }
   }
   rsa->len = ( mpi_msb( &rsa->N ) + 7 ) >> 3; // no clue what this does
index 7069fd5318eade208b0e97234496c2356817ed3a..a24e928e0b5960210d458f7b932fdc29220617ab 100644 (file)
@@ -351,7 +351,7 @@ try
     cout << dpk.d_key.convertToISC(dpk.d_algorithm) <<endl;
   }  
   else if(cmds[0]=="import-zone-key") {
-    if(cmds.size()!=3) {
+    if(cmds.size() < 3) {
       cerr<<"Syntax: pdnssec import-zone-key zone-name filename"<<endl;
       exit(1);
     }