Patch level : 2.0 664

Files correlati     : authoriz.exe
Ricompilazione Demo : [ ]
Commento            :

EP20152
test sul server di chiavi: non permette la connessione quando si passa
velocemente da una applicazione ad un'altra, tramite "Collega"
in cascata oppure entrando ed uscendo dalla stessa voce di menu.
Praticamente si e' sempre costretti ad aspettare almeno 8 secondi prima
di avere il premesso dal server.


git-svn-id: svn://10.65.10.50/trunk@11681 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-12-19 10:31:03 +00:00
parent b978a2d3d8
commit bdefc688c6

View File

@ -118,6 +118,8 @@ private:
unsigned long m_Modules[3];
unsigned int m_nModules;
wxString m_strLastPassword;
wxString m_strLastApp;
unsigned int m_nPwdCount;
TUserTable m_Users;
@ -146,7 +148,7 @@ public:
void ReturnInt(wxSocketBase& outs, unsigned int i);
void ReturnBool(wxSocketBase&, bool b);
unsigned int DecodePassword(const wxChar* strPassword);
unsigned int DecodePassword(const wxChar* strPassword, const wxChar* strApp);
void ProcessUserLogin(wxString cmd, wxSocketBase& sock);
bool ProcessUserLogout(wxString cmd, wxSocketBase& sock);
@ -692,7 +694,7 @@ void TAuthorizationServer::ProcessFormCommand(wxString cmd, wxSocketBase& outs)
}
}
unsigned int TAuthorizationServer::DecodePassword(const wxChar* strPassword)
unsigned int TAuthorizationServer::DecodePassword(const wxChar* strPassword, const wxChar* strApp)
{
const unsigned int BASE = 19;
unsigned int num = 0;
@ -716,13 +718,26 @@ unsigned int TAuthorizationServer::DecodePassword(const wxChar* strPassword)
len++;
}
// Per essereva valido deve essere divisibile per 883
if (len >= 5 && (num%883) == 0 && m_strLastPassword != strPassword)
if (len >= 5 && (num%883) == 0)
{
// Creo la risposta: metà di num reso divisibile per 883
num /= 2;
while (num % 883 != 0)
num++;
m_strLastPassword = strPassword;
if (m_strLastPassword != strPassword || m_strLastApp != strApp)
{
m_strLastPassword = strPassword;
m_strLastApp = strApp;
m_nPwdCount = 0;
}
else
m_nPwdCount++;
if (m_nPwdCount < 8)
{
// Creo la risposta: metà di num reso divisibile per 883
num /= 2;
while (num % 883 != 0)
num++;
}
else
num = 0;
}
else
num = 0;
@ -748,19 +763,27 @@ void TAuthorizationServer::ProcessUserLogin(wxString cmd, wxSocketBase& sock)
}
else
{
if (m_Users.Find(sock, strUser) == NULL && m_Users.GetCount() >= m_Dongle.MaxUsers())
if (m_Users.GetCount() >= m_Dongle.MaxUsers() && m_Users.Find(sock, strUser) == NULL)
{
WriteLog("*** Maximum users exceeded");
num = 0;
}
else
{
if (strcmp(strPassword, "******") == 0) // Older 16 bit version
num = 1;
else
num = DecodePassword(strPassword);
num = DecodePassword(strPassword, strProgram);
if (num > 0)
m_Users.AddConnection(sock, strUser);
else
WriteLog("*** Bad password");
}
}
}
else
WriteLog("*** Dongle not responding");
ReturnInt(sock, num);
}