mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 22:18:19 +00:00
Merge pull request #7367 from Robyt3/Engine-Password-Config-Improvement
Bump maximum server password length from 128 to 256, refactoring
This commit is contained in:
commit
9424be7a61
|
@ -239,18 +239,18 @@ int CClient::SendMsgActive(CMsgPacker *pMsg, int Flags)
|
|||
return SendMsg(g_Config.m_ClDummy, pMsg, Flags);
|
||||
}
|
||||
|
||||
void CClient::SendInfo()
|
||||
void CClient::SendInfo(int Conn)
|
||||
{
|
||||
CMsgPacker MsgVer(NETMSG_CLIENTVER, true);
|
||||
MsgVer.AddRaw(&m_ConnectionID, sizeof(m_ConnectionID));
|
||||
MsgVer.AddInt(GameClient()->DDNetVersion());
|
||||
MsgVer.AddString(GameClient()->DDNetVersionStr(), 0);
|
||||
SendMsg(CONN_MAIN, &MsgVer, MSGFLAG_VITAL);
|
||||
MsgVer.AddString(GameClient()->DDNetVersionStr());
|
||||
SendMsg(Conn, &MsgVer, MSGFLAG_VITAL);
|
||||
|
||||
CMsgPacker Msg(NETMSG_INFO, true);
|
||||
Msg.AddString(GameClient()->NetVersion(), 128);
|
||||
Msg.AddString(m_aPassword, 128);
|
||||
SendMsg(CONN_MAIN, &Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH);
|
||||
Msg.AddString(GameClient()->NetVersion());
|
||||
Msg.AddString(m_aPassword);
|
||||
SendMsg(Conn, &Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH);
|
||||
}
|
||||
|
||||
void CClient::SendEnterGame(int Conn)
|
||||
|
@ -259,10 +259,10 @@ void CClient::SendEnterGame(int Conn)
|
|||
SendMsg(Conn, &Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH);
|
||||
}
|
||||
|
||||
void CClient::SendReady()
|
||||
void CClient::SendReady(int Conn)
|
||||
{
|
||||
CMsgPacker Msg(NETMSG_READY, true);
|
||||
SendMsg(CONN_MAIN, &Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH);
|
||||
SendMsg(Conn, &Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH);
|
||||
}
|
||||
|
||||
void CClient::SendMapRequest()
|
||||
|
@ -289,8 +289,8 @@ void CClient::RconAuth(const char *pName, const char *pPassword)
|
|||
str_copy(m_aRconPassword, pPassword);
|
||||
|
||||
CMsgPacker Msg(NETMSG_RCON_AUTH, true);
|
||||
Msg.AddString(pName, 32);
|
||||
Msg.AddString(pPassword, 128);
|
||||
Msg.AddString(pName);
|
||||
Msg.AddString(pPassword);
|
||||
Msg.AddInt(1);
|
||||
SendMsgActive(&Msg, MSGFLAG_VITAL);
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ void CClient::RconAuth(const char *pName, const char *pPassword)
|
|||
void CClient::Rcon(const char *pCmd)
|
||||
{
|
||||
CMsgPacker Msg(NETMSG_RCON_CMD, true);
|
||||
Msg.AddString(pCmd, 256);
|
||||
Msg.AddString(pCmd);
|
||||
SendMsgActive(&Msg, MSGFLAG_VITAL);
|
||||
}
|
||||
|
||||
|
@ -1494,7 +1494,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
|||
{
|
||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client/network", "loading done");
|
||||
SetLoadingStateDetail(IClient::LOADING_STATE_DETAIL_SENDING_READY);
|
||||
SendReady();
|
||||
SendReady(CONN_MAIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2096,7 +2096,7 @@ void CClient::FinishMapDownload()
|
|||
{
|
||||
ResetMapDownload();
|
||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client/network", "loading done");
|
||||
SendReady();
|
||||
SendReady(CONN_MAIN);
|
||||
}
|
||||
else if(m_pMapdownloadTask) // fallback
|
||||
{
|
||||
|
@ -2329,7 +2329,7 @@ void CClient::PumpNetwork()
|
|||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", "connected, sending info", gs_ClientNetworkPrintColor);
|
||||
SetState(IClient::STATE_LOADING);
|
||||
SetLoadingStateDetail(IClient::LOADING_STATE_DETAIL_INITIAL);
|
||||
SendInfo();
|
||||
SendInfo(CONN_MAIN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2921,32 +2921,11 @@ void CClient::Run()
|
|||
if(m_DummySendConnInfo && !m_aNetClient[CONN_DUMMY].SecurityTokenUnknown())
|
||||
{
|
||||
m_DummySendConnInfo = false;
|
||||
|
||||
// send client info
|
||||
CMsgPacker MsgVer(NETMSG_CLIENTVER, true);
|
||||
MsgVer.AddRaw(&m_ConnectionID, sizeof(m_ConnectionID));
|
||||
MsgVer.AddInt(GameClient()->DDNetVersion());
|
||||
MsgVer.AddString(GameClient()->DDNetVersionStr(), 0);
|
||||
SendMsg(CONN_DUMMY, &MsgVer, MSGFLAG_VITAL);
|
||||
|
||||
CMsgPacker MsgInfo(NETMSG_INFO, true);
|
||||
MsgInfo.AddString(GameClient()->NetVersion(), 128);
|
||||
MsgInfo.AddString(m_aPassword, 128);
|
||||
SendMsg(CONN_DUMMY, &MsgInfo, MSGFLAG_VITAL | MSGFLAG_FLUSH);
|
||||
|
||||
// update netclient
|
||||
SendInfo(CONN_DUMMY);
|
||||
m_aNetClient[CONN_DUMMY].Update();
|
||||
|
||||
// send ready
|
||||
CMsgPacker MsgReady(NETMSG_READY, true);
|
||||
SendMsg(CONN_DUMMY, &MsgReady, MSGFLAG_VITAL | MSGFLAG_FLUSH);
|
||||
|
||||
// startinfo
|
||||
SendReady(CONN_DUMMY);
|
||||
GameClient()->SendDummyInfo(true);
|
||||
|
||||
// send enter game an finish the connection
|
||||
CMsgPacker MsgEnter(NETMSG_ENTERGAME, true);
|
||||
SendMsg(CONN_DUMMY, &MsgEnter, MSGFLAG_VITAL | MSGFLAG_FLUSH);
|
||||
SendEnterGame(CONN_DUMMY);
|
||||
}
|
||||
|
||||
// update input
|
||||
|
|
|
@ -112,9 +112,9 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
int m_aCurrentRecvTick[NUM_DUMMIES];
|
||||
int m_aRconAuthed[NUM_DUMMIES];
|
||||
char m_aRconUsername[32];
|
||||
char m_aRconPassword[128];
|
||||
char m_aRconPassword[sizeof(g_Config.m_SvRconPassword)];
|
||||
int m_UseTempRconCommands;
|
||||
char m_aPassword[128];
|
||||
char m_aPassword[sizeof(g_Config.m_Password)];
|
||||
bool m_SendPassword;
|
||||
bool m_ButtonRender = false;
|
||||
|
||||
|
@ -270,9 +270,9 @@ public:
|
|||
// Send via the currently active client (main/dummy)
|
||||
int SendMsgActive(CMsgPacker *pMsg, int Flags) override;
|
||||
|
||||
void SendInfo();
|
||||
void SendInfo(int Conn);
|
||||
void SendEnterGame(int Conn);
|
||||
void SendReady();
|
||||
void SendReady(int Conn);
|
||||
void SendMapRequest();
|
||||
|
||||
bool RconAuthed() const override { return m_aRconAuthed[g_Config.m_ClDummy] != 0; }
|
||||
|
|
|
@ -10,7 +10,7 @@ MACRO_CONFIG_STR(PlayerName, player_name, 16, "", CFGFLAG_SAVE | CFGFLAG_CLIENT
|
|||
MACRO_CONFIG_STR(PlayerClan, player_clan, 12, "", CFGFLAG_SAVE | CFGFLAG_CLIENT | CFGFLAG_INSENSITIVE, "Clan of the player")
|
||||
MACRO_CONFIG_INT(PlayerCountry, player_country, -1, -1, 1000, CFGFLAG_SAVE | CFGFLAG_CLIENT | CFGFLAG_INSENSITIVE, "Country of the player")
|
||||
|
||||
MACRO_CONFIG_STR(Password, password, 128, "", CFGFLAG_CLIENT | CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, "Password to the server")
|
||||
MACRO_CONFIG_STR(Password, password, 256, "", CFGFLAG_CLIENT | CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, "Password to the server")
|
||||
MACRO_CONFIG_INT(Events, events, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT | CFGFLAG_SERVER, "Enable triggering of events, (eye emotes on some holidays in server, christmas skins in client).")
|
||||
MACRO_CONFIG_STR(SteamName, steam_name, 16, "", CFGFLAG_SAVE | CFGFLAG_CLIENT, "Last seen name of the Steam profile")
|
||||
|
||||
|
@ -188,7 +188,7 @@ MACRO_CONFIG_INT(EcPort, ec_port, 0, 0, 0, CFGFLAG_ECON, "Port to use for the ex
|
|||
MACRO_CONFIG_STR(EcPassword, ec_password, 128, "", CFGFLAG_ECON, "External console password")
|
||||
MACRO_CONFIG_INT(EcBantime, ec_bantime, 0, 0, 1440, CFGFLAG_ECON, "The time a client gets banned if econ authentication fails. 0 just closes the connection")
|
||||
MACRO_CONFIG_INT(EcAuthTimeout, ec_auth_timeout, 30, 1, 120, CFGFLAG_ECON, "Time in seconds before the the econ authentication times out")
|
||||
MACRO_CONFIG_INT(EcOutputLevel, ec_output_level, 1, 0, 2, CFGFLAG_ECON, "Adjusts the amount of information in the external console")
|
||||
MACRO_CONFIG_INT(EcOutputLevel, ec_output_level, 0, -3, 2, CFGFLAG_ECON, "Adjusts the amount of information in the external console (-3 = none, -2 = error only, -1 = warn, 0 = info, 1 = debug, 2 = trace)")
|
||||
|
||||
MACRO_CONFIG_INT(Debug, debug, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SERVER, "Debug mode")
|
||||
MACRO_CONFIG_INT(DbgCurl, dbg_curl, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SERVER, "Debug curl")
|
||||
|
@ -204,7 +204,7 @@ MACRO_CONFIG_INT(HttpAllowInsecure, http_allow_insecure, 0, 0, 1, CFGFLAG_CLIENT
|
|||
// DDRace
|
||||
MACRO_CONFIG_STR(SvWelcome, sv_welcome, 64, "", CFGFLAG_SERVER, "Message that will be displayed to players who join the server")
|
||||
MACRO_CONFIG_INT(SvReservedSlots, sv_reserved_slots, 0, 0, MAX_CLIENTS, CFGFLAG_SERVER, "The number of slots that are reserved for special players")
|
||||
MACRO_CONFIG_STR(SvReservedSlotsPass, sv_reserved_slots_pass, 128, "", CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, "The password that is required to use a reserved slot")
|
||||
MACRO_CONFIG_STR(SvReservedSlotsPass, sv_reserved_slots_pass, 256, "", CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, "The password that is required to use a reserved slot")
|
||||
MACRO_CONFIG_INT(SvReservedSlotsAuthLevel, sv_reserved_slots_auth_level, 1, 1, 4, CFGFLAG_SERVER, "Minimum rcon auth level needed to use a reserved slot. 4 = rcon auth disabled")
|
||||
MACRO_CONFIG_INT(SvHit, sv_hit, 1, 0, 1, CFGFLAG_SERVER | CFGFLAG_GAME, "Whether players can hammer/grenade/laser each other or not")
|
||||
MACRO_CONFIG_INT(SvEndlessDrag, sv_endless_drag, 0, 0, 1, CFGFLAG_SERVER | CFGFLAG_GAME, "Turns endless hooking on/off")
|
||||
|
|
Loading…
Reference in a new issue