Cleanly handle invalid response from trusted server instead of panicking

This commit is contained in:
Nyaaori 2022-10-31 12:08:01 +01:00
parent 00996dd834
commit 23cf39c525
No known key found for this signature in database
GPG Key ID: E7819C3ED4D1F82E
1 changed files with 11 additions and 1 deletions

View File

@ -1464,7 +1464,17 @@ impl Service {
.write()
.map_err(|_| Error::bad_database("RwLock is poisoned."))?;
for k in keys.server_keys {
let k = k.deserialize().unwrap();
let k = match k.deserialize() {
Ok(key) => key,
Err(e) => {
warn!(
"Received error {} while fetching keys from trusted server {}",
e, server
);
warn!("{}", k.into_json());
continue;
}
};
// TODO: Check signature from trusted server?
servers.remove(&k.server_name);