Commit Graph

258 Commits

Author SHA1 Message Date
Miek Gieben
4d3dac9c36 Add the OPENPGPKEY RR. 2014-08-14 09:18:08 +01:00
Miek Gieben
fb3a1585ad fmt 2014-07-27 20:38:11 +01:00
Miek Gieben
b691354313 Add OPENPGPKEY, but without type code 2014-07-24 09:29:42 +01:00
Miek Gieben
b7a8c14d7d Add dns.Name as a type
This can be used for printing names.
2014-04-23 21:06:17 +01:00
Miek Gieben
6295f64c1c Make sprintDomain public as NameToString 2014-04-23 20:58:55 +01:00
Miek Gieben
2dc3e40828 add TODO 2014-04-23 20:54:17 +01:00
Andrew Tunnell-Jones
38d78bafe4 Escape @ when printing/unpacking domain names 2014-03-01 22:30:52 +00:00
Andrew Tunnell-Jones
6fd4d29ced Fix bounds overflow in sprintTxt
Passing excessively long strings (>256*4+3) to sprintTxt would result in
overflowing src. Fix isn't as efficient but simplifies the code.
2014-03-01 02:42:47 +00:00
Andrew Tunnell-Jones
0c98da613d Fix bounds check in nextByte 2014-03-01 02:37:24 +00:00
Andrew Tunnell-Jones
3f834a04fb Update domain name and TXT string escape behaviour
Changes to domain name packing and unpacking:
* Escape dot, backslash, brackets, double-quote, semi-colon and space
* Tab, line feed and carriage return become \t, \n and \r

Changes to TXT string packing and unpacking:
* Escape backslash and double-quote
* Tab, line feed and carriage return become \t, \n and \r
* Other unprintables to \DDD

Stringers do the equivalent of putting domain names and TXT strings
to the wire and back.

There is some duplication of logic. I found performance suffered when
I broke the logic out into smaller functions. I think this may have
been due to functions not being inlined for various reasons.
2014-02-26 10:55:11 +00:00
Miek Gieben
87b380cad5 Revert "Use dLen for domain name length"
This reverts commit b595183834.

Fix up the tests too.
2014-02-14 20:20:22 +00:00
Miek Gieben
89cc033428 Be much more precice in msg.Len()
There is still a one-off in EDNS0 records, but I'm not too bothered with
that one.
2014-02-12 12:59:42 +00:00
Miek Gieben
b595183834 Use dLen for domain name length 2014-02-12 12:50:16 +00:00
Miek Gieben
be9467466c Formatting and reshuffle some code 2014-01-12 10:11:23 +00:00
Miek Gieben
3342ee9d85 Rename dupIP to copyIP
Also make the function shorter.
2014-01-12 10:09:54 +00:00
Miek Gieben
189f4a23fc Merge pull request #74 from majek/marek/deepcopy
msg.Copy() makes a deep-copy of the msg object
2014-01-12 02:03:17 -08:00
Miek Gieben
82b2b6ec82 QuoteToASCII is needed
When not using this, TXT strings get interpreted by Golang, making
TXT behave unexpected. QuoteToASCII has surpises too, see
TestTxtEqual(), but this, I hope, lesser of an issue.
2014-01-11 17:17:38 +00:00
Miek Gieben
a49cd38336 Add quoteString function.
This is to just quote a string s -> "s"
2014-01-11 16:57:36 +00:00
Marek Majkowski
2cfad667d7 msg.Copy() makes a deep-copy of the msg object
There was a copy function that did shallow copies of the msg
object. Export it and make it support proper deep copying.
2014-01-10 08:49:45 -08:00
Miek Gieben
9f5db7b72c Disable the unfinished CAA support
CAA was partially implemented, it's better to do it 100% until that
time handle CAA as an unknown record.

Closes #70:
2014-01-07 07:44:06 +00:00
Miek Gieben
e01f57407d Put all len() function on one line
At least for the shorter ones.
2014-01-04 13:05:57 +00:00
Miek Gieben
bca469e6b1 Fix other string len occurences
Add the +1 in the correct places for the RR length calculations.
2014-01-04 12:50:18 +00:00
Miek Gieben
9e73cb688f Fix NAPTR's length function
Add the 3 bytes for the length byte of the strings.

Close issue #67.
2014-01-04 11:30:20 +00:00
Miek Gieben
6b32a711e9 Allocate just enough space
Remove the len()*2, and replace it with len()+1. The current
len() impl. of the types is good enough to be more precise.
2013-12-06 11:30:33 +00:00
Miek Gieben
70ee966106 Fix the unknown record sign test
Don't make up new error in msg.Pack when there are perfectly fine
errors to return.
2013-12-06 09:43:26 +00:00
Miek Gieben
6c9cc37ac3 Small tweaks to the pull request from Alex 2013-12-06 07:46:08 +00:00
Miek Gieben
110f6c9ea7 Test for TYPE65534 records, copy now copies slices correctly 2013-12-06 07:37:48 +00:00
Miek Gieben
ca52132cef reverse this until I have evidence it would be needed 2013-12-05 19:48:08 +00:00
Skinner, Alex
edd235088a Added TYPE65534 record type so that zone scanning doesn't die upon encountering one. Fixed DNSSEC signature verification. 2013-12-04 12:58:20 -05:00
Miek Gieben
ff7806469c Implement EID and NIMLOC records 2013-10-19 21:31:12 +01:00
Miek Gieben
221e0c0e4e some doc updates 2013-10-13 13:27:50 +01:00
Miek Gieben
35bcc78d76 Implement PX record 2013-10-13 13:23:02 +01:00
Miek Gieben
cc2c42cc91 Implement GPOS record 2013-10-13 13:01:33 +01:00
Miek Gieben
961e137891 Add NSAP and NSAP-PTR record 2013-10-13 12:25:08 +01:00
Miek Gieben
67065da09c Fix the CAA type 2013-09-27 08:51:20 +00:00
Miek Gieben
b6a2d1fb5e Allow empty rdata in records
Empty or no rdata is allowed for dynamic updates, so test if this
works for packing/unpacking. It only fails for TSIG (which is
never seen in zone files), SOA (which is not seen like this in dyn.
updates) and WKS (just an old record).
2013-08-31 20:24:52 +01:00
Miek Gieben
f99d511479 if A or AAAA is nil return empty string
Now it returns <nil> for nil value, which can not be parsed
back to the record.
2013-08-31 20:07:13 +01:00
Miek Gieben
80f55713f1 comment update 2013-08-30 20:15:05 +01:00
Miek Gieben
fdcdc6dbf6 Add test to zero rdata (for dyn updates)
This triggerd a bunch of failures, the most important one
is the packing and zero length domain name now works.
2013-08-26 21:11:24 -07:00
Miek Gieben
9fa50d8ac2 Fix the nsec/3 length calculation
This overshoots, 'cause it only counts the windows, not the
actual bitmap sizes in the window. But it keeps the code
simple and fast.
2013-06-27 20:19:02 +01:00
Miek Gieben
b651c7ea1f Fix TXT lenght again, but now it looks more right 2013-06-27 14:43:57 +00:00
Miek Gieben
245be76edf Revert "Fix length computation for TXT"
This reverts commit 795a69a6ec.
2013-06-26 22:22:31 +01:00
Miek Gieben
b35306b755 Created two new types: Type and Class
Actually just go with Robert's suggestion as this seems the
cleanest way to do it. Also saves me from thinking about could
names for the new functions.
2013-06-08 14:09:37 +01:00
Miek Gieben
c72535f2d6 Add TypeToTypeString and ClassToClassString
After some discussion with Robert Edmonds, these helper functions
seems in order. It is not what he requested (that was an RRType
and RRClass as new types), but is does make sense to add some
convience functions to save some typing. The dns package itself
also used these function (4 times). So clearly there is a need.

I'm not completely sold about the names.
2013-06-08 13:59:49 +01:00
Marc Capdevielle
795a69a6ec Fix length computation for TXT 2013-06-06 14:02:43 +02:00
Miek Gieben
c66494c6c5 Resolv merge conflicts 2013-05-12 19:08:37 +02:00
Miek Gieben
98b677a97c Update the copy right for the original GO files 2013-05-12 16:07:06 +02:00
Miek Gieben
e1151d6edc Update the Zone structure for NSEC and NSEC3 2013-05-07 09:44:21 +02:00
Miek Gieben
6c9efcdf1f Small tweaks 2013-04-30 16:56:30 +02:00
Miek Gieben
495b7d6552 Add UID/GID/UINFO record 2013-04-30 16:42:04 +02:00