mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd:Ⓜ️:keys: Fix response handling for feds parallel key request.
This commit is contained in:
parent
3fe0729340
commit
8029d25c2d
1 changed files with 33 additions and 18 deletions
|
@ -391,7 +391,7 @@ ircd::m::keys::get(const queries &queries,
|
|||
bool ret{true};
|
||||
std::vector<m::feds::opts> opts;
|
||||
opts.reserve(queries.size());
|
||||
for(const auto &[server_name, key_id] : queries)
|
||||
for(const auto &[server_name, key_id] : queries) try
|
||||
{
|
||||
assert(key_id);
|
||||
assert(server_name);
|
||||
|
@ -461,29 +461,44 @@ ircd::m::keys::get(const queries &queries,
|
|||
result.object["server_keys"]
|
||||
};
|
||||
|
||||
if(empty(server_keys))
|
||||
return true;
|
||||
|
||||
const m::keys keys
|
||||
for(const json::object &keys : server_keys)
|
||||
{
|
||||
server_keys
|
||||
};
|
||||
|
||||
if(!verify(keys, std::nothrow))
|
||||
{
|
||||
log::derror
|
||||
const json::string &server_name
|
||||
{
|
||||
m::log, "Failed to verify key '%s' for '%s' from '%s'",
|
||||
result.request->arg[0],
|
||||
result.request->arg[1],
|
||||
result.origin,
|
||||
keys["server_name"]
|
||||
};
|
||||
|
||||
return true;
|
||||
if(server_name != result.request->arg[0] || server_name != result.origin)
|
||||
{
|
||||
log::derror
|
||||
{
|
||||
m::log, "Origin mismatch for '%s' got '%s' from '%s'",
|
||||
result.request->arg[0],
|
||||
server_name,
|
||||
result.origin,
|
||||
};
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!verify(m::keys(keys), std::nothrow))
|
||||
{
|
||||
log::derror
|
||||
{
|
||||
m::log, "Failed to verify key '%s' for '%s' from '%s'",
|
||||
result.request->arg[0],
|
||||
result.request->arg[1],
|
||||
result.origin,
|
||||
};
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
cache::set(keys);
|
||||
if(!(ret = closure(keys)))
|
||||
return ret;
|
||||
}
|
||||
|
||||
cache::set(result.object);
|
||||
ret = closure(result.object);
|
||||
return ret;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue