library/src/blockclass/BP-BlockClass.cc
// Set All Checks (for simplicity)
Set All Checks (for simplicity)
Set All Checks ( for simplicity )
int Block::SetAllWebAssessmentChecksDefault(bool useDummy)
{
	if (!this->webAssessment)
	{
		this->AddErrorToStack((char*) "Error in SetAllWebAssessmentChecksDefault: No web assessment exists.");
		return ERR_FAILURE;
	}
	if (!useDummy)
	{
		if(this->webAssessment->sqlChecks)
		{
			BP_DestroySQLTests(this->webAssessment->sqlChecks, this->webAssessment->sqlCheckCount);
			this->webAssessment->sqlChecks     = NULL;
			this->webAssessment->sqlCheckCount = 0;
		}
		if(this->webAssessment->xssChecks)
		{
			BP_DestroyXSSTests(this->webAssessment->xssChecks, this->webAssessment->xssChecksCount);
			this->webAssessment->xssChecks     = NULL;
			this->webAssessment->xssChecksCount = 0;
		}
		if (this->SetSQLINJChecks(BP_SQLGenerateRandomArray()) != ERR_SUCCESS)
			return ERR_FAILURE;
		if (this->SetXSSChecks(BP_XSSGenerateRandomArray()) != ERR_SUCCESS)
			return ERR_FAILURE;
	}
	else
	{
		if(this->webAssessment->sqlChecks)
		{
			BP_DestroySQLTests(this->webAssessment->sqlChecks, this->webAssessment->sqlCheckCount);
			this->webAssessment->sqlChecks     = NULL;
			this->webAssessment->sqlCheckCount = 0;
		}
		if(this->webAssessment->xssChecks)
		{
			BP_DestroyXSSTests(this->webAssessment->xssChecks, this->webAssessment->xssChecksCount);
			this->webAssessment->xssChecks     = NULL;
			this->webAssessment->xssChecksCount = 0;
		}
		if (this->SetSQLINJChecks(BP_SQLGenerateRandomArray()) != ERR_SUCCESS)
			return ERR_FAILURE;
		if (this->SetXSSChecks(BP_XSSGenerateRandomArray()) != ERR_SUCCESS)
			return ERR_FAILURE;
	}
	return ERR_SUCCESS;
}
int Block :: SetAllWebAssessmentChecksDefault ( bool useDummy ) { if ( ! this -> webAssessment ) { this -> AddErrorToStack ( ( char * ) " " ) ; return ERR_FAILURE ; } if ( ! useDummy ) { if ( this -> webAssessment -> sqlChecks ) { BP_DestroySQLTests ( this -> webAssessment -> sqlChecks , this -> webAssessment -> sqlCheckCount ) ; this -> webAssessment -> sqlChecks = NULL ; this -> webAssessment -> sqlCheckCount = 0 ; } if ( this -> webAssessment -> xssChecks ) { BP_DestroyXSSTests ( this -> webAssessment -> xssChecks , this -> webAssessment -> xssChecksCount ) ; this -> webAssessment -> xssChecks = NULL ; this -> webAssessment -> xssChecksCount = 0 ; } if ( this -> SetSQLINJChecks ( BP_SQLGenerateRandomArray ( ) ) != ERR_SUCCESS ) return ERR_FAILURE ; if ( this -> SetXSSChecks ( BP_XSSGenerateRandomArray ( ) ) != ERR_SUCCESS ) return ERR_FAILURE ; } else { if ( this -> webAssessment -> sqlChecks ) { BP_DestroySQLTests ( this -> webAssessment -> sqlChecks , this -> webAssessment -> sqlCheckCount ) ; this -> webAssessment -> sqlChecks = NULL ; this -> webAssessment -> sqlCheckCount = 0 ; } if ( this -> webAssessment -> xssChecks ) { BP_DestroyXSSTests ( this -> webAssessment -> xssChecks , this -> webAssessment -> xssChecksCount ) ; this -> webAssessment -> xssChecks = NULL ; this -> webAssessment -> xssChecksCount = 0 ; } if ( this -> SetSQLINJChecks ( BP_SQLGenerateRandomArray ( ) ) != ERR_SUCCESS ) return ERR_FAILURE ; if ( this -> SetXSSChecks ( BP_XSSGenerateRandomArray ( ) ) != ERR_SUCCESS ) return ERR_FAILURE ; } return ERR_SUCCESS ; }
Set All Checks (for simplicity)
Set All Checks ( for simplicity )
// ensure a webassessment exists // set real tests if not dummy // set the non-dummy checks for SQL // set the non-dummy checks for XSS // If not real tests, then dummy tests // set the non-dummy checks for SQL // set the non-dummy checks for XSS // return indicating success