for (j = 0; (j < i + 1); j++)
ret += base64_chars[char_array_4[j]];
-
- while((i++ < 3))
- ret += '=';
+
+ // Don't pad it with =
+ /*while((i++ < 3))
+ ret += '=';*/
}
SharedBuffer<u8> data(2+1+PLAYERNAME_SIZE+PASSWORD_SIZE);
writeU16(&data[0], TOSERVER_INIT);
writeU8(&data[2], SER_FMT_VER_HIGHEST);
+
memset((char*)&data[3], 0, PLAYERNAME_SIZE);
snprintf((char*)&data[3], PLAYERNAME_SIZE, "%s", myplayer->getName());
+
+ /*dstream<<"Client: password hash is \""<<m_password<<"\""
+ <<std::endl;*/
+
+ memset((char*)&data[23], 0, PASSWORD_SIZE);
snprintf((char*)&data[23], PASSWORD_SIZE, "%s", m_password.c_str());
// Send as unreliable
-----------------------------\r
- Fix client password crash\r
- Remember to release the fixes (some are already done)\r
+- A command to set one's password when the server is running\r
\r
Stuff to do after release:\r
---------------------------\r
g_settings.set("creative_mode", itos(menudata.creative_mode));\r
g_settings.set("enable_damage", itos(menudata.enable_damage));\r
\r
+ // NOTE: These are now checked server side; no need to do it\r
+ // here, so let's not do it here.\r
/*// Check for valid parameters, restart menu if invalid.\r
if(playername == "")\r
{\r
checkpwd = g_settings.get("default_password");
}
- if(password != checkpwd)
+ if(password != checkpwd && checkpwd != "")
{
derr_server<<DTIME<<"Server: peer_id="<<peer_id
<<": supplied invalid password for "
if(password.length() == 0)
return "";
- std::string slt=playername + wide_to_narrow(password);
- SHA1 *sha1 = new SHA1();
- sha1->addBytes(slt.c_str(), slt.length());
- unsigned char *digest = sha1->getDigest();
+ std::string slt = playername + wide_to_narrow(password);
+ SHA1 sha1;
+ sha1.addBytes(slt.c_str(), slt.length());
+ unsigned char *digest = sha1.getDigest();
std::string pwd = base64_encode(digest, 20);
free(digest);
return pwd;