diff options
Diffstat (limited to 'libs/core')
-rw-r--r-- | libs/core/luasrc/sys.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/core/luasrc/sys.lua b/libs/core/luasrc/sys.lua index 6d03f59db..80d702b94 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) |