From 0182a4676a87149244868a2742858c5cd41341ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=9C=D0=B0?= =?UTF-8?q?=D0=BA=D0=B0=D1=80=D0=BE=D0=B2?= Date: Thu, 15 Jul 2021 00:04:10 +0500 Subject: [PATCH] Add assert for login/password --- src/ldap-auth-request.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ldap-auth-request.lua b/src/ldap-auth-request.lua index d28f024..3cc8478 100644 --- a/src/ldap-auth-request.lua +++ b/src/ldap-auth-request.lua @@ -20,6 +20,8 @@ local decode_authorization = function(header) local auth_string_b64 = string.match(header, "^Basic%s([^%s]+)$") local auth_string, _ = mime.unb64(auth_string_b64) local login, password = string.match(auth_string, "^([^:]+)[:](.+)$") + assert(login ~= nil and login ~= "", [[Login empty!]]) + assert(password ~= nil and password ~= "", [[Password empty!]]) return login, password end @@ -59,7 +61,7 @@ function _M.run(wsapi_env) -- make normal username local username = string.format("%s%s%s", login_prefix, login, login_suffix) - + local status, err = pcall(bind, dc, username, password) if (not status) then log(err)