Bug 397 - an $INCLUDE directive with a relative origin set isn't used as relative
an $INCLUDE directive with a relative origin set isn't used as relative
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: Zonec Code
other
Other Linux
: P5 enhancement
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-11 12:42 CEST by Ondřej Surý
Modified: 2011-11-24 10:15 CET (History)
1 user (show)

See Also:


Attachments
lexer-allow-relative-origin-for-INCLUDE-directives.patch (677 bytes, patch)
2011-07-11 12:42 CEST, Ondřej Surý
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ondřej Surý 2011-07-11 12:42:28 CEST
Created attachment 172 [details]
lexer-allow-relative-origin-for-INCLUDE-directives.patch

As reported in http://bugs.debian.org/633534 by Hugh Davenport <hugh@davenport.net.nz>

> RFC 1035 states that an $INCLUDE directive is as follows (page 33)
> $INCLUDE <file-name> [<domain-name>] [<comment>]
> where <domain-name> is stated as follows (bottom of page 33)
> .... Domain names which do not end in a dot are called relative; the
> actual domain is the concatenation of the relative part with an origin
> specified in a $ORIGIN, $INCLUDE, or as an argument to the master file
> loading routine.
> 
> nsd doesn't use the domain-name attached to an $INCLUDE directive as a
> possible relative domain, and assumes it is absolute. The patch attached
> checks whether a dot (.) is present, and appends the origin if
> nessessary.
> 
> The patch should also apply cleanly upstream.

I personally didn't check if the reasoning and/or the patch is correct.
Comment 1 Matthijs Mekking 2011-10-26 11:24:50 CEST
It is hard to parse what is actually said here in this paragraph of RFC 1035,
but I don't think it is the intention to concatenate the domain-name in the $INCLUDE directive with the origin:

$INCLUDE <file-name> [<domain-name>] [<comment>]

$INCLUDE inserts the named file into the current file, and may optionally specify a domain name that sets the relative domain name origin for the included file. 

I am not sure what "relative domain name origin for the included file" means, but I read it has being the origin that needs to be concatenated to the relative domain names in the included file. To my understanding, the domain-name is the origin for domain names listed in the included file. Relative says something about origin, not about domain-name.

Instead of this fix, that concatenates the origin to the relative domain name in the $INCLUDE directive, I propose to make a fix that requires the domain-name in the $INCLUDE directive to be absolute.

That
Comment 2 Matthijs Mekking 2011-10-26 11:26:29 CEST
... continued

That fix is committed to the NSD repository. Please provide feedback if you think that is ok.

Best regards,
 Matthijs
Comment 3 Matthijs Mekking 2011-11-24 10:15:28 CET
Closing this ticket, the fix as interpreted has been included in the 3.2.9 release.