1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-24 02:37:05 +00:00

Fixed SIM102 (collapsible-if): Use a single if statement instead of nested if statements

This commit is contained in:
Teal Dulcet 2023-12-22 07:20:00 -08:00 committed by Joshua Tauberer
parent 67b9d0b279
commit e8d1c037cb
3 changed files with 33 additions and 37 deletions

View File

@ -434,8 +434,7 @@ def scan_postfix_smtpd_line(date, log, collector):
return return
# only log mail to known recipients # only log mail to known recipients
if user_match(user): if user_match(user) and (collector["known_addresses"] is None or user in collector["known_addresses"]):
if collector["known_addresses"] is None or user in collector["known_addresses"]:
data = collector["rejected"].get( data = collector["rejected"].get(
user, user,
{ {

View File

@ -82,8 +82,7 @@ def get_ssl_certificates(env):
for domain in cert_domains: for domain in cert_domains:
# The primary hostname can only use a certificate mapped # The primary hostname can only use a certificate mapped
# to the system private key. # to the system private key.
if domain == env['PRIMARY_HOSTNAME']: if domain == env['PRIMARY_HOSTNAME'] and cert["private_key"]["filename"] != os.path.join(env['STORAGE_ROOT'], 'ssl', 'ssl_private_key.pem'):
if cert["private_key"]["filename"] != os.path.join(env['STORAGE_ROOT'], 'ssl', 'ssl_private_key.pem'):
continue continue
domains.setdefault(domain, []).append(cert) domains.setdefault(domain, []).append(cert)
@ -149,8 +148,7 @@ def get_domain_ssl_files(domain, ssl_certificates, env, allow_missing_cert=False
"certificate_object": load_pem(load_cert_chain(ssl_certificate)[0]), "certificate_object": load_pem(load_cert_chain(ssl_certificate)[0]),
} }
if use_main_cert: if use_main_cert and domain == env['PRIMARY_HOSTNAME']:
if domain == env['PRIMARY_HOSTNAME']:
# The primary domain must use the server certificate because # The primary domain must use the server certificate because
# it is hard-coded in some service configuration files. # it is hard-coded in some service configuration files.
return system_certificate return system_certificate

View File

@ -420,8 +420,7 @@ def check_primary_hostname_dns(domain, env, output, dns_domains, dns_zonefiles):
# If a DS record is set on the zone containing this domain, check DNSSEC now. # If a DS record is set on the zone containing this domain, check DNSSEC now.
has_dnssec = False has_dnssec = False
for zone in dns_domains: for zone in dns_domains:
if zone == domain or domain.endswith("." + zone): if (zone == domain or domain.endswith("." + zone)) and query_dns(zone, "DS", nxdomain=None) is not None:
if query_dns(zone, "DS", nxdomain=None) is not None:
has_dnssec = True has_dnssec = True
check_dnssec(zone, env, output, dns_zonefiles, is_checking_primary=True) check_dnssec(zone, env, output, dns_zonefiles, is_checking_primary=True)