library/src/blockclass/BP-BlockClass.cc
// Saves the SQL error message data to the database.
Saves the SQL error message data to the database.
Saves the SQL error message data to the database .
BP_ERROR_T Block::WebAssessmentSaveSQLErrorMessageData()
{
	if(!this->mysqlSession)
		return ERR_FAILURE;
	BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION;
	if(!this->webAssessment)
		BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_FAILURE);
	if(!this->webAssessment->sqlResults)
		BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_FAILURE);
	P_BP_WEB_SQLINJ_TEST_RESULT sql_result = this->webAssessment->sqlResults->first;
	size_t index_iterator = 0;
	for(; sql_result; sql_result = sql_result->next)
	{
		for
		(
				index_iterator = 0;
				index_iterator < sql_result->mysqlTestMatchesMade;
				index_iterator++
		)
		{
			this->WebAssessmentAddEngineAnalysisDataEntry
			(
					sql_result->request_data.result_id,
					sql_result->request_data.request_id,
					sql_result->request_data.http_status_code,
					(char *) &sql_result->request_data.http_get,
					(char *) &sql_result->request_data.http_post,
					(char *) &sql_result->request_data.http_cookie,
					(char *) &sql_result->request_data.http_header,
					(char *) &sql_result->request_data.suspected_get_var,
					(char *) &sql_result->request_data.suspected_post_var,
					(char *) &sql_result->request_data.suspected_cookie_var,
					(char *) &sql_result->request_data.suspected_header_var,
					BP_WEB_ANALYSIS_ENGINES_MYSQL,
					BP_WEB_ANALYSIS_CONDITION_SQL_MSG,
					(char *) this->webAssessment->mysqlErrCodes[sql_result->mysqlTestMatchIndexes[index_iterator]].mysqlErrStr,
					(char *) this->webAssessment->mysqlErrCodes[sql_result->mysqlTestMatchIndexes[index_iterator]].mysqlErrStr,
					sql_result->mysqlTestMatchIndexes[index_iterator]
			);
		}
		for
		(
				index_iterator = 0;
				index_iterator < sql_result->msqlTestMatchesMade;
				index_iterator++
		)
		{
			this->WebAssessmentAddEngineAnalysisDataEntry
			(
					sql_result->request_data.result_id,
					sql_result->request_data.request_id,
					sql_result->request_data.http_status_code,
					(char *) &sql_result->request_data.http_get,
					(char *) &sql_result->request_data.http_post,
					(char *) &sql_result->request_data.http_cookie,
					(char *) &sql_result->request_data.http_header,
					(char *) &sql_result->request_data.suspected_get_var,
					(char *) &sql_result->request_data.suspected_post_var,
					(char *) &sql_result->request_data.suspected_cookie_var,
					(char *) &sql_result->request_data.suspected_header_var,
					BP_WEB_ANALYSIS_ENGINES_MSQL,
					BP_WEB_ANALYSIS_CONDITION_SQL_MSG,
					(char *) this->webAssessment->msqlErrCodes[sql_result->msqlTestMatchIndexes[index_iterator]].description,
					(char *) this->webAssessment->msqlErrCodes[sql_result->msqlTestMatchIndexes[index_iterator]].description,
					sql_result->msqlTestMatchIndexes[index_iterator]
			);
		}
		for
		(
				index_iterator = 0;
				index_iterator < sql_result->oracleTestMatchesMade;
				index_iterator++
		)
		{
			this->WebAssessmentAddEngineAnalysisDataEntry
			(
					sql_result->request_data.result_id,
					sql_result->request_data.request_id,
					sql_result->request_data.http_status_code,
					(char *) &sql_result->request_data.http_get,
					(char *) &sql_result->request_data.http_post,
					(char *) &sql_result->request_data.http_cookie,
					(char *) &sql_result->request_data.http_header,
					(char *) &sql_result->request_data.suspected_get_var,
					(char *) &sql_result->request_data.suspected_post_var,
					(char *) &sql_result->request_data.suspected_cookie_var,
					(char *) &sql_result->request_data.suspected_header_var,
					BP_WEB_ANALYSIS_ENGINES_ORACLE,
					BP_WEB_ANALYSIS_CONDITION_SQL_MSG,
					(char *) this->webAssessment->oracleErrCodes[sql_result->oracleTestMatchIndexes[index_iterator]].description,
					(char *) this->webAssessment->oracleErrCodes[sql_result->oracleTestMatchIndexes[index_iterator]].description,
					sql_result->oracleTestMatchIndexes[index_iterator]
			);
		}
		for
		(
				index_iterator = 0;
				index_iterator < sql_result->odbcTestMatchesMade;
				index_iterator++
		)
		{
			this->WebAssessmentAddEngineAnalysisDataEntry
			(
					sql_result->request_data.result_id,
					sql_result->request_data.request_id,
					sql_result->request_data.http_status_code,
					(char *) &sql_result->request_data.http_get,
					(char *) &sql_result->request_data.http_post,
					(char *) &sql_result->request_data.http_cookie,
					(char *) &sql_result->request_data.http_header,
					(char *) &sql_result->request_data.suspected_get_var,
					(char *) &sql_result->request_data.suspected_post_var,
					(char *) &sql_result->request_data.suspected_cookie_var,
					(char *) &sql_result->request_data.suspected_header_var,
					BP_WEB_ANALYSIS_ENGINES_ODBC,
					BP_WEB_ANALYSIS_CONDITION_SQL_MSG,
					(char *) this->webAssessment->odbcErrCodes[sql_result->odbcTestMatchIndexes[index_iterator]].description,
					(char *) this->webAssessment->odbcErrCodes[sql_result->odbcTestMatchIndexes[index_iterator]].description,
					sql_result->odbcTestMatchIndexes[index_iterator]
			);
		}
		for
		(
				index_iterator = 0;
				index_iterator < sql_result->postgresTestMatchesMade;
				index_iterator++
		)
		{
			this->WebAssessmentAddEngineAnalysisDataEntry
			(
					sql_result->request_data.result_id,
					sql_result->request_data.request_id,
					sql_result->request_data.http_status_code,
					(char *) &sql_result->request_data.http_get,
					(char *) &sql_result->request_data.http_post,
					(char *) &sql_result->request_data.http_cookie,
					(char *) &sql_result->request_data.http_header,
					(char *) &sql_result->request_data.suspected_get_var,
					(char *) &sql_result->request_data.suspected_post_var,
					(char *) &sql_result->request_data.suspected_cookie_var,
					(char *) &sql_result->request_data.suspected_header_var,
					BP_WEB_ANALYSIS_ENGINES_POSTGRES,
					BP_WEB_ANALYSIS_CONDITION_SQL_MSG,
					(char *) this->webAssessment->postgresErrCodes[sql_result->postgresTestMatchIndexes[index_iterator]].postgresErrStr,
					(char *) this->webAssessment->postgresErrCodes[sql_result->postgresTestMatchIndexes[index_iterator]].postgresErrStr,
					sql_result->postgresTestMatchIndexes[index_iterator]
			);
		}
	}
	BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_SUCCESS);
}
BP_ERROR_T Block :: WebAssessmentSaveSQLErrorMessageData ( ) { if ( ! this -> mysqlSession ) return ERR_FAILURE ; BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION ; if ( ! this -> webAssessment ) BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_FAILURE ) ; if ( ! this -> webAssessment -> sqlResults ) BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_FAILURE ) ; P_BP_WEB_SQLINJ_TEST_RESULT sql_result = this -> webAssessment -> sqlResults -> first ; size_t index_iterator = 0 ; for ( ; sql_result ; sql_result = sql_result -> next ) { for ( index_iterator = 0 ; index_iterator < sql_result -> mysqlTestMatchesMade ; index_iterator ++ ) { this -> WebAssessmentAddEngineAnalysisDataEntry ( sql_result -> request_data . result_id , sql_result -> request_data . request_id , sql_result -> request_data . http_status_code , ( char * ) & sql_result -> request_data . http_get , ( char * ) & sql_result -> request_data . http_post , ( char * ) & sql_result -> request_data . http_cookie , ( char * ) & sql_result -> request_data . http_header , ( char * ) & sql_result -> request_data . suspected_get_var , ( char * ) & sql_result -> request_data . suspected_post_var , ( char * ) & sql_result -> request_data . suspected_cookie_var , ( char * ) & sql_result -> request_data . suspected_header_var , BP_WEB_ANALYSIS_ENGINES_MYSQL , BP_WEB_ANALYSIS_CONDITION_SQL_MSG , ( char * ) this -> webAssessment -> mysqlErrCodes [ sql_result -> mysqlTestMatchIndexes [ index_iterator ] ] . mysqlErrStr , ( char * ) this -> webAssessment -> mysqlErrCodes [ sql_result -> mysqlTestMatchIndexes [ index_iterator ] ] . mysqlErrStr , sql_result -> mysqlTestMatchIndexes [ index_iterator ] ) ; } for ( index_iterator = 0 ; index_iterator < sql_result -> msqlTestMatchesMade ; index_iterator ++ ) { this -> WebAssessmentAddEngineAnalysisDataEntry ( sql_result -> request_data . result_id , sql_result -> request_data . request_id , sql_result -> request_data . http_status_code , ( char * ) & sql_result -> request_data . http_get , ( char * ) & sql_result -> request_data . http_post , ( char * ) & sql_result -> request_data . http_cookie , ( char * ) & sql_result -> request_data . http_header , ( char * ) & sql_result -> request_data . suspected_get_var , ( char * ) & sql_result -> request_data . suspected_post_var , ( char * ) & sql_result -> request_data . suspected_cookie_var , ( char * ) & sql_result -> request_data . suspected_header_var , BP_WEB_ANALYSIS_ENGINES_MSQL , BP_WEB_ANALYSIS_CONDITION_SQL_MSG , ( char * ) this -> webAssessment -> msqlErrCodes [ sql_result -> msqlTestMatchIndexes [ index_iterator ] ] . description , ( char * ) this -> webAssessment -> msqlErrCodes [ sql_result -> msqlTestMatchIndexes [ index_iterator ] ] . description , sql_result -> msqlTestMatchIndexes [ index_iterator ] ) ; } for ( index_iterator = 0 ; index_iterator < sql_result -> oracleTestMatchesMade ; index_iterator ++ ) { this -> WebAssessmentAddEngineAnalysisDataEntry ( sql_result -> request_data . result_id , sql_result -> request_data . request_id , sql_result -> request_data . http_status_code , ( char * ) & sql_result -> request_data . http_get , ( char * ) & sql_result -> request_data . http_post , ( char * ) & sql_result -> request_data . http_cookie , ( char * ) & sql_result -> request_data . http_header , ( char * ) & sql_result -> request_data . suspected_get_var , ( char * ) & sql_result -> request_data . suspected_post_var , ( char * ) & sql_result -> request_data . suspected_cookie_var , ( char * ) & sql_result -> request_data . suspected_header_var , BP_WEB_ANALYSIS_ENGINES_ORACLE , BP_WEB_ANALYSIS_CONDITION_SQL_MSG , ( char * ) this -> webAssessment -> oracleErrCodes [ sql_result -> oracleTestMatchIndexes [ index_iterator ] ] . description , ( char * ) this -> webAssessment -> oracleErrCodes [ sql_result -> oracleTestMatchIndexes [ index_iterator ] ] . description , sql_result -> oracleTestMatchIndexes [ index_iterator ] ) ; } for ( index_iterator = 0 ; index_iterator < sql_result -> odbcTestMatchesMade ; index_iterator ++ ) { this -> WebAssessmentAddEngineAnalysisDataEntry ( sql_result -> request_data . result_id , sql_result -> request_data . request_id , sql_result -> request_data . http_status_code , ( char * ) & sql_result -> request_data . http_get , ( char * ) & sql_result -> request_data . http_post , ( char * ) & sql_result -> request_data . http_cookie , ( char * ) & sql_result -> request_data . http_header , ( char * ) & sql_result -> request_data . suspected_get_var , ( char * ) & sql_result -> request_data . suspected_post_var , ( char * ) & sql_result -> request_data . suspected_cookie_var , ( char * ) & sql_result -> request_data . suspected_header_var , BP_WEB_ANALYSIS_ENGINES_ODBC , BP_WEB_ANALYSIS_CONDITION_SQL_MSG , ( char * ) this -> webAssessment -> odbcErrCodes [ sql_result -> odbcTestMatchIndexes [ index_iterator ] ] . description , ( char * ) this -> webAssessment -> odbcErrCodes [ sql_result -> odbcTestMatchIndexes [ index_iterator ] ] . description , sql_result -> odbcTestMatchIndexes [ index_iterator ] ) ; } for ( index_iterator = 0 ; index_iterator < sql_result -> postgresTestMatchesMade ; index_iterator ++ ) { this -> WebAssessmentAddEngineAnalysisDataEntry ( sql_result -> request_data . result_id , sql_result -> request_data . request_id , sql_result -> request_data . http_status_code , ( char * ) & sql_result -> request_data . http_get , ( char * ) & sql_result -> request_data . http_post , ( char * ) & sql_result -> request_data . http_cookie , ( char * ) & sql_result -> request_data . http_header , ( char * ) & sql_result -> request_data . suspected_get_var , ( char * ) & sql_result -> request_data . suspected_post_var , ( char * ) & sql_result -> request_data . suspected_cookie_var , ( char * ) & sql_result -> request_data . suspected_header_var , BP_WEB_ANALYSIS_ENGINES_POSTGRES , BP_WEB_ANALYSIS_CONDITION_SQL_MSG , ( char * ) this -> webAssessment -> postgresErrCodes [ sql_result -> postgresTestMatchIndexes [ index_iterator ] ] . postgresErrStr , ( char * ) this -> webAssessment -> postgresErrCodes [ sql_result -> postgresTestMatchIndexes [ index_iterator ] ] . postgresErrStr , sql_result -> postgresTestMatchIndexes [ index_iterator ] ) ; } } BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_SUCCESS ) ; }
Saves the SQL error message data to the database.
Saves the SQL error message data to the database .
// ensure we have a mysql session // enter critical section // check pointers before entering save logic // set iterative result pointer // set index iterator // walk the sql results // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% MySQL Match Insert %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Microsoft SQL Match Insert %%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Oracle SQL Match Insert %%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% ODBC SQL Match Insert %%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Postgres SQL Match Insert %%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // return indicating success