X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/3a0773b72ce785fd13021f4624f525a23cd65f18..7838a402e606a6e4119b9dddf8a0dcf5dfaed1c7:/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp index 0319ef8d..6d8db063 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.cpp @@ -39,6 +39,10 @@ extern volatile const time_t stgTime; +void InitEncrypt(BLOWFISH_CTX * ctx, const string & password); +void Decrypt(BLOWFISH_CTX * ctx, char * dst, const char * src, int len8); +void Encrypt(BLOWFISH_CTX * ctx, char * dst, const char * src, int len8); + //----------------------------------------------------------------------------- class IA_CREATOR { @@ -323,6 +327,9 @@ AUTH_IA::AUTH_IA() : nonstop(false), isRunningRun(false), isRunningRunTimeouter(false), + users(NULL), + stgSettings(NULL), + listenSocket(-1), WriteServLog(GetStgLogger()), enabledDirs(0xFFffFFff), onDelUserNotifier(*this) @@ -1128,30 +1135,6 @@ gettimeofday(&tv, NULL); return res; } //----------------------------------------------------------------------------- -void AUTH_IA::InitEncrypt(BLOWFISH_CTX * ctx, const string & password) -{ -unsigned char keyL[PASSWD_LEN]; // ðÁÒÏÌØ ÄÌÑ ÛÉÆÒÏ×ËÉ -memset(keyL, 0, PASSWD_LEN); -strncpy((char *)keyL, password.c_str(), PASSWD_LEN); -Blowfish_Init(ctx, keyL, PASSWD_LEN); -} -//----------------------------------------------------------------------------- -void AUTH_IA::Decrypt(BLOWFISH_CTX * ctx, char * dst, const char * src, int len8) -{ -// len8 - ÄÌÉÎÁ × 8-ÍÉ ÂÁÊÔÏ×ÙÈ ÂÌÏËÁÈ - -for (int i = 0; i < len8; i++) - DecodeString(dst + i * 8, src + i * 8, ctx); -} -//----------------------------------------------------------------------------- -void AUTH_IA::Encrypt(BLOWFISH_CTX * ctx, char * dst, const char * src, int len8) -{ -// len8 - ÄÌÉÎÁ × 8-ÍÉ ÂÁÊÔÏ×ÙÈ ÂÌÏËÁÈ - -for (int i = 0; i < len8; i++) - EncodeString(dst + i * 8, src + i * 8, ctx); -} -//----------------------------------------------------------------------------- int AUTH_IA::SendMessage(const STG_MSG & msg, uint32_t ip) const { STG_LOCKER lock(&mutex, __FILE__, __LINE__); @@ -1835,3 +1818,30 @@ if (res == 0) // Timeout return true; } +//----------------------------------------------------------------------------- +inline +void InitEncrypt(BLOWFISH_CTX * ctx, const string & password) +{ +unsigned char keyL[PASSWD_LEN]; // ðÁÒÏÌØ ÄÌÑ ÛÉÆÒÏ×ËÉ +memset(keyL, 0, PASSWD_LEN); +strncpy((char *)keyL, password.c_str(), PASSWD_LEN); +Blowfish_Init(ctx, keyL, PASSWD_LEN); +} +//----------------------------------------------------------------------------- +inline +void Decrypt(BLOWFISH_CTX * ctx, char * dst, const char * src, int len8) +{ +// len8 - ÄÌÉÎÁ × 8-ÍÉ ÂÁÊÔÏ×ÙÈ ÂÌÏËÁÈ + +for (int i = 0; i < len8; i++) + DecodeString(dst + i * 8, src + i * 8, ctx); +} +//----------------------------------------------------------------------------- +inline +void Encrypt(BLOWFISH_CTX * ctx, char * dst, const char * src, int len8) +{ +// len8 - ÄÌÉÎÁ × 8-ÍÉ ÂÁÊÔÏ×ÙÈ ÂÌÏËÁÈ + +for (int i = 0; i < len8; i++) + EncodeString(dst + i * 8, src + i * 8, ctx); +}