Package: opendnssec-signer
Version: 1:1.4.6-6
Severity: normal
Tags: patch

Dear Maintainer,

When configuring the opendnssec-signerd to sign a local zone file I receive
error in my syslog:

    [adapter] error parsing RR at line 172 (Syntax error, could not parse the 
RR): 
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

The signing itself did not happen.
I expected to receive a signed zone file from ods-signerd.

The problem is because on my ARM CPU the function `adutil_readline_frm_file`
from `signer/src/adapter/adutil.c` fails to detect `EOF`, because `char` on ARM
is unsigned and `EOF` is `-1`.
Upstream has a patch available, which is *not* yet included in 1.4.7 (the
current release in experimental, but on the branch for the next upstream 1.4 
release.
The patch is attached and available here: 
https://github.com/opendnssec/opendnssec/commit/75df18925f512a3906bc0c27f1030e055f11b41f

-- System Information:
Debian Release: 8.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: armhf (armv7l)

Kernel: Linux 4.1.6-249 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages opendnssec-signer depends on:
ii  dpkg               1.17.25
ii  libc6              2.19-18+deb8u1
ii  libldns1           1.6.17-5+b1
ii  libssl1.0.0        1.0.1k-3+deb8u1
ii  libxml2            2.9.1+dfsg1-5
ii  opendnssec-common  1:1.4.6-6

Versions of packages opendnssec-signer recommends:
ii  opendnssec           1:1.4.6-6
ii  opendnssec-enforcer  1:1.4.6-6
ii  softhsm              1.3.7-2
>From 75df18925f512a3906bc0c27f1030e055f11b41f Mon Sep 17 00:00:00 2001
From: Yuri Schaeffer <y...@nlnetlabs.nl>
Date: Mon, 27 Jul 2015 15:46:15 +0200
Subject: [PATCH] ARM chars are unsigned by default, therefore c==EOF will
 always yield false.

---
 signer/src/adapter/adutil.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/signer/src/adapter/adutil.c b/signer/src/adapter/adutil.c
index 59a2c38..7719fca 100644
--- a/signer/src/adapter/adutil.c
+++ b/signer/src/adapter/adutil.c
@@ -87,14 +87,14 @@ adutil_readline_frm_file(FILE* fd, char* line, unsigned int* l,
     int in_string = 0;
     int depth = 0;
     int comments = 0;
-    char c = 0;
-    char lc = 0;
+    int c = 0;
+    int lc = 0;
 
     for (i = 0; i < SE_ADFILE_MAXLINE; i++) {
-        c = (char) ods_fgetc(fd, l);
+        c = ods_fgetc(fd, l);
         if (comments) {
-            while (c != EOF && c != '\n') {
-                c = (char) ods_fgetc(fd, l);
+            while (c != EOF && (char)c != '\n') {
+                c = ods_fgetc(fd, l);
             }
         }
 
@@ -109,27 +109,27 @@ adutil_readline_frm_file(FILE* fd, char* line, unsigned int* l,
             } else {
                 return -1;
             }
-        } else if (c == '"' && lc != '\\') {
+        } else if ((char)c == '"' && (char)lc != '\\') {
             in_string = 1 - in_string; /* swap status */
-            line[li] = c;
+            line[li] = (char)c;
             li++;
-        } else if (c == '(') {
+        } else if ((char)c == '(') {
             if (in_string) {
-                line[li] = c;
+                line[li] = (char)c;
                 li++;
-            } else if (lc != '\\') {
+            } else if ((char)lc != '\\') {
                 depth++;
                 line[li] = ' ';
                 li++;
             } else {
-                line[li] = c;
+                line[li] = (char)c;
                 li++;
             }
-        } else if (c == ')') {
+        } else if ((char)c == ')') {
             if (in_string) {
-                line[li] = c;
+                line[li] = (char)c;
                 li++;
-            } else if (lc != '\\') {
+            } else if ((char)lc != '\\') {
                 if (depth < 1) {
                     ods_log_error("[%s] read line: bracket mismatch "
                         "discovered at line %i, missing '('", adapter_str,
@@ -141,20 +141,20 @@ adutil_readline_frm_file(FILE* fd, char* line, unsigned int* l,
                 line[li] = ' ';
                 li++;
             } else {
-                line[li] = c;
+                line[li] = (char)c;
                 li++;
             }
-        } else if (c == ';') {
+        } else if ((char)c == ';') {
             if (in_string) {
-                line[li] = c;
+                line[li] = (char)c;
                 li++;
-            } else if (lc != '\\' && !keep_comments) {
+            } else if ((char)lc != '\\' && !keep_comments) {
                 comments = 1;
             } else {
-                line[li] = c;
+                line[li] = (char)c;
                 li++;
             }
-        } else if (c == '\n' && lc != '\\') {
+        } else if ((char)c == '\n' && (char)lc != '\\') {
             comments = 0;
             /* if no depth issue, we are done */
             if (depth == 0) {
@@ -163,7 +163,7 @@ adutil_readline_frm_file(FILE* fd, char* line, unsigned int* l,
             line[li] = ' ';
             li++;
         } else {
-            line[li] = c;
+            line[li] = (char)c;
             li++;
         }
         /* continue with line */
-- 
2.5.1

Reply via email to