mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-25 15:29:32 -05:00
do not permit node id to be a schema member. closes #359
This commit is contained in:
parent
d8710b800d
commit
ab419f03ef
@ -212,6 +212,20 @@ impl StorageManagerInner {
|
||||
apibail_not_initialized!();
|
||||
};
|
||||
|
||||
// Verify the dht schema does not contain the node id
|
||||
{
|
||||
let cfg = self.unlocked_inner.config.get();
|
||||
if let Some(node_id) = cfg.network.routing_table.node_id.get(kind) {
|
||||
if schema.is_member(&node_id.value) {
|
||||
apibail_invalid_argument!(
|
||||
"node id can not be schema member",
|
||||
"schema",
|
||||
node_id.value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compile the dht schema
|
||||
let schema_data = schema.compile();
|
||||
|
||||
|
@ -134,8 +134,11 @@ fn get_route_id(
|
||||
}
|
||||
}
|
||||
|
||||
fn get_dht_schema(text: &str) -> Option<DHTSchema> {
|
||||
deserialize_json::<DHTSchema>(text).ok()
|
||||
fn get_dht_schema(text: &str) -> Option<VeilidAPIResult<DHTSchema>> {
|
||||
if text.is_empty() {
|
||||
return None;
|
||||
}
|
||||
Some(deserialize_json::<DHTSchema>(text))
|
||||
}
|
||||
|
||||
fn get_safety_selection(routing_table: RoutingTable) -> impl Fn(&str) -> Option<SafetySelection> {
|
||||
@ -1424,7 +1427,7 @@ impl VeilidAPI {
|
||||
"dht_schema",
|
||||
get_dht_schema,
|
||||
)
|
||||
.unwrap_or_else(|_| DHTSchema::dflt(1));
|
||||
.unwrap_or_else(|_| Ok(DHTSchema::dflt(1)))?;
|
||||
|
||||
let csv = get_debug_argument_at(
|
||||
&args,
|
||||
|
Loading…
Reference in New Issue
Block a user