worker: add runOutput function
[hcoop/domtool2.git] / scripts / domtool-vmailpasswd
CommitLineData
83ea7833 1#!/usr/bin/python
0e0442b0
CE
2# -*- python -*-
3
4# Helper for domtool to check if a vmail password matches the stored
5# password, before allowing the portal to change the password. This
6# should never be run manually, since it does not suppress echoing of
7# anything entered.
8
9import crypt, getpass, sys
10
11def getpasswords ():
12 crypted = raw_input()
13 clear = raw_input()
14 return (crypted, clear)
15
16def checkpassword (crypted, clear):
17 return crypt.crypt (clear, crypted) == crypted
18
19def main ():
20 (crypted, clear) = getpasswords ()
21 if checkpassword (crypted, clear):
22 sys.exit ()
23 else:
24 sys.exit (1)
25
26if __name__ == "__main__":
27 main ()