HostServ: normalise vhosts + enforce uniqueness
Canonicalise a requested vhost the way the ircd displays it (a disallowed underscore becomes a hyphen) before storing and applying, so what we keep matches what shows on the network. A vhost can no longer be assigned to two accounts: prepare_vhost normalises, validates, and checks vhost_owner at every assignment point (SET/REQUEST/ACTIVATE/TAKE/DEFAULT), so two inputs that collapse to the same host are caught as one. Approach recommended by siniStar (the ns_nethost normalisation logic).
This commit is contained in:
parent
271e06fa77
commit
31d23cf6b3
9 changed files with 130 additions and 18 deletions
|
|
@ -601,6 +601,7 @@ pub trait Store {
|
|||
fn del_vhost(&mut self, account: &str) -> Result<bool, RegError>;
|
||||
fn vhost(&self, account: &str) -> Option<VhostView>;
|
||||
fn vhosts(&self) -> Vec<VhostView>;
|
||||
fn vhost_owner(&self, host: &str) -> Option<String>;
|
||||
fn request_vhost(&mut self, account: &str, host: &str) -> Result<(), RegError>;
|
||||
fn vhost_request_wait(&self, account: &str) -> u64;
|
||||
fn take_vhost_request(&mut self, account: &str) -> Result<Option<String>, RegError>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue