setsa: enable spam checking on admin mail nodes
[hcoop/domtool2.git] / scripts / domtool-vmailpasswd
1 #!/usr/bin/python
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
9 import crypt, getpass, sys
10
11 def getpasswords ():
12 crypted = raw_input()
13 clear = raw_input()
14 return (crypted, clear)
15
16 def checkpassword (crypted, clear):
17 return crypt.crypt (clear, crypted) == crypted
18
19 def main ():
20 (crypted, clear) = getpasswords ()
21 if checkpassword (crypted, clear):
22 sys.exit ()
23 else:
24 sys.exit (1)
25
26 if __name__ == "__main__":
27 main ()