Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
aports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TBK
aports
Commits
cc4653d9
Commit
cc4653d9
authored
8 years ago
by
Timo Teräs
Browse files
Options
Downloads
Patches
Plain Diff
testing/lua-resty-dns: upgrade to 0.17 and update naptr patch
parent
528334a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
testing/lua-resty-dns/APKBUILD
+7
-7
7 additions, 7 deletions
testing/lua-resty-dns/APKBUILD
testing/lua-resty-dns/add-naptr.patch
+70
-28
70 additions, 28 deletions
testing/lua-resty-dns/add-naptr.patch
with
77 additions
and
35 deletions
testing/lua-resty-dns/APKBUILD
+
7
−
7
View file @
cc4653d9
...
...
@@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
_luaversions
=
"5.1"
pkgname
=
lua-resty-dns
pkgver
=
0.1
6
pkgver
=
0.1
7
pkgrel
=
0
pkgdesc
=
"DNS resolver for the nginx lua module"
url
=
"https://github.com/openresty/lua-resty-dns"
...
...
@@ -51,9 +51,9 @@ for _v in $_luaversions; do
eval
"split_
${
_v
/./_
}
() { _split
$_v
; }"
done
md5sums
=
"
f25a1d8169fd213887221d7d7600da30
lua-resty-dns-0.1
6
.tar.gz
d5b6cf8894c838e74a4e38cd1d17939e
add-naptr.patch"
sha256sums
=
"
299763d072f02364a7a767cab85f0412cdf64e2cf6034259c909a5515f7f0a13
lua-resty-dns-0.1
6
.tar.gz
d99c3f35678ec828e6b72cb12e7e291b8cce13f88b1576ab532d92adb449079f
add-naptr.patch"
sha512sums
=
"
7920a7cf6b7927b09ed5b066f7b8cb72f1a5924cdb7fa382500cf36a0c1d3d1099441c64003b201d820ed69003676e494087ac3f24ed021f457837e08f8b0f14
lua-resty-dns-0.1
6
.tar.gz
a05183db6e9d40b916e27c03f85d1d227203a70b57807df680a6f07956100481b511cfcfdd229e862cea1623a728b0e60f3a0edfcaabae458e57ed80b7aafc8f
add-naptr.patch"
md5sums
=
"
ebbc3dc086a3991a707b6a145657b489
lua-resty-dns-0.1
7
.tar.gz
9b286e97c8f09334793b411eacc4eecd
add-naptr.patch"
sha256sums
=
"
586740cd3eff66cb9e57747dcc000831c8a7988128e80b8b17f691bfe01e510e
lua-resty-dns-0.1
7
.tar.gz
10a8d351fd87468dd680f43645f5b3117a5929b67f6d0f5d6d9649ce5da04c58
add-naptr.patch"
sha512sums
=
"
5c9d7291b90f95694a9b1d4f12fcd94d30ff3d918f0942af93c02a26c794f86e1b458faccbba9cc5ec879a43ec24a7c8fdb2e5ac4f4ce7376576f33f606b0d1a
lua-resty-dns-0.1
7
.tar.gz
e30849f3c45d8ca4aceae312a5e66566d70e6eaee81a622de3837b8d46f4f953ffd2ddd0c8f37ebeecf8d929518967a1252d2593b041cfa16a4f971b17d8a0cc
add-naptr.patch"
This diff is collapsed.
Click to expand it.
testing/lua-resty-dns/add-naptr.patch
+
70
−
28
View file @
cc4653d9
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment