From 941e7e46e15c1d0b168606ac218dc9cf2e6f7b92 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sat, 18 Dec 2010 16:16:28 +0200 Subject: [PATCH] =?utf8?q?=D0=94=D0=BE=D0=B4=D0=B0=D0=BD=D0=BE=20=D1=96?= =?utf8?q?=D0=BD=D1=96=D1=86=D1=96=D0=B0=D0=BB=D1=96=D0=B7=D0=B0=D1=86?= =?utf8?q?=D1=96=D1=8E=20=D0=B4=D0=B5=D1=8F=D0=BA=D0=B8=D1=85=20=D1=87?= =?utf8?q?=D0=BB=D0=B5=D0=BD=D1=96=D0=B2=20=D0=BA=D0=BB=D0=B0=D1=81=D1=83?= =?utf8?q?=20AUTH=5FIA,=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B8=20=D1=88?= =?utf8?q?=D0=B8=D1=84=D1=80=D1=83=D0=B2=D0=B0=D0=BD=D0=BD=D1=8F=20=D0=B2?= =?utf8?q?=D0=B8=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=D0=BE=20=D1=83=20=D0=B7?= =?utf8?q?=D0=B2=D0=B8=D1=87=D0=B0=D0=B9=D0=BD=D1=96=20=D1=84=D1=83=D0=BD?= =?utf8?q?=D0=BA=D1=86=D1=96=D1=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../authorization/inetaccess/inetaccess.cpp | 58 +++++++++++-------- 1 file changed, 34 insertions(+), 24 deletions(-) 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); +} -- 2.44.2