[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r3654 - trunk/OpenDNSSEC/signer/src/adapter

Matthijs Mekking matthijs at nlnetlabs.nl
Thu Aug 5 17:45:02 CEST 2010


Author: matthijs
Date: 2010-08-05 17:45:02 +0200 (Thu, 05 Aug 2010)
New Revision: 3654

Modified:
   trunk/OpenDNSSEC/signer/src/adapter/adfile.c
Log:
data incorrectly skipped because out of zone Story ID:4577064


Modified: trunk/OpenDNSSEC/signer/src/adapter/adfile.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2010-08-05 14:04:51 UTC (rev 3653)
+++ trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2010-08-05 15:45:02 UTC (rev 3654)
@@ -65,6 +65,36 @@
 }
 
 
+/*
+ * Trim trailing whitespace.
+ *
+ */
+static void
+adfile_rtrim(char* line, int* line_len)
+{
+    int i = strlen(line), nl = 0;
+    int trimmed = 0;
+
+    while (i>0) {
+        --i;
+        if (line[i] == '\n') {
+            nl = 1;
+        }
+        if (line[i] == ' ' || line[i] == '\t' || line[i] == '\n') {
+            line[i] = '\0';
+            trimmed++;
+        } else {
+            break;
+        }
+    }
+    if (nl) {
+        line[++i] = '\n';
+    }
+    *line_len -= trimmed;
+    return;
+}
+
+
 /**
  * Read one line from zone file.
  *
@@ -183,6 +213,8 @@
 
     while (line_len >= 0) {
         line_len = adfile_read_line(fd, (char*) line, &l);
+        adfile_rtrim(line, &line_len);
+
         if (line_len > 0) {
             if (line[0] != ';') {
                 status = ldns_rr_new_frm_str(&cur_rr, line, 0, NULL, NULL);
@@ -222,6 +254,7 @@
 
 adfile_read_line:
     len = adfile_read_line(fd, line, l);
+    adfile_rtrim(line, &len);
 
     if (len >= 0) {
         switch (line[0]) {




More information about the Opendnssec-commits mailing list