mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Adds method setConnectorInformation to ModSecurity class
For the purpose of log it is necessary for modsecurity to understand which 'connector' is consuming the API.
This commit is contained in:
@@ -38,7 +38,8 @@ namespace ModSecurity {
|
||||
*
|
||||
* @endcode
|
||||
*/
|
||||
ModSecurity::ModSecurity() {
|
||||
ModSecurity::ModSecurity()
|
||||
: m_connector("") {
|
||||
UniqueId::uniqueId();
|
||||
srand(time(NULL));
|
||||
}
|
||||
@@ -84,6 +85,66 @@ std::string ModSecurity::whoAmI() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name setConnectorInformation
|
||||
* @brief Set information about the connector that is using the library.
|
||||
*
|
||||
* For the purpose of log it is necessary for modsecurity to understand which
|
||||
* 'connector' is consuming the API.
|
||||
*
|
||||
* @note It is strongly recommended to set a information in the following
|
||||
* pattern:
|
||||
*
|
||||
* ConnectorName vX.Y.Z-tag (something else)
|
||||
*
|
||||
* For instance: ModSecurity-nginx v0.0.1-alpha (Whee)
|
||||
*
|
||||
* @param connector Information about the connector.
|
||||
*
|
||||
*/
|
||||
void ModSecurity::setConnectorInformation(std::string connector) {
|
||||
m_connector = connector;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name getConnectorInformation
|
||||
* @brief Returns the connector information.
|
||||
*
|
||||
* Returns whatever was set by 'setConnectorInformation'. Check
|
||||
* setConnectorInformation documentation to understand the expected format.
|
||||
*
|
||||
* @retval "" Nothing was informed about the connector.
|
||||
* @retval !="" Connector information.
|
||||
*/
|
||||
const std::string& ModSecurity::getConnectorInformation() {
|
||||
return m_connector;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name msc_set_connector_info
|
||||
* @brief Set information about the connector that is using the library.
|
||||
*
|
||||
* For the purpose of log it is necessary for modsecurity to understand which
|
||||
* 'connector' is consuming the API.
|
||||
*
|
||||
* @note It is strongly recommended to set a information in the following
|
||||
* pattern:
|
||||
*
|
||||
* ConnectorName vX.Y.Z-tag (something else)
|
||||
*
|
||||
* For instance: ModSecurity-nginx v0.0.1-alpha (Whee)
|
||||
*
|
||||
* @param connector Information about the connector.
|
||||
*
|
||||
*/
|
||||
extern "C" void msc_set_connector_info(ModSecurity *msc,
|
||||
const char *connector) {
|
||||
msc->setConnectorInformation(std::string(connector));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name msc_who_am_i
|
||||
* @brief Return information about this ModSecurity version and platform.
|
||||
|
Reference in New Issue
Block a user