VMM/password: added small output check on _dovecotpw(). v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Thu, 29 Apr 2010 03:38:19 +0000
branchv0.6.x
changeset 274 45ec5c3cfef4
parent 273 77fc7138ef6a
child 275 524f7ed5ad5b
VMM/password: added small output check on _dovecotpw().
VirtualMailManager/password.py
--- a/VirtualMailManager/password.py	Thu Apr 29 03:05:22 2010 +0000
+++ b/VirtualMailManager/password.py	Thu Apr 29 03:38:19 2010 +0000
@@ -52,7 +52,11 @@
     stdout, stderr = process.communicate()
     if process.returncode:
         raise VMMError(stderr.strip(), VMM_ERROR)
-    return stdout.strip()
+    hashed = stdout.strip()
+    if not hashed.startswith('{%s}' % scheme):
+        raise VMMError('Unexpected result from %s: %s' %
+                       (cfg_dget('bin.dovecotpw'), hashed), VMM_ERROR)
+    return hashed
 
 
 def _md4_new():