2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-03 18:45:46 +03:00

Merge pull request #170 from theAsmodai/password

Added a message when connected to a password-protected server without a password
This commit is contained in:
theAsmodai 2016-02-07 20:19:47 +03:00
commit f7ecc5a931

View File

@ -2138,10 +2138,24 @@ int SV_CheckUserInfo(netadr_t *adr, char *userinfo, qboolean bIsReconnecting, in
if (!NET_IsLocalAddress(*adr))
{
if (sv_password.string[0] != 0 && Q_stricmp(sv_password.string, "none") && Q_strcmp(sv_password.string, Info_ValueForKey(userinfo, "password")))
if (sv_password.string[0] != 0 && Q_stricmp(sv_password.string, "none"))
{
Con_Printf("%s: password failed\n", NET_AdrToString(*adr));
SV_RejectConnectionForPassword(adr);
const char* password = Info_ValueForKey(userinfo, "password");
#ifdef REHLDS_FIXES
if (password[0] == '\0')
{
Con_Printf("%s: connect without password\n", NET_AdrToString(*adr));
SV_RejectConnection(adr, "No password set. Clean your userinfo.\n");
}
else
#endif
if (Q_strcmp(sv_password.string, password))
{
Con_Printf("%s: password failed\n", NET_AdrToString(*adr));
SV_RejectConnectionForPassword(adr);
}
return 0;
}