Package: opendnssec-signer-tools
Severity: normal
Tags: patch

In the quicksorter file, if you have an $INCLUDE directive without
an explicit ORIGIN after the filename, it incorrectly takes the first
token on the next line as the origin.

When an origin is not specified, it should use the currect origin for
the included file

I have attached a patch to fix this.


-- System Information:
Debian Release: 6.0
  APT prefers stable
  APT policy: (950, 'stable'), (850, 'stable-updates'), (50, 'testing'), (25, 
'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- Begin Message ---
This patch fixes two problems

First, if an $INCLUDE directive did not have an explicit origin after
the path, then the first token from the next line was used (unless
there was a ; as the next token). This is because the program assumes the
filename is followed by something else, so skips over the next charater
(which was a NULL character, previously a new line character)
This patch fixes this by checking if we are at the end of the line already
then not getting the next token.

Second, if the directive doesn't have an explicit origin, then no origin was
set in the next file. This patch fixes this by setting it to the currect
origin if none was provided.
---
 signer/tools/quicksorter.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/signer/tools/quicksorter.c b/signer/tools/quicksorter.c
index ee718ba..36855e7 100644
--- a/signer/tools/quicksorter.c
+++ b/signer/tools/quicksorter.c
@@ -394,10 +394,12 @@ int read_file(char* filename,
                     char* filename = p;
                     while (*p && !isspace(*p))
                         p++;
-                    *p = 0; /* terminate filename */
-                    p++;
-                    while (*p && isspace(*p))
+                    if (*p) {
+                        *p = 0; /* terminate filename */
                         p++;
+                        while (*p && isspace(*p))
+                            p++;
+                    }
 
                     char* domain = NULL;
                     if (*p && *p != ';') {
@@ -406,6 +408,9 @@ int read_file(char* filename,
                             p++;
                         *p = 0; /* terminate domain name */
                     }
+                    else {
+                        domain = origin;
+                    }
                     read_file(filename, domain, default_ttl, dnskey_ttl, g);
                     goto next_line;
                 }
-- 

--- End Message ---

Reply via email to