library/src/filesystem/BP-FilesystemRegistryPolicyCheckValidators.cc
// Check a file against hidden policy.
Check a file against hidden policy.
Check a file against hidden policy .
BP_BOOL BP_FSRegCheckFileAgainstCrawlHiddenPolicy(BP_FSREG_CHECK_FILE_FUNC_PARMS)
{
	BP_FSREG_CHECK_POLICY_FUNC_ENTRY_RUN_NULL_CHECKS(BP_FALSE);
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(fs_reg->hreg);
	BP_BOOL is_hidden = (filename[0] == '.') ? BP_TRUE : BP_FALSE;
	policy_analysis_inout->is_hidden = is_hidden;
	if(BP_FLAG_IS_SET(fs_reg_pol->hidden_policy, BP_FS_HIDDEN_POLICY_FLAG_ONLY) && is_hidden)
	{
		policy_analysis_inout->hidden_only_match = BP_TRUE;
	}
	if(BP_FLAG_IS_SET(fs_reg_pol->hidden_policy, BP_FS_HIDDEN_POLICY_FLAG_IGNORE_ALL) && is_hidden)
	{
		policy_analysis_inout->hidden_ignore_all_match = BP_TRUE;
	}
	if(BP_FLAG_IS_SET(fs_reg_pol->hidden_policy, BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_HIDDEN_DIRECTORIES) && is_hidden)
	{
		policy_analysis_inout->hidden_examine_directories_match = BP_TRUE;
	}
	if(BP_FLAG_IS_SET(fs_reg_pol->hidden_policy, BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_HIDDEN_FILES) && is_hidden)
	{
		policy_analysis_inout->hidden_examine_files_match = BP_TRUE;
	}
	if(BP_FLAG_IS_SET(fs_reg_pol->hidden_policy, BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_ONLY_HIDDEN_DIRECTORIES) && is_hidden)
	{
		policy_analysis_inout->hidden_examine_only_directories_match = BP_TRUE;
	}
	if(BP_FLAG_IS_SET(fs_reg_pol->hidden_policy, BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_ONLY_HIDDEN_FILES) && is_hidden)
	{
		policy_analysis_inout->hidden_examine_only_files_match = BP_TRUE;
	}
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION(fs_reg->hreg);
	return BP_TRUE;
}
BP_BOOL BP_FSRegCheckFileAgainstCrawlHiddenPolicy ( BP_FSREG_CHECK_FILE_FUNC_PARMS ) { BP_FSREG_CHECK_POLICY_FUNC_ENTRY_RUN_NULL_CHECKS ( BP_FALSE ) ; BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( fs_reg -> hreg ) ; BP_BOOL is_hidden = ( filename [ 0 ] == ' ' ) ? BP_TRUE : BP_FALSE ; policy_analysis_inout -> is_hidden = is_hidden ; if ( BP_FLAG_IS_SET ( fs_reg_pol -> hidden_policy , BP_FS_HIDDEN_POLICY_FLAG_ONLY ) && is_hidden ) { policy_analysis_inout -> hidden_only_match = BP_TRUE ; } if ( BP_FLAG_IS_SET ( fs_reg_pol -> hidden_policy , BP_FS_HIDDEN_POLICY_FLAG_IGNORE_ALL ) && is_hidden ) { policy_analysis_inout -> hidden_ignore_all_match = BP_TRUE ; } if ( BP_FLAG_IS_SET ( fs_reg_pol -> hidden_policy , BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_HIDDEN_DIRECTORIES ) && is_hidden ) { policy_analysis_inout -> hidden_examine_directories_match = BP_TRUE ; } if ( BP_FLAG_IS_SET ( fs_reg_pol -> hidden_policy , BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_HIDDEN_FILES ) && is_hidden ) { policy_analysis_inout -> hidden_examine_files_match = BP_TRUE ; } if ( BP_FLAG_IS_SET ( fs_reg_pol -> hidden_policy , BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_ONLY_HIDDEN_DIRECTORIES ) && is_hidden ) { policy_analysis_inout -> hidden_examine_only_directories_match = BP_TRUE ; } if ( BP_FLAG_IS_SET ( fs_reg_pol -> hidden_policy , BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_ONLY_HIDDEN_FILES ) && is_hidden ) { policy_analysis_inout -> hidden_examine_only_files_match = BP_TRUE ; } BP_HASH_TABLE_LEAVE_CRITICAL_SECTION ( fs_reg -> hreg ) ; return BP_TRUE ; }
Check a file against hidden policy.
Check a file against hidden policy .
// run initial null parameter checks // enter critical section before creating new record // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Check if Hidden %%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // We need to determine if the file is a hidden file, so run initial check. // if the file starts with a dot, it's a hidden file // set hidden flag in policy // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Run Individual Flag Checks %%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // BP_FS_HIDDEN_POLICY_FLAG_IGNORE_ALL // BP_FS_HIDDEN_POLICY_FLAG_ONLY // BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_HIDDEN_DIRECTORIES // BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_HIDDEN_FILES // BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_ONLY_HIDDEN_DIRECTORIES // BP_FS_HIDDEN_POLICY_FLAG_EXAMINE_ONLY_HIDDEN_FILES // -- basic examine checks ---- // -- only examine checks --- // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Unlock and Exit %%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // unlock and exit // return indicating true (all checks passed ok)