ltd-beget / dns-zone-tokenizer Goto Github PK
View Code? Open in Web Editor NEWDnszone file lexical parser
License: MIT License
Dnszone file lexical parser
License: MIT License
If there are tabs at the beginning of the second (or subsequent) lines in a multi line TXT record, the tokenizer only returns the first line of text. It correctly ignores space and newline, but currently doesn't ignore tab.
While this may not be too widespread, the functions that DirectAdmin (server management software) uses to create TXT records inserts tabs at the beginning of the second (and subsequent) lines of a multi line TXT record, and as DirectAdmin is widely used it would be nice to be able to support this.
I've created a fix and a pull request for this: #23
I appreciate your fantastic script - thanks!
Hi!
I'd like to ask a quick question about your tokeniser.
Imagine that I have something like this (simplified) example:
$ORIGIN typefish.co.uk.
@ 3600 IN A 127.0.0.1
a 3600 IN A 127.0.0.2
a.typefish.co.uk 3600 IN A 127.0.0.3
a.typefish.co.uk. 3600 IN A 127.0.0.4
We end up with output from named-compilezone
similar to:
typefish.co.uk. 3600 IN A 127.0.0.1
a.typefish.co.uk. 3600 IN A 127.0.0.2
a.typefish.co.uk.a.typefish.co.uk. 3600 IN A 127.0.0.3
a.typefish.co.uk. 3600 IN A 127.0.0.4
However, the output from your tokeniser is:
@ 3600 IN A 127.0.0.1
a.typefish.co.uk. 3600 IN A 127.0.0.2
a.typefish.co.uk.a.typefish.co.uk. 3600 IN A 127.0.0.3
a.typefish.co.uk. 3600 IN A 127.0.0.4
Now, the code - and its tests, imply that the root zone is tokenised as @
as opposed to typefish.co.uk.
- should this be the case?
(I personally think it should match named-compilezone
)
I've changed the code on my machine to match the output of named-compilezone
but I don't want to change any tests nor proceed further with any merging of code until I know why this has been done in this manner.
Regards,
David Weston
WTF
@ 600 IN MX 10 mx1.beget.ru.
This will be parsed as WTF\n@ in nodename
In RData.php, line 205, we have:
if($this->stream->isEnd()) {
$this->tokens[$tokenName] = trim($this->tokens[$tokenName]);
}
goto start;
The problem is that isEnd()
returns true, but the code still goes back to start:
.
On line 155, the code should check for isEnd()
as well as AsciiChar::NULL
to prevent the infinite loop.
You can find the whole list here: http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
Subj. For dns parser we need a lot of unit tests
;
; BIND reverse data file for BEGET-NEW-NET1 5.101.159.0/24 zone
;
$TTL 3600
@ IN SOA ns1.beget.ru. hostmaster.beget.ru. (
2014070701 ; Serial
3600 ; Refresh
600 ; Retry
86400 ; Expire
3600 ; Negative Cache TTL
)
;; NS
@ IN NS ns1.beget.ru.
@ IN NS ns2.beget.ru.
;; SYSTEM
1 IN PTR rt01.beget.ru.
3 IN PTR ns3.beget.ru.
5 IN PTR ns5.beget.ru.
11 IN PTR ns1.beget.ru.
12 IN PTR ns2.beget.com.ua.
не зацикливается без комментариев в начале
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.