From a5709854a8f0dc833598a2e1aefbd3000aeefb41 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Tue, 13 Sep 2011 17:19:38 +0300 Subject: [PATCH 1/1] Initializing constructor added for IA_USER --- .../authorization/inetaccess/inetaccess.h | 50 ++++++++++++++----- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h index 5b280880..e55733c1 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h @@ -126,15 +126,14 @@ struct IA_USER { protoVer(0), password("NO PASSWORD") { - // +++ Preparing CTX +++ - unsigned char keyL[PASSWD_LEN]; - memset(keyL, 0, PASSWD_LEN); - strncpy((char *)keyL, password.c_str(), PASSWD_LEN); - Blowfish_Init(&ctx, keyL, PASSWD_LEN); - // --- Preparing CTX --- - #ifdef IA_DEBUG - aliveSent = false; - #endif + unsigned char keyL[PASSWD_LEN]; + memset(keyL, 0, PASSWD_LEN); + strncpy((char *)keyL, password.c_str(), PASSWD_LEN); + Blowfish_Init(&ctx, keyL, PASSWD_LEN); + + #ifdef IA_DEBUG + aliveSent = false; + #endif }; IA_USER(const IA_USER & u) @@ -148,12 +147,37 @@ struct IA_USER { protoVer(u.protoVer), password(u.password) { - #ifdef IA_DEBUG - aliveSent = u.aliveSent; - #endif - memcpy(&ctx, &u.ctx, sizeof(BLOWFISH_CTX)); + #ifdef IA_DEBUG + aliveSent = u.aliveSent; + #endif + memcpy(&ctx, &u.ctx, sizeof(BLOWFISH_CTX)); }; + IA_USER(const std::string & l, + CONST_USER_PTR u, + uint16_t p, + int ver) + : login(l), + user(u), + phase(), + lastSendAlive(0), + rnd(random()), + port(p), + ctx(), + messagesToSend(), + protoVer(ver), + password(user->GetProperty().password.Get()) + { + unsigned char keyL[PASSWD_LEN]; + memset(keyL, 0, PASSWD_LEN); + strncpy((char *)keyL, password.c_str(), PASSWD_LEN); + Blowfish_Init(&ctx, keyL, PASSWD_LEN); + + #ifdef IA_DEBUG + aliveSent = false; + #endif + } + std::string login; CONST_USER_PTR user; IA_PHASE phase; -- 2.44.2