diff options
author | Mike Mason <ms13sp@gmail.com> | 2008-01-30 14:53:49 +0000 |
---|---|---|
committer | Mike Mason <ms13sp@gmail.com> | 2008-01-30 14:53:49 +0000 |
commit | cd0c582c41acb719ef6590ab4ba63d66bdd7539d (patch) | |
tree | f3107fd31ecef36e9446e03c9220e0b7eef74d4f | |
parent | 16dec62905c7e8580bff7ef5f75c29b29409d105 (diff) | |
download | acf-core-cd0c582c41acb719ef6590ab4ba63d66bdd7539d.tar.bz2 acf-core-cd0c582c41acb719ef6590ab4ba63d66bdd7539d.tar.xz |
Updated the code to use md5sums in the acf passwd file. Made the md5sum_string function(to go along with md5sum_file) in fs
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@665 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | app/acf-util/logon-model.lua | 4 | ||||
-rw-r--r-- | lib/format.lua | 1 | ||||
-rw-r--r-- | lib/fs.lua | 12 |
3 files changed, 15 insertions, 2 deletions
diff --git a/app/acf-util/logon-model.lua b/app/acf-util/logon-model.lua index abbbfd2..a86d361 100644 --- a/app/acf-util/logon-model.lua +++ b/app/acf-util/logon-model.lua @@ -4,6 +4,7 @@ module (..., package.seeall) require ("session") require ("html") +require ("fs") --varibles for time in case of logons,expired,lockouts minutes_expired_events=30 @@ -50,7 +51,8 @@ end session.expired_events(conf.sessiondir, minutes_expired_events) if id_user and password_user then - if auth.authenticate (self, id_user, password_user) then + local password_user_md5 = fs.md5sum_string(password_user) + if auth.authenticate (self, id_user, password_user_md5) then local t = auth.get_userinfo (self, id_user) sessiondata.id = session.random_hash(512) sessiondata.userinfo = t or {} diff --git a/lib/format.lua b/lib/format.lua index 0b7b54b..1fa5fc6 100644 --- a/lib/format.lua +++ b/lib/format.lua @@ -148,4 +148,3 @@ function string_to_table ( text, delimiter) return list end - @@ -88,6 +88,18 @@ function md5sum_file ( path ) return checksum end +function md5sum_string ( str) + cmd = "/bin/echo -n " .. str .. "|/usr/bin/md5sum|cut -f 1 -d \" \" " + f = io.popen(cmd) + local checksum = {} + for line in f:lines() do + checksum[#checksum + 1] = line + end + f:close() + return checksum[1] +end + + -- iterator function for finding dir entries matching filespec (what) -- starting at where, or currentdir if not specified. |