Search code examples
dnsrfcrfc1035

In what cases can a DNS master file contain a CRLF?


While reading RFC 1035 Section 5.1 in order to write a master file parser, I stumbled across the following statement:

5.1. Format

The format of these files is a sequence of entries. Entries are predominantly line-oriented, though parentheses can be used to continue a list of items across a line boundary, and text literals can contain CRLF within the text. Any combination of tabs and spaces act as a delimiter between the separate items that make up an entry. The end of any line in the master file can end with a comment. The comment starts with a ";" (semicolon).

What do the authors mean by "text literals can contain CRLF within the text"? I am aware that the beneath entry is valid as outlined in Section 5.3 but I fail to find either an example of the statement or a proper definition of "text literal". I have furthermore searched the companion RFC 1034 without success for any mention of the above statement.

@   IN  SOA     VENERA      Action\.domains (
                                 20     ; SERIAL
                                 7200   ; REFRESH
                                 600    ; RETRY
                                 3600000; EXPIRE
                                 60)    ; MINIMUM

I would assume a text literal could be delimited by parentheses. Would any of the following comments be valid per RFC 1035 and in what different ways would a CRLF be valid in the file?

@   IN  SOA     VENERA      Action\.domains (
                                 20     ;  Some example of a multi-line comment 
                                           inside parentheses
                                 7200
                                 600
                                 3600000
                                 60)    ;  (Some example of parentheses
                                           inside a multi-line comment)

Solution

  • It means that this is supposed to be valid:

    example.com. IN TXT "hello,
    world"
    

    The RFC authors probably expect it to be equivalent to:

    example.com. IN TXT "hello,\013\010world"
    

    Due to the ambiguity of line ending encodings in this situations (if the platform uses LF as the line terminator, do you still get CRLF in the TXT record?), I doubt this is widely implemented.