blob: 91767ade24ae085d3eb3e2f8ac4b4f78c81b9851 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/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") as authfd:
inp = authfd.read()
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()
|