diff options
author | Ted Trask <ttrask01@yahoo.com> | 2010-09-09 14:34:52 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2010-09-09 14:34:52 +0000 |
commit | ba26ef8ecef31ae3bd145b276994f76e5f633ebd (patch) | |
tree | 237b0b89d7548109d73d7c213859514dd890f852 /authenticator-freeswitch-vmail.lua | |
download | acf-freeswitch-vmail-ba26ef8ecef31ae3bd145b276994f76e5f633ebd.tar.bz2 acf-freeswitch-vmail-ba26ef8ecef31ae3bd145b276994f76e5f633ebd.tar.xz |
Initial cut - but pretty close to complete.v0.0.1
Diffstat (limited to 'authenticator-freeswitch-vmail.lua')
-rw-r--r-- | authenticator-freeswitch-vmail.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/authenticator-freeswitch-vmail.lua b/authenticator-freeswitch-vmail.lua new file mode 100644 index 0000000..5824dc7 --- /dev/null +++ b/authenticator-freeswitch-vmail.lua @@ -0,0 +1,46 @@ +-- Copy of authenticator-plaintext, plus added authentication from voicemail DB +module (..., package.seeall) + +require("md5") +a = require("authenticator-plaintext") + +list_fields = function(self, tabl) + result = a.list_fields(self, tabl) + return result +end + +read_field = function(self, tabl, field) + result = a.read_field(self, tabl, field) + if tabl == authenticator.usertable and field == "" then + -- authenticator is reading all users + local vmcontroller = self:new("freeswitch-vmail/vmail") + local users = vmcontroller:listusers() + for i,val in ipairs(users.value) do + local settings = vmcontroller.model.get_usersettings(val.username) + local string = md5.sumhexa(settings.value["vm-password"].value)..":Voicemail User:/freeswitch-vmail/vmail/USER" + result[#result+1] = { id=settings.value.username.value, entry=string } + end + vmcontroller:destroy() + end + return result +end + +delete_field = function(self, tabl, field) + result = a.delete_field(self, tabl, field) + return result +end + +write_entry = function(self, tabl, field, id, entry) + result = a.write_entry(self, tabl, field, id, entry) + return result +end + +read_entry = function(self, tabl, field, id) + result = a.read_entry(self, tabl, field, id) + return result +end + +delete_entry = function (self, tabl, field, id) + result = a.delete_entry(self, tabl, field, id) + return result +end |