library/src/filesystem/BP-FilesystemRegistryPolicyCheckValidators.cc
// Check a file against socket policy
Check a file against socket policy
Check a file against socket policy
BP_BOOL BP_FSRegCheckFileAgainstCrawlSocketPolicy(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);
	if(file_dirent->d_type == DT_SOCK)
		policy_analysis_inout->is_sock = BP_TRUE;
	if(BP_FLAG_IS_SET(fs_reg_pol->sock_policy, BP_FS_SOCK_POLICY_FLAG_IGNORE_ALL) && policy_analysis_inout->is_sock)
	{
		policy_analysis_inout->sock_ignore_all_match = BP_TRUE;
	}
	if(BP_FLAG_IS_SET(fs_reg_pol->sock_policy, BP_FS_SOCK_POLICY_FLAG_ONLY) && policy_analysis_inout->is_sock)
	{
		policy_analysis_inout->sock_only_match = BP_TRUE;
	}
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION(fs_reg->hreg);
	return BP_TRUE;
}
BP_BOOL BP_FSRegCheckFileAgainstCrawlSocketPolicy ( 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 ) ; if ( file_dirent -> d_type == DT_SOCK ) policy_analysis_inout -> is_sock = BP_TRUE ; if ( BP_FLAG_IS_SET ( fs_reg_pol -> sock_policy , BP_FS_SOCK_POLICY_FLAG_IGNORE_ALL ) && policy_analysis_inout -> is_sock ) { policy_analysis_inout -> sock_ignore_all_match = BP_TRUE ; } if ( BP_FLAG_IS_SET ( fs_reg_pol -> sock_policy , BP_FS_SOCK_POLICY_FLAG_ONLY ) && policy_analysis_inout -> is_sock ) { policy_analysis_inout -> sock_only_match = BP_TRUE ; } BP_HASH_TABLE_LEAVE_CRITICAL_SECTION ( fs_reg -> hreg ) ; return BP_TRUE ; }
Check a file against socket policy
Check a file against socket policy
// run initial null parameter checks // enter critical section before creating new record // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Check if Sock Device %%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // check file type // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Run Individual Flag Checks %%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // BP_FS_SOCK_POLICY_FLAG_IGNORE_ALL // BP_FS_SOCK_POLICY_FLAG_ONLY // ignore check // set ignore all match // only check // set follow directories match // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Unlock and Exit %%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // unlock and exit // return indicating true (all checks passed ok)