From: Perttu Ahola Date: Sun, 31 Jul 2011 12:32:45 +0000 (+0300) Subject: Fixed problem of server always receiving an empty password from the client X-Git-Tag: 0.2.20110731_3~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e0b8e66540d2724379d6278f83bbbf0f6d5e2aac;p=oweals%2Fminetest.git Fixed problem of server always receiving an empty password from the client --- diff --git a/src/client.cpp b/src/client.cpp index 5f299890a..55f0af6dc 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -424,7 +424,7 @@ void Client::step(float dtime) memset((char*)&data[3], 0, PLAYERNAME_SIZE); snprintf((char*)&data[3], PLAYERNAME_SIZE, "%s", myplayer->getName()); - /*dstream<<"Client: password hash is \""<= 2+1+PLAYERNAME_SIZE) + if(datasize < 2+1+PLAYERNAME_SIZE+PASSWORD_SIZE) { // old version - assume blank password password[0] = 0; @@ -2044,7 +2044,10 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) checkpwd = g_settings.get("default_password"); } - if(password != checkpwd && checkpwd != "") + /*dstream<<"Server: Client gave password '"<getName(); if(m_authmanager.exists(playername) == false) @@ -3361,7 +3367,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) } std::string checkpwd = m_authmanager.getPassword(playername); - + if(oldpwd != checkpwd) { dstream<<"Server: invalid old password"<