mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Only send password on connection when explicitly asked to (fixes #788)
This commit is contained in:
parent
49eb0128f2
commit
fba3815ddc
|
@ -87,7 +87,7 @@ public:
|
||||||
inline float LocalTime() const { return m_LocalTime; }
|
inline float LocalTime() const { return m_LocalTime; }
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
virtual void Connect(const char *pAddress) = 0;
|
virtual void Connect(const char *pAddress, const char *pPassword = NULL) = 0;
|
||||||
virtual void Disconnect() = 0;
|
virtual void Disconnect() = 0;
|
||||||
|
|
||||||
// dummy
|
// dummy
|
||||||
|
|
|
@ -299,6 +299,7 @@ CClient::CClient() : m_DemoPlayer(&m_SnapshotDelta)
|
||||||
m_RconAuthed[0] = 0;
|
m_RconAuthed[0] = 0;
|
||||||
m_RconAuthed[1] = 0;
|
m_RconAuthed[1] = 0;
|
||||||
m_RconPassword[0] = '\0';
|
m_RconPassword[0] = '\0';
|
||||||
|
m_Password[0] = '\0';
|
||||||
|
|
||||||
// version-checking
|
// version-checking
|
||||||
m_aVersionStr[0] = '0';
|
m_aVersionStr[0] = '0';
|
||||||
|
@ -403,7 +404,7 @@ void CClient::SendInfo()
|
||||||
{
|
{
|
||||||
CMsgPacker Msg(NETMSG_INFO);
|
CMsgPacker Msg(NETMSG_INFO);
|
||||||
Msg.AddString(GameClient()->NetVersion(), 128);
|
Msg.AddString(GameClient()->NetVersion(), 128);
|
||||||
Msg.AddString(g_Config.m_Password, 128);
|
Msg.AddString(m_Password, 128);
|
||||||
SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH);
|
SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,7 +665,7 @@ void CClient::GenerateTimeoutCodes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClient::Connect(const char *pAddress)
|
void CClient::Connect(const char *pAddress, const char *pPassword)
|
||||||
{
|
{
|
||||||
char aBuf[512];
|
char aBuf[512];
|
||||||
int Port = 8303;
|
int Port = 8303;
|
||||||
|
@ -685,6 +686,11 @@ void CClient::Connect(const char *pAddress)
|
||||||
net_host_lookup("localhost", &m_ServerAddress, m_NetClient[0].NetType());
|
net_host_lookup("localhost", &m_ServerAddress, m_NetClient[0].NetType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!pPassword)
|
||||||
|
m_Password[0] = 0;
|
||||||
|
else
|
||||||
|
str_copy(m_Password, pPassword, sizeof(m_Password));
|
||||||
|
|
||||||
m_RconAuthed[0] = 0;
|
m_RconAuthed[0] = 0;
|
||||||
if(m_ServerAddress.port == 0)
|
if(m_ServerAddress.port == 0)
|
||||||
m_ServerAddress.port = Port;
|
m_ServerAddress.port = Port;
|
||||||
|
@ -2791,7 +2797,7 @@ void CClient::Run()
|
||||||
// send client info
|
// send client info
|
||||||
CMsgPacker MsgInfo(NETMSG_INFO);
|
CMsgPacker MsgInfo(NETMSG_INFO);
|
||||||
MsgInfo.AddString(GameClient()->NetVersion(), 128);
|
MsgInfo.AddString(GameClient()->NetVersion(), 128);
|
||||||
MsgInfo.AddString(g_Config.m_Password, 128);
|
MsgInfo.AddString(m_Password, 128);
|
||||||
SendMsgExY(&MsgInfo, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1);
|
SendMsgExY(&MsgInfo, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1);
|
||||||
|
|
||||||
// update netclient
|
// update netclient
|
||||||
|
|
|
@ -108,6 +108,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
||||||
int m_RconAuthed[2];
|
int m_RconAuthed[2];
|
||||||
char m_RconPassword[32];
|
char m_RconPassword[32];
|
||||||
int m_UseTempRconCommands;
|
int m_UseTempRconCommands;
|
||||||
|
char m_Password[32];
|
||||||
|
|
||||||
// version-checking
|
// version-checking
|
||||||
char m_aVersionStr[10];
|
char m_aVersionStr[10];
|
||||||
|
@ -252,7 +253,7 @@ public:
|
||||||
void OnEnterGame();
|
void OnEnterGame();
|
||||||
virtual void EnterGame();
|
virtual void EnterGame();
|
||||||
|
|
||||||
virtual void Connect(const char *pAddress);
|
virtual void Connect(const char *pAddress, const char *pPassword = NULL);
|
||||||
void DisconnectWithReason(const char *pReason);
|
void DisconnectWithReason(const char *pReason);
|
||||||
virtual void Disconnect();
|
virtual void Disconnect();
|
||||||
|
|
||||||
|
|
|
@ -1277,7 +1277,7 @@ int CMenus::Render()
|
||||||
static int s_ButtonTryAgain = 0;
|
static int s_ButtonTryAgain = 0;
|
||||||
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Try again"), 0, &TryAgain) || m_EnterPressed)
|
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Try again"), 0, &TryAgain) || m_EnterPressed)
|
||||||
{
|
{
|
||||||
Client()->Connect(g_Config.m_UiServerAddress);
|
Client()->Connect(g_Config.m_UiServerAddress, g_Config.m_Password);
|
||||||
}
|
}
|
||||||
|
|
||||||
Box.HSplitBottom(60.f, &Box, &Part);
|
Box.HSplitBottom(60.f, &Box, &Part);
|
||||||
|
|
Loading…
Reference in a new issue