[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r4212 - in branches/OpenDNSSEC-1.1: . signer/tools/v2

Matthijs Mekking matthijs at nlnetlabs.nl
Tue Nov 23 14:57:47 CET 2010


Author: matthijs
Date: 2010-11-23 14:57:47 +0100 (Tue, 23 Nov 2010)
New Revision: 4212

Modified:
   branches/OpenDNSSEC-1.1/NEWS
   branches/OpenDNSSEC-1.1/signer/tools/v2/adfile.c
Log:
rollback trunk bugfixes in file adapter



Modified: branches/OpenDNSSEC-1.1/NEWS
===================================================================
--- branches/OpenDNSSEC-1.1/NEWS	2010-11-23 11:27:45 UTC (rev 4211)
+++ branches/OpenDNSSEC-1.1/NEWS	2010-11-23 13:57:47 UTC (rev 4212)
@@ -2,6 +2,9 @@
 
 Bugfixes:
 * Bugreport #191: add a could not sign zone due to error log message.
+* Signer Engine: When reading file, convert newlines to spaces when they are
+  in between parentheses.
+* Signer Engine: Use the correct TTL for RRs after the $INCLUDE directive.
 
 OpenDNSSEC 1.1.3 - 2010-09-10
 

Modified: branches/OpenDNSSEC-1.1/signer/tools/v2/adfile.c
===================================================================
--- branches/OpenDNSSEC-1.1/signer/tools/v2/adfile.c	2010-11-23 11:27:45 UTC (rev 4211)
+++ branches/OpenDNSSEC-1.1/signer/tools/v2/adfile.c	2010-11-23 13:57:47 UTC (rev 4212)
@@ -74,7 +74,7 @@
 {
     int i;
     for (i = 0; i < line_len; i++) {
-        if (!isspace(line[i])) {
+        if (!isspace((int)line[i])) {
             return 0;
         }
     }
@@ -161,6 +161,8 @@
             if (depth == 0) {
                 break;
             }
+            line[li] = ' ';
+            li++;
         } else {
             line[li] = c;
             li++;
@@ -192,14 +194,15 @@
     ldns_rdf* tmp = NULL;
     FILE* fd_include = NULL;
     int len = 0, error = 0;
+    uint32_t new_ttl = 0;
     const char *endptr;  /* unused */
-    uint32_t new_ttl = 0;
+    int offset = 0;
 
+adfile_read_line:
     if (ttl && *ttl) {
         new_ttl = *ttl;
     }
 
-adfile_read_line:
     len = adapter_file_read_line(fd, line, l);
 
     if (len >= 0) {
@@ -212,7 +215,11 @@
                         ldns_rdf_deep_free(*orig);
                         *orig = NULL;
                     }
-                    tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, line + 8);
+                    offset = 8;
+                    while (isspace(line[offset])) {
+                        offset++;
+                    }
+                    tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, line + offset);
                     if (!tmp) {
                         /* could not parse what next to $ORIGIN */
                         *status = LDNS_STATUS_SYNTAX_DNAME_ERR;
@@ -224,15 +231,22 @@
                     break;
                 } else if (strncmp(line, "$TTL", 4) == 0 && isspace(line[4])) {
                     /* override default ttl */
-                    if (ttl) {
-                        *ttl = ldns_str2period(line + 5, &endptr);
+                    offset = 5;
+                    while (isspace(line[offset])) {
+                        offset++;
+                    }                    if (ttl) {
+                        *ttl = ldns_str2period(line + offset, &endptr);
                         new_ttl = *ttl;
                     }
                     goto adfile_read_line; /* perhaps next line is rr */
                     break;
                 } else if (strncmp(line, "$INCLUDE", 8) == 0 && isspace(line[8])) {
                     /* dive into this file */
-                    fd_include = fopen(line + 9, "r");
+                    offset = 9;
+                    while (isspace(line[offset])) {
+                        offset++;
+                    }
+                    fd_include = fopen(line + offset, "r");
                     if (fd_include) {
                         error = adapter_file_read(fd_include, zone_in, 1);
                         fclose(fd_include);
@@ -246,6 +260,8 @@
                         fprintf(stderr, "error in include file '%s'\n", line + 9);
                         return NULL;
                     }
+                    /* restore current ttl */
+                    *ttl = new_ttl;
                     goto adfile_read_line; /* perhaps next line is rr */
                     break;
                 }
@@ -271,16 +287,19 @@
                     ldns_rr2canonical(rr);
                     return rr;
                 } else if (*status == LDNS_STATUS_SYNTAX_EMPTY) {
-                    *status = LDNS_STATUS_OK;
                     if (rr) {
                         ldns_rr_free(rr);
                         rr = NULL;
                     }
+                    *status = LDNS_STATUS_OK;
                     goto adfile_read_line; /* perhaps next line is rr */
                     break;
                 } else {
                     fprintf(stderr, "error parsing RR at line %i (%s): %s\n", *l,
                         ldns_get_errorstr_by_id(*status), line);
+                    while (len >= 0) {
+                        len = adapter_file_read_line(fd, line, l);
+                    }
                     if (rr) {
                         ldns_rr_free(rr);
                         rr = NULL;




More information about the Opendnssec-commits mailing list