From 44ad57f793c838b24d31575eeb79609b227395e4 Mon Sep 17 00:00:00 2001 From: Leonid Korokh Date: Mon, 2 Jun 2025 16:13:14 +0300 Subject: openconnect: T7511: fix ruff warnings --- src/conf_mode/vpn_openconnect.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conf_mode/vpn_openconnect.py b/src/conf_mode/vpn_openconnect.py index 38d03fd6f..391034a94 100755 --- a/src/conf_mode/vpn_openconnect.py +++ b/src/conf_mode/vpn_openconnect.py @@ -106,7 +106,7 @@ def verify(ocserv): users_wo_key = [] for user, user_config in ocserv["authentication"]["local_users"]["username"].items(): # User has no OTP key defined - if dict_search('otp.key', user_config) == None: + if dict_search('otp.key', user_config) is None: users_wo_key.append(user) if users_wo_key: raise ConfigError(f'OTP enabled, but no OTP key is configured for these users:\n{users_wo_key}') @@ -114,7 +114,7 @@ def verify(ocserv): if "password" in ocserv["authentication"]["mode"]["local"] or "otp" not in ocserv["authentication"]["mode"]["local"]: users_wo_pswd = [] for user in ocserv["authentication"]["local_users"]["username"]: - if not "password" in ocserv["authentication"]["local_users"]["username"][user]: + if "password" not in ocserv["authentication"]["local_users"]["username"][user]: users_wo_pswd.append(user) if users_wo_pswd: raise ConfigError(f'password required for users:\n{users_wo_pswd}') @@ -194,7 +194,7 @@ def generate(ocserv): otp_type = "HOTP/T" + otp_interval ocserv["authentication"]["local_users"]["username"][user]["otp"]["token_tmpl"] = otp_type + "/" + otp_length # if there is a password, generate hash - if "password" in ocserv["authentication"]["mode"]["local"] or not "otp" in ocserv["authentication"]["mode"]["local"]: + if "password" in ocserv["authentication"]["mode"]["local"] or "otp" not in ocserv["authentication"]["mode"]["local"]: if "local_users" in ocserv["authentication"]: for user in ocserv["authentication"]["local_users"]["username"]: ocserv["authentication"]["local_users"]["username"][user]["hash"] = get_hash(ocserv["authentication"]["local_users"]["username"][user]["password"]) -- cgit v1.2.3