Commit | Line | Data |
---|---|---|
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 | ||
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 () |