mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Check password hash validity
This commit is contained in:
@@ -2080,6 +2080,12 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
||||
}
|
||||
password[PASSWORD_SIZE-1] = 0;
|
||||
}
|
||||
|
||||
if(!base64_is_valid(password)){
|
||||
infostream<<"Server: "<<playername<<" supplied invalid password hash"<<std::endl;
|
||||
SendAccessDenied(m_con, peer_id, L"Invalid password hash");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string checkpwd;
|
||||
bool has_auth = scriptapi_get_auth(m_lua, playername, &checkpwd, NULL);
|
||||
@@ -2790,6 +2796,13 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
||||
newpwd += c;
|
||||
}
|
||||
|
||||
if(!base64_is_valid(newpwd)){
|
||||
infostream<<"Server: "<<player->getName()<<" supplied invalid password hash"<<std::endl;
|
||||
// Wrong old password supplied!!
|
||||
SendChatMessage(peer_id, L"Invalid new password hash supplied. Password NOT changed.");
|
||||
return;
|
||||
}
|
||||
|
||||
infostream<<"Server: Client requests a password change from "
|
||||
<<"'"<<oldpwd<<"' to '"<<newpwd<<"'"<<std::endl;
|
||||
|
||||
|
Reference in New Issue
Block a user