summaryrefslogtreecommitdiff
path: root/src/RpcMethodImpl.cc
diff options
context:
space:
mode:
authorNils Maier <maierman@web.de>2014-05-17 17:31:21 +0200
committerNils Maier <maierman@web.de>2014-05-20 12:53:39 +0200
commit855dfa0e2f8ca7869d28d2afc21fed2e3790549a (patch)
treee156bebeee259fa0213611a54d3ed169c1c04ad7 /src/RpcMethodImpl.cc
parent88b61f2eb97faa5fad1a0dd882ef1d1ade48c8df (diff)
Authorize RPC multicalls only once.
Cache the auth status afterwards and just assume the token still matches (within the same request, of course).
Diffstat (limited to 'src/RpcMethodImpl.cc')
-rw-r--r--src/RpcMethodImpl.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc
index 0ecf9f3e..91d5a2ed 100644
--- a/src/RpcMethodImpl.cc
+++ b/src/RpcMethodImpl.cc
@@ -1361,6 +1361,7 @@ std::unique_ptr<ValueBase> SystemMulticallRpcMethod::process
{
const List* methodSpecs = checkRequiredParam<List>(req, 0);
auto list = List::g();
+ auto auth = RpcRequest::MUST_AUTHORIZE;
for(auto & methodSpec : *methodSpecs) {
Dict* methodDict = downcast<Dict>(methodSpec);
if(!methodDict) {
@@ -1388,12 +1389,19 @@ std::unique_ptr<ValueBase> SystemMulticallRpcMethod::process
} else {
paramsList = List::g();
}
- RpcResponse res = getMethod(methodName->s())->execute
- ({methodName->s(), std::move(paramsList), nullptr, req.jsonRpc}, e);
+ RpcRequest r = {
+ methodName->s(),
+ std::move(paramsList),
+ nullptr,
+ auth,
+ req.jsonRpc
+ };
+ RpcResponse res = getMethod(methodName->s())->execute(std::move(r), e);
if(res.code == 0) {
auto l = List::g();
l->append(std::move(res.param));
list->append(std::move(l));
+ auth = RpcRequest::PREAUTHORIZED;
} else {
list->append(std::move(res.param));
}