summaryrefslogtreecommitdiffstats
path: root/lib/authenticator-plaintext.lua
diff options
context:
space:
mode:
authorNathan Angelacos <nangel@tetrasec.net>2007-12-09 18:07:00 +0000
committerNathan Angelacos <nangel@tetrasec.net>2007-12-09 18:07:00 +0000
commit1197c8530638be7e8123301f47ca863cd9598338 (patch)
tree3e9719a5114fcf3142aa1f3a17cd1ff618e278ba /lib/authenticator-plaintext.lua
parent48cf8a5a2da228724e519187469539d8a006d83f (diff)
downloadacf-core-1197c8530638be7e8123301f47ca863cd9598338.tar.bz2
acf-core-1197c8530638be7e8123301f47ca863cd9598338.tar.xz
added logevent function (hardcoded to write to /var/log/acf.log)
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@421 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/authenticator-plaintext.lua')
-rw-r--r--lib/authenticator-plaintext.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/authenticator-plaintext.lua b/lib/authenticator-plaintext.lua
index 6c58565..d18f5bb 100644
--- a/lib/authenticator-plaintext.lua
+++ b/lib/authenticator-plaintext.lua
@@ -21,13 +21,14 @@ pvt.parse_authfile = function(filename)
-- open our password file
local f = io.open (filename)
if f then
- local m = f:read("*all") .. "\n"
+ local m = (f:read("*all") or "" ).. "\n"
f:close()
-
+
for l in string.gmatch(m, "(%C*)\n") do
local userid, password, username, roles =
string.match(l, "([^:]*):([^:]*):([^:]*):(.*)")
local r = {}
+ roles=roles or ""
for x in string.gmatch(roles, "([^,]*),?") do
table.insert (r, x )
end
@@ -58,11 +59,11 @@ end
-- This function returns true or false, and
-- if false: the reason for failure
-authenticate = function ( userid, password )
+authenticate = function ( self, userid, password )
password = password or ""
userid = userid or ""
- local t = pvt.parse_authfile(conf.confdir .. "/passwd")
+ local t = pvt.parse_authfile(self.conf.confdir .. "/passwd")
if t == false then
return false, "password file is missing"
@@ -81,8 +82,8 @@ authenticate = function ( userid, password )
-- This function returns the username and roles
-- or false on an error
-userinfo = function ( userid )
- local t = pvt.parse_authfile(conf.confdir .. "/passwd")
+userinfo = function ( self, userid )
+ local t = pvt.parse_authfile(self.conf.confdir .. "/passwd")
if t == false then
return false
else