Hi Simon,

I got reported bug in Fedora [1], that cname is broken in new releases.
At first I though this was false report, but there is still new
regression in cname handling.

Before, it accepted alias with trailing dot. Not it would accept only
target, but not alias.

cname=alias.,target

is no longer valid. The issue is it will count size to skip after
canonicalize. If that ignores trailing dot, next name would be "". And
that is invalid and refused, dnsmasq refuses to start.

I also think that any whitespace like tab should be possible after
comma. So this fixes also 30858e3b9b12500825a5dc4cd67902c3201c1b25.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1498667
-- 
Petr Menšík
Software Engineer
Red Hat, http://www.redhat.com/
email: pemen...@redhat.com  PGP: 65C6C973
From 69f713eed3b765be3acb0f0e63baf936c6d30ac3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemen...@redhat.com>
Date: Mon, 26 Feb 2018 19:49:57 +0100
Subject: [PATCH] Fix cases when cname will shorten after canonicalize. This is
 the case when trailing dot is used in alias name. Ignore any whitespace after
 comma, not just spaces.

---
 src/option.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/option.c b/src/option.c
index edd0e62..482e501 100644
--- a/src/option.c
+++ b/src/option.c
@@ -3856,6 +3856,7 @@ err:
 
 	while (arg != last)
 	  {
+	    int arglen = strlen(arg);
 	    alias = canonicalise_opt(arg);
 
 	    if (!alias || !target)
@@ -3871,7 +3872,7 @@ err:
 	    new->target = target;
 	    new->ttl = ttl;
 
-	    for (arg += strlen(arg)+1; *arg == ' '; arg++);
+	    for (arg += arglen+1; *arg && isspace(*arg); arg++);
 	  }
       
 	break;
-- 
2.14.3

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to