summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--freeradius3-model.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/freeradius3-model.lua b/freeradius3-model.lua
index 1606971..df85118 100644
--- a/freeradius3-model.lua
+++ b/freeradius3-model.lua
@@ -554,7 +554,8 @@ function mymodule.update_passwd(self, passwd)
local success = false
passwd.value.oldpassword.errtxt = "Incorrect password"
local algo_salt, hash = string.match(pwhash, "^(%$%d%$[a-zA-Z0-9./]+%$)(.*)")
- if algo_salt ~= nil and hash ~= nil then
+ if not algo_salt then algo_salt = string.sub(pwhash, 1, 3) end
+ if algo_salt ~= nil then
if (pwhash == posix.crypt(passwd.value.oldpassword.value, algo_salt)) then
success = true
passwd.value.oldpassword.errtxt = nil