diff options
| author | Axel Cocat <ax.cocat@gmail.com> | 2021-06-28 18:02:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-28 18:02:19 +0200 |
| commit | f1727b79d251ec28775796a45cfb669b1c346b66 (patch) | |
| tree | a37a2d6a3c3fc1a6c4d4aeaa4f51d3534d830ceb /src/server/database/Database/Implementation | |
| parent | 091b072be10ecbe75d9aa38c19e2262e0cbc7690 (diff) | |
fix(Core): fix ip bans (#6519)
Diffstat (limited to 'src/server/database/Database/Implementation')
| -rw-r--r-- | src/server/database/Database/Implementation/LoginDatabase.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/server/database/Database/Implementation/LoginDatabase.cpp b/src/server/database/Database/Implementation/LoginDatabase.cpp index 90989bde93..c369aaa79b 100644 --- a/src/server/database/Database/Implementation/LoginDatabase.cpp +++ b/src/server/database/Database/Implementation/LoginDatabase.cpp @@ -11,12 +11,26 @@ void LoginDatabaseConnection::DoPrepareStatements() if (!m_reconnecting) m_stmts.resize(MAX_LOGINDATABASE_STATEMENTS); - PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, "SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, " - "ab.unbandate = ab.bandate, aa.gmlevel, a.totp_secret, a.salt, a.verifier " - "FROM account a LEFT JOIN account_access aa ON a.id = aa.id LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 WHERE a.username = ?", CONNECTION_SYNCH); - PrepareStatement(LOGIN_SEL_RECONNECTCHALLENGE, "SELECT a.id, UPPER(a.username), a.locked, a.lock_country, a.last_ip, a.failed_logins, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, " - "ab.unbandate = ab.bandate, aa.gmlevel, a.session_key " - "FROM account a LEFT JOIN account_access aa ON a.id = aa.id LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 WHERE a.username = ? AND a.session_key IS NOT NULL", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, + "SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins, " + "ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, " + "ipb.unbandate > UNIX_TIMESTAMP() OR ipb.unbandate = ipb.bandate, ipb.unbandate = ipb.bandate, " + "aa.gmlevel, a.totp_secret, a.salt, a.verifier " + "FROM account a " + "LEFT JOIN account_access aa ON a.id = aa.id " + "LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 " + "LEFT JOIN ip_banned ipb ON ipb.ip = ? " + "WHERE a.username = ?", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_RECONNECTCHALLENGE, + "SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins, " + "ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, " + "ipb.unbandate > UNIX_TIMESTAMP() OR ipb.unbandate = ipb.bandate, ipb.unbandate = ipb.bandate, " + "aa.gmlevel, a.session_key " + "FROM account a " + "LEFT JOIN account_access aa ON a.id = aa.id " + "LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 " + "LEFT JOIN ip_banned ipb ON ipb.ip = ? " + "WHERE a.username = ? AND a.session_key IS NOT NULL", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id, a.session_key, a.last_ip, a.locked, a.lock_country, a.expansion, a.mutetime, a.locale, a.recruiter, a.os, a.totaltime, " "aa.gmlevel, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id FROM account a LEFT JOIN account_access aa ON a.id = aa.id AND aa.RealmID IN (-1, ?) " "LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 LEFT JOIN account r ON a.id = r.recruiter WHERE a.username = ? " |
