summaryrefslogtreecommitdiff
path: root/src/RpcMethod.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/RpcMethod.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/RpcMethod.cc')
-rw-r--r--src/RpcMethod.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/RpcMethod.cc b/src/RpcMethod.cc
index 1f7ea20b..ec424300 100644
--- a/src/RpcMethod.cc
+++ b/src/RpcMethod.cc
@@ -85,9 +85,11 @@ void RpcMethod::authorize(RpcRequest& req, DownloadEngine* e)
}
}
}
- if (!e || !e->validateToken(token)) {
+ if (!e || (req.authorization != RpcRequest::PREAUTHORIZED &&
+ !e->validateToken(token))) {
throw DL_ABORT_EX("Unauthorized");
}
+ req.authorization = RpcRequest::PREAUTHORIZED;
}
RpcResponse RpcMethod::execute(RpcRequest req, DownloadEngine* e)