aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-resty-dns/add-naptr.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-08-23 09:32:41 +0300
committerTimo Teräs <timo.teras@iki.fi>2016-08-23 09:33:13 +0300
commitcc4653d969b7e6ea0917f810b12f8dea9a1538b7 (patch)
tree9b8cf00ef4ed0c6bbf846ddacb0b4f896a6a451a /testing/lua-resty-dns/add-naptr.patch
parent528334a1c482176781261a8a8a1c7a5aec582c1b (diff)
downloadaports-cc4653d969b7e6ea0917f810b12f8dea9a1538b7.tar.gz
aports-cc4653d969b7e6ea0917f810b12f8dea9a1538b7.tar.bz2
aports-cc4653d969b7e6ea0917f810b12f8dea9a1538b7.tar.xz
testing/lua-resty-dns: upgrade to 0.17 and update naptr patch
Diffstat (limited to 'testing/lua-resty-dns/add-naptr.patch')
-rw-r--r--testing/lua-resty-dns/add-naptr.patch98
1 files changed, 70 insertions, 28 deletions
diff --git a/testing/lua-resty-dns/add-naptr.patch b/testing/lua-resty-dns/add-naptr.patch
index a3bb991698..6a2294a0d4 100644
--- a/testing/lua-resty-dns/add-naptr.patch
+++ b/testing/lua-resty-dns/add-naptr.patch
@@ -1,14 +1,44 @@
-From 5dcc817d96352b05f7468d058c39be3e6616d037 Mon Sep 17 00:00:00 2001
+From 4a2b0606cf3757ef98413b8986602b60a8913890 Mon Sep 17 00:00:00 2001
From: Sergey Lukin <sergey.lukin@inbox.lv>
Date: Fri, 5 Aug 2016 12:09:11 +0300
Subject: [PATCH] add NAPTR record support
---
- lib/resty/dns/resolver.lua | 49 ++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 49 insertions(+)
+ README.markdown | 11 +++++++++
+ lib/resty/dns/resolver.lua | 61 ++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 72 insertions(+)
+diff --git a/README.markdown b/README.markdown
+index 2cf852e..7fb2974 100644
+--- a/README.markdown
++++ b/README.markdown
+@@ -28,6 +28,7 @@ Table of Contents
+ * [TYPE_TXT](#type_txt)
+ * [TYPE_AAAA](#type_aaaa)
+ * [TYPE_SRV](#type_srv)
++ * [TYPE_NAPTR](#type_naptr)
+ * [TYPE_SPF](#type_spf)
+ * [CLASS_IN](#class_in)
+ * [SECTION_AN](#section_an)
+@@ -373,6 +374,16 @@ See RFC 2782 for details.
+
+ [Back to TOC](#table-of-contents)
+
++TYPE_NAPTR
++----------
++`syntax: typ = r.TYPE_NAPTR`
++
++The `NAPTR` resource record type, equal to the decimal number `35`.
++
++See RFC 2915 for details.
++
++[Back to TOC](#table-of-contents)
++
+ TYPE_SPF
+ ---------
+ `syntax: typ = r.TYPE_SPF`
diff --git a/lib/resty/dns/resolver.lua b/lib/resty/dns/resolver.lua
-index 7612b52..989d225 100644
+index 7612b52..6cb6fda 100644
--- a/lib/resty/dns/resolver.lua
+++ b/lib/resty/dns/resolver.lua
@@ -48,6 +48,7 @@ local TYPE_MX = 15
@@ -27,24 +57,29 @@ index 7612b52..989d225 100644
TYPE_SPF = TYPE_SPF,
CLASS_IN = CLASS_IN,
SECTION_AN = SECTION_AN,
-@@ -209,6 +211,16 @@ local function _encode_name(s)
- return char(#s) .. s
+@@ -210,6 +212,21 @@ local function _encode_name(s)
end
+
+local function _decode_string(buf, pos)
+ local slen = byte(buf, pos)
++
+ if slen == 0 then
+ return "", pos + 1
+ end
++
+ if pos + 1 + slen >= #buf then
+ return nil, 'truncated'
+ end
++
+ return sub(buf, pos + 1, pos + slen), pos + slen + 1
+end
-
++
++
local function _decode_name(buf, pos)
local labels = {}
-@@ -484,6 +496,43 @@ local function parse_section(answers, section, buf, start_pos, size,
+ local nptrs = 0
+@@ -484,6 +501,50 @@ local function parse_section(answers, section, buf, start_pos, size,
pos = p
@@ -53,34 +88,41 @@ index 7612b52..989d225 100644
+ return nil, "bad NAPTR record value length: " .. len
+ end
+
-+ local hi = byte(buf, pos)
-+ local lo = byte(buf, pos + 1)
-+ ans.order = lshift(hi, 8) + lo
++ local order_hi = byte(buf, pos)
++ local order_lo = byte(buf, pos + 1)
++ ans.order = lshift(order_hi, 8) + order_lo
+
-+ hi = byte(buf, pos + 2)
-+ lo = byte(buf, pos + 3)
-+ ans.preference = lshift(hi, 8) + lo
++ local preference_hi = byte(buf, pos + 2)
++ local preference_lo = byte(buf, pos + 3)
++ ans.preference = lshift(preference_hi, 8) + preference_lo
+
-+ local str, p = _decode_string(buf, pos + 4)
-+ if not str then return nil, pos end
-+ ans.flags = str
++ local flags_str, p = _decode_string(buf, pos + 4)
++ if not flags_str then
++ return nil, pos
++ end
++ ans.flags = flags_str
+
-+ str, p = _decode_string(buf, p)
-+ if not str then return nil, pos end
-+ ans.services = str
++ local services_str, p = _decode_string(buf, p)
++ if not services_str then
++ return nil, pos
++ end
++ ans.services = services_str
+
-+ str, p = _decode_string(buf, p)
-+ if not str then return nil, pos end
-+ ans.regexp = str
++ local regexp_str, p = _decode_string(buf, p)
++ if not regexp_str then
++ return nil, pos
++ end
++ ans.regexp = regexp_str
+
-+ if p - pos < len then
-+ str,p = _decode_name(buf, p)
-+ if not str then return nil, pos end
-+ ans.replacements = str
++ local replacements_str,p = _decode_name(buf, p)
++ if not replacements_str
++ then return nil, pos
+ end
++ ans.replacements = replacements_str
+
+ if p - pos ~= len then
-+ return nil, format("bad NAPTR record length: %d ~= %d", p - pos, len)
++ return nil, format("bad NAPTR record length: %d ~= %d",
++ p - pos, len)
+ end
+
+ pos = p