diff options
| author | leak <leak@bitmx.net> | 2012-02-19 13:51:16 +0100 |
|---|---|---|
| committer | leak <leak@bitmx.net> | 2012-02-19 13:51:16 +0100 |
| commit | 8e3a4b956e8fcc3ec31240d847a7a630eaf2bba2 (patch) | |
| tree | c7a797f883906019d9fa820b4d782eb7dfd4c1c5 /src/server/shared/Utilities | |
| parent | f0f68f15a86c5ac0c83c47c6db67786506f8460d (diff) | |
Core/Warden: Base implementation for Warden functionality
Note: The default config file action for clients failing the checks can be changed for each check via the characters.warden_action table
Credits to TOM_RUS
Diffstat (limited to 'src/server/shared/Utilities')
| -rwxr-xr-x | src/server/shared/Utilities/Util.cpp | 13 | ||||
| -rwxr-xr-x | src/server/shared/Utilities/Util.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index 6ae43bc6840..52ce74be8f8 100755 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -16,6 +16,7 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <iostream> #include "Util.h" #include "utf8.h" #ifdef USE_SFMT_FOR_RNG @@ -529,3 +530,15 @@ void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result) result = ss.str(); } +std::string ByteArrayToHexStr(uint8* bytes, uint32 length) +{ + std::ostringstream ss; + for (uint32 i = 0; i < length; ++i) + { + char buffer[4]; + sprintf(buffer, "%02X ", bytes[i]); + ss << buffer; + } + + return ss.str(); +} diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index 684b26eea63..4c2c1936993 100755 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -378,6 +378,7 @@ bool IsIPAddress(char const* ipaddress); uint32 CreatePIDFile(const std::string& filename); void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result); +std::string ByteArrayToHexStr(uint8* bytes, uint32 length); #endif //handler for operations on large flags |
