#!/usr/bin/env python3 import logging import os import sys VALID_USER = b"mockmaildir@example.org" VALID_PW = b"12345" def main(): with os.fdopen(3, "rb", buffering=0) as authfd: inp = authfd.readall() u, p, *r = inp.split(b"\0") if len(r) > 2: logging.warning("too many fields!") sys.exit(2) if r and r[0]: raise ValueError("cram currently not supported") else: if u == VALID_USER and p == VALID_PW: os.execvp(sys.argv[1], sys.argv[1:]) sys.exit(1) if __name__ == "__main__": main()