summaryrefslogtreecommitdiffhomepage
path: root/libs/sgi-webuci
diff options
context:
space:
mode:
Diffstat (limited to 'libs/sgi-webuci')
-rw-r--r--libs/sgi-webuci/luasrc/sgi/webuci.lua15
-rw-r--r--libs/sgi-webuci/root/usr/lib/boa/luci.lua2
2 files changed, 17 insertions, 0 deletions
diff --git a/libs/sgi-webuci/luasrc/sgi/webuci.lua b/libs/sgi-webuci/luasrc/sgi/webuci.lua
index 2beff6907..1ad067c6b 100644
--- a/libs/sgi-webuci/luasrc/sgi/webuci.lua
+++ b/libs/sgi-webuci/luasrc/sgi/webuci.lua
@@ -33,6 +33,21 @@ function initenv(env, vars)
luci.http.vars = vars
end
+-- Enforces user authentification
+function luci.http.basic_auth(verify_callback, realm)
+ local user = luci.http.env.auth_user
+ local pass = luci.http.env.auth_password
+ realm = realm or ""
+
+ if not user or not verify_callback(user, pass) then
+ luci.http.status("401", "Unauthorized")
+ luci.http.header("WWW-Authenticate", string.format('Basic realm="%s"', realm))
+ return false
+ else
+ return true
+ end
+end
+
-- Returns the main dispatcher URL
function luci.http.dispatcher()
return luci.http.env.SCRIPT_NAME or ""
diff --git a/libs/sgi-webuci/root/usr/lib/boa/luci.lua b/libs/sgi-webuci/root/usr/lib/boa/luci.lua
index 2ea6ba4cb..e34bd5e2d 100644
--- a/libs/sgi-webuci/root/usr/lib/boa/luci.lua
+++ b/libs/sgi-webuci/root/usr/lib/boa/luci.lua
@@ -38,6 +38,8 @@ function init(path)
luci.sys.net.routes = function() return {} end
luci.sys.wifi.getiwconfig = function() return {} end
luci.sys.wifi.iwscan = function() return {} end
+
+ luci.sys.user.checkpasswd = function() return true end
end
end