Merge pull request #547 from matthiasbeyer/libimagstore/aspect-execution-output
Add error output in Aspect execution code
This commit is contained in:
commit
c6be35554b
1 changed files with 18 additions and 2 deletions
|
@ -42,7 +42,15 @@ impl Aspect {
|
||||||
impl StoreIdAccessor for Aspect {
|
impl StoreIdAccessor for Aspect {
|
||||||
fn access(&self, id: &StoreId) -> HookResult<()> {
|
fn access(&self, id: &StoreId) -> HookResult<()> {
|
||||||
let accessors : Vec<HDA> = self.hooks.iter().map(|h| h.accessor()).collect();
|
let accessors : Vec<HDA> = 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));
|
return Err(HE::new(HEK::AccessTypeViolation, None));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +101,15 @@ impl MutableHookDataAccessor for Aspect {
|
||||||
impl NonMutableHookDataAccessor for Aspect {
|
impl NonMutableHookDataAccessor for Aspect {
|
||||||
fn access(&self, fle: &FileLockEntry) -> HookResult<()> {
|
fn access(&self, fle: &FileLockEntry) -> HookResult<()> {
|
||||||
let accessors : Vec<HDA> = self.hooks.iter().map(|h| h.accessor()).collect();
|
let accessors : Vec<HDA> = 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));
|
return Err(HE::new(HEK::AccessTypeViolation, None));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue