mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-21 19:39:43 +01:00
fix the atheme side of #1864
Import stored certfps from Atheme as well.
This commit is contained in:
parent
98e87f6cc0
commit
8fc20d8eed
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import binascii
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
@ -19,6 +20,14 @@ CMODE_FLAG_TO_MODE = {
|
|||||||
0x100: 't', # CMODE_TOPIC
|
0x100: 't', # CMODE_TOPIC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# attempt to interpret certfp as a hex-encoded SHA-256 fingerprint
|
||||||
|
def validate_certfp(certfp):
|
||||||
|
try:
|
||||||
|
dec = binascii.unhexlify(certfp)
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
return len(dec) == 32
|
||||||
|
|
||||||
def convert(infile):
|
def convert(infile):
|
||||||
out = {
|
out = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
@ -70,6 +79,11 @@ def convert(infile):
|
|||||||
if parts[2] == 'private:usercloak':
|
if parts[2] == 'private:usercloak':
|
||||||
username = parts[1]
|
username = parts[1]
|
||||||
out['users'][username]['vhost'] = parts[3]
|
out['users'][username]['vhost'] = parts[3]
|
||||||
|
elif category == 'MCFP':
|
||||||
|
username, certfp = parts[1], parts[2]
|
||||||
|
if validate_certfp(certfp):
|
||||||
|
user = out['users'][username]
|
||||||
|
user.setdefault('certfps', []).append(certfp.lower())
|
||||||
elif category == 'MC':
|
elif category == 'MC':
|
||||||
# channel registration
|
# channel registration
|
||||||
# MC #mychannel 1600134478 1600467343 +v 272 0 0
|
# MC #mychannel 1600134478 1600467343 +v 272 0 0
|
||||||
|
Loading…
Reference in New Issue
Block a user