Driver: Simplify fort_conf_app_blocked().

This commit is contained in:
Nodir Temirkhodjaev 2021-04-19 14:33:34 +03:00
parent da78546141
commit d5b947ffe6

View File

@ -267,16 +267,14 @@ FORT_API BOOL fort_conf_app_blocked(
const UINT32 app_perm = app_perm_val << (app_flags.group_index * 2); const UINT32 app_perm = app_perm_val << (app_flags.group_index * 2);
/* Block All */ /* Block All */
if (conf->flags.app_block_all) { const BOOL app_allowed = app_found && (app_perm & conf->app_perms_allow_mask) != 0;
/* Block, if it is not explicitly allowed */ if (conf->flags.app_block_all)
return !app_found || (app_perm & conf->app_perms_allow_mask) == 0; return !app_allowed; /* Block, if it is not explicitly allowed */
}
/* Allow All */ /* Allow All */
if (conf->flags.app_allow_all) { const BOOL app_blocked = app_found && (app_perm & conf->app_perms_block_mask) != 0;
/* Block, if it is explicitly blocked */ if (conf->flags.app_allow_all)
return app_found && (app_perm & conf->app_perms_block_mask) != 0; return app_blocked; /* Block, if it is explicitly blocked */
}
/* Block or Allow */ /* Block or Allow */
if (!app_found) { if (!app_found) {
@ -285,8 +283,7 @@ FORT_API BOOL fort_conf_app_blocked(
} }
/* Block, if it is explicitly blocked and not allowed */ /* Block, if it is explicitly blocked and not allowed */
return (app_perm & conf->app_perms_block_mask) != 0 return app_blocked && !app_allowed;
&& (app_perm & conf->app_perms_allow_mask) == 0;
} }
FORT_API UINT16 fort_conf_app_period_bits(const PFORT_CONF conf, FORT_TIME time, int *periods_n) FORT_API UINT16 fort_conf_app_period_bits(const PFORT_CONF conf, FORT_TIME time, int *periods_n)