1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-01 23:57:05 +00:00

Fix invalid escape sequences

This commit is contained in:
downtownallday 2024-03-05 08:56:39 -05:00
parent 38ad0d3cd6
commit da2d88e4f4
2 changed files with 12 additions and 12 deletions

View File

@ -168,7 +168,7 @@ def get_domain_ssl_files(domain, ssl_certificates, env, allow_missing_cert=False
# it is hard-coded in some service configuration files.
return system_certificate
wildcard_domain = re.sub("^[^\.]+", "*", domain)
wildcard_domain = re.sub("^[^\\.]+", "*", domain)
if domain in ssl_certificates:
return ssl_certificates[domain]
elif wildcard_domain in ssl_certificates:
@ -540,7 +540,7 @@ def check_certificate(domain, ssl_certificate, ssl_private_key, warn_if_expiring
# Check that the domain appears among the acceptable names, or a wildcard
# form of the domain name (which is a stricter check than the specs but
# should work in normal cases).
wildcard_domain = re.sub("^[^\.]+", "*", domain)
wildcard_domain = re.sub("^[^\\.]+", "*", domain)
if domain not in certificate_names and wildcard_domain not in certificate_names:
return ("The certificate is for the wrong domain name. It is for %s."
% ", ".join(sorted(certificate_names)), None)

View File

@ -33,7 +33,7 @@
# lines while the lines start with whitespace, e.g.:
#
# NAME VAL
# UE
# UE
import sys, re
@ -147,9 +147,9 @@ while len(input_lines) > 0:
name, val = (settings[i].name, settings[i].val)
flags = re.S | (re.I if case_insensitive_names else 0)
m = re.match(
"(\s*)"
+ "(" + re.escape(comment_char) + "\s*)?"
+ re.escape(name) + delimiter_re + "(.*?)\s*$",
"(\\s*)"
+ "(" + re.escape(comment_char) + "\\s*)?"
+ re.escape(name) + delimiter_re + "(.*?)\\s*$",
line, flags)
if not m: continue
indent, is_comment, existing_val = m.groups()
@ -170,7 +170,7 @@ while len(input_lines) > 0:
buf += line
found.add(i)
break
# comment-out the existing line (also comment any folded lines)
if is_comment is None:
if val or not erase_setting or erase_setting_via_comment:
@ -178,23 +178,23 @@ while len(input_lines) > 0:
else:
# the line is already commented, pass it through
buf += line
# if this option already is set don't add the setting again,
# or if we're clearing the setting with -e, don't add it
if (i in found) or (not val and erase_setting):
break
# add the new setting
buf += indent + name + delimiter + val + "\n"
# note that we've applied this option
found.add(i)
break
else:
# If did not match any setting names, pass this line through.
buf += line
# Put any settings we didn't see at the end of the file,
# except settings being cleared.
if not ini_section or cur_section == ini_section.lower():