luci-base: dispatcher: fix rpc controller regression
authorJo-Philipp Wich <jo@mein.io>
Tue, 7 Jan 2020 08:08:49 +0000 (09:08 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 7 Jan 2020 08:10:19 +0000 (09:10 +0100)
When testing the luci-rpc authnetication, avoid clobbering the HTTP
post request body.

Fixes: #3470
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/luasrc/dispatcher.lua

index d4293422b5d92bbadce0a1794ac9204e45a39906..8dac8d6b6e65effe7c972e2ce61f210f2d68b594 100644 (file)
@@ -305,7 +305,7 @@ local function tree_to_json(node, json)
                                elseif subname == "rpc" and subnode.module == "luci.controller.rpc" then
                                        spec.auth = {
                                                login = false,
-                                               methods = { "param:auth", "cookie:sysauth" }
+                                               methods = { "query:auth", "cookie:sysauth" }
                                        }
                                elseif subnode.module == "luci.controller.admin.uci" then
                                        spec.auth = {
@@ -546,6 +546,8 @@ local function check_authentication(method)
                sid = http.getcookie(auth_param)
        elseif auth_type == "param" then
                sid = http.formvalue(auth_param)
+       elseif auth_type == "query" then
+               sid = http.formvalue(auth_param, true)
        end
 
        return session_retrieve(sid)