From 1a64deeb894dc95e2645a75771732c6cc53a79ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 4 Oct 2023 01:35:06 +0200 Subject: Squash changes containing private information There were a lot of changes since the previous commit, but a lot of them contained personnal information about users. All thos changes got stashed into a single commit (history is kept in a different place) and private information was moved in a separate private repository --- modules/private/mail/filter-rewrite-from.py | 68 ----------------------------- 1 file changed, 68 deletions(-) delete mode 100755 modules/private/mail/filter-rewrite-from.py (limited to 'modules/private/mail/filter-rewrite-from.py') diff --git a/modules/private/mail/filter-rewrite-from.py b/modules/private/mail/filter-rewrite-from.py deleted file mode 100755 index aad9c69..0000000 --- a/modules/private/mail/filter-rewrite-from.py +++ /dev/null @@ -1,68 +0,0 @@ -#! /usr/bin/env python3 -import sys - -sys.stdin.reconfigure(encoding='utf-8') -sys.stdout.reconfigure(encoding='utf-8') -stdin = sys.stdin -stdout = sys.stdout - -mailaddr = sys.argv[1] -inheader = {} - -# Change to actual file for logging -logfile = open("/dev/null", "a") - -def log(l, i): - logfile.write("{} {}\n".format(i, l)) - logfile.flush() - -def send(l): - log(l, ">") - stdout.write("{}\n".format(l)) - stdout.flush() - -def token_and_sid(version, sid, token): - if version < "0.5": - return "{}|{}".format(token, sid) - else: - return "{}|{}".format(sid, token) - -log("started", "l") -while True: - line = stdin.readline().strip() - log(line, "<") - if not line: - log("finished", "l") - break - splitted = line.split("|") - if line == "config|ready": - log("in config ready", "l") - send("register|filter|smtp-in|mail-from") - send("register|filter|smtp-in|data-line") - send("register|ready") - if splitted[0] != "filter": - continue - if len(splitted) < 7: - send("invalid filter command: expected >6 fields!") - sys.exit(1) - version = splitted[1] - action = splitted[4] - sid = splitted[5] - token = splitted[6] - token_sid = token_and_sid(version, sid, token) - rest = "|".join(splitted[7:]) - if action == "mail-from": - inheader[sid] = True - send("filter-result|{}|rewrite|<{}>".format(token_sid, mailaddr)) - continue - if action == "data-line": - if rest == "" and inheader.get(sid, False): - inheader[sid] = False - if rest == "." and not inheader.get(sid): - del(inheader[sid]) - if inheader.get(sid, False) and rest.upper().startswith("FROM:"): - send("filter-dataline|{}|From: {}".format(token_sid, mailaddr)) - else: - send("filter-dataline|{}|{}".format(token_sid, rest)) - continue - send("filter-result|{}|proceed".format(token_sid)) -- cgit v1.2.3