Skip to content

Commit

Permalink
Revert "cursed race condition"
Browse files Browse the repository at this point in the history
This reverts commit 367cf7b.
  • Loading branch information
jmayclin committed Jan 14, 2025
1 parent 367cf7b commit e473f7f
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions tests/integrationv2/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ def __init__(self, options: ProviderOptions):

self.options = options
if self.options.mode == Provider.ServerMode:
# lgtm [py/init-calls-subclass]
self.cmd_line = self.setup_server()
self.cmd_line = self.setup_server() # lgtm [py/init-calls-subclass]
elif self.options.mode == Provider.ClientMode:
# lgtm [py/init-calls-subclass]
self.cmd_line = self.setup_client()
self.cmd_line = self.setup_client() # lgtm [py/init-calls-subclass]

def setup_client(self):
"""
Expand Down Expand Up @@ -142,8 +140,7 @@ class S2N(Provider):
def __init__(self, options: ProviderOptions):
Provider.__init__(self, options)

# lgtm [py/overwritten-inherited-attribute]
self.send_with_newline = True
self.send_with_newline = True # lgtm [py/overwritten-inherited-attribute]

@classmethod
def get_send_marker(cls):
Expand Down Expand Up @@ -337,6 +334,8 @@ def setup_server(self):


class OpenSSL(Provider):
_version = get_flag(S2N_PROVIDER_VERSION)

def __init__(self, options: ProviderOptions):
Provider.__init__(self, options)
# We print some OpenSSL logging that includes stderr
Expand Down Expand Up @@ -391,7 +390,7 @@ def _cipher_to_cmdline(self, cipher):

@classmethod
def get_version(cls):
return get_flag(S2N_PROVIDER_VERSION)
return cls._version

@classmethod
def supports_protocol(cls, protocol, with_cert=None):
Expand All @@ -405,15 +404,13 @@ def supports_cipher(cls, cipher, with_curve=None):
return True

def _is_openssl_11(self) -> None:
result = subprocess.run(["openssl", "version"],
shell=False, capture_output=True, text=True)
result = subprocess.run(["openssl", "version"], shell=False, capture_output=True, text=True)
version_str = result.stdout.split(" ")
project = version_str[0]
version = version_str[1]
print(f"openssl version: {project} version: {version}")
if (project != "OpenSSL" or version[0:3] != "1.1"):
raise FileNotFoundError(f"Openssl version returned {
version}, expected 1.1.x.")
raise FileNotFoundError(f"Openssl version returned {version}, expected 1.1.x.")

def setup_client(self):
cmd_line = ['openssl', 's_client']
Expand Down Expand Up @@ -706,8 +703,7 @@ def __init__(self, options: ProviderOptions):
Provider.__init__(self, options)

self.expect_stderr = True # lgtm [py/overwritten-inherited-attribute]
# lgtm [py/overwritten-inherited-attribute]
self.send_with_newline = True
self.send_with_newline = True # lgtm [py/overwritten-inherited-attribute]

@staticmethod
def cipher_to_priority_str(cipher):
Expand Down Expand Up @@ -779,15 +775,13 @@ def get_send_marker(cls):
def create_priority_str(self):
priority_str = "NONE"

protocol_to_priority_str = self.protocol_to_priority_str(
self.options.protocol)
protocol_to_priority_str = self.protocol_to_priority_str(self.options.protocol)
if protocol_to_priority_str:
priority_str += ":+" + protocol_to_priority_str
else:
priority_str += ":+VERS-ALL"

cipher_to_priority_str = self.cipher_to_priority_str(
self.options.cipher)
cipher_to_priority_str = self.cipher_to_priority_str(self.options.cipher)
if cipher_to_priority_str:
priority_str += ":+" + cipher_to_priority_str
else:
Expand All @@ -799,8 +793,7 @@ def create_priority_str(self):
else:
priority_str += ":+GROUP-ALL"

sigalg_to_priority_str = self.sigalg_to_priority_str(
self.options.signature_algorithm)
sigalg_to_priority_str = self.sigalg_to_priority_str(self.options.signature_algorithm)
if sigalg_to_priority_str:
priority_str += ":+" + sigalg_to_priority_str
else:
Expand Down

0 comments on commit e473f7f

Please sign in to comment.