vmailpasswd
[hcoop/zz_old/portal.git] / vmailpasswd / pass.sml
diff --git a/vmailpasswd/pass.sml b/vmailpasswd/pass.sml
new file mode 100644 (file)
index 0000000..c78c84b
--- /dev/null
@@ -0,0 +1,24 @@
+structure Pass :> PASS =
+struct
+
+fun validEmail email =
+    case String.fields (fn ch => ch = #"@") email of
+       [_, dom] => dom <> "localhost"
+      | _ => false
+
+val vmp = "/usr/local/bin/vmailpasswd"
+
+fun change (email, old, new) =
+    let
+       val cmd = String.concat ["/usr/local/bin/vmailpasswd \"",
+                                String.toString email,
+                                "\" \"",
+                                String.toString old,
+                                "\" \"",
+                                String.toString new,
+                                "\" >/dev/null 2>/dev/null"]
+    in
+       OS.Process.isSuccess (OS.Process.system cmd)
+    end
+
+end