Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - szll2010

#1
General / SetPassword in Trunk Code
February 26, 2011, 11:27:07 AM
Dear Victor,

There is a bug in the userdb_objects.cpp in trunk. The setpassword function does not consider the Unicode and MBCS. However, I changed the code to this:
void User::setPassword(const TCHAR *password, bool clearChangePasswdFlag)
{
#ifdef UNICODE
   char *mb = MBStringFromWideString(password);
   CalculateSHA1Hash((BYTE *)mb, strlen(mb), m_passwordHash);
   free(mb);
#else
   CalculateSHA1Hash((BYTE *)password, _tcslen(password), m_passwordHash);
#endif
   //CalculateSHA1Hash((BYTE *)password, _tcslen(password), m_passwordHash);
   m_graceLogins = MAX_GRACE_LOGINS;
   m_flags |= UF_MODIFIED;
   if (clearChangePasswdFlag)
      m_flags &= ~UF_CHANGE_PASSWORD;
}
Still has the problem with setting or changing the password.

Could you check?

best regards,

szll2010
#2
General / Server Module development
December 09, 2010, 06:37:16 PM
Hi Victor,

Is there any sample code  for the server module development like the agent's skeleton for reference.
#3
I found problems with displaying east asian characters in NETxms console, the following is the environment:
1. Server on Windows (build with MBCS)
2. Console on Windows (Build with Unicode)

In this scenario, east asian character can be input, but after transfering to server, then the these characters was wrong in server's database. I read the source code, found that:
1. In message.c file, GetVariableStr and SetVariable function's allocating memory is assume the MBCS is Single byte for one character, so it allocates double or half buffer for the converting, but the fact is not.
2. In GetVariable Str, allocating memory for the pStr, but not found where to release the memory,  chance to leak ?

Could you help to check the source file.