mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-04 21:05:11 +00:00
interface: fix cert handling
notably os.unlink cannot be inside the "with open"
This commit is contained in:
parent
9543a108be
commit
6700364ac8
1 changed files with 11 additions and 11 deletions
|
@ -103,19 +103,19 @@ class Interface(PrintError):
|
|||
if exists:
|
||||
with open(self.cert_path, 'r') as f:
|
||||
contents = f.read()
|
||||
if contents != '': # if not CA signed
|
||||
if contents != '': # if not CA signed
|
||||
try:
|
||||
b = pem.dePem(contents, 'CERTIFICATE')
|
||||
except SyntaxError:
|
||||
exists = False
|
||||
else:
|
||||
x = x509.X509(b)
|
||||
try:
|
||||
b = pem.dePem(contents, 'CERTIFICATE')
|
||||
except SyntaxError:
|
||||
x.check_date()
|
||||
except x509.CertificateError as e:
|
||||
self.print_error("certificate problem", e)
|
||||
os.unlink(self.cert_path)
|
||||
exists = False
|
||||
else:
|
||||
x = x509.X509(b)
|
||||
try:
|
||||
x.check_date()
|
||||
except x509.CertificateError as e:
|
||||
self.print_error("certificate problem", e)
|
||||
os.unlink(self.cert_path)
|
||||
exists = False
|
||||
if not exists:
|
||||
ca_signed = await self.is_server_ca_signed(ca_sslc)
|
||||
if ca_signed:
|
||||
|
|
Loading…
Add table
Reference in a new issue