modules/luci-mod-rpc: fix attempt to index global 'luci' (a nil value)
authorSabbir Ahmed <sabbiirr@gmail.com>
Sat, 12 Sep 2015 09:11:18 +0000 (15:11 +0600)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 15 Dec 2015 22:46:48 +0000 (23:46 +0100)
modules/luci-mod-rpc/luasrc/controller/rpc.lua

index 129ca43b514ac1d35526829c01e68ffe638d42eb..759bb749cfe0a2cef1b11664df7ddeab42d7a41a 100644 (file)
@@ -49,10 +49,10 @@ function rpc_auth()
        server.challenge = function(user, pass)
                local sid, token, secret
 
-               require "luci.config"
+               local config = require "luci.config"
 
                if sys.user.checkpasswd(user, pass) then
-                       local sdat = util.ubus("session", "create", { timeout = luci.config.sauth.sessiontime })
+                       local sdat = util.ubus("session", "create", { timeout = config.sauth.sessiontime })
                        if sdat then
                                sid = sdat.ubus_rpc_session
                                token = sys.uniqueid(16)