mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Clean up some auth packet handling related code
This commit is contained in:
parent
00f71c3b9d
commit
a65f6f07f3
9 changed files with 52 additions and 98 deletions
|
@ -227,7 +227,7 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
|
|||
Compose auth methods for answer
|
||||
*/
|
||||
std::string encpwd; // encrypted Password field for the user
|
||||
bool has_auth = m_script->getAuth(playername, &encpwd, NULL);
|
||||
bool has_auth = m_script->getAuth(playername, &encpwd, nullptr);
|
||||
u32 auth_mechs = 0;
|
||||
|
||||
client->chosen_mech = AUTH_MECHANISM_NONE;
|
||||
|
@ -1461,11 +1461,9 @@ void Server::handleCommand_FirstSrp(NetworkPacket* pkt)
|
|||
session_t peer_id = pkt->getPeerId();
|
||||
RemoteClient *client = getClient(peer_id, CS_Invalid);
|
||||
ClientState cstate = client->getState();
|
||||
const std::string playername = client->getName();
|
||||
|
||||
std::string playername = client->getName();
|
||||
|
||||
std::string salt;
|
||||
std::string verification_key;
|
||||
std::string salt, verification_key;
|
||||
|
||||
std::string addr_s = getPeerAddress(peer_id).serializeString();
|
||||
u8 is_empty;
|
||||
|
@ -1551,8 +1549,6 @@ void Server::handleCommand_SrpBytesA(NetworkPacket* pkt)
|
|||
RemoteClient *client = getClient(peer_id, CS_Invalid);
|
||||
ClientState cstate = client->getState();
|
||||
|
||||
bool wantSudo = (cstate == CS_Active);
|
||||
|
||||
if (!((cstate == CS_HelloSent) || (cstate == CS_Active))) {
|
||||
actionstream << "Server: got SRP _A packet in wrong state " << cstate <<
|
||||
" from " << getPeerAddress(peer_id).serializeString() <<
|
||||
|
@ -1560,6 +1556,8 @@ void Server::handleCommand_SrpBytesA(NetworkPacket* pkt)
|
|||
return;
|
||||
}
|
||||
|
||||
const bool wantSudo = (cstate == CS_Active);
|
||||
|
||||
if (client->chosen_mech != AUTH_MECHANISM_NONE) {
|
||||
actionstream << "Server: got SRP _A packet, while auth is already "
|
||||
"going on with mech " << client->chosen_mech << " from " <<
|
||||
|
@ -1606,8 +1604,7 @@ void Server::handleCommand_SrpBytesA(NetworkPacket* pkt)
|
|||
|
||||
client->chosen_mech = chosen;
|
||||
|
||||
std::string salt;
|
||||
std::string verifier;
|
||||
std::string salt, verifier;
|
||||
|
||||
if (based_on == 0) {
|
||||
|
||||
|
@ -1657,10 +1654,10 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt)
|
|||
session_t peer_id = pkt->getPeerId();
|
||||
RemoteClient *client = getClient(peer_id, CS_Invalid);
|
||||
ClientState cstate = client->getState();
|
||||
std::string addr_s = getPeerAddress(pkt->getPeerId()).serializeString();
|
||||
std::string playername = client->getName();
|
||||
const std::string addr_s = client->getAddress().serializeString();
|
||||
const std::string playername = client->getName();
|
||||
|
||||
bool wantSudo = (cstate == CS_Active);
|
||||
const bool wantSudo = (cstate == CS_Active);
|
||||
|
||||
verbosestream << "Server: Received TOSERVER_SRP_BYTES_M." << std::endl;
|
||||
|
||||
|
@ -1720,8 +1717,7 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt)
|
|||
if (client->create_player_on_auth_success) {
|
||||
m_script->createAuth(playername, client->enc_pwd);
|
||||
|
||||
std::string checkpwd; // not used, but needed for passing something
|
||||
if (!m_script->getAuth(playername, &checkpwd, NULL)) {
|
||||
if (!m_script->getAuth(playername, nullptr, nullptr)) {
|
||||
errorstream << "Server: " << playername <<
|
||||
" cannot be authenticated (auth handler does not work?)" <<
|
||||
std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue