From ded6a3f24098a3a74ff8b4d64cb896944edbf515 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Jul 2016 00:55:55 +0200 Subject: [PATCH] Add error output in Aspect execution code --- libimagstore/src/hook/aspect.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/libimagstore/src/hook/aspect.rs b/libimagstore/src/hook/aspect.rs index 71ebd4f7..6fdfb209 100644 --- a/libimagstore/src/hook/aspect.rs +++ b/libimagstore/src/hook/aspect.rs @@ -42,7 +42,15 @@ impl Aspect { impl StoreIdAccessor for Aspect { fn access(&self, id: &StoreId) -> HookResult<()> { let accessors : Vec = self.hooks.iter().map(|h| h.accessor()).collect(); - if !accessors.iter().all(|a| is_match!(*a, HDA::StoreIdAccess(_))) { + if !accessors.iter().all(|a| { + let x = is_match!(*a, HDA::StoreIdAccess(_)); + if !x { + warn!("Denied execution of None-StoreId-Accessing Hook"); + debug!("Accessor: {:?}", a); + debug!("in StoreIdAccess-Aspect execution: {:?}", self); + } + x + }) { return Err(HE::new(HEK::AccessTypeViolation, None)); } @@ -90,7 +98,15 @@ impl MutableHookDataAccessor for Aspect { impl NonMutableHookDataAccessor for Aspect { fn access(&self, fle: &FileLockEntry) -> HookResult<()> { let accessors : Vec = self.hooks.iter().map(|h| h.accessor()).collect(); - if !accessors.iter().all(|a| is_match!(*a, HDA::NonMutableAccess(_))) { + if !accessors.iter().all(|a| { + let x = is_match!(*a, HDA::NonMutableAccess(_)); + if !x { + warn!("Denied execution of Non-Mutable-Accessing Hook"); + debug!("Accessor: {:?}", a); + debug!("in StoreIdAccess-Aspect execution: {:?}", self); + } + x + }) { return Err(HE::new(HEK::AccessTypeViolation, None)); }