Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
BIND
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
635
Issues
635
List
Boards
Labels
Service Desk
Milestones
Merge Requests
108
Merge Requests
108
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
BIND
Commits
b9c5b37e
Commit
b9c5b37e
authored
May 24, 2017
by
Mark Andrews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make chain system test work with python 3
parent
a5dc0d50
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
bin/tests/system/chain/ans4/ans.py
bin/tests/system/chain/ans4/ans.py
+12
-13
bin/tests/system/chain/tests.sh
bin/tests/system/chain/tests.sh
+2
-2
No files found.
bin/tests/system/chain/ans4/ans.py
View file @
b9c5b37e
...
...
@@ -17,6 +17,7 @@ import signal
import
socket
import
select
from
datetime
import
datetime
,
timedelta
import
functools
import
dns
,
dns
.
message
,
dns
.
query
from
dns.rdatatype
import
*
...
...
@@ -71,12 +72,12 @@ def ctl_channel(msg):
msg
=
msg
.
splitlines
().
pop
(
0
)
print
(
'received control message: %s'
%
msg
)
msg
=
msg
.
split
(
'|'
)
msg
=
msg
.
split
(
b
'|'
)
if
len
(
msg
)
==
0
:
return
actions
=
[
x
.
strip
()
for
x
in
msg
[
0
].
split
(
','
)]
n
=
reduce
(
lambda
n
,
act
:
(
n
+
(
2
if
act
==
'dname'
else
1
)),
[
0
]
+
actions
)
actions
=
[
x
.
strip
()
for
x
in
msg
[
0
].
split
(
b
','
)]
n
=
functools
.
reduce
(
lambda
n
,
act
:
(
n
+
(
2
if
act
==
b
'dname'
else
1
)),
[
0
]
+
actions
)
if
len
(
msg
)
==
1
:
rrs
=
[]
...
...
@@ -85,10 +86,10 @@ def ctl_channel(msg):
rrs
.
append
((
i
,
b
))
return
rlist
=
[
x
.
strip
()
for
x
in
msg
[
1
].
split
(
','
)]
rlist
=
[
x
.
strip
()
for
x
in
msg
[
1
].
split
(
b
','
)]
rrs
=
[]
for
item
in
rlist
:
if
item
[
0
]
==
's'
:
if
item
[
0
]
==
b
's'
[
0
]
:
i
=
int
(
item
[
1
:].
strip
())
-
1
if
i
>
n
:
print
(
'invalid index %d'
+
(
i
+
1
))
...
...
@@ -161,9 +162,9 @@ def create_response(msg):
i
=
0
for
action
in
actions
:
if
name
<>
'test'
:
if
name
!=
'test'
:
continue
if
action
==
'xname'
:
if
action
==
b
'xname'
:
owner
=
curname
+
'.'
+
curdom
newname
=
'cname%d'
%
i
i
+=
1
...
...
@@ -180,7 +181,7 @@ def create_response(msg):
curdom
=
newdom
continue
if
action
==
'cname'
:
if
action
==
b
'cname'
:
owner
=
curname
+
'.'
+
curdom
newname
=
'cname%d'
%
i
target
=
newname
+
'.'
+
curdom
...
...
@@ -194,7 +195,7 @@ def create_response(msg):
curname
=
newname
continue
if
action
==
'dname'
:
if
action
==
b
'dname'
:
owner
=
curdom
newdom
=
'domain%d.%s'
%
(
i
,
tld
)
i
+=
1
...
...
@@ -225,7 +226,7 @@ def create_response(msg):
# prepare the response and convert to wire format
r
=
dns
.
message
.
make_response
(
m
)
if
name
<>
'test'
:
if
name
!=
'test'
:
r
.
answer
.
append
(
answers
[
-
1
])
if
wantsigs
:
r
.
answer
.
append
(
sigs
[
-
1
])
...
...
@@ -254,6 +255,7 @@ def sigterm(signum, frame):
print
(
"Shutting down now..."
)
os
.
remove
(
'ans.pid'
)
running
=
0
sys
.
exit
(
0
)
############################################################################
# Main
...
...
@@ -277,9 +279,6 @@ ctrl_socket.listen(5)
signal
.
signal
(
signal
.
SIGTERM
,
sigterm
)
# Unbuffered ouput ensures we can always check current status in ans.run.
sys
.
stdout
=
os
.
fdopen
(
sys
.
stdout
.
fileno
(),
'w'
,
0
)
f
=
open
(
'ans.pid'
,
'w'
)
pid
=
os
.
getpid
()
print
(
pid
,
file
=
f
)
...
...
bin/tests/system/chain/tests.sh
View file @
b9c5b37e
...
...
@@ -138,7 +138,7 @@ grep "ANSWER: 2" dig.out.test$n > /dev/null || ret=1
if
[
$ret
!=
0
]
;
then
echo
"I:failed"
;
fi
status
=
`
expr
$status
+
$ret
`
t
=
`
expr
$t
+ 1
`
n
=
`
expr
$n
+ 1
`
echo
"I:checking CNAME to signed external delgation is handled (
$n
)"
ret
=
0
$DIG
$DIGOPTS
@10.53.0.7
-p
5300 c.example
>
dig.out.
$n
...
...
@@ -146,7 +146,7 @@ grep "status: NOERROR" dig.out.$n > /dev/null || ret=1
if
[
$ret
!=
0
]
;
then
echo
"I: failed"
;
fi
status
=
`
expr
$status
+
$ret
`
t
=
`
expr
$t
+ 1
`
n
=
`
expr
$n
+ 1
`
echo
"I:checking CNAME to signed internal delgation is handled (
$n
)"
ret
=
0
$DIG
$DIGOPTS
@10.53.0.7
-p
5300 d.example
>
dig.out.
$n
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment