From eaaeb1c031675baad5c15fa563ed65d32035f9eb Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Mon, 3 Jul 2017 01:14:18 +0200 Subject: [PATCH] Made IPv6 and Python2.6-format() compatible. Removed sys.exit() to enable full functionality. --- qmail-arc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qmail-arc.py b/qmail-arc.py index 5cefccb..e5e03d3 100755 --- a/qmail-arc.py +++ b/qmail-arc.py @@ -36,7 +36,7 @@ privkey = open('.dkim-privkey', 'rb').read() message = sys.stdin.read() -up_srv_ip_match = re.search(r"Received: from .* \(HELO (.*)\) \(([0-9.]+)\).*by ", message, re.MULTILINE | re.DOTALL) +up_srv_ip_match = re.search(r"Received: from .* \(HELO (.*)\) \(([0-9a-f.:]+)\).*by ", message, re.MULTILINE | re.DOTALL) up_srv_helo = up_srv_ip_match.group(1).lower() up_srv_ip = up_srv_ip_match.group(2) @@ -73,7 +73,7 @@ spf_res = authres.SPFAuthenticationResult(result=spf_result[0], smtp_mailfrom=se results_list += [spf_res] # Write Received-SPF header -sys.stdout.write('Received-SPF: {} ({}) client-ip={} helo={} envelope-from={}'.format(spf_result[0], spf_result[1], up_srv_ip, up_srv_helo, sender_address)+"\n") +sys.stdout.write('Received-SPF: {0} ({1}) client-ip={2} helo={3} envelope-from={4}'.format(spf_result[0], spf_result[1], up_srv_ip, up_srv_helo, sender_address)+"\n") ### ARC SIGNATURE @@ -95,5 +95,5 @@ sig = dkim.arc_sign(message, DKIM_SELECTOR, DKIM_DOMAIN, privkey, str(auth_res)[ for line in sig: sys.stdout.write(line) -sys.exit(0) + sys.stdout.write(message)