Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
re6stnet
Commits
1b272c71
Commit
1b272c71
authored
Apr 23, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More sanity check
parent
c231062f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
re6st/db.py
re6st/db.py
+12
-7
re6st/tunnel.py
re6st/tunnel.py
+5
-2
No files found.
re6st/db.py
View file @
1b272c71
...
@@ -84,15 +84,20 @@ class PeerDB(object):
...
@@ -84,15 +84,20 @@ class PeerDB(object):
logging
.
info
(
'Getting Boot peer...'
)
logging
.
info
(
'Getting Boot peer...'
)
try
:
try
:
bootpeer
=
self
.
_proxy
.
getBootstrapPeer
(
self
.
_prefix
).
data
bootpeer
=
self
.
_proxy
.
getBootstrapPeer
(
self
.
_prefix
).
data
except
(
socket
.
error
,
xmlrpclib
.
Fault
),
e
:
p
=
subprocess
.
Popen
(
(
'openssl'
,
'rsautl'
,
'-decrypt'
,
'-inkey'
,
self
.
_key_path
),
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
out
,
err
=
p
.
communicate
(
bootpeer
)
if
p
.
returncode
:
raise
subprocess
.
CalledProcessError
(
p
.
returncode
,
err
)
prefix
,
address
=
out
.
split
()
except
(
socket
.
error
,
xmlrpclib
.
Fault
,
subprocess
.
CalledProcessError
,
ValueError
),
e
:
logging
.
warning
(
'Failed to bootstrap (%s)'
,
e
)
logging
.
warning
(
'Failed to bootstrap (%s)'
,
e
)
else
:
else
:
p
=
subprocess
.
Popen
((
'openssl'
,
'rsautl'
,
'-decrypt'
,
'-inkey'
,
self
.
_key_path
),
if
prefix
!=
self
.
_prefix
:
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
self
.
addPeer
(
prefix
,
address
)
bootpeer
=
p
.
communicate
(
bootpeer
)[
0
].
split
()
return
prefix
,
address
if
bootpeer
[
0
]
!=
self
.
_prefix
:
self
.
addPeer
(
*
bootpeer
)
return
bootpeer
logging
.
warning
(
'Buggy registry sent us our own address'
)
logging
.
warning
(
'Buggy registry sent us our own address'
)
def
addPeer
(
self
,
prefix
,
address
,
set_preferred
=
False
):
def
addPeer
(
self
,
prefix
,
address
,
set_preferred
=
False
):
...
...
re6st/tunnel.py
View file @
1b272c71
...
@@ -405,10 +405,13 @@ class TunnelManager(object):
...
@@ -405,10 +405,13 @@ class TunnelManager(object):
return
return
code
=
ord
(
msg
[
0
])
code
=
ord
(
msg
[
0
])
if
code
==
1
:
# answer
if
code
==
1
:
# answer
# TODO: do not fail if message contains garbage
# We parse the message in a way to discard a truncated line.
# We parse the message in a way to discard a truncated line.
for
peer
in
msg
[
1
:].
split
(
'
\
n
'
)[:
-
1
]:
for
peer
in
msg
[
1
:].
split
(
'
\
n
'
)[:
-
1
]:
prefix
,
address
=
peer
.
split
()
try
:
prefix
,
address
=
peer
.
split
()
int
(
prefix
,
2
)
except
ValueError
:
break
if
prefix
!=
self
.
_prefix
:
if
prefix
!=
self
.
_prefix
:
self
.
_peer_db
.
addPeer
(
prefix
,
address
)
self
.
_peer_db
.
addPeer
(
prefix
,
address
)
try
:
try
:
...
...
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