From 8e1eacf3a87a0cee39c8c27c3846828c12e73f9d Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 30 Jul 2011 23:33:57 +0300 Subject: Fixed handling of inventory in creative mode (normal inventory is not trashed anymore), fixed mese pick speed, added some forgotten stuff --- src/server.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index 07f9875c4..503d60b84 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4130,6 +4130,11 @@ Player *Server::emergePlayer(const char *name, const char *password, u16 peer_id // Reset inventory to creative if in creative mode if(g_settings.getBool("creative_mode")) { + // Warning: double code below + // Backup actual inventory + player->inventory_backup = new Inventory(); + *(player->inventory_backup) = player->inventory; + // Set creative inventory craft_set_creative_inventory(player); } @@ -4183,6 +4188,11 @@ Player *Server::emergePlayer(const char *name, const char *password, u16 peer_id if(g_settings.getBool("creative_mode")) { + // Warning: double code above + // Backup actual inventory + player->inventory_backup = new Inventory(); + *(player->inventory_backup) = player->inventory; + // Set creative inventory craft_set_creative_inventory(player); } else if(g_settings.getBool("give_initial_stuff")) -- cgit v1.2.3 From 756f8f88d4c127917cc9ea77e2e44606c199beed Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 31 Jul 2011 02:27:26 +0300 Subject: Made stricter handling for old clients because now they are not compatible at all. --- src/server.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index 503d60b84..ba40ec627 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1972,20 +1972,23 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) } /* - Check network protocol version + Read and check network protocol version */ + u16 net_proto_version = 0; if(datasize >= 2+1+PLAYERNAME_SIZE+PASSWORD_SIZE+2) { net_proto_version = readU16(&data[2+1+PLAYERNAME_SIZE+PASSWORD_SIZE]); } + getClient(peer->id)->net_proto_version = net_proto_version; - /*if(net_proto_version == 0) + + if(net_proto_version == 0) { SendAccessDenied(m_con, peer_id, - L"Your client is too old (network protocol)"); + L"Your client is too old. Please upgrade."); return; - }*/ + } /* Set up player @@ -2181,11 +2184,12 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) message += L" joined game"; BroadcastChatMessage(message); } - - if(getClient(peer->id)->net_proto_version == 0) + + // Warnings about protocol version can be issued here + /*if(getClient(peer->id)->net_proto_version == 0) { SendChatMessage(peer_id, L"# Server: NOTE: YOUR CLIENT IS OLD AND DOES NOT WORK PROPERLY WITH THIS SERVER"); - } + }*/ return; } -- cgit v1.2.3 From e0b8e66540d2724379d6278f83bbbf0f6d5e2aac Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 31 Jul 2011 15:32:45 +0300 Subject: Fixed problem of server always receiving an empty password from the client --- src/client.cpp | 2 +- src/main.cpp | 2 ++ src/server.cpp | 12 +++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/server.cpp') 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"< Date: Sun, 31 Jul 2011 15:51:24 +0300 Subject: Fixes a bug that made the server to deny non-empty passwords from players connecting the first time. --- doc/changelog.txt | 3 +++ src/server.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/server.cpp') diff --git a/doc/changelog.txt b/doc/changelog.txt index 3ae571dca..2c577b421 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -3,6 +3,9 @@ Minetest-c55 changelog This should contain all the major changes. For minor stuff, refer to the commit log of the repository. +2011-07-31_3: +- Fixes a bug that made the server to deny non-empty passwords from players connecting the first time + 2011-07-31_2: - Fixes a bug that caused the server to always read an empty password from the client when a client connected. diff --git a/src/server.cpp b/src/server.cpp index 35c186b5d..8a19306a9 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2047,7 +2047,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) /*dstream<<"Server: Client gave password '"<