summaryrefslogtreecommitdiffhomepage
path: root/libs/core/luasrc
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-06-02 17:49:27 +0000
committerSteven Barth <steven@midlink.org>2008-06-02 17:49:27 +0000
commitf56890a5733b3c57d088b52bf91a77c44976ca99 (patch)
treee835d0e242cf957bc8b0d0cce1eb5551c3d4a321 /libs/core/luasrc
parent92d76ed83603e50321f171996fc78cef0a6d3580 (diff)
* Added native basic authentication support
* Cleanups
Diffstat (limited to 'libs/core/luasrc')
-rw-r--r--libs/core/luasrc/sys.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/core/luasrc/sys.lua b/libs/core/luasrc/sys.lua
index 6d03f59dbc..80d702b942 100644
--- a/libs/core/luasrc/sys.lua
+++ b/libs/core/luasrc/sys.lua
@@ -263,6 +263,14 @@ end
user = {}
-- returns user information to a given uid
user.getuser = posix.getpasswd
+
+-- checks whether a string matches the password of a certain system user
+function user.checkpasswd(user, password)
+ local account = user.getuser(user)
+ if posix.crypt and account then
+ return (account.passwd == posix.crypt(account.passwd, password))
+ end
+end
-- Changes the user password of given user
function user.setpasswd(user, pwd)