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
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
re6stnet
Commits
0b012c01
Commit
0b012c01
authored
May 16, 2024
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logs
parent
748ea1d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
re6st/registry.py
re6st/registry.py
+11
-4
No files found.
re6st/registry.py
View file @
0b012c01
...
...
@@ -99,7 +99,9 @@ class RegistryServer:
"prefix TEXT PRIMARY KEY NOT NULL"
,
"email TEXT"
,
"cert TEXT"
)
logging
.
debug
(
"Checking for existing certs..."
)
if
not
self
.
db
.
execute
(
"SELECT 1 FROM cert LIMIT 1"
).
fetchone
():
logging
.
debug
(
"No existing certs found, creating a blank one..."
)
self
.
db
.
execute
(
"INSERT INTO cert VALUES ('',null,null)"
)
prev
=
'-'
...
...
@@ -265,7 +267,7 @@ class RegistryServer:
if
x
<=
old
:
if
prefix
==
self
.
prefix
:
logging
.
critical
(
"Refuse to delete certificate"
" of main node: wrong clock ?"
)
" of main node: wrong clock ?
Alternatively, try deleting .db
"
)
sys
.
exit
(
1
)
logging
.
info
(
"Delete %s: %s (invalid since %s)"
,
"certificate requested by '%s'"
%
email
...
...
@@ -350,9 +352,11 @@ class RegistryServer:
def
getCert
(
self
,
client_prefix
):
assert
self
.
lock
.
locked
()
return
self
.
db
.
execute
(
"SELECT cert FROM cert"
" WHERE prefix=? AND cert IS NOT NULL"
,
(
client_prefix
,)).
fetchone
()[
0
]
cert
=
self
.
db
.
execute
(
"SELECT cert FROM cert"
" WHERE prefix=? AND cert IS NOT NULL"
,
(
client_prefix
,)).
fetchone
()
assert
cert
,
(
"cert query from db is None, should not happen"
,
self
.
db
.
execute
(
"SELECT * FROM cert"
).
fetchall
())
return
cert
[
0
]
@
rpc_private
def
isToken
(
self
,
token
):
...
...
@@ -433,6 +437,7 @@ class RegistryServer:
return
default
def
mergePrefixes
(
self
):
logging
.
debug
(
"Merging prefixes"
)
q
=
self
.
db
.
execute
prev_prefix
=
None
max_len
=
128
,
...
...
@@ -455,6 +460,7 @@ class RegistryServer:
prev_prefix
=
prefix
def
newPrefix
(
self
,
prefix_len
,
community
):
logging
.
info
(
"Allocating /%u prefix for %s"
,
prefix_len
,
community
)
community_len
=
len
(
community
)
prefix_len
+=
community_len
max_len
=
128
-
len
(
self
.
network
)
...
...
@@ -494,6 +500,7 @@ class RegistryServer:
@
rpc
def
requestCertificate
(
self
,
token
,
req
,
location
=
''
,
ip
=
''
):
logging
.
debug
(
"Requesting certificate with token %s"
,
token
)
req
=
crypto
.
load_certificate_request
(
crypto
.
FILETYPE_PEM
,
req
)
with
self
.
lock
:
with
self
.
db
:
...
...
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