Author: baufo
Date: Wed Oct 8 20:53:18 2008
New Revision: 29966
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29966&view=rev
Log:
Fixing error handling for invalid username+password hashes
Modified:
trunk/src/multiplayer.cpp
trunk/src/server/forum_user_handler.hpp
trunk/src/server/server.cpp
Modified: trunk/src/multiplayer.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer.cpp?rev=29966&r1=29965&r2=29966&view=diff
==============================================================================
--- trunk/src/multiplayer.cpp (original)
+++ trunk/src/multiplayer.cpp Wed Oct 8 20:53:18 2008
@@ -252,10 +252,16 @@
sp["username"] = login ;
sp["password_reminder"] = password_reminder;
- //If password is not empty start hashing
+ // If password is not empty start hashing
std::string result;
if(!(password.empty())) {
+
+ // Check if we have everything we need
+ if((*error)["salt"].empty() ||
(*error)["hash_seed"].empty()) {
+ return ABORT_SERVER;
+ }
+
std::string
itoa64("./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
std::string salt = (*error)["salt"];
Modified: trunk/src/server/forum_user_handler.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/forum_user_handler.hpp?rev=29966&r1=29965&r2=29966&view=diff
==============================================================================
--- trunk/src/server/forum_user_handler.hpp (original)
+++ trunk/src/server/forum_user_handler.hpp Wed Oct 8 20:53:18 2008
@@ -60,6 +60,8 @@
* from the original hash to recreate the same hash
* index = 0 returns the hash seed
* index = 1 return the salt
+ *
+ * Return an empty string if an error occurs
*/
std::string create_pepper(const std::string& name, int index);
Modified: trunk/src/server/server.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/server.cpp?rev=29966&r1=29965&r2=29966&view=diff
==============================================================================
--- trunk/src/server/server.cpp (original)
+++ trunk/src/server/server.cpp Wed Oct 8 20:53:18 2008
@@ -442,6 +442,11 @@
std::string salt1 = user_handler_->create_salt();
std::string salt2 = user_handler_->create_pepper(user, 0);
std::string salt3 = user_handler_->create_pepper(user, 1);
+ if(salt2.empty() || salt3.empty()) {
+ send_error(sock, "Even though your nick is registered on this
server you"
+ "cannot log in due to an error in the
hashing algorithm.");
+ return;
+ }
seeds_.insert(std::pair<network::connection,std::string>(sock, salt1));
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits