mirror of
				https://github.com/mail-in-a-box/mailinabox.git
				synced 2025-10-30 18:50:53 +00:00 
			
		
		
		
	Fixed RUF039 (unraw-re-pattern)
This commit is contained in:
		
							parent
							
								
									d27797b44b
								
							
						
					
					
						commit
						58b9a59114
					
				| @ -391,7 +391,7 @@ def scan_postgrey_line(date, log, collector): | |||||||
|     """ Scan a postgrey log line and extract interesting data """ |     """ Scan a postgrey log line and extract interesting data """ | ||||||
| 
 | 
 | ||||||
|     m = re.match(r"action=(greylist|pass), reason=(.*?), (?:delay=\d+, )?client_name=(.*), " |     m = re.match(r"action=(greylist|pass), reason=(.*?), (?:delay=\d+, )?client_name=(.*), " | ||||||
|                  "client_address=(.*), sender=(.*), recipient=(.*)", |                  r"client_address=(.*), sender=(.*), recipient=(.*)", | ||||||
|                  log) |                  log) | ||||||
| 
 | 
 | ||||||
|     if m: |     if m: | ||||||
| @ -423,7 +423,7 @@ def scan_postfix_smtpd_line(date, log, collector): | |||||||
| 
 | 
 | ||||||
|     # Check if the incoming mail was rejected |     # Check if the incoming mail was rejected | ||||||
| 
 | 
 | ||||||
|     m = re.match("NOQUEUE: reject: RCPT from .*?: (.*?); from=<(.*?)> to=<(.*?)>", log) |     m = re.match(r"NOQUEUE: reject: RCPT from .*?: (.*?); from=<(.*?)> to=<(.*?)>", log) | ||||||
| 
 | 
 | ||||||
|     if m: |     if m: | ||||||
|         message, sender, user = m.groups() |         message, sender, user = m.groups() | ||||||
| @ -467,7 +467,7 @@ def scan_postfix_smtpd_line(date, log, collector): | |||||||
| def scan_dovecot_login_line(date, log, collector, protocol_name): | def scan_dovecot_login_line(date, log, collector, protocol_name): | ||||||
|     """ Scan a dovecot login log line and extract interesting data """ |     """ Scan a dovecot login log line and extract interesting data """ | ||||||
| 
 | 
 | ||||||
|     m = re.match("Info: Login: user=<(.*?)>, method=PLAIN, rip=(.*?),", log) |     m = re.match(r"Info: Login: user=<(.*?)>, method=PLAIN, rip=(.*?),", log) | ||||||
| 
 | 
 | ||||||
|     if m: |     if m: | ||||||
|         # TODO: CHECK DIT |         # TODO: CHECK DIT | ||||||
|  | |||||||
| @ -167,7 +167,7 @@ def make_domain_config(domain, templates, ssl_certificates, env): | |||||||
| 				proxy_redirect_off = False | 				proxy_redirect_off = False | ||||||
| 				frame_options_header_sameorigin = False | 				frame_options_header_sameorigin = False | ||||||
| 				web_sockets = False | 				web_sockets = False | ||||||
| 				m = re.search("#(.*)$", url) | 				m = re.search(r"#(.*)$", url) | ||||||
| 				if m: | 				if m: | ||||||
| 					for flag in m.group(1).split(","): | 					for flag in m.group(1).split(","): | ||||||
| 						if flag == "pass-http-host": | 						if flag == "pass-http-host": | ||||||
| @ -178,7 +178,7 @@ def make_domain_config(domain, templates, ssl_certificates, env): | |||||||
| 							frame_options_header_sameorigin = True | 							frame_options_header_sameorigin = True | ||||||
| 						elif flag == "web-sockets": | 						elif flag == "web-sockets": | ||||||
| 							web_sockets = True | 							web_sockets = True | ||||||
| 					url = re.sub("#(.*)$", "", url) | 					url = re.sub(r"#(.*)$", "", url) | ||||||
| 
 | 
 | ||||||
| 				nginx_conf_extra += "\tlocation {} {{".format(path) | 				nginx_conf_extra += "\tlocation {} {{".format(path) | ||||||
| 				nginx_conf_extra += "\n\t\tproxy_pass {};".format(url) | 				nginx_conf_extra += "\n\t\tproxy_pass {};".format(url) | ||||||
|  | |||||||
| @ -23,7 +23,7 @@ def migration_1(env): | |||||||
| 	# Migrate the 'domains' directory. | 	# Migrate the 'domains' directory. | ||||||
| 	for sslfn in glob.glob(os.path.join( env["STORAGE_ROOT"], 'ssl/domains/*' )): | 	for sslfn in glob.glob(os.path.join( env["STORAGE_ROOT"], 'ssl/domains/*' )): | ||||||
| 		fn = os.path.basename(sslfn) | 		fn = os.path.basename(sslfn) | ||||||
| 		m = re.match("(.*)_(certifiate.pem|cert_sign_req.csr|private_key.pem)$", fn) | 		m = re.match(r"(.*)_(certifiate.pem|cert_sign_req.csr|private_key.pem)$", fn) | ||||||
| 		if m: | 		if m: | ||||||
| 			# get the new name for the file | 			# get the new name for the file | ||||||
| 			domain_name, file_type = m.groups() | 			domain_name, file_type = m.groups() | ||||||
|  | |||||||
| @ -96,7 +96,7 @@ def sslyze(opts, port, ok_ciphers): | |||||||
| 			# Failed. Just output the error. | 			# Failed. Just output the error. | ||||||
| 			out = re.sub("[\\w\\W]*CHECKING HOST\\(S\\) AVAILABILITY\n\\s*-+\n", "", out) # chop off header that shows the host we queried | 			out = re.sub("[\\w\\W]*CHECKING HOST\\(S\\) AVAILABILITY\n\\s*-+\n", "", out) # chop off header that shows the host we queried | ||||||
| 		out = re.sub("[\\w\\W]*SCAN RESULTS FOR.*\n\\s*-+\n", "", out) # chop off header that shows the host we queried | 		out = re.sub("[\\w\\W]*SCAN RESULTS FOR.*\n\\s*-+\n", "", out) # chop off header that shows the host we queried | ||||||
| 		out = re.sub("SCAN COMPLETED IN .*", "", out) | 		out = re.sub(r"SCAN COMPLETED IN .*", "", out) | ||||||
| 		out = out.rstrip(" \n-") + "\n" | 		out = out.rstrip(" \n-") + "\n" | ||||||
| 
 | 
 | ||||||
| 		# Print. | 		# Print. | ||||||
|  | |||||||
| @ -408,7 +408,7 @@ class BashScript(Grammar): | |||||||
| 		string = re.sub(".* #NODOC\n", "", string) | 		string = re.sub(".* #NODOC\n", "", string) | ||||||
| 		string = re.sub("\n\s*if .*then.*|\n\s*fi|\n\s*else|\n\s*elif .*", "", string) | 		string = re.sub("\n\s*if .*then.*|\n\s*fi|\n\s*else|\n\s*elif .*", "", string) | ||||||
| 		string = quasitokenize(string) | 		string = quasitokenize(string) | ||||||
| 		string = re.sub("hide_output ", "", string) | 		string = re.sub(r"hide_output ", "", string) | ||||||
| 
 | 
 | ||||||
| 		parser = BashScript.parser() | 		parser = BashScript.parser() | ||||||
| 		result = parser.parse_string(string) | 		result = parser.parse_string(string) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user