From 0dfd76c6fc55b5930c5ff296a28b77f1c5a2c43e Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sat, 18 Dec 2010 16:51:14 +0200 Subject: [PATCH] =?utf8?q?=D0=86=D0=B7=20=D0=BA=D0=BB=D0=B0=D1=81=D1=83=20?= =?utf8?q?=D0=BF=D1=96=D0=B4=D1=82=D1=80=D0=B8=D0=BC=D0=BA=D0=B8=20=D0=BF?= =?utf8?q?=D1=80=D0=BE=D1=82=D0=BE=D0=BA=D0=BE=D0=BB=D1=83=20=D0=B0=D0=B2?= =?utf8?q?=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0=D1=82=D0=BE=D1=80=D0=B0=20?= =?utf8?q?=D0=BF=D1=80=D0=B8=D0=B1=D1=80=D0=B0=D0=BD=D1=96=20=D0=BD=D0=B5?= =?utf8?q?=20=D0=B2=D0=B8=D0=BA=D0=BE=D1=80=D0=B8=D1=81=D1=82=D0=BE=D0=B2?= =?utf8?q?=D1=83=D0=B2=D0=B0=D0=BD=D1=96=20=D1=87=D0=BB=D0=B5=D0=BD=D0=B8,?= =?utf8?q?=20=D0=B0=20=D0=BE=D0=B1=D0=BB=D0=B0=D1=81=D1=82=D1=8C=20=D0=B2?= =?utf8?q?=D0=B8=D0=B4=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D1=96=20=D1=96=D0=BD?= =?utf8?q?=D1=88=D0=B8=D1=85=20=D0=B7=D0=B2=D1=83=D0=B6=D0=B5=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- stglibs/ia_auth_c.lib/ia_auth_c.cpp | 37 +++++++++++++++-------------- stglibs/ia_auth_c.lib/ia_auth_c.h | 2 -- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/stglibs/ia_auth_c.lib/ia_auth_c.cpp b/stglibs/ia_auth_c.lib/ia_auth_c.cpp index a7620692..25e4d8c9 100644 --- a/stglibs/ia_auth_c.lib/ia_auth_c.cpp +++ b/stglibs/ia_auth_c.lib/ia_auth_c.cpp @@ -108,19 +108,13 @@ return 0; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- IA_CLIENT_PROT::IA_CLIENT_PROT(const string & sn, unsigned short p, uint16_t localPort) - : stat(), - action(IA_NONE), + : action(IA_NONE), phase(1), phaseTime(0), - messageText(), - infoText(), - strError(), codeError(0), - nonstop(true), + nonstop(false), isNetPrepared(false), proxyMode(false), - password(), - login(), serverName(sn), port(p), ip(0), @@ -142,7 +136,6 @@ IA_CLIENT_PROT::IA_CLIENT_PROT(const string & sn, unsigned short p, uint16_t loc infoCbData(NULL), errorCbData(NULL), dirNameCbData(NULL), - packetTypes(), connSyn8(NULL), connSynAck8(NULL), connAck8(NULL), @@ -151,7 +144,6 @@ IA_CLIENT_PROT::IA_CLIENT_PROT(const string & sn, unsigned short p, uint16_t loc disconnSyn8(NULL), disconnSynAck8(NULL), disconnAck8(NULL), - err(), info(NULL) { memset(&stat, 0, sizeof(stat)); @@ -175,9 +167,21 @@ packetTypes["INFO_7"] = INFO_7_N; packetTypes["INFO_8"] = INFO_8_N; unsigned char key[IA_PASSWD_LEN]; -memset(key, 0, IA_LOGIN_LEN); +memset(key, 0, IA_PASSWD_LEN); strncpy((char *)key, "pr7Hhen", 8); Blowfish_Init(&ctxHdr, key, IA_PASSWD_LEN); + +memset(key, 0, IA_PASSWD_LEN); +Blowfish_Init(&ctxPass, key, IA_PASSWD_LEN); + +for (size_t i = 0; i < DIR_NUM; ++i) + { + selectedDirs[i] = false; + } + +servAddr.sin_family = AF_INET; +servAddr.sin_port = htons(port); +servAddr.sin_addr.s_addr = ip; } //--------------------------------------------------------------------------- void IA_CLIENT_PROT::PrepareNet() @@ -198,7 +202,7 @@ if (ip == INADDR_NONE) strError = string("Unknown host ") + "\'" + serverName + "\'"; codeError = IA_GETHOSTBYNAME_ERROR; if (pErrorCb != NULL) - pErrorCb(messageText, IA_GETHOSTBYNAME_ERROR, errorCbData); + pErrorCb(strError, IA_GETHOSTBYNAME_ERROR, errorCbData); } } @@ -210,10 +214,7 @@ closesocket(sockr); sockr = socket(AF_INET, SOCK_DGRAM, 0); // Cîêåò ÷åðåç êîòîðûé øëåì è ïðèíèìàåì -localAddrS.sin_family = AF_INET; -localAddrS.sin_port = htons(port); -localAddrS.sin_addr.s_addr = inet_addr("0.0.0.0"); - +struct sockaddr_in localAddrR; // Íàø àäðåñ localAddrR.sin_family = AF_INET; if (localPort) @@ -232,7 +233,7 @@ if (res == -1) strError = "bind error"; codeError = IA_BIND_ERROR; if (pErrorCb != NULL) - pErrorCb(messageText, IA_BIND_ERROR, errorCbData); + pErrorCb(strError, IA_BIND_ERROR, errorCbData); return; } @@ -245,7 +246,7 @@ if (0 != fcntl(sockr, F_SETFL, O_NONBLOCK)) strError = "fcntl error"; codeError = IA_FCNTL_ERROR; if (pErrorCb != NULL) - pErrorCb(messageText, IA_FCNTL_ERROR, errorCbData); + pErrorCb(strError, IA_FCNTL_ERROR, errorCbData); } #endif diff --git a/stglibs/ia_auth_c.lib/ia_auth_c.h b/stglibs/ia_auth_c.lib/ia_auth_c.h index 2e88cf76..639646af 100644 --- a/stglibs/ia_auth_c.lib/ia_auth_c.h +++ b/stglibs/ia_auth_c.lib/ia_auth_c.h @@ -159,8 +159,6 @@ private: uint32_t ip; // Proxy IP uint32_t localPort; - struct sockaddr_in localAddrS; // Íàø àäðåñ - struct sockaddr_in localAddrR; // Íàø àäðåñ struct sockaddr_in servAddr; // àäðåñ ñåðâåðà bool firstConnect; -- 2.44.2