Deny mutable access for hooks if the config says so

This commit is contained in:
Matthias Beyer 2016-07-06 19:10:29 +02:00
parent 7f14639c1e
commit 7818b523b9
1 changed files with 4 additions and 0 deletions

View File

@ -73,6 +73,10 @@ impl StoreIdAccessor for Aspect {
impl MutableHookDataAccessor for Aspect {
fn access_mut(&self, fle: &mut FileLockEntry) -> HookResult<()> {
if !self.cfg.as_ref().map(|c| c.allow_mutable_hooks()).unwrap_or(false) {
return Err(HE::new(HEK::MutableHooksNotAllowed, None));
}
let accessors : Vec<HDA> = self.hooks.iter().map(|h| h.accessor()).collect();
fn is_file_accessor(a: &HDA) -> bool {