MCPcopy Create free account
hub / github.com/ddnet/ddnet / ConchainRconPasswordChangeGeneric

Method ConchainRconPasswordChangeGeneric

src/engine/server/server.cpp:4223–4251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4221}
4222
4223void CServer::ConchainRconPasswordChangeGeneric(const char *pRoleName, const char *pCurrent, IConsole::IResult *pResult)
4224{
4225 if(pResult->NumArguments() == 1)
4226 {
4227 int KeySlot = m_AuthManager.DefaultKey(pRoleName);
4228 const char *pNew = pResult->GetString(0);
4229 if(str_comp(pCurrent, pNew) == 0)
4230 {
4231 return;
4232 }
4233 if(KeySlot == -1 && pNew[0])
4234 {
4235 m_AuthManager.AddDefaultKey(pRoleName, pNew);
4236 }
4237 else if(KeySlot >= 0)
4238 {
4239 if(!pNew[0])
4240 {
4241 AuthRemoveKey(KeySlot);
4242 // Already logs users out.
4243 }
4244 else
4245 {
4246 m_AuthManager.UpdateKey(KeySlot, pNew, pRoleName);
4247 LogoutKey(KeySlot, "key update");
4248 }
4249 }
4250 }
4251}
4252
4253void CServer::ConchainRconPasswordChange(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
4254{

Calls 6

str_compFunction · 0.85
NumArgumentsMethod · 0.80
DefaultKeyMethod · 0.80
AddDefaultKeyMethod · 0.80
UpdateKeyMethod · 0.80
GetStringMethod · 0.45

Tested by

no test coverage detected