1
0
Fork 0
forked from wry/wry

wayland: prevent unprivileged clients from binding secure globals

This commit is contained in:
Julian Orth 2022-05-07 19:59:51 +02:00
parent 6c9e058c3f
commit 1e9cc60693
2 changed files with 13 additions and 7 deletions

View file

@ -174,8 +174,16 @@ impl Globals {
self.broadcast(state, global.secure(), |r| r.send_global(&global));
}
pub fn get(&self, name: GlobalName) -> Result<Rc<dyn Global>, GlobalsError> {
self.take(name, false)
pub fn get(
&self,
name: GlobalName,
allow_secure: bool,
) -> Result<Rc<dyn Global>, GlobalsError> {
let global = self.take(name, false)?;
if global.secure() && !allow_secure {
return Err(GlobalsError::GlobalDoesNotExist(name));
}
Ok(global)
}
pub fn remove<T: WaylandGlobal>(&self, state: &State, global: &T) -> Result<(), GlobalsError> {